Upgrade Arch Linux for Raspberry Pi 2
Arch Linux ARM images are tied to specific hardware architecture. While this may be seen as an inconvenience, there is an advantage in that Arch Linux binaries for Raspberry Pi 2 are compiled for ARM7 CPU and thus can benefit from the new instruction set.
Because ARM7 architecture is backward compatible with ARM6, it’s possible to upgrade your Raspberry Pi hardware to version 2 without reinstalling Arch Linux. Here is how we can do that (it goes without saying, that if you have any important data, consider backing it up first).
Update: this guide works for Rapsberry Pi 3 as well
Let’s start from Raspberry Pi 1 prompt. Some of the commands will require root privileges, so either login as
root user or use sudo to start an interactive shell:
It’s good idea to fully update the existing system before performing the upgrade:
1. Download the latest ArchLinux image for Raspberry Pi 2
2. Extract required files from the archive
mkdir ~/update bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz \ -C ~/update boot usr/lib/modules
All we need is
/boot directory (with an updated kernel image —
kernel7.img) and updated kernel modules.
3. Replace files in
/boot directory with the new ones (with backup)
mkdir -p ~/backup/boot mv /boot/* ~/backup/boot mv ~/update/boot/* /boot
4. Update boot configuration
If you have previously customized Rasperry Pi’s boot configuration, you may need to update
config.txt and / or
cmdline.txt files appropriately.
Use the following commands to display differences between the old configuration files and the new ones:
diff ~/backup/boot/config.txt /boot/config.txt diff ~/backup/boot/cmdline.txt /boot/cmdline.txt
Then, update the configuration files (if needed):
nano /boot/config.txt nano /boot/cmdline.txt
5. Replace files in
/usr/lib/modules with the new ones (with backup)
mkdir -p ~/backup/modules mv /usr/lib/modules/* ~/backup/modules mv ~/update/usr/lib/modules/* /usr/lib/modules
6. Re-generate initial RAM file system (optional)
This step is require only if your Linux installation is relying on initramfs image to load additional drivers (like LVM, LUKS, etc.) early in boot sequence. If you are in doubt about whether your OS contains the initial ramdisk, you may check the
backup/boot directory for presence of
initrd files (default Arch Linux images for Raspberry Pi don’t contain them).
Use the following command to print version of the new (ARM7) kernel:
ls ~/update/usr/lib/modules | grep ARCH
To generate a new ramdisk (with ARM7 kernel modules), run mkinitcpio with that kernel version:
mkinitcpio -c /etc/mkinitcpio.conf -g /boot/initramfs -k KERNEL_VERSION
7. Boot the image in Raspberry Pi 2
Power off the Raspberry Pi 1:
Then insert your SD card into Raspberry Pi 2 (either by removing SD-adapter, or by cloning the data to microSD) and boot the device.
If Raspberry Pi 2 won’t boot, you can always restore original files from the
~/backup folder (using a separate machine) and boot from Raspberry Pi 1 again.
8. Upgrade binaries
After those steps, Raspberry Pi 2 should use new, ARM7 kernel and modules. However, all user-space binaries are still compiled for ARM6. While this combination works just fine (because ARM7 CPU is compatible with ARM6 instructions), me may want to update the binaries to use newer CPU instruction set.
First, we need to change system architecture in the package manager (pacman) — run:
armv7h in the
Architecture = armv6h line.
Then completely clean package cache:
and perform full package database synchronization:
We need to use
--force option for Linux kernel package in order to overwrite the files that we’ve previously created manually (namely,
pacman -S linux-raspberrypi --force
If the kernel version from package manager differs from version of the manually copied kernel, you may delete obsolete
/usr/lib/modules/KERNEL_VERSION directory (which we’ve created on step 5) to save storage space.
Other packages should be re-installed (and, thus, upgraded) normally:
pacman -Qqn | pacman -S -
9. Re-generate initial RAM file system (optional)
If your system uses initial RAM disk, you may repeat the actions from step 6 one more time to include the updated binaries in the
10. Reboot the system
Login and display current machine hardware:
It should be
armv7l, which confirms that you have successfully upgraded your OS to the new architecture.
If everything works as expected, you may finally delete the
* Raspberry Pi is a trademark of the Raspberry Pi Foundation