agaskar.com

Jan 22 2008

Stable 32-bit chroot flash with sound for Debian Etch amd64.

Over about 12 hours I managed to put together a chroot that would provide Flash with audio to a debian etch amd64 install.

Some background: I’m in the process of switching to Linux as a main desktop, in order to take advantage of the awesome awesome tools available on the Linux platform (and because Vista is like XP circa 2001 — both myself and the computer I own aren’t ready for it yet).

I’ve tried all the major PHP IDEs (and installed, then discarded many of the minor ones) available on the windows platform: Komodo, Aptana, Zend, and Nusphere (Nusphere was the one I used longest; if Zend was native instead of Java, it might’ve won that battle). None of them provide everything I want in an editor, and as I’ve used vim more and more on our test servers for small configuration tasks, I’ve come to appreciate the elegance and speed that modal editing can offer. A couple of days of experimentation has revealed that vim (combined with sshfs and a couple of vimrc settings and plugins) can provide 98% of what I’m looking for in an editor, and has a pretty low overhead.

Naturally, the other requirement of my development environment is a web browser; and however you feel about flash (I like it, personally — there’s applications for which flash is very appropriate), it’s as necessary to web development as a copy of IE6 (I don’t even want to think about how I’m going to solve that problem).

Of course, Flash on Linux has a pretty crappy track record, and there isn’t a 64-bit version yet. The “easy” workaround is to simply run a 32-bit version of Linux, but that just seems wrong when you’ve got a 64-bit processor in your machine. Thus, I’ve spent the last 2 days off and on — in what has felt like a fool’s errand — getting a firefox browser to run in a 64 bit environment.

Why Debian?

I don’t know — I didn’t want to use Ubuntu because Debian seems more geared towards stability and production — I haven’t heard of very many web servers running Ubuntu. As for Why not CentOS/RHEL/Etc — well, I’ve so far preferred the Debian experience. I’m willing to accept that my reasoning is woefully misinformed — nonetheless, I’m stubborn about decisions I’ve made, and debian etch is one of them. Anyways, if you’re here, it’s probably because you’ve chosen Debian for one reason or another too.

Sources:

These two links in particular have been very helpful in guiding me:
Using chroot to run 32-bit Firefox multimedia in 64-bit Etch
Installing apps in a 32-bit chroot in AMD64 Debian system (warning: this site loads very slowly for me)

I begun by pretty much following the steps from the first link, including installing a 32-bit version of the latest Mint linux (version 4). This produced a rock-solid Mint desktop, and a crash-if-you-view-some-flash-and-breathe-on-it-funny chrooted Firefox. 3 or 4 hours of googling and trying things narrowed it down to a some sort of audio incompatibility.

Starting fresh the next day, and keeping in mind that the second strategy of “Figurin’ Out Them Computers’ is ‘Reduce Variables’ (the first being ‘Search The Hell Out Of Google’), I reinstalled a fresh copy of Debian etch amd64 (with gnome and audio installed and working), leaving a whole ton of un-partitioned space, and then debootstrap-ed a copy of sid 32 into a new partition (created with gparted). I did not use LVM in this case, although I’m not sure if that would affect anything. That looked something like this:

1. Create the partition with gparted; I was forced to make it a primary, I picked ext3 for the format type and gave it 5GB of space, which I figured would be plenty for my needs. Make note of the /dev/xxx location. In my case, it was /dev/sda4
2. Open a root terminal.
2. Using the root terminal (which we’ll be doing for the rest of these steps), create a mount point for what will be your new 32-bit chroot. I chose /deb32, so I typed in ‘mkdir /deb32’
3. Edit /etc/fstab so you can mount the new partition (I’m guessing you could just issue a mount command, but you need to edit /etc/fstab anyways). Using vim or another editor, add the following line at the end:

/dev/sda4 /deb32 ext3 defaults 0 0

YOUR LINE WILL VARY. Let’s look at this for a minute: the first string here is the location of my partition — remember, in my case, it was ‘/dev/sda4’, so that’s what I put there. The next string is the location of my mount point — ‘/deb32’ was what I chose, so that’s what got added. Now, as for the rest — well, ext3 was the type of partition I selected during the gparted format, and the other stuff is magic-voodoo to me right now, but I’m sure google could tell you a lot more about editing your fstab file.

EDIT: I recommend creating a logical partition during your initial install for the 32-bit chroot to sit in. Ideally, you should not leave any unpartitioned space after the install of your base system, otherwise you may find — as I did — you are unable to use it due to the primary partition limit.

4. Save the /etc/fstab and run mount -a in order to mount the partition we just added. If you’re in gnome, it’ll probably pop up a little ‘file explorer’ with the new partition, that’ll be largely empty except for a ‘lost and found’ temp folder. Success, I guess.
5. Now for the debootstrap. If typing in ‘debootstrap’ gets you a ‘Command not found’ and you are root, you probably need to install it with ‘apt-get install debootstrap’. After that you should be ready. I used the following command:
debootstrap —arch i386 sid /deb32 http://mirrors.kernel.org/debian/

A quick gotcha: make sure you have TWO hyphens in front of the ‘arch’ var, or it won’t process properly (in my case, it failed without any output). Here we’ve selected i386 as the architecture, so we get the 32-bit version, and sid as the release. I chose sid because I figured it would have the most up-to-date packages available, and thus stood a more likely chance of having a functional flash plugin. After the release name, we specify where we want to put it, and here it is ‘/deb32’, where I’ve mounted my new partition. Lastly we have the distro that we want to retrieve packages from. mirrors.kernel.org is the closest/fastest for me, so that’s what I picked.

If everything goes right, your terminal should churn away happily for 5-10 minutes (depending on your connection speed, of course).

6. After the debootstrap is complete, we need to add a couple more lines to our fstab (I only found this out later — when apt-get failed to install some packages). Add the following (replace /deb32 with whatever mount point you picked):

/home /deb32/home none bind 0 0
/tmp /deb32/tmp none bind 0 0
/dev /deb32/dev none bind 0 0
/proc /deb32/proc proc defaults 0 0

Now, as I understand it, generally what we’re doing here is making our “main” (64-bit) files, configuration, and devices available to our chrooted install. I’m not precisely sure what magic they provide (and the two HOWTOs I read weren’t specific either), but these lines were necessary for me to complete the next couple of steps. Save/quit and run ‘mount -a’ again to update the mounts.

7. edit /etc/apt/sources.list and add ‘contrib’ to the source. Ie, the contents of the file will likely look something like this:

deb http://mirrors.kernel.org/debian sid main

Change that line to

deb http://mirrors.kernel.org/debian sid main contrib

save/quit and run ‘apt-get update’


8. Run ‘chroot /deb32’ (or whatever you named your 32-bit mount point). This should put you at the / prompt (I find it helpful to do a quick ‘ls /’ to determine where I am — if I don’t see my 32-bit mount point, then I must be inside the 32 bit system). Let’s install a minimal gdm (I’ve been using this forum thread as a guide: HOWTO: Minimal Debian Install (w/ Minimal GNOME)):

apt-get install gnome-core xorg gdm gnome-volume-manager

Hopefully, that will complete without errors. In my case, dpkg failed to install fam and uswsusp, which I attribute to the lack of extra mounts in my fstab. This was fixed by adding the mounts, typing ‘export LC_ALL=”C”’, and then ‘apt-get -f install’. EDIT: Adding these lines seems to allow both fam and uswsusp to install — the locale remains unset but this does not cause any issues.

9. Install iceweasel. ‘apt-get install iceweasel’

9. Install flash with ‘apt-get install flashplugin-nonfree’

10. run iceweasel by typing ‘/usr/bin/iceweasel’. Go to YouTube; enjoy not crashing (so far).

11. You can probably follow the rest of the steps in the Using chroot to run 32-bit Firefox multimedia in 64-bit Etch to setup a shortcut icon that can be used to launch your 32-bit firefox browser from your 64-bit etch desktop. The one modification I would make is to use the following script to launch:

#! /bin/sh
exec dchroot -c x86_64 -d /usr/bin/firefox $1

the $1 permits the script to take an argument so it is able to launch and open a particular webpage, etc — this way you can set it to open files in gnome, etc.


12. ???

13. INTERNET

NOTE: I didn’t need to do anything extra in the chroot to get audio to work with Flash (audio was already working in my amd64 install), in fact, I suspect that having audio or something else installed in my Mint chroot was what caused it to fail. I’ll probably be updating this post as I have further experiences with this configuration, but so far, so good.

Comments (View)
Page 1 of 1
blog comments powered by Disqus