IgnorantGuru / udevil

Mount without password
http://ignorantguru.github.com/udevil/
GNU General Public License v3.0
129 stars 30 forks source link

udevil: denied 94: file isofile.iso is already mounted (or specify mount point) #24

Closed morfikov closed 11 years ago

morfikov commented 11 years ago

I came across a strange behavior -- when I mount, unmount and remount an .iso file as a normal user, everything is ok. The same with root user. When I mount it as a normal user and try to unmount it as root, everything seems to be fine, at least to the next mount action as a normal or root user of unmounted file.

I got an error: udevil: denied 94: file /media/Server/iso/archlinux-2013.03.01-dual.iso is already mounted (or specify mount point)

I have specified "allowed_media_dirs = /media, /run/media/$USER" in /etc/udevil/udevil.conf . But there is no mount points in those locations.

When I try to switch users and mount an .iso file first as root and unmount it as a normal user, everything is ok, even the next mount of the .iso file.

I was using two instances of spacefm -- one with normal user privileges and the second with root.

After reboot, I typed from root:

udevil mount archlinux-2013.03.01-dual.iso

Mounted /media/Server/iso/archlinux-2013.03.01-dual.iso at /media/archlinux-2013.03.01-dual.iso

udevil umount /media/archlinux-2013.03.01-dual.iso/

udevil: success running umount as current user

udevil mount archlinux-2013.03.01-dual.iso

udevil: denied 94: file /media/Server/iso/archlinux-2013.03.01-dual.iso is already mounted (or specify mount point)

udevil mount archlinux-2013.03.01-dual.iso /media/test

Mounted /media/Server/iso/archlinux-2013.03.01-dual.iso at /media/test

udevil umount /media/test

udevil: success running umount as current user

Then, I tried with another .iso file:

udevil mount aptosid.iso

Mounted /media/Server/iso/aptosid.iso at /media/aptosid.iso

udevil umount /media/aptosid.iso/

udevil: success running umount as current user

udevil mount aptosid.iso

udevil: denied 94: file /media/Server/iso/aptosid.iso is already mounted (or specify mount point)

So, it looks like I can mount a file only once. The second mount action gets the error because there is no mount point specified. So, I think that's why spacefm gets the error too.

This only exist with .iso files. Mounting a device is fine. And there is no other way but rebooting in order to make spacefm work again with .iso files.

IgnorantGuru commented 11 years ago

Confirmed. Thanks for the report and sorry for the delay - will look at this shortly.

IgnorantGuru commented 11 years ago

The reason for this is that by just unmounting as root, you're leaving the loop device attached. To see this run:

losetup -a

To completely umount and detach, use these commands as root:

umount file.iso
losetup -d /dev/loop0    # or whatever loop is seen in losetup -a

I have improved the 'denied 94' message to be more descriptive. I'm not sure I like the idea of udevil detaching a loop device automatically in this case. If you're going to umount directly as root, you should probably detach too.