In this tutorial I will show you all the necessary steps to convert a Gentoo from a “no-multilib” system to a “multilib” system.
I had a “no-multilib” Gentoo running on my server, but got into trouble somehow getting a 32-bit application to work. Unfortunately, simply changing the profile is not sufficient. Since a new installation was too complex for me, I decided on a different way, which I will explain to you here.
I use a current Stage 3 archive with which I simply compile the necessary packages in a chroot.
Before you start, you should definitely make a backup of the existing system! If something goes wrong, I don’t want to be the bad guy who killed your system.
We activate the following parameters in our kernel to enable 32-bit support:
Binary Emulations ---> [*] IA32 Emulation < > IA32 a.out support [*] x32 ABI for 64-bit mode
Then recompile and install the kernel.
Create stage 3 chroot
First we create a folder for the Stage3 system. I chose “/chroot”. After creating the folder, switch to it.
mkdir /chroot ch /chroot
If you have decided on a different folder, you will have to replace “/chroot” with yours during the course of this tutorial!
Now we download the current Stage3 archive:
You have to replace the “” in “stage3-amd64-.tar.xz” with the current release!
Now we unpack the Stage3 archive:
tar xvpf stage3-amd64-*.tar.xz
Create and mount directories
First we mount our portage directory into the Stage3 folder:
mkdir /chroot/usr/portage mount --bind /usr/portage /chroot/usr/portage
Next we mount the root file system of the main system:
mkdir /chroot/system_root mount --bind / /chroot/system_root
Then follow the usual steps that you also know from the Gentoo manual:
cp /etc/resolv.conf /chroot/etc/ mount -t proc none /chroot/proc chroot /chroot /bin/bash env-update source /etc/profile
Configure chroot system
Now we are in our chroot. We first select a suitable profile. You get a list with:
eselect profile list
Setting a profile goes through:
eselect profile set [Number]
It is best to enter the same CFLAGS in “/etc/portage/make.conf” as in the main system.
Now we need to compile “GCC” and “glibc”. It is important that the same versions are used here as in the main system! Please check this carefully!
emerge -a --root=/system_root --root-deps=rdeps gcc glibc
This will compile “GCC” and “glibc” into the chroot but install them into the main system. Make sure that if you use a folder other than “system_root”, you must adapt it!
If the two packages are successfully installed, we leave the chroot again.
Leave chroot and clean up
After installing “GCC” and “glibc” in the main system, let’s exit the chroot and clean up:
umount /chroot/proc umount /chroot/usr/portage umount /chroot/system_root
If you no longer need the chroot, you can simply delete it again:
rm -R /chroot
Complete the main system
Since we now have “GCC” and “glibc” in the “multilib” variant in the main system, we can now change our profile. Now switch to the desired “multilib” profile:
eselect profile set [Number]
After that, we finally run a world update:
emerge -a -u --deep --newuse --changed-deps @world
That should at least install “sys-apps/sandbox” with the ABI_X86 flag for 32- and 64-bit.
With the steps described you have changed your “no-multilib” system into a “multilib” system. If something doesn’t work, your backup will play back what you obviously did at the beginning.