[] Dark Mode

Pinebook Pro Arch Linux Alternative

(posted in blog)

In a previous post I talked a bit about setting up Arch Linux on the Pinebook Pro. That process relied on using a third-party pacman repo for the Pinebook Pro specific build and driver stuff which has disappeared and seems to be no longer maintained. As there’s still no official Arch Linux ARM Pinebook Pro support, I’ve decided that the next best thing is to use official Manjaro images to get as close to my familiar Arch Linux setup as I can. It’s not perfect (because it’s not Arch), but Manjaro is based on top of Arch Linux and it’s easier than the hoops you have to jump through to actually get Arch on the Pinebook Pro. Here’s my guide in which I detail the steps I went through to achieve the following goals:

  • Full-disk LUKS encryption on root partition
  • Minimal Manjaro install on the Unstable branch

I take no responsibility for anything good or bad that happens as a result of following this guide. If you manage to brick your Pinebook Pro and think I’m somehow to blame, you can shoot me a nasty email. It’s OK, I won’t hold it against you. But I probably won’t reply. Make sure you’re plugged into a power outlet before starting this, because it takes a while, and running out of juice midway may leave your Pinebook Pro in an… interesting state.

Step 1 Obtain Manjaro

I downloaded the Pinebook Pro Minimal Manjaro image. This is a base install that doesn’t include any window managers or even xorg. You could pick one of the other images too if you wanted, but we’re only using it to perform the installation so it makes sense to optimize for the smallest possible size.

It’s an xz archive, so decompress it and write it to an SD card. Replace the /dev/some/device with the path to the actual SD card you want to write the image to (be careful not to wipe something important unintentionally). Might need sudo to do the dd command depending on your setup.

unxz Manjaro-ARM-minimal-pbpro-21.04.img.xz
dd if=Manjaro-ARM-minimal-pbpro-21.04.img of=/dev/some/device status=progress

Step 1.1 Boot Manjaro

Stick the SD card into your Pinebook Pro and power it on. It should boot automatically without having to press any keys or anything. Once you’re in you’ll select what kind of keyboard your Pinebook Pro has, enter a username, password, timezone info, stuff like that. These are the settings that your SD card is using, not necessarily what you’ll be installing onto the Pinebook Pro. When you’re done you might have to wait a bit while it resizes the partition to fill your SD card, and it’ll reboot itself when done.

Step 2 Connect to the Internet

Once it’s done you should be able to log in using the username and password from step one, and be sitting at a shell prompt. I did a sudo loadkeys dvorak here because I’m a non-qwerty-boi. Then I set up my wifi connection thusly (as non-root):

[iwd]# station wlan0 connect my-network-name
Passphrase: ******

Obviously put your own wifi SSID and password in at the prompts. If you don’t see any messages you can probably assume it worked, but if you want to check, type station wlan0 show and you should see that you’re connected to your wifi. Then type exit to get back to the shell.

At this point I did a sudo pacman -Syyu to update my SD card, but I don’t really know why—probably just force of habit, and I love watching those beautiful ASCII progress bars. If you’re following this guide, this may be a required step, because if your SD card image was too far out of date, then the next step where we install the Manjaro installer with pacman may fail. I also edited /etc/vconsole.conf to load my Dvorak keymap on the SD card by default. You can probably ignore that.

After my system update completed, I rebooted.

Step 3 Install the Manjaro Installer

I didn’t want to just flash one of the pre-built Manjaro images to my eMMC, because that method doesn’t support full disk encryption. Instead I decided to use the manjaro-arm-installer package. I installed it with pacman like this:

sudo pacman -S manjaro-arm-installer

The instructions then say you need to reboot. I was skeptical, but did it anyway just to be safe:

sudo reboot

Step 4 Install Manjaro

For some reason, my Pinebook Pro was mounting the boot partition off the eMMC instead of the one on the SD card, so I unmounted it first. You may not need to do this:

sudo umount /boot

Then I started the installer:

sudo bash manjaro-arm-installer

From the menus that followed I selected Pinebook Pro (obviously), Minimal Edition, and then entered the same information that I initially did during the SD setup (username, password, etc.). When asked to choose the installation media, I chose mmcblk2, since that’s my Pinebook Pro’s internal eMMC storage. Make sure to heed the warning that any existing data will be completely destroyed.

For the filesystem I chose ext4, and I selected Yes when asked if I wanted the “Experimental!” encrypted root partition. Oh boy! This was followed by selecting a few other things (including timezone, keyboard layout, and the correct locale this time—en_US.UTF-8 el estúpido burro!). After confirming my selections, the installer started doing stuff.

After a little while it spit out a fun little message:

Error: /mnt/mmcblk2: unrecognized disk label

I stuck my fingers in my ears and said “LA LA LA” and pretended not to see it. A bit of DuckDuckGoing seems to indicate it is expected.

I was also prompted a couple times to set my full disk encryption password, and then the rest of this step involved watching more beautiful ASCII progress bars flashing across the screen.

Near the end after it did a system update and ran mkinitcpio, there were some more errors, which I also pretended not to see:

==> ERROR: module not found: `i2c_hid'
==> Generating module dependencies
==> WARNING: errors were encountered during the build. The image may not be complete.
error: command failed to execute correctly

Step 5 Reboot and Fix Stuff

From here I ran sudo poweroff, removed the SD card, and powered the Pinebook Pro back on. I saw some semi-concerning prompts about bad CRCs, but my fingers were still in my ears and I was well into another verse of “LA LA LA,” so it was cool. Despite all that, I was prompted for my encryption password, which I entered, and then got to log in.

At this point you’ll want to connect to wifi again, which I did by repeating the iwctl stuff from step two. I also did another sudo pacman -Syyu to update my new Manjaro installation, but it didn’t do anything (I think the installer did that for me already).

Now, I’ll be completely honest here. I don’t really understand the next two steps. I cobbled them together from various sources and they seemed to fix some things, so I’m presenting them here as-is. The first is to get rid of the i2c_hid error when running mkinitcpio. I edited the file /etc/mkinitcpio.conf and removed i2c-hid from the MODULES list, then ran sudo mkinitcpio -P. It completed without errors. I don’t know why that module is in there to begin with, what it is, or why it’s missing. My guess is it’s something that got rolled into the mainline kernel so isn’t needed as an external module anymore, but I could be way off. Maybe you didn’t see any errors like that during the install, in which case don’t bother doing anything.

The next step I don’t understand is to get rid of the weird CRC errors at boot time. To do that I replaced the stock uboot with the bsp one. I don’t know what that means, or what the consequences are (aside from fixing the boot messages), but this is how I did it:

pacman -S uboot-pinebookpro-bsp
dd if=/boot/idbloader.img of=/dev/mmcblk2 seek=64 conv=notrunc
dd if=/boot/uboot.img of=/dev/mmcblk2 seek=16384 conv=notrunc
dd if=/boot/trust.img of=/dev/mmcblk2 seek=24576 conv=notrunc

Step 6 Optional Steps

I updated my system to the unstable Manjaro branch, which is closer to Arch Linux (the packages are synced from Arch multiple times a day). Read the wiki to decide if that’s something you want to do:

sudo pacman-mirrors --api --set-branch unstable
sudo pacman-mirrors --fasttrack 5
sudo pacman -Syyu

I also installed base-devel and yay-bin (my AUR-friendly pacman replacement of choice):

sudo pacman -S base-devel
curl -OL https://aur.archlinux.org/cgit/aur.git/snapshot/yay-bin.tar.gz
tar zxvf yay-bin.tar.gz
cd yay-bin
makepkg -si

plymouth is already installed on Manjaro, so I took some snippets from the Arch Linux wiki to configure it. I edited /etc/mkinitcpio.conf and added plymouth to the HOOKS after base udev, and replaced encrypt with plymouth-encrypt. I left the MODULES section alone. I also added quiet splash vt.global_cursor_default=0 to the end of my APPEND line in /boot/extlinux/extlinux.conf. Upon rebooting, I was presented with the Manjaro splash screen and a graphical encryption password prompt.

This fixed that:

yay -S plymouth-theme-arch-logo
sudo plymouth-set-default-theme -R arch-logo

I’ve noticed that some time after booting I get the following error on the console:

cdn-dp fec00000.dp: [drm:cdn_dp_request_firmware [rockchipdrm]] \*ERROR\* failed to request firmware: -11

I don’t know what that is or how to fix it yet. Everything seems to be working right now though, so my plan from here is to configure the system and install xorg and a window manager like normal. I’ll update this post if it turns out something is broken.

Edit: After a bit more tweaking, here is the mkinitcpio.conf file I’ve settled on, which seems to have cleared up some boot/shutdown errors I was seeing. I still get the rockchipdrm error, but everything that I use seems to be working, so I’m not worrying about that one for now.

Ongoing Notes

I’ll add to this section occasionally if I discover new things that improve the setup.

  • : Here is my full /etc/mkinitcpio.conf file, for reference. Remember to run sudo mkinitcpio -P if you edit that file.

    MODULES=(rtc_rk808 panfrost drm rockchipdrm drm_kms_helper hantro_vpu analogix_dp rockchip_rga panel_simple arc_uart cw2015_battery iscsi_boot_sysfs jsm pwm_bl rtc_rk808 uhid)
    HOOKS=(base udev plymouth keyboard autodetect keymap modconf block plymouth-encrypt lvm2 filesystems fsck)

    (Edited to add rtc_rk808 to the beginning of the MODULES section.)

  • : Install the packages mesa-git and xf86-video-fbturbo-git, and remove any other packages that start with xf86-video- in order to get hardware accelerated video working. Until I did that, redraws were painfully slow, and alacritty would fail to run, complaining about the OpenGL version. Afterwards things became buttery smooth.

  • : As mentioned in the comments, installing the packages linux-pinebookpro and linux-pinebookpro-headers will downgrade your kernel to a version in which deep sleep works. If you then edit /etc/systemd/sleep.conf and set SuspendState=mem, suspending your Pinebook Pro to a very low power deep sleep state should work (systemctl suspend). You might find, like I did, that suspending on lid close doesn’t seem to work quite right. There’s a Pine64 wiki section indicating this may be a hardware problem that could be corrected if you’re willing to disassemble your LCD panel. I’m not.

Note: This is a highly cleaned-up and euphemistic account of what was actually a much more harrowing experience. The true story involves soft-bricking my Pinebook Pro a couple times, slicing my fingers open on the razor-sharp edges of its back-panel when opening it to find the eMMC hardware switch, and a lot of swearing and alcohol consumption. I got it in the end though.

Short Permalink for Attribution: rdsm.ca/hjrso