Tinkering with Manjaro and NetBSD on the Pinebook Pro: a crumbs-in-the-forest tutorial & review
I found a used Pinebook Pro on Craigslist for $100 CAD, invented some flimsy excuse[1], and bought it.
Then I went much farther down the rabbit hole than I expected, trying to get it functional.[2]
Here are my first impressions of the journey to get (semi-) functional Linux and BSD systems installed on the Pinebook Pro.
What works out of the box
Here’s what Just Works™ with Manjaro KDE, the stock Pinebook Pro Linux distribution:
- It boots!
- Screen brightness keys
- Wifi
- Keyboard
- The battery charges
- USB
- Suspend (mostly)
- Privacy switches (though there’s no way to confirm)
What I like
- Hackable! Linux-first!! Open-hardware!!!
- Cheap ($100 CAD used)
- Excellent battery life
- Lovely magnesium alloy case
- Decent keyboard
- Nice screen
- It was my introduction to Arch linux / Manjaro, which was surprisingly pleasant:
- various nice things are packaged for Arch linux that aren’t packaged for Debian/Ubuntu, including Sway, Helix, & Nyxt browser
- Manjaro software installer GUI is very nice, and actually works (unlike Ubuntu’s new software store)
- KDE Plasma, aside from how laggy it is on this little machine, is nice and polished, and Manjaro Sway is surprisingly slick, too.
The rough edges
-
It ... is ... very ... slow ... to ... do ... … … anything. Even basic apps (like Manjaro system settings) hang frequently. Web browsing is barely usable. This is probably a combination of the underpowered specs (little ram, sub-SSD disk speed, lots of slow cores), and the fact that fewer things are optimized for Arm.
-
The touchpad performance is extremely shoddy out of the box, especially at fine movements. This turned out to be partly a firmware issue (see below).
-
Installing OpenBSD is a real headache (you’d need a UART serial console, rockchip DTB files, etc.) This is too bad because I kind of got the machine in order to fiddle with OpenBSD...
-
Privacy keys are not hardware killswitches, they’re controlled by the keyboard firmware, which could be compromised.
-
No dedicated delete key :/
-
Having the power button as part of the keyboard is irritating; especially since it’s where the delete key should be on a full size keyboard, and I accidentally hit it all the time.
-
It wasn’t possible to flash Tow Boot onto the SPI using the Tow Boot SD card installer until I had removed U-boot from the eMMC. (It might have been possible to
dd
Tow Boot onto the eMMC, but I figured the installer would be more reliable, so I got rid of U-Boot first.) -
My first attempt to overwrite eMMC with zeros using
dd
mysteriously failed. (Eventually eitherdd
with/dev/urandom
or elseblkdiscard /dev/mmcblk2
seemed like it worked...) -
I was unable to connect to an external 4k monitor (Asus TUF) using Baseus USB-C hub, either on NetBSD or Manjaro
-
And some other quirks that are probably Arch Linux / Manjaro specific:
- Suspend failed one time. Thankfully, it provided lucid instructions on what command to run on a virtual terminal to get back in (Ctrl+Alt+f3, run loginctl unlock-session 2)
- Setting language to en_GB somehow set keyboard layout to en_GB, even though I specified en_US keyboard layout. (This is probably a Manjaro thing, not Pinebook specific.)
- Arm printer drivers didn’t work. It’s probably possible (by extracting and converting various pieces), but I gave up after wasting too much time trying to figure it out.
- On first install of Manjaro, pacman (the Arch Linux package manager) had all kinds of GPG signing errors. I tried all the fixes I found mentioned on forums. Eventually, I knobbled the security features by editing pacman.conf, which fixed it; then I re-installed Manjaro, and that time it worked...
Here are some of the steps I used to get up and running:
How I tried to erase the SPI
First, install mtd-utils
with sudo pacman -S mtd-utils
then run sudo flash_erase /dev/mtd0 0 0
. (Not sure if this actually worked.)
Write Tow Boot installer to SD card
On my normal machine, I downloaded pine64-pinebookPro-2021.10-005.tar.xz
from Tow Boot’s latest GitHub release (link), unzipped it, and, following the instructions, wrote the installer to an SD card with:
sudo dd if=spi.installer.img of=/dev/mmcblk0 bs=1M oflag=direct,sync status=progress
Useful things I installed right away:
pacman -S kupfer helix vim nyxt hdparm
Kupfer was unable to set its own hotkey (probably because Wayland), so I set up a keybinding through system settings.
Install sway & optional dependencies
pamac install sway bemenu dmenu foot i3status mako polkit swaybg swayidle swaylock waybar xorg-wayland
I think pamac is Manjaro’s more user-friendly wrapper around pacman?
Overclocking?!
I tried to use corectrl
but it showed up blank. I tinkered with cpupower
but even on the default governor the A72 cores were maxed out.
I have asked on Twitter, but as far as I can tell, unlike the Raspberry Pi, there’s no straightforward way to overclock this machine without re-compiling the kernel.
https://wiki.pine64.org/wiki/Overclocking
How to update your Manjaro system
sudo pacman -Syu
How I overwrote the eMMC (but not as securely as I’d like)
One or other or both of these seemed to work:
sudo dd if=/dev/urandom of=/dev/mmcblk2 bs=8192
sudo blkdiscard --secure /dev/mmcblk2
However, I wanted to use secure erase. Installed hdparm, but hdparm -I /dev/mmcblk2
just prints /dev/mmcblk2
, so I assumed the eMMC didn’t support ATA secure erase.
However, the datasheet indicate that secure erase is supported.
pamac install mmc-utils
mmc erase secure-erase 0 9999999999999999 /dev/mmcblk2
... seemed to work. I also ran the command on
/dev/mmcblk2boot0 and /dev/mmcblk2boot1, which said it succeeded. I ran it on /dev/mmcblk2p1 and /dev/mmcblk2p4, after having run it on /dev/mmcblk2, and those failed (maybe because the partitions had already been secure-erased?)
I still don’t know if I have securely erased the eMMC, but I’ve tried enough things that it seems unlikely there are any but the most durable creepy-crawlies left on it. I can confirm that mmc erase did not work. BSD still tried to boot after it should have been gone...
How I flashed an installer to the eMMC
Successfully wrote BSD to eMMC (from Manjaro running off an SD card) with:
sudo cat '/run/media/pine/Data/install73-arm.img' | sudo dd of=/dev/mmcblk2 bs=1M status=progress conv=fsync
There was also talk of using manjaro-chroot -a
or manjaro-arm-flasher
, which I installed with pacman -S majaro-arm-flasher
, but it wouldn’t run on Wayland, needed sudo, sudo -E didn’t work, and I'd forgotten about wsudo
...
Run GUI apps with sudo in Wayland
This sometimes works, but is probably a bad idea:
sudo -E gnome-disks
How to write Manjaro disk image to an SD card
sudo xzcat '/home/pine/Manjaro-ARM-kde-plasma-pbpro-23.02.img.xz' | sudo dd of=/dev/mmcblk1 bs=1M status=progress conv=fsync
How I tried and failed to fix the issues with Pacman
killall gpg-agent # (didn’t work)
sudo pkill gpg-agent
sudo rm -rf /etc/pacman.d/gnupg/
sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman -Sc
sudo pacman -Sy archlinux-keyring && sudo pacman -Su
How I updated the keyboard firmware, which significantly improved touchpad performance
I carefully followed the instructions in README to compile and use this keyboard firmware updater:
https://github.com/dragan-simic/pinebook-pro-keyboard-updater
It worked, and improved fine movements of touchpad.
NOTE: my usb keyboard did not work at the Tow Boot stage. Therefor, I had to open the case and switch off the eMMC. Thankfully, the USB keyboard worked to login and issue the remaining commands; otherwise I would have been hooped.
Attempts to connect to a 4K monitor over USB-C
I have an Asus VG289Q 4K monitor. It will talk to a Dell XPS 15 running Ubuntu via a Baseus JoyStar USB-C hub (though only at 30Hz). I have not been able to connect to the monitor using that hub from the Pinebook. On NetBSD, the hub doesn’t even light up. On Manjaro, the hub works for ethernet, but the HDMI signal does not reach the monitor. I have tried flipping the USB-C cable over, as some have suggested. I also ran across mention of running sudo pacman -Syyu linux-pinebookpro linux-pinebookpro-headers
, however I get “target not found” errors for those packages.
I know that people have successfully run 4k monitors with the PineBook Pro, including, I believe, the model I have. A Baseus USB-C hub is listed as “good” in the hardware compatibility table. I’ve read that Manjaro used to distribute a patched kernel (5.7?), and then dropped the patch for the 5.8 kernel (?), which broke 4k monitor support (which relies on USB-C DisplayPort Alt Mode), and the fix never made it to mainline.
I’ve given up, for now.
Performance tuning
I followed some of the tips in this article; specifically, setting swappiness
, vfs_cache_pressure
, dirty_ratio
, and dirty_background_ratio
to the recommended values.
However, rather than in a single file as described (/etc/sysctl.conf
), those setting are now set with individual configuration files in /etc/sysctl.d/. So I made a file for each parameter, putting vm.swappiness=100
in /etc/sysctl.d/swappiness.conf
, and so forth.
Regarding OpenBSD on the Pinebook Pro
Installing OpenBSD on the Pinebook Pro can’t be done without using a UART serial console:
https://tomscii.sig7.se/2022/02/Guide-to-OpenBSD-on-the-PinebookPro
... or getting into some heavy and experimental patching:
https://tomscii.sig7.se/2022/03/Patches-for-OpenBSD-on-the-PinebookPro
Installing NetBSD
Well, if we can’t have nice things, maybe we can at least have semi-nice things? I decided to try to install some other BSD, and settled on NetBSD.
-
Download from: https://nycdn.netbsd.org/pub/arm/
-
Replace xzcat with gunzip -c, and the same
dd
command used to write the Manjaro installer to the eMMC works:
gunzip -c /path/to/installer.img.gz | sudo dd of=/dev/mmcblk1 bs=1M status=progress conv=fsync
I went away, and when I came back, it was installed, and at login. Hit enter, type startx
, and we’re golden!
How to use it was another question...
Using NetBSD
Enable ethernet:
ifconfig
... will print out various things. In my case, there was “lo” and “cdce0”:
ifconfig cdce0 up
... Internet connection established! (I tested it with dig autodidacts.io
; you might want to use a site with higher uptime...)
Wifi drivers are not available for the Pinebook Pro.
Also, the USB 3 port on the left side does not seem to work on NetBSD.
Installing packages:
vi /root/.profile
As I recall, I uncommented the “PKG_SRC...” line, but that didn't do anything, so then I ran export PKG_SRC=
with the value from the line in /root/.profile
. (only works with http?)
How to upgrade NetBSD system (can be quite slow, if it’s been a while):
pkgin update
pkgin upgrade
Add some useful apps:
pkg_add vim git firefox helix zoxide gnome-terminal bash nushell fzf pkgin nautilus cryptsetup pandoc
Unsolved:
- There was a warning about Firefox security, and something about a timestamp, which I never got to the bottom of. Firefox was too heavy anyway.
- Copy and paste works in gnome terminal, but not in uxterm.
- I was able to compile whisper.cpp speech-to-text on NetBSD and batch-transcribe audio overnight using the medium model. I was not able to get SDL2 support working for real-time streaming transcription (even though I think I installed the right SDL2 packages).
- I tried to install the following apps, and found them not available:
which
,locate
,kupfer
,gnome-do
,albert
,lshw
,lsblk
,nyxt
,ulauncher
.
Further reading: https://wiki.netbsd.org/laptops/
XFCE on NetBSD
Install it with:
pkgin install xfce4 xfce4-extras
(I also installed the cpugraph and system load plugins, and some others.)
Start it with:
startxfce4
It seems to basically work!
How to mount a USB drive
# Figure out which drive to mount. In this case, I’m searching for info about an ADATA thumbdrive:
dmesg | grep ADATA
# The above command revealed that it was /dev/sd0. “a” is the partition? I just guessed that part and it worked.
mount_msdos /dev/sd0a /mnt
# When you’re done, unmount drive with:
umount /dev/sd0a
But what about if you're using an encrypted drive? In that case, you’ll need to pkg_add cryptsetup
(included in the above list of programs to install), then:
cryptsetup luksOpen /dev/sdb1 luks_device
mount /dev/mapper/luks_device /mnt
I never got this to work AFAIK.
How to set backlight brightness:
sysctl hw.pwmbacklight0
# hw.pwmbacklight0.levels = 0 30 40 50 60 70 80 90 100
hw.pwmbacklight0.level = 80
Default shell?
The default shell, strangely, is sh
, rather than bash
. sh doesn’t seem to have Ctrl+R reverse history search, which I depend upon for rapid use of the command line.
So, one of the first things I did was to install bash, and, just for kicks, nushell (which I’d tried before). I run nu
every time I open a terminal, since I haven’t bothered to set the default shell yet.
First impression of NetBSD
Let me just say, I liked NetBSD as soon as it booted (after all, it had booted), even though I didn’t know how to get it to do anything. When I’d briefly experimented with OpenBSD on a ThinkPad, the install process was confusing, and nothing much worked.
To be very untechnical, NetBSD felt small and light and stable. If Manjaro was a very smart, powerful person who was overcaffeinated and under-rested and having a very bad hair day … NetBSD was an aging but good-natured accountant, quietly and placidly adding sums by hand over its spectacles, while sipping tea. NetBSD isn’t fast — but it doesn’t hang when you ask it to do something that taxes the hardware specs (like, in this case, opening Firefox). It just does it very slowly. And I like that a lot.
That said, it’s not for those who want an out-of-the box experience and nice GUIs. Wifi does not work, and I haven’t found a way to get it to. Screen brightness keys don’t work. Suspend does not work (it turns off the screen, that’s all, when the lid is closed).
Conclusion
The Pinebook Pro offers appealing hardware at a very low price. However, the combination of Arm architecture, underpowered specs, and poor software support for the hardware make it frustrating to get things working, or be productive in any way.
But it’s usable for writing text, and a fun way to learn about different Linux & BSD operating systems.
Upon close examination, my rationale for the purchase could be reduced to*gollum voice* We wants it, we needs it *gollum voice* … ↩︎
It’s not the first time something like this has happened. But, I’m getting wise in my old age, and after spending the better part of two days tinkering with it, I set a 1-hour daily Pinebook troubleshooting limit. ↩︎