dhruvvyas90 / qemu-rpi-kernel

Qemu kernel for emulating Rpi on QEMU
2.06k stars 363 forks source link

wrong fs type, bad option, bad superblock : ERROR while mounting the image #132

Open harshcht opened 3 years ago

harshcht commented 3 years ago

I followed the instructions as in the readme.md file. I download the raspbian OS image and then do :

sudo losetup -f --show -P ~/2021-05-07-raspios-buster-armhf-full.img

I get : /dev/loop14

now I try to mount the image, but am gettng error

sudo mount /dev/loop14 /mnt/rpi

mount: /mnt/rpi: wrong fs type, bad option, bad superblock on /dev/loop14, missing codepage or helper program, or other error.

Can someone please help me out with this ?

paulwratt commented 3 years ago

/dev/loop14 is the device id allocation provided by losetup (loopback device setup), it is equivalent to /dev/sda or /dev/mccblk0, none of which are partitions, needed by mount if ls /dev/loop14* lists only one item then run sudo partprobe /dev/loop14 and try again. you are looking for (in your case) /dev/loop14p1 (the FAT16/32 boot partition) and /dev/loop14p2 (the EXT4 linux partition). then redo your sudo mount command with either of those (optionally adding -t vfat or -t ext4 depending on partition)

pi@raspberrypi:~ $ ls /dev/mmcblk0*
/dev/mmcblk0  /dev/mmcblk0p1  /dev/mmcblk0p2  /dev/mmcblk0p3

(on my setup partition 3 is a linux swap partition)

EDIT: for those wanting complete quick setup:

-=Loop Device=-
$ sudo losetup -f
/dev/loop0
$ sudo losetup /dev/loop0 sd-image.img
$ sudo partprobe /dev/loop0
$ sudo mount -t ext4 /dev/loop0p2 /mnt/sd-img
$ sudo mount -t vfat /dev/loop0p1 /mnt/sd-img/boot