Dedors’s Weblog

10. Dezember 2008

Run KDE4 in Chroot (Gentoo/Debian/Ubuntu Howto)

As I have some home server services running on a same machine I use as surf/music/mail/chat station. I like to mess around with the new KDE  as I want the newest features but still a stable and safe to run always base system with nfs, samba, music deamon, dns, router, printer and webserver.

So I set up a Chroot for KDE with that I can mess around as much as I want 🙂 But it’s a little bit tricky, so here I share my knowledge: This is not fully polished or redone yet, so no guarantee. Let me know if you have any problems.

#Short Basics: Set up Chroot
#you have several ways to do that, beginning from copy the current system to a new subdir or partition, or create a chroot with downloading
#strage3 or on a debian system with dchroot. google is your friend here and its not difficult to find your way.
#in the chroot you can choose to take a non-stable build, like portage 2.2 with kde-crazy overlay, or ubuntu with kde-nightly. May I add later more informations on how to set that up.

i had to enable rc_parallel=“YES“ in both /etc/rc.conf and (chroot)/etc/rc.conf to allow to start in-chroot services on a gentoo-chroot-gentoo system (should work with debian or mixed)

Create these 3 files:


mount -a
mount /extchroot
mount -o bind /proc /extchroot/proc
mount -o bind /dev /extchroot/dev
mount -o bind /sys /extchroot/sys
mount -o bind /tmp /extchroot/tmp
mount -t devpts none /extchroot/dev/pts
mount -o bind /media /extchroot/media
mount -o bind /var/lib/dbus /extchroot/var/lib/dbus
mount -o bind /usr/src/linux /extchroot/usr/src/linux #you set the later linux kernel in the chroot and compile it in the real root.
ln -s /home/dedi/.Xauthority /extchroot/home/dedi/.Xauthority #only need once
chroot /extchroot /bin/bash

nano (chroot)/usr/bin/hichroot

mount /media
/etc/init.d/dhald start
/etc/init.d/dbus start
/etc/init.d/xdm restart

nano (chroot)/usr/bin/byechroot

/etc/init.d/dbus stop
/etc/init.d/hald stop
umount /media
umount -a

now chmod +x all of these 3 files

to enter the chroot just run „prepchroot“, it will set up everything that is needed inside

after you entered the chroot run „hichroot“, it prepares to start X

to end a session (e.g. for reboot) you should NOT reboot it from KDE. Quit the Session, run „byechroot“ in the console, then exit and reboot.

A side note:  I have nfs setup already, and just getting all my storage with nfs from the chroot to outside, as ln and mount -o seems not to work. if anyone knows a better solution, please tell me.

Another side note:  at the beginning i had the problem not being able to start /etc/init.d services in the chroot, something made this gone away, i think its the reason i wrote up there. If not, you can still start dbus inside chroot directly, and start X with „startx“, after you „su user“ as you dont have a login that way.

Bloggen auf