Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old April 7th, 2005   #1
Crad
5 Cups of Ubuntu
 
Crad's Avatar
 
Join Date: Mar 2005
Location: Los Angeles, CA
Beans: 28
Send a message via ICQ to Crad Send a message via AIM to Crad Send a message via MSN to Crad
Lightbulb HOWTO: 32-Bit Chroot on 64-Bit Installs

Most of this comes from http://digital-conquest.ath.cx/wiki/...h_debbootstrap but I wanted to put together a cleaned up version that worked for me here (There are typos and inaccuracies on the wiki page).

Quote:
Step 1:
  • sudo apt-get install dchroot debootstrap
  • sudo mkdir /chroot/
  • sudo gedit /etc/dchroot.conf
    • Add this line: hoary /chroot
  • sudo debootstrap --arch i386 hoary /chroot/ http://archive.ubuntu.com/ubuntu
  • sudo chroot /chroot/
  • dpkg-reconfigure locales
Step 2:
In another terminal window (or by existing chroot):(We do this step because gedit has yet to be installed in the chroot environment)

Step 3:
In your chrooted environment (chroot /chroot):
  • apt-get update ; apt-get upgrade
Step 4:
In another terminal window (or by existing chroot):
  • sudo cp /etc/passwd /chroot/etc/
  • sudo cp /etc/shadow /chroot/etc/
  • sudo cp /etc/group /chroot/etc/
  • sudo cp /etc/sudoers /chroot/etc/
  • sudo cp /etc/hosts /chroot/etc/
  • sudo gedit /etc/fstab
  • Add the following lines:
    • /home /chroot/home none bind 0 0
    • /tmp /chroot/tmp none bind 0 0
    • /dev /chroot/dev none bind 0 0
    • /proc /chroot/proc proc defaults 0 0
    • /media/cdrom0 /chroot/media/cdrom0 none bind 0 0
    • /usr/share/fonts /chroot/usr/share/fonts none bind 0 0
  • sudo mkdir /chroot/media/cdrom0
  • sudo mount -a
  • sudo gedit /usr/local/bin/do_dchroot
  • Add the following:
    • #!/bin/sh
    • /usr/bin/dchroot -d "`echo $0 | sed 's|^.*/||'` $*"
  • sudo chmod 755 /usr/local/bin/do_dchroot
Step 5:
In a new terminal:
  • dchroot -d
  • sudo apt-get install synaptic
  • sudo ln -s /usr/sbin/synaptic /usr/sbin/synaptic32
  • exit
  • sudo ln -s /usr/local/bin/do_dchroot /usr/local/bin/synaptic32
  • sudo synaptic32
At this point you should have a 32 bit environment setup with synaptic setup. When you run synaptic32 from your main environment it will chroot execute it and all installations will be made to your 32 bit environment. If you want to be able to easily launch 32 bit chroot apps from your 64 bit environment symlink the app name to /usr/local/bin/do_dchroot. If you're using this as desktop system you'll probably want to use synaptic to install x, gnome, ubuntu specific themes, etc.

Please let me know of any errors, enhancements, or corrections

Last edited by Crad; May 13th, 2005 at 05:12 PM.. Reason: Updated to include making a directory for cdrom0
Crad is offline   Reply With Quote
Old April 7th, 2005   #2
Crad
5 Cups of Ubuntu
 
Crad's Avatar
 
Join Date: Mar 2005
Location: Los Angeles, CA
Beans: 28
Send a message via ICQ to Crad Send a message via AIM to Crad Send a message via MSN to Crad
Re: 32-Bit Chroot How-To

To get Firefox setup with Flash I did the following:
  • Ran sudo synaptic32 (as noted in the above thread
  • Installed mozilla-firefox
  • dchroot -d
  • sudo ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1
  • sudo ln -s /usr/bin/firefox /usr/bin/firefox32
  • exit
  • sudo ln -s /usr/local/bin/do_dchroot /usr/local/bin/firefox32
  • Made sure all instances of firefox are closed (you can not run both 32 and 64 bit firefoxes at the same time afaik... it just spawns a new 64 bit thread when you launch the old.
  • firefox32
  • Visited a site with flash on it and ran the automated firefox flash install.

As of right now sound is not working. If I figure out how to get the sound stuff working across the chroot, I'll post it here.

Last edited by Crad; April 13th, 2005 at 03:49 PM.. Reason: Updated with symlink per minuo's suggestion
Crad is offline   Reply With Quote
Old April 7th, 2005   #3
wmcbrine
Dipped in Ubuntu
 
wmcbrine's Avatar
 
Join Date: Mar 2005
Beans: 645
Ubuntu 9.10 Karmic Koala
Re: 32-Bit Chroot How-To

To get sound working, you need to mount --bind /dev /chroot/dev (or the equivalent fstab line).

In my case, I also had to add my username to the right group to have permission to write to /dev/dsp; but that was because I was using my old Mandrake system as the chroot, and it used a different number for the audio group. For an Ubuntu chroot, you should be set already.

In another thread, someone said it was also necessary to modprobe ioctl32 before starting the chroot. I've not found that to be the case here, but perhaps that's because my chroot is using OSS. (?)
wmcbrine is offline   Reply With Quote
Old April 7th, 2005   #4
wmcbrine
Dipped in Ubuntu
 
wmcbrine's Avatar
 
Join Date: Mar 2005
Beans: 645
Ubuntu 9.10 Karmic Koala
Re: 32-Bit Chroot How-To

P.S.:

Quote:
sudo chmod 777 /usr/local/bin/do_dchroot
Should be 755 -- there's no reason for this script to be world-writable.
wmcbrine is offline   Reply With Quote
Old April 7th, 2005   #5
Crad
5 Cups of Ubuntu
 
Crad's Avatar
 
Join Date: Mar 2005
Location: Los Angeles, CA
Beans: 28
Send a message via ICQ to Crad Send a message via AIM to Crad Send a message via MSN to Crad
Re: 32-Bit Chroot How-To

Quote:
Originally Posted by wmcbrine
P.S.:


Should be 755 -- there's no reason for this script to be world-writable.
Fixed
Crad is offline   Reply With Quote
Old April 8th, 2005   #6
wmcbrine
Dipped in Ubuntu
 
wmcbrine's Avatar
 
Join Date: Mar 2005
Beans: 645
Ubuntu 9.10 Karmic Koala
Re: 32-Bit Chroot How-To

You have "/chroot" in most places, but "/var/chroot" for the fstab lines. They should be "/chroot" too.

I've followed this guide (more or less), and I can confirm that sound works just by mounting /dev. For the record, that's:

/dev /chroot/dev none bind 0 0

in /etc/fstab. (However, I also killed esd long ago, just to get sound working on the 64-bit side, and set everything to alsa then; I don't know if that makes a difference.)

I now have two chroots on my system -- /old32 and /new32. (/old32 is where my old distro is, but I also need /new32 for more current software, like Acroread 7.) I added "-c new32" to my do_dchroot script, since I have old32 as the default.

Another thing I added is the "linux32" command (in the package of the same name). Put this before dchroot, and the 32-bit apps will think they're running under an i686 kernel -- which is necessary in some cases (mainly install scripts).

Re Flash, you can install it from Synaptic. In fact there are, confusingly, two conflicting packages. I chose the big one -- the small one is apparently just a wrapper for Macromedia's installer.

Themes are a little off for the 32-bit apps. But that could be an advantage, since it reminds me which version I'm using.

Now we need a list of what hasn't been ported to 64-bit. (Another thread, perhaps.)

Last edited by wmcbrine; April 8th, 2005 at 12:13 AM..
wmcbrine is offline   Reply With Quote
Old April 8th, 2005   #7
Crad
5 Cups of Ubuntu
 
Crad's Avatar
 
Join Date: Mar 2005
Location: Los Angeles, CA
Beans: 28
Send a message via ICQ to Crad Send a message via AIM to Crad Send a message via MSN to Crad
Re: 32-Bit Chroot How-To

Quote:
Originally Posted by wmcbrine
You have "/chroot" in most places, but "/var/chroot" for the fstab lines. They should be "/chroot" too.

I've followed this guide (more or less), and I can confirm that sound works just by mounting /dev. For the record, that's:

/dev /chroot/dev none bind 0 0

in /etc/fstab. (However, I also killed esd long ago, just to get sound working on the 64-bit side, and set everything to alsa then; I don't know if that makes a difference.)

I now have two chroots on my system -- /old32 and /new32. (/old32 is where my old distro is, but I also need /new32 for more current software, like Acroread 7.) I added "-c new32" to my do_dchroot script, since I have old32 as the default.

Another thing I added is the "linux32" command (in the package of the same name). Put this before dchroot, and the 32-bit apps will think they're running under an i686 kernel -- which is necessary in some cases (mainly install scripts).

Re Flash, you can install it from Synaptic. In fact there are, confusingly, two conflicting packages. I chose the big one -- the small one is apparently just a wrapper for Macromedia's installer.

Themes are a little off for the 32-bit apps. But that could be an advantage, since it reminds me which version I'm using.

Now we need a list of what hasn't been ported to 64-bit. (Another thread, perhaps.)
Thanks, I updated and fixed the /var bit. Sound isn't working for me, perhaps I need to set everything to alsa. You can fix themes if you're so inclined by installing the ubuntu artwork and ubuntu base (I think).
Crad is offline   Reply With Quote
Old April 10th, 2005   #8
remkio
First Cup of Ubuntu
 
Join Date: Apr 2005
Beans: 5
Arrow Re: 32-Bit Chroot How-To

The do_dchroot script was giving me problems, as parameters like:

Quote:
This\ is\ a\ filename\ with\ spaces.txt
were translated into:

Quote:
This is a filename with spaces.txt
causing the 32-bit program (totem) to not being able to open the file.

I solved it in the following way:

Code:
#!/bin/sh

for arg; do
        arg=`echo $arg | sed -e 's/ /\\\ /g'`
        args=`echo $args $arg`
done

/usr/bin/dchroot -d "`echo $0 | sed 's|^.*/||'` $args"
There should be a shorter way, however I am no expert in shell scripting.

Last edited by remkio; April 10th, 2005 at 11:04 AM..
remkio is offline   Reply With Quote
Old April 10th, 2005   #9
dreadnought
5 Cups of Ubuntu
 
Join Date: Nov 2004
Location: Kent, England
Beans: 27
Re: 32-Bit Chroot How-To

Many thanks Crad, having followed your instructions I am now able to chroot into 32 bit hoary. I nearly gave up and returned to 32 system but am now a confirmed 64-bitter.
dreadnought is offline   Reply With Quote
Old April 10th, 2005   #10
gratefulfrog
A Carafe of Ubuntu
 
Join Date: Jan 2005
Beans: 113
Re: 32-Bit Chroot How-To

I've followed the instructions at the head of this thread, but when I reach step 5, I get some problems.... then it all falls apart...

Any help? Thanks!

Code:
 ~$ dchroot -d
Executing shell in 'hoary' chroot.
dchroot: chdir: No such file or directory
dchroot: Child exited non-zero.
dchroot: Operation failed.
~$
But the following happens without the -d option
Code:
~$ dchroot
Executing shell in 'hoary' chroot.
No directory, logging in with HOME=/
/$exit
logout
~$ synaptic32
(hoary) synaptic32
dchroot: chdir: No such file or directory
dchroot: Child exited non-zero.
dchroot: Operation failed.
:~$
gratefulfrog is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:02 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry