Upgrade Arch Linux from i686 to x86 64 HOWTO
From ArchWiki
Contents |
Introduction
Warning: This operation may take your system to un-bootable. And if you have some mistake, some data will be lost.
Preparation
Check the CPU
CPU must support x86_64. The follow command can check it:
cat /proc/cpuinfo |grep --color lm
If the cpu support x86_64, it will return some letters.
Prepare the disk space
It will take about twice free space of `/var/cache/pacman/pkg',if you have run `pacman -Sc' but not `pacman -Scc' from the finish of the Arch Linux system installation. We should keep all of the i686 packages, and download the x86_64 packages that installed in your system.
If you have not enough disk, please use `gparted' resize your root partition, or mount other partition to `/var/cache/pacman'.
Confirm the power
This operation may take about 1 hour or more, and can't be terminated. Please confirm you power supply.
Prepare fallback environment
pacman -S busybox
Packages
Download the i686 packages for fallback:
pacman -Sw $(pacman -Q |awk '{print $1}')
Download the x86_64 packages for upgrade. Edit `/etc/pacman.d/mirrorlist',change `i686' to `x86_64',modify it manually, or use the follow script:
sed -i -e s/i686/x86_64/g /etc/pacman.d/mirrorlist
Do it:
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 can't be downloaded, please remove them.
Open a root console
Terminal will be ok, too. But in the upgrade, some program will be destroyed, console is stable. Just press `Ctrl+Alt+F1' and login as root.
Upgrade
Kernel
Upgrade of the kernel is safe, in other words, 64bit program must run at 64bit kernel, but 32bit program and 64bit program both will work well at 64bit kernel. We have swith the mirror to x86_64, the follow command will install 64bit kernel.
pacman -S kernel26
Then reboot the system, confirm the kernel version:
# uname -m x86_64
Prepare fallback lib
This step can be skipped. We will use it only when some mistake has be made. In that 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 starting, it won't be terminated.
The pacman and all of its depends must be install at one time.
pacman -S pacman glibc libfetch libarchive openssl acl attr xz-utils bzip2 zlib readline bash ncurses
When this operation finished, only busybox, bash and pacman work now.
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 be replaced to 64bit, many program can't running, 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 command 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
Most problem can be resolved with these tips.