Install bundled 32-bit system in 64-bit system

From ArchWiki
Revision as of 07:44, 30 October 2006 by Jf (Talk | contribs) (Configure the new installed system: add 'cp /etc/localtime' to chroot)

Jump to: navigation, search

Arch64 Install bundled 32bit system:

Note that this script don'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 easyly. As Arch64 try to be a pure 64 bit distro, it seems the devs won't provide any compatibility libs, this system seems to me the cleaner.


Install the base 32 bit system

We create the repository.

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

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.

You might also want to create a separate pacman.log LogFile for your 32-bit chroot environment (in order to be able to track the "32root" pacman/package changes properly/not mess up your current 64-bit pacman.log). Again, don't forget to change this back too at the end of this howto unless you want to mess up your pacman logging.

vim /etc/pacman.conf

Change the 'LogFile' directive accordingly.

Now proceed to sync up pacman:

pacman --root /opt/arch32 -Sy

Now we can install the base packages:

pacman --root /opt/arch32 -S autoconf automake bash bin86  binutils bison bzip2 coreutils cpio cracklib db dcron dhcpcd dialog diffutils e2fsprogs ed file filesystem findutils flex gawk gcc gdbm gen-init-cpio gettext glibc grep groff grub gzip initscripts iputils jfsutils kbd kernel-headers klibc klibc-extras klibc-udev less libpcap libtool libusb licenses lilo logrotate lshwd m4 mailx make man man-pages mkinitcpio mkinitrd mktemp module-init-tools nano ncurses net-tools openssl pacman pam patch pciutils pcmciautils pcre perl popt procinfo procps psmisc raidtools readline reiserfsprogs rp-pppoe sed shadow slocate sysfsutils syslog-ng sysvinit tar tcp_wrappers udev usbutils util-linux vim wget which wireless_tools xfsprogs zlib

Alternatively, try this shorter list of more essential packages: this list has been trimmed, and most of what you will definitely not be needing has been taken out, as well as the "filesystem-specific (eg. jfsutils) packages" (you can add them in later on if you really need them...):

pacman --root /opt/arch32 -S autoconf automake bash bin86  binutils bison bzip2 coreutils cpio cracklib db dcron dialog diffutils e2fsprogs ed file filesystem findutils flex gawk gcc gdbm gettext glibc grep groff gzip initscripts iputils kbd kernel-headers klibc klibc-extras klibc-udev less libpcap libtool libusb logrotate lshwd m4 mailx make man man-pages mktemp module-init-tools nano ncurses net-tools openssl pacman pam patch pciutils pcmciautils pcre perl popt procinfo procps psmisc readline sed shadow slocate sysfsutils sysvinit tar tcp_wrappers udev usbutils util-linux vim wget which wireless_tools zlib

Here is the list of packages from base that have been taken out from the list above so that you can have a look: dhcpcd, gen-init-cpio, grub, jfsutils, licenses (*no offense to the various Open Source licenses, but we have this in our main 64-bit system already), lilo, mkinitcpio, mkinitrd, ppp, raidtools, rp-pppoe, reiserfsprogs, syslog-ng, xfsprogs

You can now revert your pacman.d/current file to x86_64. Also change back your 'LogFile' in /etc/pacman.conf.

/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

cp /etc/passwd*             .
cp /etc/shadow*             .
cp /etc/group*              .

cp /etc/rc.conf             .
cp /etc/resolv.conf         .

cp -a /etc/localtime        .
cp /etc/locale.gen          .
cp /etc/profile.d/locale.sh profile.d

cp /etc/vimrc               .

Now chroot in your new system

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

Fix some future locale issues

/usr/sbin/locale-gen
pacman -Sy 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. So if you want to use "community" repositories, don't forget to edit it !

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 the pkgs to win back some space. Some cleanups that can be done: (from your "32root" environment)

rmdir /home/ftp
pacman -Rd mkinitcpio

Consider also clearing out your pacman cache (do a 'man pacman', and search for 'clean' for more info; *Note that this is *not* a command that you'll only have to do 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 dchroot

Download "dchroot" from the AUR (http://aur.archlinux.org/packages.php) and install it on your 64bit system (outside the chroot):

tar xvf dchroot_0.12.1.tar.gz
cd dchroot-0.12.1
./configure --prefix=/opt/dchroot
make
make install

In my case, there has been an error at the end of the "make install". But everything works anyway ... so I haven't care about it.

Configuration

Now, we must edit the configuration file (/etc/dchroot.conf) and add this line:

arch32 /opt/arch32


Execute 32bit apps

Finally, to use your 32bit apps:

/opt/dchroot/bin/dchroot -d "opera -notrayicon"
/opt/dchroot/bin/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.