0

Every time I install 2018-11-13-raspbian-stretch-full.img or 2018-11-13-raspbian-stretch-lite.img on my SD card and plug it in the Raspberry Pi 3 B+ device, they first time it runs fine but I am presented with the error kernelPanic: VFS: can't mount root fs (179,2) after I restart the device.

By default the value is something like root=PARTITION=<someting> in the cmdline.txt file. I tried setting to root=/dev/mmcblk0p6 as it is suggested in different resources, it didn't help me either. I even tried root=/dev/sda2 and root=/dev/mmcblk0p2 but all in vain. I am sure that I eject the SD card safely after making the changes.

I am installing the images using Windows 10, SD Card Formatter for formatting the SD Card, Balena Etcher to Flash the images.

What else can be tried to fix the problem?

  • 2
    "SD Card Formatter for formatting the SD Card, Balena Etcher to Flash the images..." -> Probably not the source of your problems, but the first part ("formatting the SD card") is, at best, totally pointless because the second part ("flash the images") will overwrite the boot sector etc. created by formatting. At worst, it leads to further confusion about what exactly flashing an image involves. So, don't bother "formatting" the card separately. The SD card image is a formatted image. – goldilocks Apr 21 '19 at 20:45
0

You wrote:

By default the value is something like root=PARTITION= in the config.txt file.

You are doing wrong if you try to define this in /boot/config.txt. You have to define the root partition in /boot/cmdline.txt and in addition the partitions must be defined in /etc/fstab.

On the latest unused Raspbian Stretch Lite image 2019-04-08-raspbian-stretch-lite.img you will find:

# cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=c1dc39e5-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh

# etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=c1dc39e5-01  /boot           vfat    defaulinit=/usr/lib/raspi-config/init_resize.shts          0       2
PARTUUID=c1dc39e5-02  /               ext4    defaults,noatime  0       1

After first boot with the image the option init=/usr/lib/raspi-config/init_resize.sh has been removed. This is done by the initial boot procedure and it is OK. But the option quiet should be still there if there was nothing done than booting. With the default entries from the image the SD Card should boot without limit. If quiet have also been removed then it is an indication that everything else is modifying your boot files and may cause failing boot the second time but missing quiet is not the cause. It only suppress boot messages on the screen.

|improve this answer|||||
  • Thanks for your answer. Do you suggest that I don't change the value of root then? By the way, I don't have the quiet and init=/usr/lib/raspi-config/init_resize.sh parts present on this cmdline.txt. Can this be the issue? I have installed the latest, 2019-04-08-raspbian-stretch-lite.img now and it has the same issue. – Kashif Nazar Apr 22 '19 at 10:03
  • Also, how can I visualize the filesystem on my Windows 10 machine? The Raspberry machine doesn't let me see the filesystem because of the error. – Kashif Nazar Apr 22 '19 at 10:20
  • @KashifNazar I have updated my answer with the last paragraph. To visualize the filesystem on MS Windows you need a running RasPi with a network share. But that's a question of its own. – Ingo Apr 22 '19 at 16:13
0

The cause of the issue is simply that Linux cannot find the root partition.

If you view your current cmdline.txt and config.txt you will find something like root=PARTUUID=c1dc39e5-02 which is meant to match the partition UUID (the universally unique identifier).

I would suggest finding what the partition is and using that mountpoint specifically. If I remember correctly it is root=/dev/mmcblk0p7 - 7, rather than 6. This is set to the partition layout of whatever Raspbian does; it could change for future versions.

You can use the partition manager in Windows to observe what partitions are there; the biggest one should be the root partition. Just count its number from the left.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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