Are you interested in poking at archlinux without disturbing your pristine Gentoo installation? Want to submit something to the AUR for your friend when you are not an archlinux fan? This guide describes how to set up an archlinux chroot on your Gentoo system. As always, if there are any issues with this guide, please email me (see the page's footer for the email)
Archlinux's package manager is known as pacman. Pacman is not in portage yet but is available in the Sunrise overlay. Make sure you have set up the sunrise overlay before proceeding.
To get pacman from sunrise, you first need to unmask it (as packages in sunrise are never marked stable to protect Gentoo users). Then emerge it.
echo sys-apps/pacman >> /etc/portage/package.keywords emerge -va sys-apps/pacman
Pacman stores its configuration information in /etc/pacman.conf. I believe that the default configuration file should be working in most respects. However, you'll have you set up the repositories section. First, install reflector (archlinux's take on mirrorselect).
for A in dev-perl/perl-xyne-{arch,common} www-misc/reflector; do echo ${A} >> /etc/portage/package.keywords; done
emerge -av www-misc/reflector
Now you may get a list of mirrors as described on arch's Mirrors wiki page. You may examine the output, /etc/pacman.d/mirrorlist. Note that the architecture of the repos has been automatically selected for you. If you know what you're doing, this is your chance to choose the ABI of your chroot.
reflector -l 8 -r -o /etc/pacman.d/mirrorlist
The last configuration step is to enable the core repository. Edit /etc/pacman.conf so that it has a [core] section which looks like the following:
[core] # The file referenced here should contain a list of 'Server = ' lines. Include = /etc/pacman.d/mirrorlist
To enable other repositories, such as testing or extra, just duplicate the core repository example (above) and put the name of the desired repository inside of the square brackets instead of core.
The pacman in sunrise has internal fetching support disabled because this support requires libfetch. Libfetch is quite difficult to package and external fetch tools work adequately. (portage, for example, does its fetching using external fetch tools). Thus, you will need to uncomment one of the two XferCommand lines. I recommend using the wget line:
XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
If you actually don't have wget installed and don't want it, you could try the following configuration:
XferCommand = /bin/busybox wget -c -O %o %u
On Gentoo systems, when one wants to install packages into a place other then /, one sets the ROOT environment variable (see make.conf(5)). For pacman, one uses the -r flag. But first, the chroot directory must be prepared. The following describes how to set up a chroot in /var/lib/arch (and is based on arch's Install from Existing Linux wiki page).
First, create the directory and the required /var/lib/pacman subdirectory. Then ask pacman to, using that root directory, download repository metadata:
mkdir -p /var/lib/arch/var/lib/pacman pacman -r /var/lib/arch -Sy
Then, you may install arch's base package set (analogous, AFAIK, to Gentoo's @system set).
pacman -r /var/lib/arch -S base
Before entering a chroot, one must set up the pseudo filesystems that most tools depend on first. These include /dev, /sys, and /proc. The following setup will be lost be lost after rebooting unless if you add the commands to a startup script (such as in /etc/conf.d/local).
mount -o bind /dev /var/lib/arch/dev mount -o bind /proc /var/lib/arch/proc mount -o bind /sys /var/lib/arch/sys
There's a good chance you'll also want a copy of your DNS resolver's settings.
cp {,/var/lib/arch}/etc/resolve.conf
That is all this guide will help you with. If there are any problems in the information above, please contact me using the email address in the footer. You may now enjoy your chroot with the following command:
chroot /var/lib/arch
Forgetting to pass the proper -r option to pacman may cause pacman to attack your beautiful Gentoo install! Whenever issuing a pacman command, check the following:
cat /etc/issue Arch Linux \r (\n) (\l)Of course, if the emerge command is unavailable, then you're likely in an arch chroot.