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)
  • 1
    Try hdparm -r0 and mount -o remount,rw on the linux box. Also, a SD -> USB adapter might make a difference, blind guess.
    – goldilocks
    Aug 29, 2019 at 15:32
  • @goldilocks: Thanks for the suggestion, will try. Already tried just the remount,rw; added that to the answer. Aug 29, 2019 at 15:37
  • Managed to fix it after all, using the physical hack. As prevention, my initramfs will now reboot into a recovery partition if boot is unsuccessful (no /home) after 300 seconds. Thanks to all :) Aug 31, 2019 at 22:48

3 Answers 3


On many readers, it's enough to insert the SD card not all the way in, so that the pads make contact, but the place where the lock should be is still occupied by the edge of the card. The edge of the card will then activate the lock detection mechanism which allows writing.

Otherwise, the trick with the sticky tape is universal. Just make sure not to cover contacts with it.

SD card with tape


While internal SD card readers will detect the R/O lock, cheapest USB SD readers won't. Linux reports this as

mmc0: host does not support reading read-only switch, assuming write-enable

This is the same case as the RPi's reader: even though it does have the physical pin, the firmware doesn't report its state.

Tried with a simple USB reader, works.

  • This seems to be an additional info to your first answer. So you should edit the first answer and copy&paste this to the first answer. Then delete this one.
    – Ingo
    Aug 30, 2019 at 8:45
  • Ingo: actually, I don't think so. This is a different workaround: the other one is physical (reader detects the tape as the R/O switch, reports "switch us in R/W position, writing allowed") this one is in software (reader doesn't have detection, reports as "whatever, R/W probably"). Aug 30, 2019 at 8:47
  • 1
    if you like to separate it this way.. ok, I understand.
    – Ingo
    Aug 30, 2019 at 9:00
  • 1
    Both are independent solutions to the same problem: "can't write to the card," each works independently :) Aug 30, 2019 at 9:02

There is a physical way to force R/W status:

  • get clear cellophane tape
  • tape over the r/o lock slot
    • the tape needs to go over the whole slot
    • must not cover the contacts
    • use two or three layers if unsure
  • the laptop's SD reader physically checks for the switch
  • there's something in the way, make card read-write! mmcblk0: mmc0:1234 SD01G 972 MiB (no "ro")

This is a bit tricky - the tape needs to be strong enough so it doesn't bend under the reader's R/W pin, but also thin enough that the card fits into the slot and can be pulled out again - this turned out to be the harder part.

The key word I was missing was "SD card: fixing a broken lock", which helped me to find a howto, with pictures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.