fsck on Rspberry Pi (possibly other systems too)
Installing Alpine Linux on a Raspberry Pi SD Card revealed a bunch of bugs belonging to fsck of OpenRC startup:
The Raspberry Pi Boot Partition is a DOS FAT32 Partition, so the dosfstools package is required else the fsck crashes sometimes horribly because of the missing fsck.vfat.
… but just installing the package dosfstools, got the Pi unable to boot successfully. It took me some time to find the reason for this. The OpenRC file system check uses the Busybox fsck, which call the fsck helpers. For the FAT partitition this is called as:
from Busybox fsck =>fsck.vfat -p -C0 UUID=xxx…
fsck.vfat is symlinked to fsck.fat, so is the command dosfsck, but it does not understand the -C0 option like the ext2/3/4 handlers. So the fsck dumps the usage text on startup, and then the startup crashes due to fsck exit code. Won’t let you get to a working logging prompt this way.
… but removing -C0 option another problem is revealed. dosfsck doesn’t understand the UUID=… or LABEL=… syntax, it needs the bare block device name … but usually the partition is setup in /etc/fstab with the UUID methode.
The easiest workaround is, to remove the symlink from /usr/sbin/dosfsck to fsck.fat, rename fsck.fat to dosfsck, and create an fsck.fat shell script wrapper:
mv fsck.fat dosfsck
echo “#!/bin/sh” >fsck.fat
chmod 755 fsck.fat
This at least let the Raspberry Pi successfully boot with unmodified OpenRC scripts. Usually a quick helper in this situation, until we get some other changes on this topic.
… and this also effect other systems (tested on x86_64) which include a FAT partition on there disk setup, so it is not a specific Raspberry Pi problem.
(from redmine: issue id 8090, created on 2017-10-31, closed on 2017-11-29)