I prefer it if things Just Work™ whenever I need them to, however sometimes I need to use things that are on the cutting edge. Unfortunately in the open source world, 'reliability' and 'cutting edge' tend to be mutually exclusive. Ubuntu 'breezy' is by far the easiest and most reliable linux distro I have used. In my opinion the maintainers have achieved just the right balance - users can have both a functional and stable desktop.
My favourite video reprocessing tool, Avidemux, is not available on 'breezy'. It depends on libraries that are only available as packages in 'dapper' (the next release of Ubuntu). Unfortunately 'dapper' has been delayed 6 weeks until 1st June 2006. I couldn't wait that long to process the gigabytes of digital TV I have piling up, waiting to archive. I toyed with apt-pinning my 'breezy' install and installing the 'dapper' packages, but it was going to break things majorly.Recently I hit on an idea: Debian can be made to run 32-bit binary code on an EMT/AMD64-bit install by using a chroot jail. I know chroot can be used for wider purposes not limited to the situation above, so i set about googling. Surprisingly I turned up very little. Jump to the end for a couple of links I did find (including the Ubuntu forum describing running 32-bit code on 64-bit installs). By following a few examples, reading a bunch of 'man' pages and a bit of trial and error, I found a very functional solution. Avidemux is crunching away right now...
The solution is actually quite straight forward. As at 29th March 2006, 'Dapper Flight 5' installs very nicely into a chroot alongside 'breezy'.
- Get the latest Ubuntu 'debootstrap' package.
- Bootstrap a new 'dapper' install into /opt/dapper.
- Setup 'breezy' bindings into the 'dapper' chroot.
- Configure 'dchroot' if you want non-root users to access 'dapper'.
- Chroot into 'dapper' and 'apt-get update'.
- Finally 'apt-get install avidemux' or whatever packages you'd like.
First, I usually sudo into a root shell. That way you dont have to retype 'sudo' fifty times:
Make your desired chroot directory. I've chosen '/opt/dapper', choose your own if you like, however, adjust the rest of this document accordingly.
Install 'dchroot' and the 'debootstrap' packages:
apt-get install dchroot debootstrap
Try bootstrapping a dapper install:
[email protected]:/opt# debootstrap --arch i386 dapper /opt/dapper/ http://au.archive.ubuntu.com/ubuntu
E: No such script: /usr/lib/debootstrap/scripts/dapper
The current 'debootstrap' doesnt include 'dapper' scripts. If yours doesn't either, browse the Ubuntu archives for the latest package. Copy its location then download and install the package:
[email protected]:/opt# wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.0ubuntu2_all.deb
[email protected]:/opt# dpkg -i debootstrap_0.3.3.0ubuntu2_all.deb
Now bootstrap the 'dapper' install. You may not want to use the '.au' archives:
[email protected]:/opt# debootstrap dapper /opt/dapper/ http://au.archive.ubuntu.com/ubuntu
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: belocs-locales-bin locales
I: Found additional base dependencies: libgnutls12 vim-runtime
I: Checking component main on http://au.archive.ubuntu.com/ubuntu...
I: Configuring ubuntu-minimal...
I: Base system installed successfully.
This may take quite some time to download the packages.The 'dapper' chroot needs to be able to access certain files/paths in your 'breezy' install. This is achieved using 'mount' to bind paths into the chroot. Edit your /etc/fstab file so the bindings are done automatically on boot:
(paste at end)
/dev /opt/dapper/dev none bind 0 0
/proc /opt/dapper/proc none bind 0 0
/usr/share/fonts /opt/dapper/usr/share/fonts none bind 0 0
/media/cdrom0 /opt/dapper/media/cdrom0 none bind 0 0
/home/rob /opt/dapper/home/rob none rbind 0 0
/tmp /opt/dapper/tmp none bind 0 0
/etc/passwd /opt/dapper/etc/passwd none bind 0 0
/etc/shadow /opt/dapper/etc/shadow none bind 0 0
/etc/group /opt/dapper/etc/group none bind 0 0
/etc/sudoers /opt/dapper/etc/sudoers none bind 0 0
/etc/hosts /opt/dapper/etc/hosts none bind 0 0
Make the missing mount points, I needed these:
mkdir -p /opt/dapper/usr/share/fonts
mkdir -p /opt/dapper/media/cdrom0
mkdir -p /opt/dapper/home/rob
Note I've used bind directly on my home folder '/home/rob'. My '/home' folder is actually a mount point for an LVM partition. For some very strange reason, binding this '/home' mount location to another location '/opt/dapper/home' only bound the hidden files in '/home/rob'. A 'ls' turned up no files, while 'ls -a' turned up only the '.' hidden files in my home folder. This had me stumped for an hour, and googling turned up no similar issues to this. Anyone any ideas? does this happen to anyone else? My solution was to bind a path that was inside the mounted '/home' directory, ie. '/home/rob'. Note also that I have used 'rbind' for this mount to recursively bind other partitions that are mounted inside '/home/rob'. See the mount manpage.
Mount and check the bind paths:
mount | grep bind
Configure 'dchroot': (Note I'm only using a single dchroot and this command will unlist any others!)
echo "dapper /opt/dapper" > /etc/dchroot
Setting the flag below will alter the bash prompt so you know when you're inside your 'dapper' chroot:
echo 'orbit-dapper' > /opt/dapper/etc/debian_chroot
Now, still as root, try chroot'ing into your 'dapper' install:
[email protected]:~# chroot /opt/dapper/
(orbit-dapper)roo[email protected]:/# <-- note the bash prompt changed
Great! Now, to bring the install up to speed, we need to 'apt-get update'. Create the sources.list file and update:
echo "deb http://au.archive.ubuntu.com/ubuntu dapper main restricted universe multiverse" > /etc/apt/sources.list
echo "deb http://security.ubuntu.com/ubuntu dapper-security main restricted universe multiverse" >> /etc/apt/sources.list
Now as root inside your new 'dapper' chroot, install any packages you'd like, eg:
apt-get install avidemux
To start your 'dapper' chroot as a normal user, use 'dchroot -d'. You'll need to use the '-c' option if you have more than one dchroot setup. To launch avidemux:
- I'm using the Australian locale, and various scripts were throwing locale errors inside 'dapper'. As root in 'dapper' I simply reset to the standard POSIX locale using export, i'm not sure if this is correct, but it did stop the errors:
export LANG='' export LANGUAGE=''
- From the referenced links at the bottom of this page, you may want to try:
- Note: You should be careful with updating fonts in 'dapper', since the '/usr/share/fonts' folder is mapped back to your 'breezy' install.
- This howto was very useful: https://wiki.ubuntu.com/DebootstrapChroot
- Kudo's to this guy: http://www.calivia.com/blog/mike/create-an-ubuntu-dapper-drake-build-chroot
- And the original Ubuntu thread describing 32-bit chroot's on AMD64: http://ubuntuforums.org/showthread.php?t=24575
Post a Comment