Need to disable an re-enable automounter in linaro-android-media-create

Bug #1034853 reported by Zach Pfeffer
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro Image Tools
Fix Released
Medium
Milo Casagrande

Bug Description

The automounter is causing linaro-android-media-create to fail every so often. This seems to turn off the automounter in gnome:

dconf write /org/gnome/desktop/media-handling/automount false
dconf write /org/gnome/desktop/media-handling/automount-open false

allowing things to work better

Related branches

Fathi Boudra (fboudra)
Changed in linaro-image-tools:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Fathi Boudra (fboudra)
milestone: none → 2012.08
status: Triaged → In Progress
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

In case this happens at the host side, just remember to get it back to the previous value, it'd be annoying to have linaro-image-tools to change something at the host side without a big warning first.

Fathi Boudra (fboudra)
Changed in linaro-image-tools:
milestone: 2012.08 → 2012.09
Fathi Boudra (fboudra)
Changed in linaro-image-tools:
assignee: Fathi Boudra (fboudra) → nobody
milestone: 2012.09 → 2012.10
status: In Progress → Confirmed
importance: High → Medium
Revision history for this message
Milo Casagrande (milo) wrote :

It might be good to use 'gesettings' to set and reset values, but whatever tool we decide to use, I guess this will add a new dependency for l-i-t. 'dconf' command on my 12.04 installation is not installed (dconf-tools is not a default package and is in universe), whereas 'gsettings' seems to be. I think dconf will be the default one in 12.10, but there should still be support for 'gsettings' even there (haven't tested).

This approach though will work only with Gnome, does anybody have an idea how this work with KDE? Googling it does not give really interesting or easy solutions: from removing udev rules, to cutting the cables of the driver...

I think this should be triggered via a command line option, to avoid strange things happening if linaro-android-media-create is run from a headless system or from an AMI instance.

Changed in linaro-image-tools:
assignee: nobody → Milo Casagrande (milo)
Revision history for this message
Milo Casagrande (milo) wrote :

As briefly discussed on IRC yesterday, this would be better done usind udisks/polkit, probably over dbus under Python. It needs a little bit bigger effort to achieve this in linaro-image-tools code base.

Revision history for this message
Milo Casagrande (milo) wrote :

Using polkit/dbus/udisk is possible, but the program must be run as a privileged user, otherwise the inhibition of automount will not work. The inhibition is at system level, meaning it will be disabled for all the time required (and it can be safely restored at the end).

All l-i-t cli tools require privileges to be run, and (more than once) it is asked to insert the "sudo" password, so it might make sense to ask it at the beginning of the execution and run the entire process as a privileged user.

It might be good to run the program with pkexec, so that policykit will take care of the entire authorization process. To achieve it is necessary to find a way to or elevate the privileges of the running process, or to check and then spawn the process with the correct privileges.

We already have a policykit .policy file in l-i-t tree, it could be extended to include all the l-i-t cli tools, and installed in the system.

Milo Casagrande (milo)
Changed in linaro-image-tools:
status: Confirmed → In Progress
Revision history for this message
Milo Casagrande (milo) wrote :

I did several tests with different setups and options:
- Running linaro-media-create or other tools directly with 'sudo' or 'pkexec' has the problem that the files create will be of the root user; also, using 'pkexec', there is a problem with relative paths, it is necessary to use absolute paths or it will complain that "files are not regular files".
- Disabling of the automounter via udisks (inhibiting the udisks daemon) has to be done by root: using policykit will not be useful in this case, it needs the user to be uid=0, increasing the privileges checking for 'org.freedesktop.policykit.exec' will not work.
- It might be possible to achieve that spawning two processes from the l-i-t tools, using Popen: one to disable the automounter, the other to re-enable it back: the problem with this approach is that we need the output of the disable function in order to re-enable everything. The udisks 'Inhibit()' method returns a 'cookie' that is necessary for 'Uninhibit()'. Serialiazing and de-serializing the value should be possible. It sounds like a hacky-solution, but at the moment I do not see other options.

Changed in linaro-image-tools:
milestone: 2012.10 → 2012.11
Changed in linaro-image-tools:
milestone: 2012.11 → 2012.12
Milo Casagrande (milo)
Changed in linaro-image-tools:
milestone: 2012.12 → 2013.01
Revision history for this message
Данило Шеган (danilo) wrote :

Milo, I suggest to keep this bug a very simple one: simply do the dconf commands we recommend people execute manually anyway (if dconf is there), but do not fail in case of problems (i.e. someone using KDE). That will improve the situation, and for a proper solution, there is https://blueprints.launchpad.net/linaro-image-tools/+spec/automount-disabling-support that we'll prioritize accordingly (and I suspect it will not be done any time soon).

Milo Casagrande (milo)
Changed in linaro-image-tools:
milestone: 2013.01 → 2013.02
David Zinman (dzinman)
Changed in linaro-image-tools:
milestone: 2013.02 → 2013.03
Fathi Boudra (fboudra)
Changed in linaro-image-tools:
milestone: 2013.03 → 2013.04
Revision history for this message
Milo Casagrande (milo) wrote :

Simple calls to dconf, when installed, are now being performed by default.

Changed in linaro-image-tools:
status: In Progress → Fix Committed
Milo Casagrande (milo)
Changed in linaro-image-tools:
status: Fix Committed → Fix Released
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.