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 based on #12353#note_164623.
Prerequisites
- Internet connectivity is mandatory to complete sys mode installation.
Sys mode installation on Raspberry Pi
- Boot from the Raspberry Pi installation media.
- Run setup-alpine script until step 11(i.e SSH) of the base configuration without skipping network configuration step as Internet access is mandatory to complete sys mode installation.
- In Disk & Install section, answer the questions as follows: (refer screengrab)
- No disks available. Try boot media /media/mmcblk0? (y/n) [n], change the default option and type y.
- Which disk(s) would you like to use? (or '?' for help or 'none') [none], type device name mmcblk0 as per displayed information.
- How would you like to use it? ('sys', 'data', 'crypt', 'lvm' or '?' for help) [?], type sys.
- WARNING: Erase the above disk(s) and continue? (y/n) [n] change the default option and type y to proceed with the installation.
- At the end of Installation, you can reboot to boot into the newly installed Alpine Linux and configure the Raspberry Pi further.
Disk & Install screengrab
Depending on the size of your install media and pi model, the information below may vary.
Disk & Install ---------------- No disks available. Try boot media /media/mmcblk0? (y/n) [n] y * WARNING: you are stopping a sysinit service * Caching service dependencies ... [ ok ] * Unmounting /.modloop ... [ ok ] Available disks are: mmcblk0 (64.1 GB ) Which disk(s) would you like to use? (or '?' for help or 'none') [none] mmcblk0 The following disk is selected: mmcblk0 (64.1 GB ) How would you like to use it? ('sys', 'data', 'crypt', 'lvm' or '?' for help) [?] sys 100% /usr/sbin/update-raspberrypi-bootloader: WARNING: no kernel found WARNING: The following disk(s) will be erased: mmcblk0 (64.1 GB ) WARNING: Erase the above disk(s) and continue? (y/n) [n] y Partition #2 contains a ext4 signature. Creating file systems... mkfs.fat 4.2 (2021-01-31) Installing system on /dev/mmcblk0p2: 100% ==> initramfs: creating /boot/initramfs-rpi for 6.12.8-0-rpi /usr/sbin/update-raspberrypi-bootloader: INFO: replaced config.txt and saved config.txt.old Configured kernel vmlinuz-rpi / initramfs-rpi Installation is complete. Please reboot.
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