0

I have 2 SD cards with Raspbian Stretch that are throwing the following error on boot:

Kernel panic-not syncing: VFS: unable to mount root fs on unknown-block(179,2)

I fixed one card by running the following from an ubuntu system:

fsck.fat -y /dev/sdb1
fsck.ext4 -y /dev/sdb2

However, I want this check to be done on every boot. I tried putting fsck.mode=force in the cmdline.txt on the second card using a card reader.

However, I keep getting the same error and theres no indication that it tried to run fsck. The first card says "File System Check started on Root Device", but the second card still throws the error.

Note: I have not fixed the second card manually to check if the auto fix works or not.

Dushyant Bangal
  • 139
  • 1
  • 6
  • have you added fsck.mode=force to the one and only line in cmdline.txt - i.e. you haven't added a second line to that file? – Jaromanda X Feb 18 '19 at 09:58
  • @JaromandaX, no I've added it in the same line. And like I said, on first card, it shows "File System Check started on Root Device". But I've already fixed the first card manually. I want to fix the second card automatically, on boot – Dushyant Bangal Feb 18 '19 at 12:17

1 Answers1

1

To repair the filesystem you need the programs fsck.*. These are located on the root partition. Do you already see the problem?

You have repaired the filesystem on the first SD Card by using the fsck.* programs from the Ubuntu system. On boot of your second SD Card it tries to use fsck.* from the root partition that cannot be mounted. The only way to repair it is to doing it the same way than with the first SD Card.

You use fsck.mode=force that will unconditionally results in full file system checks. But for this it also needs fsck.* The kernel tries it on every boot without success (not really because the error to be unable to mount the root partition will freeze the system before). For further information look at How to run fsck at boot?.

Ingo
  • 42,107
  • 20
  • 85
  • 197
  • Damn, I though it will be from boot partition. Then whats the use of fsck.mode=force as it will be only needed when theres some issue with the partition? Or does it become unmountable over a period of time when there are huge number of bad blocks, and fsck.mode=force will prevent that by fixing regularly? – Dushyant Bangal Feb 19 '19 at 06:09
  • @DushyantBangal I have updated the answer. – Ingo Feb 19 '19 at 11:25