There is an article on Gentoo wiki that details the required procedure :
HOWTO_startx_in_a_chroot.
The article details how to first sett up the chroot,
then how to enter the chroot and configure mainsystem.
Another such article comes from Arch Linux :
Running graphical applications from chroot.
More for Ubuntu :
Accessing graphical applications inside the chroot
Creating a chroot jail with sound and X11
For KDE : Kde4schroot. Since that's the one that's demanded, here are some details:
Replace /etc/schroot/schroot.conf
with :
# schroot chroot definitions.
# See schroot.conf(5) for complete documentation of the file format.
#
# Please take note that you should not add untrusted users to
# root-groups, because they will essentially have full root access
# to your system. They will only have root access inside the chroot,
# but that's enough to cause malicious damage.
#
[experimental]
type=directory
description=Debian experimental (unstable)
priority=4
groups=sbuild,root
users=kde4
#root-groups=root,sbuild
aliases=unstable,default
#device=/dev/hda_vg/experimental_chroot
mount-options=-o atime,sync,user_xattr
location=/home/chroot
run-setup-scripts=true
run-exec-scripts=true
Then replace /etc/schroot/mount-defaults
:
# mount.defaults: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev /dev none rw,bind 0 0
/dev/pts /dev/pts none rw,bind 0 0
tmpfs /dev/shm tmpfs defaults 0 0
/home /home none rw,bind 0 0
/tmp /tmp none rw,bind 0 0
Switch to kde4 user:
su - kde4
Then schroot and type root passwd:
schroot -u root
Add lenny and experimental repositories to /etc/apt/sources.list:
echo "deb http://ftp.us.debian.org/debian experimental main non-free contrib" >> /etc/apt/sources.list
echo "deb http://ftp.us.debian.org/debian lenny main" >> /etc/apt/sources.list
Set up pinning by editing /etc/apt/preferences
and adding:
Package: *
Pin: release a=experimental
Pin-Priority: 800
Package: *
Pin: release a=unstable
Pin-Priority: 400
Package: *
Pin: release a=lenny
Pin-Priority: 200
Then run update and install kde4:
aptitude update && aptitude install -t experimental kde4 xorg
Install kdm:
aptitude install -t experimental kdm
Then edit /etc/kde4/kdm/kdmrc and change StaticServers and ReserveServers:
StaticServers=:1
ReserveServers=:2,:3
Or use gdm (gdm will ask to use another display if DISPLAY :0 is already in use.
aptitude install gdm
To run a full kde4 session,
go to a text virtual terminal(vt) outside the current X session, for example vt2 (ctrl-alt-F2).
To login to a full kde4 session run the following:
su - kde4
schroot
su (use root passwd here)
invoke-rc.d kdm start
And now you should see kdm and should be able to login as kde4 to kde4!
For more details see the above article.