You are not logged in.

#1 2015-10-07 12:11:36

dominic7il
Member
Registered: 2013-12-20
Posts: 18

[SOLVED] Automounting with devmon interferes with XFCE Options

I've got automounting set up using udevil and devmon running as a daemon - I'm doing it this way because most of the time my system runs headless without a desktop environment. However when I do use the desktop environment I'd like drives to open up in a file manager and audio disks to launch vlc etc...

I use XFCE as a desktop environment which provides the option to execute tasks on disk insertion, but this doesn't work at the same time as the devmon background service.

Is there any way to achieve what I'm after?

Thanks,

Last edited by dominic7il (2015-10-09 10:28:50)

Offline

#2 2015-10-07 15:55:14

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,304

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

How do you start devmon?
How do you start xfce?

Offline

#3 2015-10-07 16:01:33

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

devmon is initiated via systemd (systemctl enable devmon.service)
xfce is started via lightdm, which in turn is initiated by systemd's graphical.target

Last edited by dominic7il (2015-10-07 16:02:04)

Offline

#4 2015-10-07 16:03:22

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,720

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

dominic7il,
If you were wondering where your first post went, I think you hit "report" when you meant "reply".  It happens more often than you might imagine smile


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2015-10-07 16:11:28

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

ewaller wrote:

dominic7il,
If you were wondering where your first post went, I think you hit "report" when you meant "reply".  It happens more often than you might imagine smile

Yeah I realised that straight after I'd done it - sorry about that.

Offline

#6 2015-10-07 16:31:35

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,720

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

No worries. If that is the worst thing that happens today, I'm doing alright smile


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#7 2015-10-07 17:42:01

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

I've been playing around with this some more and ontop of the issue above, it seems devmon is mounting drives as root and are subsequently not writeable by other users. Any ideas?

Offline

#8 2015-10-08 14:25:13

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

Ok still no joy with this - one thing that keeps coming up as I search around is that udisks2 supposedly should handle automounting. How can this be configured are there any udev rule files for this lurking around?

Offline

#9 2015-10-08 14:55:13

Chazza
Wiki Maintainer
Registered: 2013-06-02
Posts: 506

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

If you have gvfs installed, it should happen automatically if you are using a dm or you're using startx with a correctly configured ~/.xinitrc. The dbus session bus will start gvfsd which will use udisks2 to mount and unmount devices on the fly. Devices are mounted to /run/media/username/xxxx-xxxx. You can also use the udisksctl command line tool.

Offline

#10 2015-10-08 15:01:52

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

OK thanks what would .xinitrc have to contain in order to start gvfsd?

Offline

#11 2015-10-08 15:23:33

Chazza
Wiki Maintainer
Registered: 2013-06-02
Posts: 506

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

It was mandatory to have the following:

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/?* ; do
        [ -x "$f" ] && . "$f"
    done
    unset f
fi

as there was a script in there which ran dbus-launch which would start the session bus. Since this change, the session bus (and hence gvfsd) should now get started without anything special in ~/.xinitrc but you still want the block above as there's a script in there which ensures that your environment variables are correct, otherwise you can experience some unpredictable behaviour - some people reported problems with DISPLAY for instance.

Offline

#12 2015-10-08 17:15:45

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

I just don't get it gvfs is running udisks2 is running but it's not mounting automatically. When I run "udisksctl --monitor" it's detecting the insertion of the device. I'm completely stumped and frustrated I've spent far too long on this.

Offline

#13 2015-10-08 18:30:05

Chazza
Wiki Maintainer
Registered: 2013-06-02
Posts: 506

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

Run thunar-volman-settings and ensure that Mount removable drives when hot-plugged and Mount removable media when inserted are ticked. If they aren't ticked, then drives will be detected but will not actually be mounted unless you open Thunar and click on the entry under devices in the shortcuts pane.

Offline

#14 2015-10-08 19:42:20

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

Yeah it works via Thunar but as I said I'm trying to get this to work when no desktop environment is running. Basically the main frontend to this machine is going to be Kodi/XBMC - the way I've got it set up is I have a kodi user who's default session is the kodi.session provided with kodi. I've done some more digging and it seems gvfs-mount doesn't detect a drive being inserted if I'm logged in as this other user. My personal user account and the kodi user account all belong to the same groups, so I don't get it.

Offline

#15 2015-10-08 21:15:37

dominic7il
Member
Registered: 2013-12-20
Posts: 18

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

Ok I finally got this working - it's not a clean a solution as I would have liked but it works nonetheless. So firstly it turns out dbus isn't started with the default kodi session file - hence why gvfs-mount wouldn't detect the drive at all. Secondly gvfs on it's own does not automount disks, it's the desktop environment detecting the disks and passing the path to gvfs-mount.

So I found this python script:
https://github.com/xenomachina/gvfs-automount

Which will listen for new disks and pass them over to gvfs mount; I had to remove the block of code that triggers notifications as it screwed up the display when running kodi. I placed the script in the kodi user's home directory and made it executable.

I then created a .profile script within the same directory to launch the script via dbus-launch, which solved the dbus issue as well. The resulting script looked like this:

#!/bin/bash
dbus-launch --exit-with-session  /storage/.gvfs_automount.py >/dev/null &

Since this is only for the one user it works fine, when I'm in the desktop environment I just let that handle mounting instead. So yeah this was a real pain in the a** and it's not a clean solution - I would have liked a systemwide daemon to handle this for every user; but it works!

Last edited by dominic7il (2015-10-09 10:21:08)

Offline

#16 2015-10-09 09:51:14

Chazza
Wiki Maintainer
Registered: 2013-06-02
Posts: 506

Re: [SOLVED] Automounting with devmon interferes with XFCE Options

Glad you managed to get some sort of fix together, even if you're not completely happy with your solution.  Don't forget to mark as solved if there are no further issues.

Last edited by Chazza (2015-10-09 09:54:14)

Offline

Board footer

Powered by FluxBB