0

I have a Raspberry Pi that is getting a kernelPanic at boot due to what looks like a corrupted file system. I'm trying to run fsck to check for sure, but have run into issues.

I've got the micro sd card in an adapter plugged into the computer (checked to make sure the "lock" switch is up). I'm running Ubuntu Server 20.04 in VMware Workstation 15.5.6, and have the following output from dmesg:

[433695.441308] usb 1-1: new high-speed USB device number 3 using ehci-pci
[433695.819170] usb 1-1: New USB device found, idVendor=058f, idProduct=6335, bcdDevice= 1.02
[433695.819239] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[433695.819240] usb 1-1: Product: Mass Storage Device
[433695.819249] usb 1-1: Manufacturer: Generic
[433695.819253] usb 1-1: SerialNumber: 058F011111B1
[433695.842661] usb-storage 1-1:1.0: USB Mass Storage device detected
[433695.876310] scsi host33: usb-storage 1-1:1.0
[433696.972969] scsi 33:0:0:0: Direct-Access     SD/MMC   Card  Reader     1.00 PQ: 0 ANSI: 0
[433696.974349] sd 33:0:0:0: Attached scsi generic sg4 type 0
[433697.284484] sd 33:0:0:0: [sdc] 62552064 512-byte logical blocks: (32.0 GB/29.8 GiB)
[433697.295757] sd 33:0:0:0: [sdc] Write Protect is on
[433697.295759] sd 33:0:0:0: [sdc] Mode Sense: 03 00 80 00
[433697.305852] sd 33:0:0:0: [sdc] No Caching mode page found
[433697.306476] sd 33:0:0:0: [sdc] Assuming drive cache: write through
[433697.376621]  sdc: sdc1 sdc2
[433697.500241] sd 33:0:0:0: [sdc] Attached SCSI removable disk

I double checked to make sure that /dev/sdc1 and /dev/sdc2 are both unmounted via fdisk -l, but am getting the following error when I try to run fsck:

~$ sudo fsck -f -y /dev/sdc1
fsck from util-linux 2.34
fsck.fat 4.1 (2017-01-24)
open: Read-only file system
~$ sudo fsck -f -y /dev/sdc2
fsck from util-linux 2.34
e2fsck 1.45.5 (07-Jan-2020)
fsck.ext4: Read-only file system while trying to open /dev/sdc2
Disk write-protected; use the -n option to do a read-only
check of the device.

Any help would be greatly appreciated.

4
  • Have you tried the other position of the lock switch ?
    – Soren A
    Commented Oct 27, 2020 at 5:25
  • A filesystem going read only is usually a sign of a bigger problem. This is a fail-safe to protect from data loss when there are file system errors. It can occur when storage media is dying. It can also happen if the system is not shut down properly. Not sure if you're doing this, but it's tempting to pull the plug on a raspi but you should first issue a shutdown command to prevent these kinds of issues
    – Nmath
    Commented Oct 27, 2020 at 6:48
  • @SorenA I did, and I actually purchased a different sd card reader, one without a lock switch. Still no joy.
    – Nick
    Commented Oct 30, 2020 at 4:07
  • @Nick Still your dmesg output says [433697.295757] sd 33:0:0:0: [sdc] Write Protect is on ...
    – Soren A
    Commented Oct 30, 2020 at 4:20

1 Answer 1

0

I am suspicious that VMWare Workstation is not giving you write access to the SD card. If you are confident that isn't the issue, then continue with normal non-VMWare debugging steps below.

fdisk -l is great for listing partitions, but won't tell you which partitions are actively mounted. Try mount | grep sdc instead and be sure to umount any matches.

If the fsck continues to generate Read-only errors, watch dmesg -w while fsck is running for disk failure messages. If you don't get failures in dmesg, then the lock switch or uSD adapter is likely bad. If you are getting severe disk failure messages in dmesg, then it is time to extract as much data as you can with ddrescue, safecopy, myrescue or a similar tool and scrap that SD card.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .