Bug 812972 - disable auto-mount of devices when USB auto share is enabled and active
disable auto-mount of devices when USB auto share is enabled and active
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: spice-gtk (Show other bugs)
6.3
Unspecified Linux
medium Severity medium
: rc
: 6.8
Assigned To: Default Assignee for SPICE Bugs
Virtualization Bugs
:
Depends On: 844075 844076
Blocks: 808057 922714
  Show dependency treegraph
 
Reported: 2012-04-16 13:10 EDT by David Jaša
Modified: 2015-10-22 08:26 EDT (History)
14 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 922714 (view as bug list)
Environment:
Last Closed: 2015-10-22 08:26:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Jaša 2012-04-16 13:10:00 EDT
Description of problem:
disable auto-mount of devices when USB auto share is enabled and active in order to prevent any corruption that might be caused by concurrent raw access to the device

Version-Release number of selected component (if applicable):
virt-viewer-0.5.2-4.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. connect with virt-viewer to VM that features USB sharing
2. ensure that virt-viewer has both keyboard and mouse focus
3. plug in the device
  
Actual results:
* virt-viewer asks for root password to get sharing privileges if necessary
* virt-viewer forwards the device
* gnome components auto mount the device in client

Expected results:
gnome in client mounts the device only if virt-viewer releases it (i.e. if user refuses to forward it to the guest or if he "ejects" it in the guest)

Additional info:
similar issue when working with gparted: 
https://bugzilla.gnome.org/show_bug.cgi?id=324220
Comment 3 Hans de Goede 2012-04-17 16:14:34 EDT
I think this is a reasonable request, but I wonder if there is an API to suspend automounting in gnome / hal / udisks (does RHEL-6 have udisks?). I guess David Zeuthen probably knows, adding him to the CC. David?
Comment 4 David Zeuthen 2012-04-17 18:05:31 EDT
(In reply to comment #3)
> I think this is a reasonable request, but I wonder if there is an API to
> suspend automounting in gnome / hal / udisks (does RHEL-6 have udisks?). I
> guess David Zeuthen probably knows, adding him to the CC. David?

RHEL6 has udisks 1.x and the D-Bus API there is

 http://hal.freedesktop.org/docs/udisks/UDisks.html#UDisks.Inhibit

You can also use the udisks(1) command for this (the --inhibit option), see

 http://hal.freedesktop.org/docs/udisks/udisks.1.html

Hope this helps.
Comment 5 Hans de Goede 2012-06-11 09:35:59 EDT
This should be done in spice-gtk, changing component.
Comment 6 Hans de Goede 2012-06-11 09:47:05 EDT
HI,

(In reply to comment #4)
> (In reply to comment #3)
> > I think this is a reasonable request, but I wonder if there is an API to
> > suspend automounting in gnome / hal / udisks (does RHEL-6 have udisks?). I
> > guess David Zeuthen probably knows, adding him to the CC. David?
> 
> RHEL6 has udisks 1.x and the D-Bus API there is
> 
>  http://hal.freedesktop.org/docs/udisks/UDisks.html#UDisks.Inhibit
> 
> You can also use the udisks(1) command for this (the --inhibit option), see
> 
>  http://hal.freedesktop.org/docs/udisks/udisks.1.html

Hmm, this seems to require root rights, and we want to inhibit it from the spice-client process which runs as normal user. Is there a way to just stop automounting for one user?

Regards,

Hans
Comment 7 David Zeuthen 2012-06-11 09:58:13 EDT
(In reply to comment #6)
> HI,
> 
> (In reply to comment #4)
> > (In reply to comment #3)
> > > I think this is a reasonable request, but I wonder if there is an API to
> > > suspend automounting in gnome / hal / udisks (does RHEL-6 have udisks?). I
> > > guess David Zeuthen probably knows, adding him to the CC. David?
> > 
> > RHEL6 has udisks 1.x and the D-Bus API there is
> > 
> >  http://hal.freedesktop.org/docs/udisks/UDisks.html#UDisks.Inhibit
> > 
> > You can also use the udisks(1) command for this (the --inhibit option), see
> > 
> >  http://hal.freedesktop.org/docs/udisks/udisks.1.html
> 
> Hmm, this seems to require root rights, and we want to inhibit it from the
> spice-client process which runs as normal user. Is there a way to just stop
> automounting for one user?

Not that I can easily think of - if you need this, the best would be to add an inhibitor interface to the automounter (for GNOME 3, it's in the Shell nowadays I think)... which is messy because you'd need all the desktops to implement it.

Best is probably to just unmount all the partitions on the device (including tearing down LUKS) if opening fails? Sure, it's not the "right" or "correct" solution but it may be a lot easier and robust than adding inbitors frameworks.

[1] : just running the umount(8) command is fine and preferred as it is the most portable solution (works on both RHEL6 and F17/RHEL7)
Comment 8 Hans de Goede 2012-06-22 02:36:52 EDT
(In reply to comment #7)
> > Hmm, this seems to require root rights, and we want to inhibit it from the
> > spice-client process which runs as normal user. Is there a way to just stop
> > automounting for one user?
> 
> Not that I can easily think of - if you need this, the best would be to add
> an inhibitor interface to the automounter (for GNOME 3, it's in the Shell
> nowadays I think)... which is messy because you'd need all the desktops to
> implement it.
>
> Best is probably to just unmount all the partitions on the device (including
> tearing down LUKS) if opening fails? Sure, it's not the "right" or "correct"
> solution but it may be a lot easier and robust than adding inbitors
> frameworks.

For those reading along here, after much discussions through other channels we've decided to go with the "add an inhibitor interface to the desktop automounter" solution, for the following reasons:

1) udisks inhibit is global (not per seat / session), udisks inhibit requires root rights and udisk2 does not have an inhibit interface, so doing this at the udisks level is not an option

2) The problem we're trying to fix is a race between automount and auto-usbredir, unmounting partitions first is not going to help, since the may get mounted until after the unmount code runs and before the device redir code detach the usb-storage driver. With that said unmounting partitions first is a good idea for the manual usbredir case and I've put it on my to-do list.
Comment 12 Hans de Goede 2012-07-28 11:59:18 EDT
In order to do this for 6.4, we not only need spice-gtk support, but we also need to have automount-inhibit support added to gnome-session and nautilus. I've filed 2 new bugs for tracking this, gnome-session bug 844075 and nautilus bug 844076, all 3 bugs need to be fixed for this to be actually fixed, and even then it will only be fixed for spice-gtk running under gnome.
Comment 22 Marc-Andre Lureau 2014-03-12 10:07:19 EDT
taking the bug, since we need an assignee, and I will update spice-gtk
Comment 23 Christophe Fergeau 2014-04-29 11:09:15 EDT
gnome-session bug 844075 and nautilus bug 844076 are still in NEW.
Comment 28 David Blechter 2015-10-22 08:26:46 EDT
closing this bug in rhel 6.x. No customer impact, and the solution is already in rhel 7

Note You need to log in before you can comment on or make changes to this bug.