These files would conflict with the normal pacman files, which will be installed in the later steps. For this reason they must be put ''into'' a temporary location ({{ic|/opt/arch32}} is used here).

+

−

The {{ic|--root}} switch in the pacman command below will create {{ic|/var/log/pacman.log}} and {{ic|/var/lib/pacman/db.lck}} inside {{ic|/opt/arch32}}. The pacman log will be {{ic|/opt/arch32/var/log/pacman.log}} and will ''not'' interfere with the native 64-bit installation. There is no need for a {{ic|LogFile}} directive in {{ic|/etc/pacman.conf}} or a {{ic|--logfile}} switch.

+

1. Create the directory:

+

mkdir /opt/arch32

−

The {{ic|--cachedir}} switch is for the package to be cached in {{ic|/opt/arch32/var/cache/pacman/pkg}} instead of {{ic|/var/cache/pacman/pkg}}.

Use the {{ic|--config}} switch to tell pacman to use the configuration file generated above, rather than {{ic|/etc/pacman.conf}}.

+

*These files would conflict with the normal pacman files, which will be installed in the later steps.

+

*For this reason they must be put ''into'' a temporary location ({{ic|/opt/arch32}} is used here).

+

*Remember to delete/comment the multilib repo, if you have enable it, in the {{ic|/opt/arch32/pacman.conf}} file

−

3. Create the directory, just to be sure:

+

3. Create the directory:

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

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

−

−

3b. Edit 'Architecture' for pacman >= 3.4

−

−

# In /opt/arch32/pacman.conf

−

# Architecture=auto

−

Architecture=i686

−

−

3c. Users following the Arch installer method will have a line at the top of {{ic|/etc/pacman.d/mirrorlist}} similar to:

−

{{bc|1=# Mirror used during installation

−

Server = http://mirror.rit.edu/archlinux/$repo/os/x86_64}}

−

−

The 'sed' command above searches for instances of '$arch' and replaces them with 'i686'. Unfortunately, since this installation mirror is explicitly set as x86_64, it is not replaced and will cause issues. Either comment it out or change it like so:

6. To use the newly installed pacman, uncomment some mirrors in {{ic|/opt/arch32/etc/pacman.d/mirrorlist}} and make any other desired changes to the new pacman installation.

−

−

7. Edit your /opt/arch32/etc/pacman.conf and change that Architecture from auto back to i686.

−

−

== Create an Arch32 Daemon Init Script ==

−

−

{{Warning|This included script does not change anything outside the 32-bit directory. However, you will be creating hard links to your base system's configuration files and also mounting your home and other directories inside the 32-bit install directory. Thus, mistaken settings in the linked configuration files or carelessly removing all or part of the locally mounted directories can inflict catastrophic damage to your base system.}}

−

−

To initiate the 32-bit environment at startup, create the following init script {{ic|/etc/rc.d/arch32}}:

−

−

{{bc|<nowiki>#!/bin/bash

−

−

. /etc/rc.conf

−

. /etc/rc.d/functions

−

−

# Add '/var/run /var/lib/dbus' to the list to enable pulseaudio.

−

dirs=(/dev /dev/pts /dev/shm /tmp /home)

−

−

case $1 in

−

start)

−

stat_busy "Starting Arch32 chroot"

−

for d in "${dirs[@]}"; do

−

mount -o bind $d /opt/arch32$d

−

done

−

mount -t proc none /opt/arch32/proc

−

mount -t sysfs none /opt/arch32/sys

−

add_daemon arch32

−

stat_done

−

;;

−

stop)

−

stat_busy "Stopping Arch32 chroot"

−

for (( i = ${#dirs[@]} - 1; i >= 0; i-- )); do

−

umount "/opt/arch32${dirs[i]}"

−

done

−

umount /opt/arch32/{proc,sys}

−

rm_daemon arch32

−

stat_done

−

;;

−

restart)

−

$0 stop

−

sleep 1

−

$0 start

−

;;

−

*)

−

echo "usage: $0 {start|stop|restart}"

−

esac

−

exit 0</nowiki>}}

−

A version of the script for Gentoo Linux (OpenRC) is available here: http://pastebin.com/kHt3440j

−

−

Then allow execution of the script:

−

chmod +x /etc/rc.d/arch32

−

−

And add it to {{ic|/etc/rc.conf}}:

−

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

−

−

==Configure the new system==

===Configuration files===

===Configuration files===

Key configuration files should be copied over:

Key configuration files should be copied over:

Line 115:

Line 68:

cp /etc/shadow* .

cp /etc/shadow* .

cp /etc/group* .

cp /etc/group* .

−

cp /etc/sudoers . # note: you'll need to install sudo before creating this entry, or sudo will refuse to install

+

cp /etc/sudoers .

−

+

−

cp /etc/rc.conf .

+

cp /etc/resolv.conf .

cp /etc/resolv.conf .

−

cp /etc/localtime .

cp /etc/localtime .

cp /etc/locale.gen .

cp /etc/locale.gen .

cp /etc/profile.d/locale.sh profile.d

cp /etc/profile.d/locale.sh profile.d

−

cp /etc/vimrc .

cp /etc/vimrc .

cp /etc/mtab .

cp /etc/mtab .

−

cp /etc/sudoers .

+

cp /etc/inputrc .

−

Be sure to include the "." character.

+

+

Be sure to include the "." character!

+

+

Remember to define the correct the number of MAKEFLAGS and other vars in {{ic|/opt/arch32/etc/makepkg.conf}} before attempting to build.

echo "/usr/bin/distccd-chroot does NOT seems to be running so doing nothing!"

+

fi

+

}

+

+

case $1 in

+

start)

+

# if you have the main chroot on another partition

+

# create the .arch32 file as a simple check for mount status

+

# edit to fit your system and take note of the corresponding unmount option in the stop function

+

# [[ ! -f /opt/arch32/.arch32 ]] && mount LABEL="arch32" /opt/arch32

+

+

dirs=(/tmp /dev /dev/pts /scratch /home)

+

for d in "${dirs[@]}"; do

+

mount -o bind $d /opt/arch32$d

+

done

+

mount -t proc none /opt/arch32/proc

+

mount -t sysfs none /opt/arch32/sys

+

touch /run/arch32

+

# if you use distccd from within the chroot uncomment this and the corresponding line in the stop function

+

# start_distccd

+

;;

+

stop)

+

dirs=(/home /scratch /dev/pts /tmp)

+

# if you use distccd from within the chroot uncomment this

+

# stop_distccd

+

umount /opt/arch32/{sys,proc}

+

for d in "${dirs[@]}"; do

+

umount "/opt/arch32$d"

+

done

+

sleep 5s

+

umount /opt/arch32/dev # needs to come out of the for loop

+

# if using a separate partition for arch32

+

# umount /opt/arch32

+

rm -f /run/arch32

+

;;

+

*)

+

echo "usage: $0 (start|stop)"

+

exit 1

+

esac</nowiki>}}

+

+

Be sure to make the init script executable:

+

# chmod +x /usr/local/bin/arch32

+

+

Enable the service as any other systemd service.

+

+

==Configure the new system==

=== Configure the chroot ===

=== Configure the chroot ===

Chroot into the new system:

Chroot into the new system:

Line 137:

Line 170:

It is recommended to use a custom bash prompt inside the 32-bit chroot installation in order to differentiate from the regular system. You can, for example, add a ''ARCH32'' string to the ''PS1'' variable defined in {{ic|~/.bashrc}}. In fact, the default Debian .bashrc prompt string contains appropriate logic to report whether the working directory is within a chroot.

It is recommended to use a custom bash prompt inside the 32-bit chroot installation in order to differentiate from the regular system. You can, for example, add a ''ARCH32'' string to the ''PS1'' variable defined in {{ic|~/.bashrc}}. In fact, the default Debian .bashrc prompt string contains appropriate logic to report whether the working directory is within a chroot.

−

Before continuing, keep in mind that the file {{ic|/etc/pacman.conf}} from the 32-bit environment is the default one. Make sure to uncomment some mirrors in {{ic|/etc/pacman.d/mirrorlist}}.

+

=== First-time Setup ===

−

+

Fix possible locale issues:

Fix possible locale issues:

/usr/sbin/locale-gen

/usr/sbin/locale-gen

+

Initialize pacman:

+

sed -i 's/CheckSpace/#CheckSpace/' /etc/pacman.conf

+

pacman-key --init

+

pacman-key --populate archlinux

+

+

=== Install Needed Packages ===

Install the needed packages including apps, fonts, etc. for example:

Install the needed packages including apps, fonts, etc. for example:

−

pacman -S acroread opera

pacman -S firefox

pacman -S firefox

pacman -S flashplugin

pacman -S flashplugin

−

pacman -S mplayer-plugin

−

−

Regain space by removing some unnecessary packages.

+

=== Regain Space (Optional) ===

{{Warning| This cleanup is for the '''32-bit''' root environment and must then be done inside it NOT the native 64-bit environment!}}

{{Warning| This cleanup is for the '''32-bit''' root environment and must then be done inside it NOT the native 64-bit environment!}}

Xyne has created a package that installs a minimalist 32-bit chroot as described above. More information can be found [http://bbs.archlinux.org/viewtopic.php?id=97629 on the forum] and [http://xyne.archlinux.ca/projects/arch32-light on the project page].

+

Xyne has created a package that installs a minimalist 32-bit chroot as described above. More information can be found [https://bbs.archlinux.org/viewtopic.php?id=97629 on the forum] and [http://xyne.archlinux.ca/projects/arch32-light on the project page].

===Allowing 32-bit applications access to 64-bit Pulseaudio===

===Allowing 32-bit applications access to 64-bit Pulseaudio===

Line 243:

Line 277:

umount /opt/arch32/var/lib/dbus

umount /opt/arch32/var/lib/dbus

−

More information is available at the [[Pulseaudio]] article, especially the section on [http://wiki.archlinux.org/index.php/PulseAudio#Pulseaudio_from_within_a_chroot_.28ex._32-bit_chroot_in_64-bit_install.29 Pulseaudio from within a chroot].

+

More information is available at the [[Pulseaudio]] article, especially the section on [[PulseAudio#Pulseaudio_from_within_a_chroot_.28ex._32-bit_chroot_in_64-bit_install.29|Pulseaudio from within a chroot]].

Configure the new system

Configure the chroot

It is recommended to use a custom bash prompt inside the 32-bit chroot installation in order to differentiate from the regular system. You can, for example, add a ARCH32 string to the PS1 variable defined in ~/.bashrc. In fact, the default Debian .bashrc prompt string contains appropriate logic to report whether the working directory is within a chroot.