GNOME Bugzilla – Bug 551841
gvfs / nautilus doesn't respect exclusive lock on org.freedesktop.Hal.Device.Storage
Last modified: 2009-02-20 14:01:06 UTC
this is with gvfs 0.99.7.1 + nautilus 2.23.92 + gnome-mount 0.8 on Mandriva LiveCD, when starting the "create partitions and dump livecd to disk" process, we use : hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive --run "/usr/sbin/draklive-install" to ensure newly created partitions won't be automounted by nautilus / gvfs. It seems hal lock is not respected in gvfs / nautilus : when new partitions are created and then formatted, two popups appeared for each partition : * one from gnome-mount : "can't mount volume : you don't have enough privileges to mount this volume * later, a dbus error popup from nautilus : "can't mount volume ... ; DBus error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." I'm not sure which component is causing the issue.
gnome-mount is responsible for enforcing locks and I'm pretty sure this works (we rely on it in Fedora). Are you trying to obtain the locks as root? Please paste "lshal --monitor" output when obtaining the locks. And then try to run gnome-mount on the commandline using the -v, -b switches and paste the output.
no, lock is obtained as user (I tried as root, same problem) I think I better understand the issue here : gvfs/nautilus is trying to remount partitions which exist previously, during the partitioning step (which is why they got added automatically in /etc/fstab by one of our tools), just after being unmounted by the partition tool (those partitions are not set as "volume.ignore"). Since those partitions are in fstab, mount will refuse to mount them (even if I think they shouldn't be automounted in the first place), causing the popup. gnome-mount output : DEBUG: Mounting /org/freedesktop/Hal/devices/volume_uuid_f2b86f47_aa19_4cab_ae34_abab15815f0d Device /dev/sda1 is in /etc/fstab with mount point "/media/hd" Message: /bin/mount said error 256, stdout="", stderr"mount: only root can mount UUID=f2b86f47-aa19-4cab-ae34-abab15815f0d on /media/hd" lshal --monitor Start monitoring devicelist: ------------------------------------------------- 13:34:35.346: computer property info.named_locks.Global.org.freedesktop.Hal.Device.Storage.exclusive = true (new) 13:34:35.398: computer property info.named_locks.Global.org.freedesktop.Hal.Device.Storage.dbus_name = {':1.30'} (new) 13:34:35.406: computer property info.named_locks.Global.org.freedesktop.Hal.Device.Storage.locked = true (new) 13:34:35.435: computer property info.named_locks = {'Global.org.freedesktop.Hal.Device.Storage'} (new) 13:34:35.442: global_interface_lock_acquired org.freedesktop.Hal.Device.Storage by :1.30 (1 lockers) ==== <= then the installer check available partitions 13:34:35.442: global_interface_lock_acquired org.freedesktop.Hal.Device.Storage by :1.30 (1 lockers) 13:35:11.274: volume_uuid_f2b86f47_aa19_4cab_ae34_abab15815f0d property volume.mount_point = '' 13:35:11.325: volume_uuid_f2b86f47_aa19_4cab_ae34_abab15815f0d property volume.is_mounted = false 13:35:11.446: volume_uuid_7957b6cf_78c2_43a1_bfee_97bff224f0a4 property volume.mount_point = '' 13:35:11.474: volume_uuid_7957b6cf_78c2_43a1_bfee_97bff224f0a4 property volume.is_mounted = false === <= then I remove and recreate partitions 13:36:51.972: volume_part2_size_1024 removed 13:36:52.345: volume_uuid_7957b6cf_78c2_43a1_bfee_97bff224f0a4 removed 13:36:52.767: volume_uuid_ece22ca1_6895_4f36_9c0c_e3816e3252cc removed 13:36:52.801: volume_uuid_f2b86f47_aa19_4cab_ae34_abab15815f0d removed 13:36:53.250: volume_part2_size_1024 added 13:36:54.020: volume_uuid_7957b6cf_78c2_43a1_bfee_97bff224f0a4 added 13:36:54.747: volume_uuid_f2b86f47_aa19_4cab_ae34_abab15815f0d added 13:36:54.823: volume_uuid_ece22ca1_6895_4f36_9c0c_e3816e3252cc added
What is the output of gnome-mount when there's no entry in /etc/fstab? Is it correct that nothing actually gets mounted and this bug is only about annoying error dialogs? (my gut feeling is that we just need to fix gnome-mount to check locks before /etc/fstab so it can be quite about things)
s/quite/quiet/ even
after more investigation, I found two bugs here (thanks to your previous comments) - gnome-mount was not checking for lock for devices specified in /etc/fstab. Attached patch fixes this issue -hal-lock is run as user (on liveCD, root has no password), and while lshal / hald seems to correctly show the lock, calls to gnome-mount don't see it locked (through the call to libhal_device_is_locked_by_others). So, even with the fix for first bug, mount is still called on "locked" devices. It is also problematic when devices are not in fstab.
Created attachment 118745 [details] [review] respect lock even for device in fstab
(In reply to comment #5) > after more investigation, I found two bugs here (thanks to your previous > comments) > > - gnome-mount was not checking for lock for devices specified in /etc/fstab. > Attached patch fixes this issue Great, that explains. We don't use /etc/fstab entries (I guess, neither does a lot of other distros) on Fedora so that explains why we haven't been seeing this bug. Please commit, thanks! > -hal-lock is run as user (on liveCD, root has no password), and while lshal / > hald seems to correctly show the lock, calls to gnome-mount don't see it locked > (through the call to libhal_device_is_locked_by_others). So, even with the fix > for first bug, mount is still called on "locked" devices. It is also > problematic when devices are not in fstab. Yeah, you need to run it as uid 0; should be even easier if there's no root password.
Was this finally commited? Thanks :-)
committed on trunk : 2009-02-20 Frederic Crozat <fcrozat@mandriva.com> * src/gnome-mount.c: Respect lock even for device in fstab (bug #551841).