Upgrade Arch Linux from i686 to x86 64 HOWTO
From ArchWiki
Contents |
Introduction
Warning: This operation may make your system totally unbootable, and some data could be losed, if you don't follow carefully this guide.
Preparation
Check your CPU
If you want to run an x64 distro, you must have a x64's capable CPU (most of them are). The following command can check it:
cat /proc/cpuinfo |grep --color lm
If your CPU supports x86_64, it will return some letters.
Prepare the disk space
It will take about twice free space of `/var/cache/pacman/pkg'. You should keep your old i686 package, until the end of your upgrading process : if the process fail, you can fallback to your old-and-functional i686 system.
Power
The operation may take about 1 hour or more, and can't be safely terminated. Please check if your power supply is fine, or, if your battery is fully charged.
Prepare fallback environment
pacman -S busybox
If the upgrade process fail, we can revert our changes, with busybox
Packages
We should download all our actual i686 packages, for the fallback.
pacman -Sw $(pacman -Q |awk '{print $1}')
Now, we can edit your mirrolist, to download packages compiled in x64, by changing `i686' to `x86_64' You could do it manually, or with this little script :
sed -i -e s/i686/x86_64/g /etc/pacman.d/mirrorlist
We can download all of your actually installed package, but x64 flavoured :
rm -rf /var/lib/pacman/sync/* # cleanup the repos cache
pacman -Sy # sync
pacman -Sw $(pacman -Q |awk '{print $1}')
If there are some packages that can't be downloaded, please remove them.
Open a root tty
A classic terminal emulator could be ok too, but during the upgrade, some programs will be unistalled, so a desktop console might not be stable.
Upgrade
Kernel
Upgrading the kernel is safe : 64bit program must run at 64bit kernel, but 32bit program and 64bit program will both work well with a 64bit kernel. To install the x64 kernel, you just have to execute :
pacman -S kernel26
We have change your mirror flavour, so pacman will now automaticaly download, and install x64 packages. Then, reboot your system, and check the kernel version:
# uname -m x86_64
Prepare fallback lib
This step can be skipped. We will use it only when some mistake had been made. In this case, some 32bit program can run with it by using `/lib/ld-linux-x86-32.so.2', in another hand, we have busybox for fallback.
pacman -S lib32-glibc
Upgrade pacman
Warning: When this step is started, it can't be terminated.
Pacman and all of its dependencies must be installed in one time.
pacman -S pacman glibc libfetch libarchive openssl acl attr xz-utils bzip2 zlib readline bash ncurses
When this operation is finished, only busybox, bash and pacman will be usable.
Upgrade the whole system
pacman -S $(pacman -Q|busybox awk '{print $1}')
After a long time wait, the system will be upgraded to 64bit. Enjoy it!
Cleanup
Now we can remove busybox and lib32-glibc.
pacman -Rcn busybox lib32-glibc
Troubleshooting
During the upgrade, when glibc is replaced by the 64bit version, many programs can't run, if you make some mistakes, you can solve it with lib32-glibc or busybox.
Use busybox
In Arch, busybox is statically linked, it can run above kernel without any other libs. There are many commands in it. For example, extra 64bit pacman from package.
busybox zcat /var/cache/pacman/pkg/pacman-3.3.2-1-i686.pkg.tar.gz | busybox tar xf - -C /
Use lib32-glibc to run 32bit program
For example:
/lib/ld-linux-x86-32.so.2 /bin/ls
Be sure to upgrade compiler flags
During upgrade the x86_64 version of /etc/makepkg.conf might be stored as /etc/makepkg.conf.pacnew. You will have to replace the old version or modify it, if you want to be able to do any compiling.
cp /etc/makepkg.conf /etc/makepkg.conf.backup_i686 && cp /etc/makepkg.conf.pacnew /etc/makepkg.conf
Most problem can be resolved with these tips.