Can't unmount UUID= volume as a user

Bug #71609 reported by Jeremy Kerr
This bug report is a duplicate of:  Bug #99437: umount: mount disagrees with the fstab. Edit Remove
10
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Confirmed
Undecided
Unassigned
Nominated for Feisty by Jonathan Rascher

Bug Description

I have the following entry in /etc/fstab:

UUID=00a1665a-f7f1-48c6-8dff-65e77c98bd2f /media/extdisk ext3 user,noauto,exec 0 0

- to allow a nonprivileged user (ie, me) to mount a firewire disk with the specified UUID.

mounting works fine, but unmounting (as the same user) doesn't:

[jk@pokey ~]$ umount /media/extdisk
umount: /media/extdisk mount disagrees with the fstab

When this disk is mounted, /proc/mounts shows:
/dev/disk/by-uuid/00a1665a-f7f1-48c6-8dff-65e77c98bd2f /media/extdisk ext3 rw,nosuid,nodev,data=ordered 0 0

however, /etc/mtab shows:
/dev/sda1 /media/extdisk ext3 rw,nosuid,nodev,user=jk 0 0

If I strace the umount:

[jk@pokey ~]$ sudo strace -etrace=file -u jk umount /media/extdisk/
execve("/bin/umount", ["umount", "/media/extdisk/"], [/* 31 vars */]) = 0
access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY) = 3
readlink("/media", 0x7fa625fb, 4096) = -1 EINVAL (Invalid argument)
readlink("/media/extdisk", 0x7fa625fb, 4096) = -1 EINVAL (Invalid argument)
open("/etc/mtab", O_RDONLY|O_LARGEFILE) = 3
open("/etc/fstab", O_RDONLY|O_LARGEFILE) = 3
readlink("/dev", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/sda1", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/proc", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/home", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/media", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/media/cdrom0", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
getcwd("/home/jk", 4095) = 9
readlink("/home/jk/UUID=00a1665a-f7f1-48c6-8dff-65e77c98bd2f", 0x7fa625cb, 4096) = -1 ENOENT (No such file or directory)
readlink("/media", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/media/ipod", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/home", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/media", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/media/ipod", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid/00bcb37c-0d82-4fc4-9515-9c7daa72ffaf", "../../hda5", 4096) = 10
readlink("/dev/hda5", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid/27a00a33-2101-44b2-b29f-0be7258b70e7", "../../hda6", 4096) = 10
readlink("/dev/hda6", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid/883a4c5f-3d9b-4ce4-bf3d-c2d187870e76", "../../hda4", 4096) = 10
readlink("/dev/hda4", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/hdc", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-uuid/00a1665a-f7f1-48c6-8dff-65e77c98bd2f", "../../sda1", 4096) = 10
readlink("/dev/sda1", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-label", 0x7fa625cb, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/disk/by-label/IPOD", 0x7fa625cb, 4096) = -1 ENOENT (No such file or directory)
umount: /media/extdisk mount disagrees with the fstab
Process 10417 detached

- umount has managed to resolve the symlink from /dev/disk/by-uuid/00... to /dev/sda1, but hasn't recognised that it's the same device ?

Revision history for this message
Brian Pitts (bpitts) wrote :
Download full text (4.1 KiB)

I can confirm this bug.

# /dev/hda6
UUID=4386-3B67 /media/backup vfat defaults,noauto,utf8,umask=007,gid=46,user,noauto 0 1

mount /media/backup

in /proc/mounts
/dev/disk/by-uuid/4386-3B67 /media/backup vfat rw,nosuid,nodev,noexec,uid=1000,gid=46,fmask=0007,dmask=0007,codepage=cp437,iocharset=iso8859-1,utf8 0 0

in /etc/mtab
/dev/hda6 /media/backup vfat rw,noexec,nosuid,nodev,utf8,umask=007,gid=46,user=brian 0 0

umount /media/backup
umount: /media/backup mount disagrees with the fstab

strace umount /media/backup
execve("/bin/umount", ["umount", "/media/backup"], [/* 31 vars */]) = 0
brk(0) = 0x805b000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f91000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=50023, ...}) = 0
mmap2(NULL, 50023, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f84000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20Z\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1248904, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f83000
mmap2(NULL, 1258876, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7e4f000
mmap2(0xb7f7c000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12c) = 0xb7f7c000
mmap2(0xb7f80000, 9596, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f80000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e4e000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e4e6b0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7f7c000, 8192, PROT_READ) = 0
munmap(0xb7f84000, 50023) = 0
brk(0) = 0x805b000
brk(0x807c000) = 0x807c000
...
close(3) = 0
umask(022) = 022
getuid32() = 1000
geteuid32() = 1000
readlink("/media", 0xbf8ad037, 4096) = -1 EINVAL (Invalid argument)
readlink("/media/backup", 0xbf8ad037, 4096) = -1 EINVAL (Invalid argument)
umask(077) = 022
open("/etc/mtab", O_RDONLY|O_LARGEFILE) = 3
umask(022) = 077
fstat64(3, {st_mode=S_IFREG|0644, st_size=623, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d3f000
read(3, "/dev/hdb1 / ext3 rw,errors=remou"..., 4096) = 623
read(3, "", 4096) = 0
close(3) = 0
munmap(0xb7d3f000, 4096) = 0
stat64("/sbin/umount.vfat", 0xbf8aef6c) = -1 ENOENT (No such file or directory)
oldumount("/media/backup") = -1 E...

Read more...

Revision history for this message
wiertel (wiertel) wrote :

I've encountered the same problem when I tried to unmount /mnt/win with nautilus.

UUID=ACB84F65B84F2D60 /mnt/win ntfs nls=utf8,ro,users,uid=1000 0 0

Revision history for this message
lknfdskjy76 (cfer45ysd) wrote :

i can confirm this bug.. its very annoying, someone please fix it

Revision history for this message
wiertel (wiertel) wrote : Re: Can't unmount UUID= volume as a user (patch)

I've found the reason for this behavior. Here is a patch which correct it.
Patch is most probably incomplete. I have no idea what is blkid or libvolume_id but it works.

Revision history for this message
Júlio Alexandrino (alexandrino) wrote :
Changed in util-linux:
status: Unconfirmed → Confirmed
Revision history for this message
Júlio Alexandrino (alexandrino) wrote :

... and with Bug #94848

Revision history for this message
Frederick Reeve (cylix) wrote :

All three bugs on this are from the same source. This is the fix. I am attaching this patch to all three. I have been using it for a while, its fine. The attached patch should be applied to the src-dep of util-linux. For those of you who want this fix now follow these instructions:

Modify your source.list so you have so the dep-src for the main repository enabled and copy the patch into /tmp. Then run the following commands:

$ sudo apt-get update
$ sudo apt-get install build-essential
$ sudo apt-get build-dep mount
$ cd /tmp
$ apt-get source mount
$ cd util-linux-2.12r
$ ./debian/rules patch
$ patch -Np1 -i ../util-linux_user_mount.patch
$ ./configure
$ make lib
$ make -C mount
$ sudo chown root:root mount/umount
$ sudo chmod 4755 mount/umount
$ sudo mv mount/umount /bin

now you should be able to unmount you drive that was user mounted using a uuid.

Revision history for this message
yakrider (yakrider) wrote :

Awesome. It works. Kudos for the good work. My appreciation and wishing godspeed.

Revision history for this message
Andrew Davis (papyromancer) wrote :

Great Work!

Revision history for this message
Stefan Fleiter (stefan-fleiter) wrote :

This seems to be fixed in gutsy.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.