After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 551841 - gvfs / nautilus doesn't respect exclusive lock on org.freedesktop.Hal.Device.Storage
gvfs / nautilus doesn't respect exclusive lock on org.freedesktop.Hal.Device....
Status: RESOLVED FIXED
Product: gnome-mount
Classification: Deprecated
Component: programs
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
Depends on:
Blocks:
 
 
Reported: 2008-09-11 17:01 UTC by Frederic Crozat
Modified: 2009-02-20 14:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
respect lock even for device in fstab (3.17 KB, patch)
2008-09-15 13:19 UTC, Frederic Crozat
committed Details | Review

Description Frederic Crozat 2008-09-11 17:01:27 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.
Comment 1 David Zeuthen (not reading bugmail) 2008-09-11 17:05:59 UTC
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.
Comment 2 Frederic Crozat 2008-09-11 18:25:57 UTC
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
Comment 3 David Zeuthen (not reading bugmail) 2008-09-11 20:34:01 UTC
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)
Comment 4 David Zeuthen (not reading bugmail) 2008-09-11 20:34:26 UTC
s/quite/quiet/ even
Comment 5 Frederic Crozat 2008-09-15 13:18:45 UTC
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.
Comment 6 Frederic Crozat 2008-09-15 13:19:26 UTC
Created attachment 118745 [details] [review]
respect lock even for device in fstab
Comment 7 David Zeuthen (not reading bugmail) 2008-09-24 15:39:43 UTC
(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.
Comment 8 Pacho Ramos 2009-01-19 12:40:03 UTC
Was this finally commited? Thanks :-)
Comment 9 Frederic Crozat 2009-02-20 14:01:06 UTC
committed on trunk :

2009-02-20  Frederic Crozat  <fcrozat@mandriva.com>

        * src/gnome-mount.c: Respect lock even for device in fstab
        (bug #551841).