This post will describe my experience installing Arch Linux on a PineBook Pro on external storage (USB stick in this example). Thus, the Manjaro default installation on the eMMC will not be touched. You should use a fast USB Stick, or the overall experience will be extremely slow. I’m using a SanDisk Extreme PRO, which is fast and feels like an SSD. This USB stick will be erased entirely, so don’t use a USB stick with essential data on it.
The post is based on the instructions found at https://wiki.pine64.org/wiki/Pinebook_Pro_Software_Release#Arch_Linux_ARM.
The installation process consists of two steps:
- First, install the official Arch Linux ARM distribution; this will not be enough to have many hardware parts working (e.g., WiFi, battery management, and sound).
- Then, add the repositories with kernels and drivers for the PineBook Pro.
The first part must be performed from an existing Linux installation on the PineBook Pro. I will use the Manjaro installation that comes with the PineBook Pro. The second part will be performed on the installed Arch Linux system on an external drive (a USB stick in this example). Since after the Arch Linux installation, the WiFi is not working, for this part, you need to connect to the wired network, e.g., with an ethernet USB adapter.
Finally, I’ll also show how to install Gnome.
First part
This is based on https://wiki.pine64.org/wiki/Installing_Arch_Linux_ARM_On_The_Pinebook_Pro.
I insert my USB stick, which is /dev/sda. (Use “lsblk” to detect that.) From now on, I’m using this device. In your case, the device name might be different.
From now on, all the instructions are executed as “root” from a terminal window; thus, I first run:
1 |
sudo su - |
I will do the following steps in a directory of the root’s home:
1 2 3 |
cd mkdir pbp-install cd pbp-install |
We need to download and extract the latest release of Tow-Boot for the Pinebook Pro from https://github.com/Tow-Boot/Tow-Boot/releases. At the time of writing, the latest one is “2021.10-005”:
1 2 3 |
wget https://github.com/Tow-Boot/Tow-Boot/releases/download/release-2021.10-005/pine64-pinebookPro-2021.10-005.tar.xz tar xf pine64-pinebookPro-2021.10-005.tar.xz |
Now we flash Tow-Boot to /dev/sda (replace this with the device you are using).
Remember: this will wipe all the contents of the USB stick. Moreover, make sure you specify the right device, or you might overwrite the eMMC of the computer.
This process creates the partition table for the device, with the first partition for Tow-Boot. This created first partition must not be modified further. In fact, as you see in a minute, when we further partition the disk, we make sure to skip the first partition.
1 |
dd if=pine64-pinebookPro-2021.10-005/shared.disk-image.img of=/dev/sda bs=1M oflag=direct,sync |
The output should be something like this:
1 2 3 |
13+1 records in 13+1 records out 13648896 bytes (14 MB, 13 MiB) copied, 0.592278 s, 23.0 MB/s |
Now, we must create the partitions on the USB stick. The process is documented step-by-step here https://wiki.pine64.org/wiki/Installing_Arch_Linux_ARM_On_The_Pinebook_Pro#Creating_the_partitions, and must be followed strictly:
1 |
fdisk /dev/sda |
These are the contents of my terminal where I follow the above-mentioned instructions (since I had already used this USB stick for some experiments before writing this blog post, fdisk detects the existing ext4 signature):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
Welcome to fdisk (util-linux 2.38.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. GPT PMBR size mismatch (26657 != 250085375) will be corrected by write. The backup GPT table is not on the end of the device. This problem will be corrected by write. Command (m for help): n Partition number (2-128, default 2): First sector (24640-250085342, default 26624): Last sector, +/-sectors or +/-size{K,M,G,T,P} (26624-250085342, default 250083327): +256M Created a new partition 2 of type 'Linux filesystem' and of size 256 MiB. Command (m for help): x Expert command (m for help): A Partition number (1,2, default 2): 2 The LegacyBIOSBootable flag on partition 2 is enabled now. Expert command (m for help): r Command (m for help): n Partition number (3-128, default 3): First sector (550912-250085342, default 550912): Last sector, +/-sectors or +/-size{K,M,G,T,P} (550912-250085342, default 250083327): Created a new partition 3 of type 'Linux filesystem' and of size 119 GiB. Partition #3 contains a ext4 signature. Do you want to remove the signature? [Y]es/[N]o: Y The signature will be removed by a write command. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. |
Now we must format the boot and the root partitions. I’m going to use EXT4 for both:
1 2 |
mkfs.ext4 /dev/sda2 mkfs.ext4 /dev/sda3 |
Note that although the second command returns immediately, the EXT4 partition will be formatted in the background and will take some time (even with a fast USB stick).
Now we mount the two partitions:
- mount the root partition (the 3rd partition) on “/mnt”
- create the boot directory at the root of the mounted system
- mount the boot partition (the 2nd partition) on “/mnt/boot”
1 2 3 |
mount /dev/sda3 /mnt mkdir /mnt/boot mount /dev/sda2 /mnt/boot |
Now, we download the tarball for the rootfs of our USB stick installation. The instructions are once again taken from the link mentioned above, and they also include the verification of the contents of the downloaded archive:
1 2 3 4 5 |
wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz{,.sig} gpg --keyserver keyserver.ubuntu.com --recv-keys 68B3537F39A313B3E574D06777193F152BDBE6A6 gpg --verify ArchLinuxARM-aarch64-latest.tar.gz.sig |
And we extract the root filesystem onto the mounted root partition of our USB stick:
1 |
bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /mnt |
This is another operation that takes time.
Now, we must create the “/etc/fstab” on the mounted partition. To do that, we need to know the UUID of the two partitions by using “blkid”. You need to take note of the UUID from the output (which will be completely different according to the used external device):
1 2 3 |
blkid /dev/sda3 /dev/sda2 /dev/sda3: UUID="7f7965a3-e04a-4e6b-ae6b-f8110202c61b" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="b0faf292-8016-4c43-b91c-c9a066c72072" /dev/sda2: UUID="63afda02-7731-49b0-a09d-59d9aa64d038" BLOCK_SIZE="1024" TYPE="ext4" PARTUUID="0cf6db95-06cf-de40-8044-702c974cb3ec" |
We create the file “/etc/fstab” in “/mnt” accordingly (remember, the UUIDs and the partition types must be specified accordingly). I run “nano /mnt/etc/fstab,” and I append the following contents (I use “noatime” to reduce the number of writes on the external USB stick when used to run the installed OS):
1 2 |
UUID=7f7965a3-e04a-4e6b-ae6b-f8110202c61b / ext4 defaults,noatime 0 1 UUID=63afda02-7731-49b0-a09d-59d9aa64d038 /boot ext4 defaults,noatime 0 2 |
Finally, we need to create the file “/mnt/boot/extlinux/extlinux.conf” (the directory must be created first, with:
1 2 |
mkdir -p /mnt/boot/extlinux nano /mnt/boot/extlinux/extlinux.conf |
Once again, the contents depend on the UUID we discovered above for the root filesystem, so the contents must be adapted accordingly:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
DEFAULT arch MENU TITLE Boot Menu PROMPT 0 TIMEOUT 50 LABEL arch MENU LABEL Arch Linux ARM LINUX /Image INITRD /initramfs-linux.img FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb APPEND root=UUID=7f7965a3-e04a-4e6b-ae6b-f8110202c61b rw LABEL arch-fallback MENU LABEL Arch Linux ARM with fallback initramfs LINUX /Image INITRD /initramfs-linux-fallback.img FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb APPEND root=UUID=7f7965a3-e04a-4e6b-ae6b-f8110202c61b rw |
We can now unmount the filesystems
1 2 |
umount /mnt/boot umount /mnt |
And we can reboot into the (hopefully) installed Arch Linux on the USB stick to finish a few operations. Remember that we need a wired connection for the next steps.
Upon rebooting, you should see the two entries (if you let the timeout expire, it will automatically boot the first entry):
After we get to the prompt, we can log in with “root” and password “root” (needless to say: change the password immediately).
Let’s connect a network cable (you need a USB adapter for that), and after a few seconds, we should be online. We verify that with “ifconfig”, which should show the assigned IP address for “eth0”.
Since there’s no DE yet, I suggest you keep following the official web pages (and this blog post) by connecting to the PineBook Pro via SSH so that it will be easy to copy and paste commands into the terminal window of another computer. Moreover, when logged into the PineBook Pro directly, you will see lots of logging information directly on the console (I guess this could be prevented by passing specific options to the kernel, but we’ll install a DE later, so I don’t care about that much). The SSH server is already up and running in the PineBook Pro installed system, so once we know the IP address from the output of “ifconfig”, we can connect via SSH. However, root access via SSH is disabled, so we must connect with the other predefined account “alarm” and password “alarm” (again, you might want to change this password right away):
1 |
ssh alarm@<ip address> |
Once we’re logged in since “sudo” is not yet configured, we switch to root:
1 |
su - |
We have to initialize the pacman keyring:
1 2 |
pacman-key --init pacman-key --populate archlinuxarm |
The guide https://wiki.pine64.org/wiki/Installing_Arch_Linux_ARM_On_The_Pinebook_Pro ends at this point.
What follows are my own instructions I usually run when installing Arch.
In particular, I configure time, network time synchronization, and timezone (Italy, in my case):
1 2 3 4 5 |
timedatectl set-timezone Europe/Rome timedatectl set-ntp on hwclock --systohc |
The next step is required for doing gnome-terminal work (and it’s also part of the Arch standard installation instructions):
Edit “/etc/locale.gen” and uncomment “en_US.UTF-8 UTF-8” and other needed locales.
Generate the locales by running:
1 |
locale-gen |
Edit the “/etc/locale.conf” file, and set the LANG variable accordingly, for example, for the UTF-8 local above:
1 |
LANG=en_US.UTF-8 |
We could run a first system upgrade
1 |
pacman -Syu |
I don’t know if that’s strictly required because we’ll add the additional repository for the PineBook Pro in a minute. However, just in case, it might be better to update the system.
Let’s reboot and verify that everything still works.
The kernel at the time of writing is
1 2 |
uname -a Linux alarm 5.19.8-1-aarch64-ARCH #1 SMP PREEMPT Thu Sep 8 18:20:33 MDT 2022 aarch64 GNU/Linux |
NOTE: By the way, I noted that if I want to boot from the USB stick, it’s better to use the right-hand side USB port (which is USB 2) instead of the left-hand side port (USB 3). Otherwise, the system seems to ignore the system on the USB stick and boots directly to the installed Manjaro system.
Second part
As mentioned above, I suggest connecting to the PineBook Pro via SSH. In any case, what follows must be executed as “root” (“su -“).
Let’s now add the additional repositories with kernels and drivers specific to PineBook Pro.
The project is documented here: https://github.com/SvenKiljan/archlinuxarm-pbp, and these are the contents of the additional repository that we’ll add in a minute https://pacman.kiljan.org/archlinuxarm-pbp/os/aarch64/.
Note that this project also provides a way to install Arch Linux directly with these repositories, with a procedure that is similar to the one in the first part. I prefer to install official Arch Linux first and then add the additional repositories, though.
The addition of the PineBook Pro repository to an existing Arch Linux installation and the installation of specific kernel and drivers is documented as a FAQ: https://github.com/SvenKiljan/archlinuxarm-pbp/blob/main/FAQ.md#how-do-i-migrate-from-other-arch-linux-arm-releases-for-the-pinebook-pro.
The addition of the PGP key and the repositories to “/etc/pacman.conf” is done by pasting the following commands (remember, as the user “root”):
1 2 3 4 5 6 7 8 9 |
pacman-key --keyserver hkps://keys.openpgp.org/ --recv-keys A1EC3C686EF7A9DD232D1563D4D12D6AA6A92769 pacman-key --lsign-key A1EC3C686EF7A9DD232D1563D4D12D6AA6A92769 cat << 'EOF' >> /etc/pacman.conf [archlinuxarm-pbp] SigLevel = Optional TrustedOnly Server = http://pacman.kiljan.org/$repo/os/$arch EOF |
Let’s now synchronize the repositories
1 |
pacman -Sy |
And let’s install the packages specific to the PineBook Pro (note that we’re going to install the Linux kernel patched by Manjaro for the PineBook Pro):
1 |
pacman -S ap6256-firmware libdrm-pinebookpro linux-manjaro pinebookpro-audio pinebookpro-post-install towboot-pinebookpro-bin |
Of course, we’ll have to answer “y” to the following question:
1 |
:: linux-manjaro and linux-aarch64 are in conflict (linux). Remove linux-aarch64? [y/N] |
Let’s reboot and verify that everything still works (again, by connecting via SSH).
Now, we should be using the new kernel:
1 2 |
uname -a Linux alarm 6.0.10-1-MANJARO-ARM #1 SMP PREEMPT Sat Nov 26 12:11:25 CET 2022 aarch64 GNU/Linux |
Before installing a DE, I prefer creating a user for myself (“bettini”) and configuring it as a “sudoer”. (We must install “sudo” first).
1 2 3 4 5 |
pacman -S sudo useradd -m bettini passwd bettini usermod -aG wheel,sys,rfkill bettini |
Then (by simply running “visudo”), we enable the users of the group “wheel” in “/etc/sudoers”; that is, we uncomment this line:
1 2 |
## Uncomment to allow members of group wheel to execute any command # %wheel ALL=(ALL:ALL) ALL |
Then, I try to re-connect with my user and verify that I can run commands with “sudo” (e.g., “sudo pacman -Syu”).
Before going on, I prefer to set up a SWAP file (of 8 Gb). The PineBook Pro has only 4 Gb of RAM, and it is likely to exhaust it. Using ZRAM did not work in my experience with Manjaro, so it’s better to have a SWAP file to avoid system hangs.
I run as root (“sudo su -“):
1 2 3 4 5 6 7 |
dd if=/dev/zero of=/swapfile bs=1M count=8192 status=progress chmod 0600 /swapfile mkswap -U clear /swapfile swapon /swapfile |
This takes some time. Then, I add the following line at the end of “/etc/fstab”:
1 |
/swapfile none swap defaults 0 0 |
Install GNOME
As usual, I’m still doing these steps via SSH.
I’m going to install GNOME with some fonts, pipewire media session, firefox, and the NetworkManager (I’ll ignore dependencies that cannot be installed, e.g., “gnome-boxes” since I’m not going to use virtual machines on this machine):
1 |
sudo pacman -S firefox noto-fonts noto-fonts-emoji power-profiles-daemon networkmanager pipewire-media-session pipewire-jack xdg-desktop-portal-gnome gnome |
It’s more than 500 Mb of packages to install, so please be patient.
Now, I enable the primary services (the login manager for GNOME, the NetworkManager to select a network from GNOME, and the profile daemon for switching between power profiles, e.g., “Balanced” and “Powersave”):
1 2 3 |
sudo systemctl enable gdm.service sudo systemctl enable NetworkManager.service sudo systemctl enable power-profiles-daemon.service |
OK, time to reboot.
This time the graphical GDM login manager should greet us, allowing us to get into GNOME and select a WiFi connection.
NOTE: when GDM starts, I always hear a strange noise. It also happens with the pre-installed Manjaro. It must be the sound card that gets activated…
IMPORTANT NOTE: Upon rebooting, the WiFi does not always work (it looks like the WiFi card is not seen at all); that also happens with Manjaro. The only solution is to shut down the computer (i.e., NOT simply rebooting it) and boot it again.
And here’s the GNOME 43 setting on the right top corner showing the connected WiFi and the currently selected power profile “Balanced”:
By default, GNOME starts with the Wayland session. Everything seems to work; touchpad gestures work out of the box (3 finger swipes). Something does not look right in the Wayland session, though. For example, if you run Firefox, you cannot switch to it with Alt+Tab. I prefer to go for the X11 session for the time being (that’s selectable from the GDM’s gear icon on the bottom right corner once you select your user).
Here are a few screenshots of the GNOME activities and the currently installed applications:
The GNOME About dialog:
And of course, once installed, let’s run “neofetch”:
That’s all for now!
In another blog post, I described my customizations to GNOME (installed programs and configurations).
Stay tuned! 🙂
Hello,
One more interesting article, even though I can’t experiment by lack of this hardware.
I would just recommend setting btrfs file system with zstd compression rather than ext4, snappier and less wearing of the stick.
I was about to add that doing this is much simpler with Slint: in “auto” partitioning mode you just have to tell where you want to install (in this case on the USB stick), and answer a very few questions. Zero command to type 🙂
Unfortunately Slint doesn’t support the ARM architecture, so can’t be used with a PineBook Pro…
Hi,
I thought that btrfs in general, might stress external storage devices more due to its write amplification.
Have you got evidence to the contrary?
Moreover, there’s no grub on this system, so it wouldn’t be possible to boot snapshots (one of the main reasons I’m using btrfs on all my other devices).
However, I’ll also experiment with installing this distribution on this computer with btrfs (maybe with a micro SD this time) and report about that.
Hi,
I use it a lot on external storage devices, never has an issue. Even if the drive gets disconnected or in case of hard halt, I observed no file system corruption.
Actually if you use compression (zstd level 3 in my case) you will trigger less writes, not more. Additionally the system with this compression enabled with this setting takes up half as much space as using ext4, at no cost wrt speed.
If you use a microSD card, put it in an USB enclosure, it will be way faster. I rather use USB sticks though.
Pingback: Installing Arch Linux with BTRFS on a PineBook Pro (external storage) | Lorenzo Bettini
Pingback: Installing EndeavourOS ARM on a PineBook Pro (August 2024) | Lorenzo Bettini