2014-07-16
I run Debian/wheezy on all my computers, mainly because I can’t afford the downtime. However, once in a while, I encounter programs I need that are only in testing. For instance the new (2014-07-16) Viber linux client needs glibc-2.14
or higher, and wheezy only has 2.13. Some blog posts suggest installing libc6
from testing
on your wheezy
system, but I think that’s playing with fire. libc6
is crucial to many packages, and I’m not sure things will work fine if you upgrade it.
I decided to set up a Debian/testing chroot
, and then install whatever I needed under it.
See the Debian wiki entry on this if you don’t know what a chroot is. Here’s what I did to set it up:
Build the chroot:
Add testing
or wheezy-backports
to your sources.list
, and then run (as root)
[root]# aptitude install -t testing debootstrap [root]# mkdir -p /srv/chroot/testing [root]# debootstrap testing /srv/chroot/testing http://http.debian.net/debian
Stop services in the chroot
from starting:
[root]# cat > /srv/chroot/testing/usr/sbin/policy-rc.d <<EOF > #!/bin/sh > exit 101 > EOF [root]# chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
Install and configure schroot:
Install schroot
[root]# aptitude install schroot
Edit /etc/schroot/schroot.conf
and add the following sections
[testing-desktop] description=Debian testing type=directory personality=linux preserve-environment=true directory=/srv/chroot/testing users=gautam profile=desktop [testing-minimal] description=Debian testing type=directory personality=linux preserve-environment=true directory=/srv/chroot/testing root-users=root profile=default aliases=default
Replace gautam
with your username (or a comma separated list of users).
Edit /etc/schroot/desktop/fstab
and uncomment the following lines:
/var/lib/dbus /var/lib/dbus none rw,bind 0 0 /run /run none rw,bind 0 0 /run/shm /run/shm none rw,bind 0 0
Don’t run the testing-desktop
session as root
.
Services started in the chroot
might affect services on the host!
Running testing-desktop
session as a regular user should be safe.
Make life easy in the chroot:
Switch to the new chroot (testing-minimal as root)
[root]# schroot -c testing-minimal
For clarity, I’ll prefix all subsequent commands that need to be run in the chroot environment with [chroot]username>
.
root
is root, of course, but replace gautam
with your own username.
Replace ischroot
with /bin/true
[root@chroot]# dpkg-divert --divert /usr/bin/ischroot.debianutils --rename /usr/bin/ischroot [root@chroot]# ln -s /bin/true /usr/bin/ischroot
Install a complete desktop environment:
[root@chroot]# aptitude install task-kde-desktop
(If you just want to run viber, then you certainly don’t need the whole kde-desktop. As long as you have pulseaudio, dbus, and a few kde libraries you should be fine. But once you have your chroot setup, it’ll have many many uses so I recomend doing a full install while you’re at it. Don’t install any services (ssh/mail/etc) though.)
If you’re a power shell user and want to see it in your prompt, then put the line
ischroot && PS1=$'%{\e[36m%}[chroot]%{\e[m%}'$PS1
in your zshrc
. (This might work for bash users if you add a ridiculous amount of quotes.)
Get sound working.
If you’re having trouble with sound, you might have to temporarily stop
pulseaudio on the host machine. Namely, try playing an audio file in the
chroot
:
[gautam]$ schroot -c testing-desktop [gautam@chroot]$ paplay etc/beep.wav Connection failure: Connection refused pa_context_connect() failed: Connection refused
If that’s the error message you see, then run this as a regular user
[gautam]$ pulseaudio --kill [gautam]$ schroot -c testing-desktop [gautam@chroot]$ paplay etc/beep.way
(Give any legal wave file to the last command of course.)
Note, now you won’t have audio in the host system, but will in the chroot
.
When you’re done with your audio, either close the chroot session, or run the following
[gautam@chroot]$ pulseaudio --kill [gautam]$ paplay etc/beep.way
Get graphics acceleration. For this you might have to upgrade your kernel on the host, and consequently all packages with kernel modules.
[root]# aptitude search '~i-dkms' i broadcom-sta-dkms i openafs-modules-dkms i A virtualbox-dkms
I couldn’t find broadcom-sta-dkms
in backports, but openafs
and virtualbox
were available.
I upgraded those first, and then the kernel.
[root]# aptitude -t wheezy-backports install openafs-client virtualbox [root]# aptitude -t wheezy-backports install linux-image-amd64 linux-headers-amd64
Now reboot into the new kernel, and test graphics acceleration:
[root]# reboot ... [gautam]$ uname -srv Linux 3.14-0.bpo.1-amd64 #1 SMP Debian 3.14.12-1~bpo70+1 (2014-07-13) [gautam]$ glxinfo | grep rendering direct rendering: Yes [gautam]$ schroot -c testing-desktop [gautam@chroot]$ glxinfo | grep rendering direct rendering: Yes
Using the chroot.
Of course you can run a variety of things in your new chroot
.
I use it very often to run python3-matplotlib
(for plotting my scientific computations and numerical simulations).
To get a shell run (as a regular user)
[gautam]$ schroot -c testing-desktop
following which you can run whatever you want. Alternately, you can also start a terminal:
[gautam]$ schroot -c testing-desktop -- mrxvt
(Replace mrxvt
with xterm
or your favourite terminal emulator.)
Download the package from here and save it as /tmp/viber.deb
Install it:
[root@chroot]# dpkg -i /tmp/viber.deb
Unfortunately they haven’t put dependency info into the package. So if you’re missing a library then viber will quit silently with no error message. (I had to do a full desktop install before I could get viber to run in the chroot.)
Run it as a regular user. Don’t run the next command as root.
[gautam]$ schroot -c testing-desktop -- /usr/share/viber/Viber.sh
Be careful when deleting your chroot.
All your home directories etc are mounted on the chroot.
So if you decide to do rm -rf /srv/chroot/testing/
you might wind up wiping /home
as well.
Don’t say I didn’t warn you.
I’d suggest doing mount | grep chroot
and make sure nothing funny shows up before doing any aggressive deletion.
GI (2014-08-09 15:23:12)
This also works great for pipelight which allows you to use many windows plugins in firefox. I tried it with silverlight (for Netflix), but have heard it also works for flash, widewine etc.
To get Silverlight working, follow the instructions here in your chroot
.
Be sure to also enable sliverlight and change your user agent.
As of 2014-08-09 Netflix works perfectly with iceweasel-30.0-2
.