Install ArchLinux on BeagleBone Black
The installation of ArchLinux on ARM based embedded devices is well documented online, but I always forget the extra and optional steps that are assumed to be known.
Tags: archlinux beaglebone
Overview
ArchLinux is a great operating system for low-cost ARM based embedded devices, such as the Raspberry Pi and BeagleBone Black. The development team for the ARM port is doing an excellent job optimizing and updating the package repository.
The official website has instructions for installing ArchLinux ARM on the BBB, but is missing the details for post-installation steps that are generally not known by users who are just starting with ArchLinux. The best, most detailed and up-to-date ArchLinux installation tutorial I found was the one by The Mukt, but it appears to be offline now.
Below you can find the condensed summary of the installation steps that I usually take on BeagleBones.
Prerequisites
Before you can start with the installation, you have to prepare a bootable SD card with ArchLinux that will be used to install the operating system. If your desktop PC is also an ArchLinux system then you can follow the SD Card Creation steps on the official web site. Insert the SD card into the BBB and power on the system.
Many developers always boot their BBB’s from an SD card, and if you are one of them, you can skip the next section. I prefer to install the OS on the on-board 2GB or 4GB eMMC flash memory, so that I can use the SD card slot for other things.
Install ArchLinux to eMMC
The on-board eMMC already has boot and root partitions by default, but if yours are modified for some reason, you need to re-create them. I suspect that you already know what you are doing, but if you are not sure, check out the Partitioning page on the ArchLinux wiki.
Once the partitions are in place, you need to format them. I use the VFAT file system for the boot partition, and EXT4 for the root partition:
# mkfs.vfat -F 16 /dev/mmcblk1p1
# mkfs.ext4 /dev/mmcblk1p2
Now download and install the bootloader:
# wget http://archlinuxarm.org/os/omap/BeagleBone-bootloader.tar.gz
# mkdir boot
# mount /dev/sdX1 boot
# tar -xvf BeagleBone-bootloader.tar.gz -C boot
You can safely ignore any error messages about changes in ownership, and unmount the boot partition:
# umount boot
Next, download and install the root filesystem:
# wget http://archlinuxarm.org/os/ArchLinuxARM-am33x-latest.tar.gz
# mkdir root
# mount /dev/sdX2 root
# bsdtar -xpf ArchLinuxARM-am33x-latest.tar.gz -C root
You can safely ignore the locale related warning and errors and unmount the root partition:
# umount root
Now power off the BBB, remove the power chord, remove the SD card and plug the power chord back in. Your BBB should now boot from eMMC.
Configure ArchLinux
Now that the system is up, log in as root / root and change the password:
# passwd
Enter new UNIX password: YourNewPassword
Retype new UNIX password: YourNewPassword
You can take a look at the system log to check whether there are any problems:
# dmesg
Then edit the package mirror list and uncomment the download servers that work best for you:
# nano /etc/pacman.d/mirrorlist
Set the system’s language and locale:
# nano /etc/locale.gen
uncomment the entries you need, i.e. en_US.UTF-8
# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8
Next, identify your time zone and set it permanently, i.e. /usr/share/zoneinfo/America/New_York:
# ls /usr/share/zoneinfo/
# ln -s /usr/share/zoneinfo/<Zone>/<SubZone> /etc/localtime
# hwclock --systohc --utc
Finally, set the machine’s host name:
# echo YourNewHostName > /etc/hostname
Optional Post-Install steps
Your BeagleBone Black is now fully set up and ready to go. I usually perform the following additional steps before putting it to work.
Install the base-devel packages if you want to compile code on the BBB:
# pacman -Syu base-devel
Install sudo
, because you don’t want to be logged in as root all the time:
# pacman -S sudo
# EDITOR=nano visudo
uncomment the following line
%wheel ALL=(ALL) ALL
Install auto completion for bash
, so it is easier to find packages:
# pacman -S bash-completion
Finally, create a new user account that you will use to log in from now on, and set its password:
# useradd -m -g users -G wheel,storage,power -s /bin/bash YourNewUserName
# passwd YourNewUserName
And that’s it!