[Pkg-raspi-maintainers] Bug#964915: raspi-firmware: upgrading kernel or firmware causes system to become unbootable on pi 4
Andres Salomon
dilinger at queued.net
Sun Jul 12 05:44:28 BST 2020
Package: raspi-firmware
Version: 1.20200212-1
Severity: important
On a Raspberry Pi 4B using one of the brand new Pi 4 daily images, I
discovered that installing the firmware-misc-nonfree package would cause
the machine to not boot.
Further investigation found that during the package installation,
/boot/firmware/cmdline.txt was modified in the following manner:
-console=tty0 console=ttyS1,115200 root=LABEL=RASPIROOT rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
+console=tty0 console=ttyS1,115200 root=/dev/mmcblk0p2 rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
After I changed this back to LABEL=RASPIROOT, the machine was able to boot
again. On the machine in question, there is no such block device:
dilinger at rpi4-20200710:~$ ls -l /dev/mmcblk0p2
ls: cannot access '/dev/mmcblk0p2': No such file or directory
dilinger at rpi4-20200710:~$ ls -lh /dev/mmcblk1p2
brw-rw---- 1 root disk 179, 2 Feb 14 2019 /dev/mmcblk1p2
The culprit here is the following in /etc/kernel/postinst.d/z50-raspi-firmware:
cat >/boot/firmware/cmdline.txt <<EOF
${pre_cmdline} root=$ROOTPART rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
EOF
ROOTPART is hardcoded to /dev/mmcblk0p2, which seems.. suboptimal.
I don't know if it would break any of the other pi boards that rely on this
package, but I would suggest any of the following fixes:
1) setting ROOTPART=`findmnt -n --output=source /boot/firmware/`,
2) or using the label and doing ROOTPART=`findmnt -n --output=source /boot/firmware/`; ROOTLABEL="`lsblk -no label $ROOTPART`",
and when overwriting cmdline.txt using "root=LABEL=$ROOTLABEL",
3) or my personal favorite - not touching cmdline.txt at all. I don't really
see the point of modifying it during postinst of a kernel package, unless
the pre_cmdline stuff needs to modify console boot settings for some reason.
[BTW, I debated whether to make this an RC bug, but I figured since the pi4
images are still very much a work-in-progress that it wasn't worth filing
this as critical.]
More information about the Pkg-raspi-maintainers
mailing list