Difference between revisions of "Migrating between architectures"

From ArchWiki
Jump to: navigation, search
Line 1: Line 1:
[[Category:Arch64 (English)]]
[[Category:Arch64 (English)]]
[[Category:Getting and installing Arch (English)]]
[[Category:Getting and installing Arch (English)]]
{{i18n|Migrating Between Architectures Without Reinstalling}}
[[fr:Migration 64 bits]]
[[fr:Migration 64 bits]]
This page documents two potential methods of migrating installed systems between i686 (32-bit) and x86_64 (64-bit) architectures, in either direction. The methods avoid reinstalling the entire system. One method uses a liveCD, the other modifies the system from within..
This page documents two potential methods of migrating installed systems between i686 (32-bit) and x86_64 (64-bit) architectures, in either direction. The methods avoid reinstalling the entire system. One method uses a liveCD, the other modifies the system from within..

Revision as of 10:29, 15 October 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

This page documents two potential methods of migrating installed systems between i686 (32-bit) and x86_64 (64-bit) architectures, in either direction. The methods avoid reinstalling the entire system. One method uses a liveCD, the other modifies the system from within..

Warning: Unless explicitly stated, all these methods are UNTESTED and may irreparably damage your system. Continue at your own risk.

General preparation

Confirm 64-bit architecture

If you are already running x86_64 but want to install i686 this is not relevant and you can skip this step.

In order to run 64-bit software, you must have a 64-bit capable CPU. Most modern CPUs are capable of running 64-bit software. You may check your CPU with the following command:

grep --color '\<lm\>' /proc/cpuinfo

For CPUs that support x86_64, this will return the Template:Codeline flag (“long mode”) highlighted. Beware that lahf_lm is a different flag and does not indicate 64-bit capability itself.

Disk space

You should be prepared for Template:Filename to grow approximately twice its current size during the migration. This is assumes only packages that are currently installed are in the cache, as if “pacman -Sc” (clean) was recently run. The disk space increase is due to duplication between the i686 and x86_64 versions of each package.

If you have not enough disk, please use gparted to resize the relevant partition, or mount another partition to /var/cache/pacman.

Please do not remove packages of the old architecture from the cache until the system is fully operating in the new architecture. Removing the packages too early may leave you unable to fall back and revert changes.

Power supply

The migration may take a substantial amount of time, and it would be inconvenient to interrupt the process. You should plan on at least an hour or more, depending on the number and size of your installed packages and internet connection speed (although you can download everything before starting the critical part). Please make sure you are connected to a stable power source, preferably with some sort of failover or battery backup.

Fallback packages

If the migration fails halfway through, there are packages that can help sort out the situation, but they should be installed before the main packages are migrated. More details about using them under #Troubleshooting below.

One package is Template:Package Official, which can be used to revert changes. It is statically linked and does not depend on any libraries. The 32-bit (i686) version should be installed, using

# pacman -S busybox

Another package is Template:Package Official, from the Multilib x86_64 repository. It is probably only useful when migrating away from 32 bits; in any case you may safely skip this package. You can use the package to run 32 bit programs by explicitly calling Template:Filename. Install with:

# pacman -S lib32-glibc

Method 1: Utilising the Arch LiveCD

  1. Download, burn and boot the 64-bit Arch ISO LiveCD
  2. Configure your network on the LiveCD, then pacman to use your new architecture repos
  3. Mount your existing installation to Template:Filename directory. For example: Template:Codeline
  4. Use the following script to update the local pacman database, get a list of all your installed packages and then reinstall them:


pacman --root $MOUNTED_INSTALL -Sy
pacman --root $MOUNTED_INSTALL -Qqet > $TEMP_FILE

for PKG in $(cat $TEMP_FILE) ; do
   pacman --root $MOUNTED_INSTALL -S $PKG --noconfirm

exit 0

Method 2: From a running system

Package preparation

Cache old packages

Note: If you have any packages installed from the AUR or third-party repositories without new architecture availability, pacman will let you know it cannot find a suitable replacement. Make a list of these packages so you may re-install them after the update process and then remove them using Template:Codeline.

If you do not have all your installed packages in your cache, download them (for the old architecture) for fallback purposes.

# pacman -Sw $(comm -23 <(pacman -Qq) <(pacman -Qmq))

or use bacman from pacman-contrib package to generate them.

If you are migrating away from 32 bits, now is the time to install 32-bit Busybox:

# pacman -S busybox

Change Pacman architecture

Edit the /etc/pacman.conf file and change Architecture from Template:Codeline to the new value. These sed commands may be used:

For x86_64:

# sed -i -e s/'Architecture = auto'/'Architecture = x86_64'/g /etc/pacman.conf

and for i686:

# sed -i -e s/'Architecture = auto'/'Architecture = i686'/g /etc/pacman.conf

Pacman’s package repository databases should be manually removed to force synchronisation with the new repositories:

# rm -rf /var/lib/pacman/sync/*   # remove existing repository cache
# pacman -Sy                      # sync new architecture repositories

Download new packages

Download the new architecture versions of all our currently installed packages:

# pacman -Sw $(pacman -Qq|sed '/^lib32-/ d')  # download new package versions

If there are some packages that cannot be downloaded, please remove them.

If migrating to 32 bits, install the 32-bit Busybox fallback now that Pacman has been configured with the 32-bit architecture:

# pacman -S busybox

Alternatively, if migrating to 64 bits, now is the time to install the lib32-glibc fallback:

# pacman -S lib32-glibc

Package installation

Install kernel (64-bit)

Upgrading the kernel to 64 bits (x86_64) is safe and straightforward: 32 bit and 64 bit applications run equally well under a 64-bit kernel. For migration away from 64 bits, leave the 64-bit kernel installed and running for now and skip this step.

To install the standard Arch Linux kernel, use the following command:

# pacman -S linux

Boot the new 64-bit kernel and verify it is running the x86_64 architecture:


Console terminal

This is the time to switch to a text-mode virtual console (e.g. Ctrl+Alt+F1) for the rest of the process. You should be fine using a pseudo-terminal like SSH but it is not advised. There will be several packages removed and replaced during the update process that may cause X11 desktops to become unstable leaving your system in an unbootable state.

Install Pacman

Warning: Once you start updating pacman and its dependencies it can not be interrupted. Pacman and all of its dependencies must be installed at the same time in a single command line.
# pacman -S pacman glibc libfetch libarchive openssl acl attr xz-utils bzip2 zlib readline bash ncurses expat

Immediately following this command only Busybox, Bash and Pacman will be executable until the other packages are migrated below. You must not reboot your system until the following commands have been completed. You have been warned.

Install remaining packages

Install all of the previously downloaded replacements for the new architecture. (Go get a drink and make a sandwich; this could take a while.)

# pacman -S $(pacman -Qq)

For migration away from 64 bits, you may want to skip installing a 32-bit kernel in the command above, since the old 64-bit kernel will still run 32-bit programs.

After this step the migration in either direction should be complete and it should be safe to reboot the computer.


You are now free to remove Busybox and lib32-glibc.

# pacman -Rcn busybox lib32-glibc

Makepkg compiler flags

During the upgrade the new version of Template:Filename may be stored as Template:Filename. You will have to replace the old version or modify it, if you want to compile anything with makepkg in the future.

# mv /etc/makepkg.conf /etc/makepkg.conf.backup && mv /etc/makepkg.conf.pacnew /etc/makepkg.conf

It might also be a good idea to just get a list of "new" additions to Template:Filename. You can get a list with the following command:

# find /etc/ -type f -name \*.pac\*


During the upgrade, when glibc is replaced by the new architecture version, old architecture versions of many programs will not run. If problems occur, you can solve them with Template:Package Official and Template:Package Official.


In Arch, Busybox is statically linked; it can run without any libraries. There are many commands available to you. For example, to extract an i686 version of Pacman from a cached package:

# busybox tar xf /var/cache/pacman/pkg/pacman-3.3.2-1-i686.pkg.tar.gz -C <some folder>


Example run 32 bit Template:Filename:

# /lib/ld-linux-x86-32.so.2 /bin/ls

See also