Alpine Linux attempt log

Has anyone had any luck getting Alpine working on the uConsole? I might try packaging the kernel for Alpine, and from there working towards putting together a system image, but I’d much prefer having some base from which to work.

Resources, loosely organized by utility (I’ll be editing this with more):

# the website is hot garbage, here's the summary
apk -U add \
   bc \
   build-base \
   elfutils-dev \
   linux-headers \
   ncurses-dev \
   openssl-dev
export KBUILD_OUTPUT="$PWD"/build # is this used?
export ARCH=x86_64
# most recent at the time the article was made
git clone --depth 1 --branch v6.6.30 \
   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
make -C linux menuconfig
make -C linux -j$(nproc) bzImage modules

# now break your system by doing this against the package manager...
make -C linux modules_install
cp linux/arch/x86/boot/bzImage /boot/vmlinuz-6.6.30-custom
cp linux/arch/System.map /boot/System.map-6.6.30-custom
cp linux/.config /boot/config-6.6.30-custom
mkinitfs -ko /boot/initramfs-6.6.30-custom  6.6.30-custom
# before breaking your system...
mkdir /tmp/kern
cp linux/arch/x86/boot/bzImage /tmp/kern/vmlinuz-6.6.30-custom
cp linux/System.map /tmp/kern/
cp linux/.config /tmp/kern/config-6.6.30-custom
dd of=/tmp/kern/install.sh 2>/dev/null <<EOF
#!/bin/sh
cp vmlinuz-6.6.30-custom /boot/
cp System.map /boot/System.map-6.6.30-custom
cp config-6.6.30-custom /boot/
EOF
chmod +x /tmp/kern/install.sh # is this actually useful?

Alpine Linux already provides an official RPi image, you just need to install it and replace kernel, modules, and device tree files in rootfs, which can be taken from deb-package.

There is one problem that makes the installation process extremely difficult: the pannel driver is built as module and as far as I understand, kernel modules loading is not available during installation, but I might be wrong.

I’d like to find some way to package OuinOuin74’s more recent 6.16 kernel for Alpine. Then I could put up a minimal image with that package installed. A stretch goal is getting a modified kernel into the official repositories, but that might be a bit lofty.

I found this forum post in the sources of my latest Perplexity.ai query about this. Let me take a moment to say Krython sucks, Krython sucks, do not use that terrible source because it is awful, The New York Times is embargoing the writers of Krython a million percent because Krython is bad, Krython is bad, blog posts by humans are worth a million times more than SEO spam.

serial number 1337-1f-yu-h8-4i-abLI5e-a1

You may want to look at that post.

Also, ClockworkPi uConsole (clockworkpi-uconsole-rpi) - postmarketOS Wiki.

postmarketOS is actually based on Alpine Linux, though lately its init system is shifted to systemd, not OpenRC.

If you insist making a pure Alpine Linux image instead, perhaps it would be wise to look into what the postmarketOS contributors did.

Oh, excellent, I’d forgotten about this! Maybe adapting that device package to Alpine would be a more manageable first step toward kernel 6.17.

I think I’ll soon start trying, erroring, documenting getting Alpine working on my uConsole as a first step. I think a good starting point is trying to install the pmOS package on plain Alpine. Then after that’s reproducible, I’ll try to stretch it and get OuinOuin74’s kernel working.

Trial: Write Alpine’s Raspberry Pi image to an SD card and boot it.
Error: No USB devices work, including an external and the built in keyboards.

Trial: Replace random bits of the Raspberry Pi image with working bits from my own Arch installation.
Error: The image refused to boot.

Trial: Boot postmarketOS.

For anyone who has had trouble using pmbootstrap, here’s my log:

$ pmbootstrap
[12:02:44] ERROR: pmaports dir not found: /home/trinity/.local/var/pmbootstrap/cache_git/pmaports
[12:02:44] Did you run 'pmbootstrap init'?
$ pmbootstrap init
[12:02:53] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[12:02:53] Work path [/home/trinity/.local/var/pmbootstrap]: 
[12:03:00] Location of the 'pmaports' path, containing package definitions.
[12:03:00] pmaports path [/home/trinity/.local/var/pmbootstrap/cache_git/pmaports]: 
[12:03:03] Setting up the native chroot and cloning the package build recipes (pmaports)...
[12:03:03] Clone git repository: https://gitlab.postmarketos.org/postmarketOS/pmaports.git
Cloning into '/home/trinity/.local/var/pmbootstrap/cache_git/pmaports'...
Updating files: 100% (7582/7582), done.
[12:05:49] Choose the postmarketOS release channel.
[12:05:49] Available (12):
[12:05:49] * edge: Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
[12:05:49] * v25.06: Latest release / Recommended for best stability
[12:05:49] * v24.12: Old release (unsupported)
[12:05:49] Channel [edge]: 
[12:06:46] NOTE: pmaports is on master branch, copying git hooks.
[12:06:46] Choose your target device vendor (either an existing one, or a new one for porting).
[12:06:46] Available vendors (100): acer, alcatel, amazon, amediatech, amlogic, apple, ark, arrow, asus, ayn, bananapi, barnesnoble, beelink, bq, clockworkpi, cubietech, cutiepi, dongshanpi, epson, essential, fairphone, finepower, fly, fxtec, generic, goclever, google, gp, hisense, htc, huawei, inet, infocus, jolla, khadas, klipad, kobo, lark, leeco, lenovo, lg, librecomputer, linksys, lynx, mangopi, medion, meizu, microsoft, mnt, mobvoi, motorola, nextbit, nobby, nokia, nothing, nvidia, odroid, oneplus, oppo, ouya, pine64, planet, pocketbook, postmarketos, powkiddy, purism, qcom, qemu, qualcomm, radxa, raspberry, realme, rockchip, samsung, semc, sharp, shift, sipeed, solidrun, sony, sourceparts, starway, surftab, t2m, thundercomm, tokio, tolino, trekstor, valve, vernee, vivo, volla, wexler, wiko, wileyfox, xiaomi, xunlong, yu, zte, zuk
[12:06:46] Vendor [qemu]: clockworkpi
[12:06:53] Devices are categorised as follows, from best to worst:
* Main: ports where mostly everything works.
* Community: often mostly usable, but may lack important functionality.
* Testing: anything from "just boots in some sense" to almost fully functioning ports.
* Downstream: ports that use a downstream kernel — very limited functionality. Not recommended.

Available devices by codename (2): uconsole-radxa-cm5 (downstream), uconsole-rpi (testing)
[12:06:53] Device codename: uconsole-rpi
[12:06:58] Username [user]: 
[12:07:09] Available providers for postmarketos-base-ui-wifi (2):
[12:07:09] * wpa_supplicant: Use wpa_supplicant as the WiFi backend. (default)
[12:07:09] * iwd: Use iwd as the WiFi backend (but may not work with all devices)
[12:07:09] Provider [default]: iwd
[12:07:18] Update package index for aarch64 (5 file(s))
[12:07:31] Available user interfaces (29): 
[12:07:31] * none: Bare minimum OS image for testing and manual customization. The "console" UI should be selected if a graphical UI is not desired.
[...]
[12:07:31] * lxqt: (X11) Lightweight Qt Desktop Environment (stylus recommended)
[...]
[12:07:31] * xfce4: (X11) Lightweight desktop (stylus recommended)
[12:07:31] User interface [console]: lxqt
[12:08:24] Based on your UI selection, 'default' will result in not installing systemd.
[12:08:24] Install systemd? (default/always/never) [default]: never
[12:08:31] Additional options: extra free space: 0 MB, boot partition size: 256 MB, parallel jobs: 4, ccache per arch: 5G, sudo timer: False, mirror: http://mirror.postmarketos.org/postmarketos/
[12:08:31] Change them? (y/n) [n]: y
[12:09:15] Set extra free space to 0, unless you ran into a 'No space left on device' error. In that case, the size of the rootfs could not be calculated properly on your machine, and we need to add extra free space to make the image big enough to fit the rootfs (pmbootstrap#1904). How much extra free space do you want to add to the image (in MB)?
[12:09:15] Extra space size: 4096
[12:09:31] What should be the boot partition size (in MB)?
[12:09:31] Boot size [256]: 
[12:09:34] How many jobs should run parallel on this machine, when compiling?
[12:09:34] Jobs [4]: 
[12:09:38] We use ccache to speed up building the same code multiple times. How much space should the ccache folder take up per architecture? After init is through, you can check the current usage with 'pmbootstrap stats'. Answer with 0 for infinite.
[12:09:38] Ccache size [5G]: 
[12:09:43] pmbootstrap does everything in Alpine Linux chroots, so your host system does not get modified. In order to work with these chroots, pmbootstrap calls 'sudo' internally. For long running operations, it is possible that you'll have to authorize sudo more than once.
[12:09:43] Enable background timer to prevent repeated sudo authorization? (y/n) [n]: y
[12:10:07] Selected mirror: http://mirror.postmarketos.org/postmarketos/
[12:10:07] Change mirror? (y/n) [n]: 
[12:10:09] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or "none"
[12:10:09] Extra packages [none]: bc,build-base,elfutils-dev,linux-headers,ncurses-dev,openssl-dev,vim
[12:11:19] Your host timezone: America/Denver
[12:11:19] Use this timezone instead of GMT? (y/n) [y]: 
[12:11:23] Choose your preferred locale, like e.g. en_US. Only UTF-8 is supported, it gets appended automatically. Use tab-completion if needed.
[12:11:23] Locale [en_US]: C
[12:11:29] Device hostname (short form, e.g. 'foo') [clockworkpi-uconsole-rpi]: 
[12:11:33] SSH public keys found (5):
[...]
[12:11:33] See https://postmarketos.org/ssh-key-glob for more information.
[12:11:33] Would you like to copy these public keys to the device? (y/n) [n]: 
[12:11:45] After pmaports are changed, the binary packages may be outdated. If you want to install postmarketOS without changes, reply 'n' for a faster installation.
[12:11:45] Build outdated packages during 'pmbootstrap install'? (y/n) [y]: 
[12:12:03] DONE!
$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda           8:0    1  59.5G  0 disk  
└─sda1        8:1    1     2G  0 part  
sdb           8:16   1     0B  0 disk  
mmcblk0     179:0    0 119.4G  0 disk  
├─mmcblk0p1 179:1    0   512M  0 part  /boot
├─mmcblk0p2 179:2    0  31.8G  0 part  /
└─mmcblk0p3 179:3    0  87.1G  0 part  
  └─home    254:0    0  87.1G  0 crypt /home
$ pmbootstrap install --sdcard /dev/sda
[12:14:10] *** (1/4) PREPARE NATIVE CHROOT ***
[12:14:16] Download http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/apk-tools-static-3.0.0_rc6-r0.apk
[12:14:18] (native) Creating chroot
[12:14:42] (native) install cryptsetup util-linux parted
[12:14:49] *** (2/4) CREATE DEVICE ROOTFS ("clockworkpi-uconsole-rpi") ***
[12:14:55] (rootfs_clockworkpi-uconsole-rpi) Creating chroot
[12:15:48] (rootfs_clockworkpi-uconsole-rpi) install postmarketos-base device-clockworkpi-uconsole-rpi postmarketos-ui-lxqt postmarketos-base-ui-wifi-iwd device-clockworkpi-uconsole-rpi-nonfree-firmware bc build-base elfutils-dev linux-headers ncurses-dev openssl-dev vim postmarketos-base-nofde doas doas-sudo-shim adwaita-icon-theme alsa-plugins-pulse alsa-utils bluedevil gnome-keyring gvfs lximage-qt network-manager-applet obconf-qt onboard paper-icon-theme pavucontrol-qt pm-utils postmarketos-artwork-wallpapers qps screengrab unclutter-xfixes font-droid font-droid-nonlatin font-twemoji lang font-droid font-droid-nonlatin font-twemoji lang
[12:44:06] (rootfs_clockworkpi-uconsole-rpi) install device-clockworkpi-uconsole-rpi
[12:44:09] (rootfs_clockworkpi-uconsole-rpi) install postmarketos-mkinitfs
[12:44:14] (rootfs_clockworkpi-uconsole-rpi) mkinitfs rpi
[12:44:38]  *** SET LOGIN PASSWORD FOR: 'user' ***
New password: 
Retype new password: 
passwd: password updated successfully
[12:45:00] NOTE: No valid keymap specified for device
[12:45:05] Keyboard config for locale "C.UTF-8" cannot be provided
[12:45:06] *** (3/4) PREPARE INSTALL BLOCKDEVICE ***
[12:45:20] (native) mount /dev/install (host: /dev/sda)
[12:45:21] EVERYTHING ON /dev/sda WILL BE ERASED! CONTINUE? (y/n) [n]: y
[12:45:31] (native) partition /dev/install (boot: 256M, reserved: 0M, root: the rest)
[12:45:34] Mounting partitions of /dev/sda inside the chroot
[12:45:34] (native) install e2fsprogs
[12:45:38] (native) format /dev/installp2 (root, ext4)
[12:46:14] (native) mount /dev/installp2 to /mnt/install
[12:46:15] (native) install dosfstools
[12:46:18] (native) format /dev/installp1 (boot, fat32), mount to /mnt/install/boot
[12:46:22] (native) create /etc/fstab
[12:46:23] (rootfs_clockworkpi-uconsole-rpi) mkinitfs
[12:46:50] *** (4/4) FILL INSTALL BLOCKDEVICE ***
[12:46:50] (native) copy rootfs_clockworkpi-uconsole-rpi to /mnt/install/
[12:49:02] Unmounting disk /dev/sda (this may take a while to sync, please wait)
[12:49:10] 
[12:49:10] *** FLASHING INFORMATION ***
[12:49:10] Refer to the installation instructions of your device, or the generic install instructions in the wiki.
[12:49:10] https://wiki.postmarketos.org/wiki/Installation_guide#pmbootstrap_flash
[12:49:10] 
[12:49:10] *** SSH DAEMON INFORMATION ***
[12:49:10] SSH daemon is enabled (disable with --no-sshd).
[12:49:10] Login as 'user' with the password given during installation.
[12:49:10] 
[12:49:10] *** FIREWALL INFORMATION ***
[12:49:10] Firewall is enabled, but may not work (couldn't determine if kernel supports nftables).
[12:49:10] For more information: https://postmarketos.org/firewall
[12:49:10] 
[12:49:10] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[12:49:10] DONE!

This was successful. postmarketOS is a nice operating system.

Trial: Take the Alpine Raspberry Pi rootfs and throw a bunch of the postmarketOS files on it to try to get it booting.

Error: Same as booting Alpine normally, though it did load the postmarketOS kernel.

1 Like

Lucky you. For some reason, my microSD card fails to format correctly. Maybe it’s because of the included adapter?

adapter doesn’t do anything, just connect small contacts to large contacts

most probably your card just died for no reason.

Great. $6 in the bin. Wait, I might have the warranty somewhere, since I believe I purchased the card legitimately.

Is this relevant to getting Alpine Linux running on a uConsole?

Trial: Use GitHub - macmpi/alpine-linux-headless-bootstrap: Headless Alpine Linux bootstrapping scripts to gain access to a booted Alpine Linux system via SSH.

Error: I can SSH in but there’s still no I/O.

Trial: Use the SSH’d system and setup-alpine(8) to convert the Alpine installation on the SD card from a diskless to a sys install, enabling normal package installation. Download the device-clockworkpi-uconsole-rpi package APKs from a postmarketOS mirror and manually install them.

Error: device-clockworkpi-uconsole-rpi and device-clockworkpi-uconsole-rpi-x11 are dependent on postmarketos-base and can’t be installed on Alpine Linux itself. After installing the other packages successfully, there was still no I/O.

No. But I’ve been trying in vain to write a postmarketOS image for the uConsole to the card. The error is somewhere along the lines of a bad partition.