Two postmarketOS installations: OpenRC may mount wrong partition as /boot
Since !756 (merged), it is possible to set pmos_boot and pmos_root kernel parameters. The initramfs script will then use pmos_boot to find more initramfs-related files (initramfs-extra), and mount pmos_root and boot into it. However, the pmos_boot partition may then not be mounted as /boot, as the partition for /boot is simply taken by label. It may point to the boot partition of a different postmarketOS installation.
Right now, the only device using pmos_boot and pmos_root is the pinephone. So it may happen, that the user has installed postmarketOS on both the internal eMMC and SD card, then boots into one of them, but the wrong boot partition gets mounted. When the user upgrades the kernel for example, the wrong installation will be modified!
postmarketos-base writes to
LABEL="pmOS_boot" /boot auto defaults 0 2
I'm thinking about a good way to fix this... either:
- mount /boot from the initramfs, or
- update /etc/fstab, if the path to /boot is still specified by label
I think the first one is more elagant, I'll look into it more soon. Feedback welcome.
EDIT: while writing this down, I realize that we may have a similar problem with the root partition. The root partition is mounted by the initramfs, but only read-only, and we rely on OpenRC (and /etc/fstab) to remount it as read-write. I'm not sure what happens if it decided to pick the wrong root partition. So whatever fix we use for pmos_boot should also be used for pmos_root.