Classic install or sys mode on Raspberry Pi
This page documents the Classic install or sys mode installation of Alpine Linux on a Raspberry Pi. As per #12353#note_164623, the usual sys mode installation works perfectly with Raspberry Pi now.
Convert diskless to sys mode
It is also possible to switch a diskless installation to a fully disk-based installation. This is not yet formally supported, but can be done somewhat manually. This frees all the memory otherwise needed for the root filesystem, allowing more installed packages.
- Split your SD card into two partitions: the FAT32 boot partition described above (in this example it'll be
mmcblk0p1
) , and a second partition to hold the root filesystem (here it'll bemmcblk0p2
). - Boot and configure your diskless system as above, then create a root filesystem using the tool
mkfs.ext4
in the e2fsprogs package:# apk add e2fsprogs # mkfs.ext4 /dev/mmcblk0p2
- Now do a disk install via a mountpoint. The
setup-disk
script will give some errors about syslinux/extlinux, but you can ignore them. The Raspberry Pi doesn't need them to boot.# mkdir /stage # mount /dev/mmcblk0p2 /stage # setup-disk -o /media/mmcblk0p1/MYHOSTNAME.apkovl.tar.gz /stage
- Add a line to /stage/etc/fstab file to mount the Pi's boot partition again as follows:
Contents of /stage/etc/fstab
/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0 - Now add a
root=/dev/mmcblk0p2
parameter to the Pi's boot command line, eithercmdline-rpi2.txt
orcmdline-rpi.txt
depending on model:# mount -o remount,rw /media/mmcblk0p1 # sed -i '$ s/$/ root=\/dev\/mmcblk0p2/' /media/mmcblk0p1/cmdline-rpi2.txt
- When the Pi boots next time, the contents of /boot will be ignored. It will use the kernel, initramfs, and modloop images from the FAT32 boot partition.
- To update the kernel, initfs or modules, one could use bind mount:
# echo /media/mmcblk0p1/boot /boot none defaults,bind 0 0 >> /etc/fstab