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:

/usr/bin/prepchroot

#!/bin/bash
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

#!/bin/bash
mount /media
/etc/init.d/dhald start
/etc/init.d/dbus start
/etc/init.d/xdm restart

nano (chroot)/usr/bin/byechroot

#!/bin/bash
/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.

2 Kommentare »

  1. ubuntu each one of the best
    Tutos Linux

    Kommentar von tutos Linux — 20. Dezember 2008 @ 21:50 | Antworten

  2. Super, dass das hier mal in der Form besprochen wird. , an dem Thema solltet Ihr dranbleiben. Ich glaube, dass ich vor einigen Tagen woanders im Web einen ähnlichen Beitrag gesehen habe.

    Kommentar von Clemens Hähnel — 17. März 2010 @ 12:28 | Antworten


RSS feed for comments on this post. TrackBack URI

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s

Bloggen auf WordPress.com.

%d Bloggern gefällt das: