Mar 8, 2008

Debian how to: Using chroot to run 32-bit Firefox multimedia in 64-bit Etch

The following text is from: http://forums.debian.net/viewtopic.php?t=12061
and that worked and helped me.

My configuration:
Debian Lenny/Sid (amd64) on hda6
Ubuntu 7.10 (i386) on hda1 mounted to /ubuntu

Notes:
I use mount point /ubuntu instead of /mint32
I skip step 3, because it is unnecessary for Ubuntu

Hope that somebody can help with this.


Original link: http://forums.debian.net/viewtopic.php?t=12061
Author: michael7

PrispevekPosted: 2007-02-06 23:45 Title: Using chroot to run 32-bit Firefox multimedia in 64-bit Etch

This HOWTO will show you how to set up and use chroot to run 32-bit Firefox with full multimedia support on a 64-bit Debian Etch installation

I have an AMD64 box running the 64-bit version of Etch. It's stable, solid and very fast. In other words, it's a great distro! The only drawback is the lack of some 64-bit multimedia players, plugins and codecs. I tried several solutions with mixed results. Then I came across some instructions on the sidux.com forum, followed them and solved my problem. I have changed those instructions to fit my hardware and added some embellishments, but the essentials came from this thread by shame: http://sidux.com/PNphpBB2-viewtopic-t-1251.html

As a prerequisite, you must have an existing 32-bit installation, with the desired players, plugins and codecs enabled, on another partition. There are several ways to do this. You can create it with a 32-bit version of Etch, like I did at: http://forums.debian.net/viewtopic.php?t=11280 You can also download and install a distro like Linux Mint which comes stock with all the multimedia stuff. I recently installed Mint on an empty partition and used it for these instructions because it was convenient.

When you complete this HOWTO, you will have an icon on the Desktop of your 64-bit installation for a 32-bit Firefox and with a mouse click, can watch all the video content on websites like CNN and such. No rebooting necessary.

Here is my setup:
Etch 64-bit on hda1
Mint 32-bit on hda5
Broadband Internet connection

1. Login as su and create a directory on root.

Koda:
michael7@etch64:~$ su
Password:
etch64:/home/michael7# cd /
etch64:/# mkdir /mint32


2. Edit the x86_64-linux-gnu.conf file by adding the last five lines shown below. I used nano but any text editor will do.

Koda:
etch64:/# nano /etc/ld.so.conf.d/x86_64-linux-gnu.conf


Koda:
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu

# chroot x86_64 system libs
/mint32/lib
/mint32/usr/lib
/mint32/usr/X11R6/lib
/mint32/usr/local/lib


After you have added the lines, select Ctrl+o (to save or "Writeout"), Enter (to confirm) and Ctrl+x (to exit).

3. Change to the /lib directory and created a symlink.

Koda:
etch64:/# cd /lib
etch64:/lib# ln -s /mint32/lib/ld-2.3.2.so ld-linux-x86-64.so.2


4. Run the ldconfig command (small L, not the digit 1 or a capital I).

Koda:
etch64:/lib# ldconfig


5. Edit the /etc/fstab file by adding the six lines shown below.

Koda:
etch64:/lib# nano /etc/fstab


Koda:
# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda3 /home ext3 defaults 0 2
/dev/hda2 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0

### 32-bit chroot ###
/dev/hda5 /mint32 ext3 defaults 0
/home /mint32/home none bind 0
/tmp /mint32/tmp none bind 0
/dev /mint32/dev none bind 0
/proc /mint32/proc proc defaults 0


When finished select Ctrl+o, Enter and Ctrl+x.

6. To run Firefox, enter these commands:
Koda:

etch64:/lib# mount -a
etch64:/lib# chroot /mint32
root@etch64:/# su michael7
michael7@etch64:/$ /usr/bin/firefox


7. To move from user in the chroot to user in the 64-bit environment, run the exit command three times:

Koda:
michael7@etch64:/$ exit
exit
root@etch64:/# exit
exit
etch64:/lib# exit
exit
michael7@etch64:~$

Now, if you want to run 32-bit Firefox, you can login as su and run the 4 commands shown in item 6 above. With a few more steps, however, we can make the process very simple.

8. Log back in as su to install dchroot:

Koda:
michael7@etch64:~$ su
Password:
etch64:/home/michael7# apt-get install dchroot


9. Create the file /etc/dchroot.conf and add the following content:

Koda:
etch64:/home/michael7# nano /etc/dchroot.conf


Koda:
# x86_64 chroot
x86_64 /mint32


Select Ctrl+o, Enter and Ctrl+x.

10. Exit as su and run the dchroot command as shown, to make sure it works:

Koda:
etch64:/home/michael7# exit
michael7@etch64:~$ exec dchroot -c x86_64 -d /usr/bin/firefox


11. Create a shell script to run Firefox 32-bit from within 64-bit environment. I used the “cat” command, but nano or any other text editor will work.

Koda:
michael7@etch64:~$ su
Password:
etch64:/home/michael7# cat > /usr/local/bin/mint32
#! /bin/sh
exec dchroot -c x86_64 -d /usr/bin/firefox
Ctrl+d [end of file]


12. Change the file permissions so that user can run the shell script:

Koda:
etch64:/home/michael7# chmod 755 /usr/local/bin/mint32


13. Exit as su and run the shell script as user:

Koda:
etch64:/home/michael7# exit
michael7@etch64:~$ mint32


14. And now the final touch-- create an icon for the Desktop:

K -> Debian -> Apps -> System -> KMenuEdit
Click the Internet icon to highlight it.
Select File, New Item and Item Name: Firefox 32
In the Command box, type: /usr/local/bin/mint32
(Or use "Open file dialog" icon to the right to navigate to the mint 32 shell script.)

Click the icon box in the upper right corner (to the right of Name and Description boxes).
Choose an icon from the "Select Icon" window.
Click File, Save and then close the KDE Menu Editor window.

Now, you can launch the 32-bit version of Firefox with: K -> Internet -> Firefox 32
You also can place a copy of the icon on the Desktop by right-clicking the Firefox 32 icon and selecting "Add Item to Desktop".

And that's it! Now, just click your Desktop icon for 32-bit Firefox and you can watch the video content from webpages while working in your 64-bit Etch installation.

If anyone has corrections or comments for improvement, please post and I'll incorporate them. While I've used this method 3 times successfully, I'm sure there are ways to make it better.
Reblog this post [with Zemanta]