Chroots and Xnest
January 17th, 2006I spent part of yesterday setting up a Chroot for testing packages that are in need of becoming stable. Its a fairly easy process that will allow you to do a lot of testing without breaking or creating bloat in my main system. Much like the install guide you create a directory to install the chroot to and download a stage3, we’re after getting it setup quickly speed is a secondary concern really, and unpack it. Next is the slightly different process. Since we are in a live system, we need to mount with –bind a few directories of the live system (as you can tell right now this isn’t a secure chroot, but its not something we need as well) to the chroot directory. These are the following that should be mounted: /proc, /dev, devpts, /usr/portage so you don’t have to sync multiple trees on the same system. You might want to mount portage as ro depending on what you are doing. /usr/src/linux, so that kernel related stuff will still build, /lib/modules, /sys for all your system information, and finally /tmp.
With all that mounted you should be able to now chroot to your new environment and start updating packages to the latest stable x86 versions.
Now for the fun part. If you have a laptop, you don’t generally want to sit in front of the desktop that you might be using as your dev box. So lets setup a remote X system. As I’m a minimalist on packages, we’ll use something built into Xorg itself, note I’ve not used modular so I’m not sure if its part of the core install or something that is in a tertiary package. The program is called Xnest, and as you can probably guess it allows you to nest a remote X system in a window. This does however require some configuration on the host machine. Please also note that the following instructions allow anyone to connect to the remote X session if they know the address. Not something you’d generally want. So either limit it to hosts or only from internally on the network.
The first step to allowing Xnest to work is to change /etc/X11/xdm/xdm-config and comment out the following:
! SECURITY: do not listen for XDMCP or Chooser requests
! Comment out this line if you want to manage X terminals with xdm
DisplayManager.requestPort: 0
Once that is done, edit the /etc/X11/xdm/Xaccess file to either allow all users with * or select users via addresses.
For gdm or kdm users in your /etc/X11/[g-k]dm/conf files there’s a line that says xdmcp=false, change that to true.
You should be able to restart your dm at that point and on a remote box do a Xnest -query (host ip) :1 and see the login manager of your choice. I haven’t gotten it to work in a chroot yet but in the main system it works beautifully, and oddly enough allows chroot gui applications to mostly run on the non chroot X session.
Give it a try, and see how you like it. I know for me its far faster then windows remote desktop, that I use on a daily basis. Also of note is tsclient, a gtk2 front end for rdesktop that also supports xnest. I havent’ tried it but compnerd has and swears that its the greatest thing since sliced bread.
Hope this helps a few of you with setting up chroots and a new fairly easy remote system with X. It can also be run over ssh but I’ve not bothered with it yet. When/if I do I’ll let you all know about it.