Difference between revisions of "Install bundled 32-bit system in 64-bit system"

From ArchWiki
Jump to: navigation, search
(Execute 32bit apps: - small program to use schroot easily)
(Fit for schroot insallation and configuration)
Line 171: Line 171:
  
  
=== Download and install dchroot ===
+
=== Download and install schroot ===
  
Install "dchroot" to your 64-bit installation from the community repository:
+
Install "schroot" to your 64-bit installation from the community repository:
  
  pacman -S dchroot
+
  pacman -S schroot
 
+
''Note: For now there is no dchroot in repository, it's replaced by schroot''
+
  
 
=== Configuration ===
 
=== Configuration ===
  
Now, we must edit the configuration file (/etc/dchroot.conf) and add this line:
+
Schroot is already configured for Arch32 chroot, so you just should check /etc/schroot/schroot.conf, section [Arch32] if all informations match your configuration.
 
+
arch32 /opt/arch32
+
  
  
Line 190: Line 186:
 
Finally, to use your 32bit apps:
 
Finally, to use your 32bit apps:
  
  dchroot -d "opera -notrayicon"
+
  schroot -p opera -notrayicon
dchroot -d acroread
+
  
It will launch Opera, without the systray icon, from your 32bit environment. The second example is for Acrobat Reader, where there is no "" since we don't need to add switches.
+
It will launch Opera, without the systray icon, from your 32bit environment.  
 
+
''Note: If you use schroot, type: schroot -p instead of dchroot -d''
+
  
 
If you want to, I wrote a small program to replace 64-bit version of firefox in your system, paste it into geany, save as cpp file named firefox.cpp and compile by pressing F9:
 
If you want to, I wrote a small program to replace 64-bit version of firefox in your system, paste it into geany, save as cpp file named firefox.cpp and compile by pressing F9:
Line 232: Line 225:
  
 
<pre>#!/bin/sh
 
<pre>#!/bin/sh
dchroot -d "firefox $1;export FIREFOX_DSP="aoss""</pre>
+
schroot -p firefox $1;export FIREFOX_DSP="aoss"</pre>
  
 
Make it executable:
 
Make it executable:
Line 243: Line 236:
  
 
Add this to your $HOME/.bashrc file at the end, and type it into bash to make the alias available immediately. Or you can just change all your DE launchers to firefox32 if you still want 64 bit firefox to be available.
 
Add this to your $HOME/.bashrc file at the end, and type it into bash to make the alias available immediately. Or you can just change all your DE launchers to firefox32 if you still want 64 bit firefox to be available.
 +
 +
=== Note ===
 +
If you still use dchroot instead of current schroot, you should use ''-d'' switch instead of ''-s''.

Revision as of 22:05, 19 September 2008

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n links end

Arch64 Install bundled 32bit system

Note that this script doesn't try to change anything out of the 32bit directory. I'm no expert so there is maybe errors or some "bad things".

This howto is just for those who really need to run 32 bit apps and to install it easily. As Arch64 tries to be a pure 64 bit distro, it seems the devs won't provide any compatibility libs, this system seems to me the cleaner.

NOTE: If you have a custom kernel config, you need to make sure that this option is set: "CONFIG_IA32_EMULATION=y". Otherwise, your 64-bit kernel will not be able to access your 32-bit chrooted environment. The stock Arch64 kernels generally have this set properly by default.

Install the base 32 bit system

We create the repository.

mkdir /opt/arch32
vim /etc/pacman.d/mirrorlist

Here you'll have to replace in the first address x86_64 by i686. Don't forget to revert it at the end of the howto or your system can be screwed when you install something.

As soon as you use the --root switch to the pacman command below, all the files /var/log/pacman.log /var/lib/pacman/db.lck will be created inside your /opt/arch32 directory. So the log of pacman will be /opt/arch32/var/log/pacman.log and will NOT mess up with your 64bit installation. There is no need for a LogFile directive in /etc/pacman.conf or a --logfile switch unless you want the log file to be elsewhere.

The --cachedir switch is for the package to be cached in the /opt/arch32/var/cache/pacman/pkg directory instead of /var/cache/pacman/pkg

We now create that directory, just to be sure:

mkdir -p /opt/arch32/var/{cache/pacman/pkg,lib/pacman}

Now proceed to sync up pacman:

pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg -Sy

Now we can install the base packages:

pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg -S base base-devel

If you don't intend to compile packages inside this chroot, you can omit the base-devel group:

pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg -S base

Note: You may have to update pacman and install the base packages with one big swoop:

pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg -Sy base base-devel

You can now revert your pacman.d/mirrorlist file to x86_64.

/etc/rc.d/arch32 rc script

To initiate the 32bit environment at startup, create a script in /etc/rc.d/ called "arch32":

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case $1 in
    start)
        stat_busy "Starting Arch32 chroot"
        mount --bind /proc /opt/arch32/proc
        mount --bind /proc/bus/usb /opt/arch32/proc/bus/usb
        mount --bind /dev /opt/arch32/dev
        mount --bind /dev/pts /opt/arch32/dev/pts
        mount --bind /dev/shm /opt/arch32/dev/shm
        mount --bind /sys /opt/arch32/sys
        mount --bind /tmp /opt/arch32/tmp
        mount --bind /home /opt/arch32/home
        add_daemon arch32
        stat_done
        ;;
    stop)
        stat_busy "Stopping Arch32 chroot"
        umount /opt/arch32/proc/bus/usb
        umount /opt/arch32/proc
        umount /opt/arch32/dev/pts
        umount /opt/arch32/dev/shm
        umount /opt/arch32/dev
        umount /opt/arch32/sys
        umount /opt/arch32/tmp
        umount /opt/arch32/home
        rm_daemon arch32
        stat_done
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
esac
exit 0

Then allow execution of this script:

chmod +x /etc/rc.d/arch32

And add it to "/etc/rc.conf":

DAEMONS=(syslog-ng network netfs crond arch32 gdm)

Configure the new installed system

First, copy some meaningful config files over....

cd /opt/arch32/etc

ln -f /etc/passwd*                     .
ln -f /etc/shadow*                     .
ln -f /etc/group*                      .

ln -f /etc/rc.conf                     .
ln -f /etc/resolv.conf                 .

ln -f /etc/localtime                .
ln -f /etc/locale.gen                  .
ln -f /etc/profile.d/locale.sh profile.d

cp /etc/vimrc                       .
cp /etc/mtab                        .

Now chroot in your new system

/etc/rc.d/arch32 start
xhost +local:
chroot /opt/arch32

I recommend that you use a custom bash prompt inside your 32bit chroot installation to know where you are (i.e. inside the 32bit chroot). You can, for example, add a ARCH32 string to your PS1 string that you may have defined in .bashrc or other config file.

Fix some future locale issues

/usr/sbin/locale-gen
pacman -S ttf-bitstream-vera ttf-ms-fonts

Note that you can install any other font. You just need one or your apps won't display any text.

Also, keep in mind that the "/etc/pacman.conf" file from the 32bit environment is the default one. The [community] repo is enabled by default now.

Now you can install any apps you need (*note for firefox with the nonfree flash plugin, you will need to install libxmu as well! Apparently this dependency has not been taken care of yet; see Flyspray).

pacman -S acroread opera
pacman -S mozilla-firefox
pacman -S libxmu flashplugin
pacman -S mplayer-plugin

You can also clean up to win back some space by removing some unnecessary packages. This cleanup is for your 32 bit root" environment and must then be done inside it after chrooting! Below is a list of package you might want to remove...

pacman -Rd mkinitcpio
pacman -R kernel26
pacman -R grub
pacman -R dhcpcd
pacman -R rp-pppoe
pacman -R ppp
pacman -R xfsprogs
pacman -R reiserfsprogs
pacman -R jfsutils
pacman -R hdparm
pacman -R hwdetect
pacman -R syslog-ng
pacman -R logrotate
pacman -R lvm2
pacman -R dcron
pacman -R wpa_supplicant
pacman -R pcmciautils

Consider also clearing out your pacman cache (regularly)

Note: this is not a command that you'll only have to run just once. As packages accumulate, you'll have to keep doing this if you want to clear out the space from the pacman cache:

pacman -Scc

Execute a 32bit apps from a 64bit env

Download and install schroot

Install "schroot" to your 64-bit installation from the community repository:

pacman -S schroot

Configuration

Schroot is already configured for Arch32 chroot, so you just should check /etc/schroot/schroot.conf, section [Arch32] if all informations match your configuration.


Execute 32bit apps

Finally, to use your 32bit apps:

schroot -p opera -notrayicon

It will launch Opera, without the systray icon, from your 32bit environment.

If you want to, I wrote a small program to replace 64-bit version of firefox in your system, paste it into geany, save as cpp file named firefox.cpp and compile by pressing F9:

#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

int main(int argc, char **argv)
{
	string temp="schroot -p firefox ";
	if (argc>=2) temp+=+argv[1];
	system(temp.c_str());
	return 0;
}

Now replace firefox binary file in /usr/lib/firefox-3.0.1 with the compiled file. (note: the directory may be different, because of version of firefox)

Using sound

The most used application in 32 bits is flash, for YouTube for example.

To get sound from the flash player in firefox, open a terminal and chroot inside the 32-bit system:

chroot /opt/arch32

From there, install alsa-oss:

pacman -S alsa-oss

Then type:

export FIREFOX_DSP="aoss"

Every chroot into the 32-bit system will require this export command to be entered so it may be best to incorporate it into a script.

Finally, launch Firefox.

Example script for Firefox with sound

Open a text editor and save the following in /usr/bin/firefox32 (as root, use sudo):

#!/bin/sh
schroot -p firefox $1;export FIREFOX_DSP="aoss"

Make it executable:

sudo chmod +x /usr/bin/firefox32

Now you can make an alias for firefox if you want:

alias firefox="firefox32"

Add this to your $HOME/.bashrc file at the end, and type it into bash to make the alias available immediately. Or you can just change all your DE launchers to firefox32 if you still want 64 bit firefox to be available.

Note

If you still use dchroot instead of current schroot, you should use -d switch instead of -s.