schroot - chroot for any users
Posted by amadeu on Tue 27 Nov 2007 at 15:06
From manpages: schroot allows the user to run a command or a login shell in a chroot environment. If no command is specified, a login shell will be started in the user current working directory inside the chroot.
I've been trying some virtual machines solutions to execute some programs 32bits in my machine. But it's take very time, start a xen VM or virtualbox. Often this solutions needs some maintain additional costs to setup a X server to run any X-based program.
My initial motivation was that wengophone
wasn't in Debian lenny for amd64 until some days ago. Thus I did want to run a x-based program in a single chroot as normal user.
makes a chroot's use easy! Very easy for end users.
- install into your original installation:
# aptitude install schroot
- configure the /etc/schroot/schroot.conf like:
description=Debian sid (unstable)
- creating a chroot:
# debootstrap --arch i386 sid /srv/chroot/sid http://ftp.br.debian.org/debian
- installing 32bit programs in the chroot:
# schroot -c sid -p aptitude install wengophone
- to run X programs make sure that your X session accept it and execute the schroot:
$ xhost +
$ schroot -c sid -p wengophone
- there is a more safer way to run X programs like comments below and a example of wengophone_wrapper script
- it isn't need mount /proc on fstab or other because run-setup-scripts and run-exec-scripts take care of this, but you should look the /etc/schroot/mount-defaults to set your specific directories
- create a wrapper script /usr/local/bin/wengophone_wrapper:
## UPDATED after the comment #16 to reduce security risk ;-)
# right way for export Xauthority file
xauth extract /srv/chroot/sid$HOME/.Xauthority $DISPLAY
# run your command
schroot -c sid -p wengophone
# remove the Xauthority
rm -f /srv/chroot/sid$HOME/.Xauthority
- permissions :
# chmod +x /usr/local/bin/wengophone_wrapper
- now you could create some wengo.desktop for your users :-)
PS: maybe wengophone example it's trivial, but try it with others programs only 32bit like the non-free skype