You are not logged in.

#1 2022-01-23 09:51:40

diederick76
Member
Registered: 2010-02-14
Posts: 169

[SOLVED] Mount -o loop forbidden

I have a disk image file that contains two partitions, of which I want to mount the second partition.

When I do

$ fdisk -l Manjaro-ARM-phosh-pinephone-beta20.img 

I can see the sector size (512) and the partition start (500001), so I can calculate the offset, and try to mount it using:

$ mkdir pp-mnt
$ sudo mount -o loop,offset=256000512 Manjaro-ARM-phosh-pinephone-beta20.img pp-mnt

which fails after:

mount: pp-mnt: mount failed: Action is not permitted (translation mine).

The pp-mnt directory is drwxr-xr-x and I also tried this as root, but I keep getting that error.

Additionally, /dev/loop0 does not exist, and even creating it with

$ sudo mknod /dev/loop0 b 7 0

Results in:

# sudo losetup /dev/loop0 Manjaro-ARM-phosh-pinephone-beta20.img
# losetup: /dev/loop0: configuring loop device failed: device or address does not exist (translation mine)

Can someone tell me how the loop back device under Arch should work and how to use it to mount disk images?

Last edited by diederick76 (2022-01-23 10:58:26)

Offline

#2 2022-01-23 10:49:33

ua4000
Member
Registered: 2015-10-14
Posts: 562

Re: [SOLVED] Mount -o loop forbidden

something seems wrong with your loop device.
Reboot the machine,
execute

sudo losetup --verbose --find
sudo losetup --verbose  /dev/loopX Manjaro-ARM-phosh-pinephone-beta20.img

by replacing X with the free number from the 1st command.
Please post the complete in+out, also logs from dmesg and journalctl, maybe the loop device gets lot loaded ?

Offline

#3 2022-01-23 10:56:45

diederick76
Member
Registered: 2010-02-14
Posts: 169

Re: [SOLVED] Mount -o loop forbidden

Rebooting did the trick. There was a /dev/loop0 device afterwards. Thanks!

A classic turning it off and on again.

Last edited by diederick76 (2022-01-23 10:57:14)

Offline

#4 2022-01-23 12:00:32

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: [SOLVED] Mount -o loop forbidden

Note that the mount command will handle loop devices automatically with no need to specify the loop option.

You can also use the shell to calculate the offset, for example:

# mount -o offset $((500001*512)) Manjaro-ARM-phosh-pinephone-beta20.img pp-mnt

Jin, Jîyan, Azadî

Offline

#5 2022-01-23 12:04:18

diederick76
Member
Registered: 2010-02-14
Posts: 169

Re: [SOLVED] Mount -o loop forbidden

Thanks, I didn't know that. I always go into python to do calculations.

Offline

Board footer

Powered by FluxBB