Archlinux on PinePhone [intro]
This is a short story of me getting my PinePhone BraveHeart Edition to run ArchLinux. Not a tutorial.
Running Arch on a somewhat modern phone was a long-forgotten dream. So I'm extremely excited to get to it!
For the image, I went to Dreemurrs Embedded Labs repo because there is no official image available. It was 20200318 to be precise.
There are two installation targets:
- internal eMMC
- MicroSD card
I went with the second one because my sd card is much bigger than integrated eMMC and I'm planning on playing with a variety of software to figure out usable configuration.
Dreemurrs Emvedded Labs image supports "DHCP over USB" which means all I need to do is to plug PP into my computer. A new network interface with an IP address appeared. Neat! No need for external USB to Ethernet adapters. Just ssh into
I'm greeted by this useful message of the day:
This is unofficial ARM build maintained by Dreemurrs Embedded Labs. To make a issue/pull request to our repo: * Issues: https://github.com/dreemurrs-embedded/Pine64-Arch/issues * Pull Requests: https://github.com/dreemurrs-embedded/Pine64-Arch/pulls Support can be provided from our chat rooms: * Discord: https://discord.gg/AvtdRJ3 * Matrix: #danctnix-portingv2:matrix.org
The first recommended thing to do is to resize partition with provided
resize_rootfs.sh. And it just works.
df -h shows more than 100G available. Connecting to the WiFi with
nmtui and off I go.
Time to practice Arch user tic:
pacman -Syu. And here we go! Meet the first problem:
error: could not open file /var/lib/pacman/sync/pine64.db: Unrecognized archive format error: failed to prepare transaction (invalid or corrupted database)
There is an extra repository with PinePhone specific stuff and it's blocking my updates? Can't be! Firing
file shows that this file is an HTTP file o.O Not good! It should be some compressed data.
[pine64] SigLevel = Never Server = http://p64.arikawa-hi.me/aarch64/
http connection and there is no signature verification. An Internet provider can easily become a man in the middle and ruin the update process just by showing some "very important" notifications (for example, about traffic limitations). The actual bad thing is there is no way for pacman to verify this. I'm also not sure how pacman handles 301/302 http codes (are used to switch
Checking upstream with
curl -v http://p64.arikawa-hi.me/aarch64/pine64.db showed that there is a 301 code redirect to
https actually works.
Good! Removing wrong
.db file, changing to
/etc/pacman.conf and filing an issue.
Back to Arch user tic. The update is going just fine!
Now I have an
aarch64 system in phone form factor. Next step is to make a phone out of it =]
Be right back with a report on getting phosh running.
PS. I have an unlimited data plan for my phone and my provider does everything it can come up with and reason to block any 'non-phone' activities like tethering or plugging a sim card in non-phone devices. PinePhone was recognized as a tablet that led to speed limitation from provider. It took me 5 days of waiting, photos of Ubuntu Touch "About" section and of it's terminal output for
cat /etc/os-release to get PP approved as a phone.
PPS. Farther you can find things I've tried without real success =\
To avoid connecting your PP to PC for initial configuration I've copied my wifi config file to the sd card right after flashing it. I'm using NetworkManager on both your PC and PinePhone. Bits that I've changed:
- uuid (just a bit to differ)
- interface-name to
wlan0(PP interface name)
This attempt failed because PP was not connecting to my WiFi. Never investigated the reason or the correct way to do it because it was so easy to just plug it into a computer.
The second failed idea was to prepare freshly flashed sd card before plugging it into the phone! I'm quite used to
arch-chroot for configuring another Arch systems but my workstation is rocking x86 family CPU while PP is ARM based.
This process became much easier in the past several years not without systemd. Here comes
qemu-arm-static specifically (there is an AUR package and it's present in my 'General' repo). To use it copy just one file:
sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
in this example target sdcard is mounted at
At this point chrooting is just one command ahead:
sudo arch-chroot /mnt
Nice! I'm in! The problem is name resolution is broken o.O
drill works just fine but
pacman is unable to connect to the mirrors.
/etc/resolv.conf is fine so I'm not sure what's the issue.
It's an interesting one to solve but I can't wait to use the phone so postponing it for a while.