TL;DR: RPi won't boot, other computers check the R/O physical switch, the switch tab is long lost. I have a backup with previous, working state, but can't write it onto the SD card.
I have a RPi1, using an old SD card with only /boot on it; rest of the system is on a USB drive.
There's kernel.img, and there's a custom initramfs (needed for
/ of type btrfs).
This is my cmdline.txt:
root=/dev/sda5 rootfstype=btrfs elevator=deadline rootwait
And a relevant part of config.txt:
initramfs initrd.img followkernel
So far, this worked well: the card reader on RPi doesn't check the R/O switch status, and the card is only written to at upgrade time. However, I have upgraded to 4.19.66, broke the initramfs in the process, and now it won't boot (I get an initramfs panic prompt).
What I tried:
- connect a keyboard. Doesn't work: USB HID support is loaded after initramfs
- ssh in. Doesn't work: SSH starts after network, long after initramfs
- restore previous state in a Linux laptop. Doesn't work:
mmcblk0: mmc0:1234 SD01G 972 MiB (ro)- kernel won't let me write to this, same in Macs and Windows boxes
- remount read-write. Doesn't work: the underlying block device is read-only, kernel won't let you mount a read-write filesystem on it:
mount: Read-only file system
hdparm -r0, then remount read-write. Doesn't work:
cannot remount /dev/mmcblk0p1 read-write, is write-protected.
- connect a serial console. (even when previously enabled in cmdline.txt - which is on /boot again, chicken-and-egg problem - initramfs only seems to log to it, non-interactively)
- reboot with a different SD card, swap and edit the old one. (Doesn't work with a stock card, as the OS will try to load commands from the card you have unloaded. A custom rescue initramfs or a RAM-only distro could work, theoretically)
- ssh in (the OS's openssh only starts late in the boot process, initramfs's dropbear seems to be missing authorized_keys)
What I did not try:
- buy a new card. (Wanted to try to rescue the old one first, doesn't seem to have any other defects)