You are not logged in.

#51 2011-02-14 00:52:59

ninian
Member
From: United Kingdom
Registered: 2008-02-24
Posts: 726
Website

Re: devmon - bash udisks automounting & autostarting

@IgnorantGuru:
Thanks for the detail of your reply - it helps to explain what's happening.
Will look into the photo frame (if you excuse the pun) a bit more ...

Offline

#52 2011-02-14 14:51:35

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: devmon - bash udisks automounting & autostarting

devmon 0.9.5 should successfully mount troublesome devices that aren't normally identified as containing a filesystem.  It also now ignores a trailing slash on manual mount and unmount commands.

Offline

#53 2011-02-14 17:23:44

ninian
Member
From: United Kingdom
Registered: 2008-02-24
Posts: 726
Website

Re: devmon - bash udisks automounting & autostarting

IgnorantGuru wrote:

devmon 0.9.5 should successfully mount troublesome devices that aren't normally identified as containing a filesystem.  It also now ignores a trailing slash on manual mount and unmount commands.

Bravo! 0.9.5 works well with my mysterious photo frame device, and trailing slashes on mountpoints are happy too.
I think you have provided a very valuable utility for Arch with devmon; all your hard work is much appreciated here.
smile

Offline

#54 2011-02-14 20:39:09

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: devmon - bash udisks automounting & autostarting

Thanks too for your feedback and details - you and the others here have been very helpful in taking it the extra distance.

Also to Sirsurthur:  Floppy drives have no media detection as far as I can see, so automounting is not feasible.  I think your best bet are keyboard shortcuts to:

devmon --mount /dev/fd0
# and
devmon --unmount /dev/fd0

Offline

#55 2011-02-15 06:43:03

Sirsurthur
Member
Registered: 2009-02-02
Posts: 124

Re: devmon - bash udisks automounting & autostarting

Thanks for your answer IgnorantGuru !

devmon --mount /dev/fd0 works great so it's not an issue for me !

Offline

#56 2011-02-15 15:38:04

ninian
Member
From: United Kingdom
Registered: 2008-02-24
Posts: 726
Website

Re: devmon - bash udisks automounting & autostarting

Kind of off-topic I know, but I thought it might be useful to mention a script udsks I wrote for manually mounting and unmounting removable media via udisks, adapted from the Bash script by some-guy94. Some of the users I support prefer automounting, some don't, so it's good to have devmon versus a manual alternative!
cool

Offline

#57 2011-02-16 12:13:16

BabyDoc
Member
Registered: 2008-03-20
Posts: 76

Re: devmon - bash udisks automounting & autostarting

Would it be possible to add an option to display notifications when (un)mounting devices. Not with zenity but using notify-send. I like to have some notification when such events occur but I am not really a fan of zenity because using notify-send fits better in the overall setup of my system. Currently I have adapted the script myself in a quick and dirty way to get this functionality, but doing this every time you update it seems a bit stupid to me.

Offline

#58 2011-02-16 13:29:15

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: devmon - bash udisks automounting & autostarting

devmon 1.0.0 is available, which adds an --unmount-recent option to unmount the most recently mounted removable drive.  It also adds mount info from udisks to stdout, and slightly improves the way devices which don't report a filesystem are handled.

Last edited by IgnorantGuru (2011-02-16 13:49:51)

Offline

#59 2011-02-16 13:43:24

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: devmon - bash udisks automounting & autostarting

BabyDoc wrote:

Would it be possible to add an option to display notifications when (un)mounting devices. Not with zenity but using notify-send. I like to have some notification when such events occur but I am not really a fan of zenity because using notify-send fits better in the overall setup of my system. Currently I have adapted the script myself in a quick and dirty way to get this functionality, but doing this every time you update it seems a bit stupid to me.

Not sure what you mean by "when (un)mounting devices".  When automounting, you should be able to use an --exec-on-XXX option to update notify-send, traymanager, etc.  There is no auto-unmounting (from the daemon mode).  As for manual mounts and unmounts, whatever script or keyboard shortcut issues the command "devmon --(un)mount..." should also be able to manually update notify-send, etc.  Could you explain where you're modifying the script or what specific events you're looking to execute a command on?

Zenity was just a minor convenience.  While I'm not too keen on natively supporting multiple notification apps (everyone has their favorite), I would consider adding --exec-on-XXX type hooks so users can issue the commands they want on various events.  But for manual mounting and unmounting, I'm not sure why this would be required, and devmon already provides this ability for automounts.

Offline

#60 2011-02-16 15:51:57

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: devmon - bash udisks automounting & autostarting

@BabyDoc
For mounting 'pop-up' you can use simle notify-send script (which can be autostarted) eg:

#!/bin/sh
killall 'devmon udisks' &
sleep 10
devmon --exec-on-drive "notify-send --icon='block-device' --urgency='low' 'Disc has been mounted' && thunar /media"

ps. I don't know bash - could you tell me how to tell the script to show disc label in pop-up and start thunar directly in mounted folder?


Lenovo G50 | LXQT-git | compton | conky

Offline

#61 2011-02-16 17:41:40

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: devmon - bash udisks automounting & autostarting

nbvcxz wrote:

@BabyDoc
For mounting 'pop-up' you can use simle notify-send script (which can be autostarted) eg:

#!/bin/sh
killall 'devmon udisks' &
sleep 10
devmon --exec-on-drive "notify-send --icon='block-device' --urgency='low' 'Disc has been mounted' && thunar /media"

ps. I don't know bash - could you tell me how to tell the script to show disc label in pop-up and start thunar directly in mounted folder?

With devmon you can do that with %d=mount point, %l=label, %f=device, and you can use two --exec-on-drive options since they don't need to be executed sequentially.  Since %l is passed by devmon in single quotes, I'm changing your single quotes to escaped quotes:

devmon --exec-on-drive "notify-send --icon=block-device --urgency=low \"Disc %l has been mounted\"" \
       --exec-on-drive "thunar %d"

Also, your killall 'devmon udisks' will attempt to kill a single program named 'devmon udisks', so you don't want to quote that.  eg

#!/bin/sh
killall devmon udisks
sleep 10
devmon --exec-on-drive "notify-send --icon=block-device --urgency=low \"Disc %l has been mounted\"" \
       --exec-on-drive "thunar %d" &

Ideally killall devmon should be sufficient, but if you don't have any other udisks stuff running, it doesn't hurt to kill that just in case.

Last edited by IgnorantGuru (2011-02-16 17:50:30)

Offline

#62 2011-02-16 19:21:53

BabyDoc
Member
Registered: 2008-03-20
Posts: 76

Re: devmon - bash udisks automounting & autostarting

IgnorantGuru wrote:

Not sure what you mean by "when (un)mounting devices".  When automounting, you should be able to use an --exec-on-XXX option to update notify-send, traymanager, etc.  There is no auto-unmounting (from the daemon mode).  As for manual mounts and unmounts, whatever script or keyboard shortcut issues the command "devmon --(un)mount..." should also be able to manually update notify-send, etc.  Could you explain where you're modifying the script or what specific events you're looking to execute a command on?

Zenity was just a minor convenience.  While I'm not too keen on natively supporting multiple notification apps (everyone has their favorite), I would consider adding --exec-on-XXX type hooks so users can issue the commands they want on various events.  But for manual mounting and unmounting, I'm not sure why this would be required, and devmon already provides this ability for automounts.

Yeah I knew I could add it to the script used for manually (un)mounting. But using the the --exec-on-XXX options to also achieve this when automounting did not occur to me for some reason. That's why I decided just to do everything in the devmon script itself. Anyway using --exec-on-device and some small modifcations to my pipemenu (I use openbox) gives me the desired result just as well.
Thank you both for the advice.

Offline

#63 2011-03-07 14:58:02

10098
Member
Registered: 2010-05-11
Posts: 40
Website

Re: devmon - bash udisks automounting & autostarting

Good job, IgnorantGuru! I've found your script to be very useful.
In case there are any openbox users here - I made a pipemenu that allows listing the currently mounted media and open it/unmount it from devmon. It can be found here: http://10098.arnet.am/posts/devmon-pipe … r-openbox/

UPD: I also added the unmount all/optical/recent commands to the pipemenu

Last edited by 10098 (2011-03-07 16:14:36)


:x

Offline

#64 2011-03-11 07:18:31

lasteffort
Member
Registered: 2011-03-11
Posts: 1

Re: devmon - bash udisks automounting & autostarting

I have a 'media-box' based on arch and was using Thunar for some time to auto-mount and auto-unmount CD/DVDs.  It was always a bit unreleaible and now it is not working at all.
There is no keyboard or mouse on the media box, it is using an regular infrared remote and a lircd daemon for user interface.

I have been experimenting with  devmon and it seems to be automounting very reliably, however it is not detecting when the DVD is removed.  I have been running devmon in the foreground on a console window to monitor its output.
From what I have read Googling about I am not sure if it is supposed to detect when the DVD has been removed. 

Will devmon automatically recognise and get rid of  the /media directory when the DVD is removed?

Or is this usually handled by the script(s) which were activated when the DVD was inserted into the drive?

Thanks

Offline

#65 2011-03-11 12:07:40

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: devmon - bash udisks automounting & autostarting

lasteffort wrote:

I have been experimenting with  devmon and it seems to be automounting very reliably, however it is not detecting when the DVD is removed.  I have been running devmon in the foreground on a console window to monitor its output.
From what I have read Googling about I am not sure if it is supposed to detect when the DVD has been removed.

It should detect when the disc is ejected and report that to stdout, but it only uses this to know enough to mount it when a disc is next inserted.  (Otherwise it would instantly re-mount any manual unmount, which is undesirable).  However, the cd or dvd folder in /media is not removed, unlike removable drives.  This is a feature/aspect of udisks and is not handled by devmon directly (when removable drives are unmounted, udisks removes their folder in media).

I think you would have trouble making it do so, as udisks is written this way.  So you would need to be root to remove that folder.  This is probably done this way because generally /media/cd is a permanent mount point.  It could also have something to do with your fstab - if /media/cd is defined as a mount point there, udisks may leave it alone.  You should be able to remove any optical drive references from fstab, then delete the mount point once as root, and this may change udisks behavior in this area (I haven't tried it like that).

Offline

#66 2011-05-14 02:29:04

mister.right
Member
Registered: 2011-05-14
Posts: 2

Re: devmon - bash udisks automounting & autostarting

IgnorantGuru, I want to thank you for providing this awesome program. You made my computing experience much better. You have my full support to continue your great work!!

Mister.Right

Offline

#67 2011-05-23 00:39:11

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: devmon - bash udisks automounting & autostarting

IgnorantGuru,

This seems to work well. I had some trouble getting it set up, but after smashing my head on my desk for a while, then with falconindy's suggestion from here:

https://bbs.archlinux.org/viewtopic.php … 27#p937827

then smashing my head against my desk for a little while longer, I got it fired up.

Thanks.

Offline

#68 2011-05-23 02:28:54

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: devmon - bash udisks automounting & autostarting

Maybe I have just missed it, but I start my WM as

devmon & 
exec i3

and I have never had problems with automounting of drives.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#69 2011-05-23 03:43:48

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: devmon - bash udisks automounting & autostarting

Inxsible wrote:

Maybe I have just missed it, but I start my WM as

devmon & 
exec i3

and I have never had problems with automounting of drives.

Both falconindy and I are using urxvtd, maybe that's the difference?

Anyway, the trick is to get consolekit and dbus-launch started, then devmon, then urxvtd, then the window manager. After he explained to me the order and before I realized devmon's place in that order, I tried launching devmon from a terminal inside of X just to test it and failed. To complicate things (in my head), I was expecting to see "echo $DBUS_SESSION_BUS_ADDRESS" return something, which never happened. I wasn't aware of the file under .dbus/session-bus being the default if the global variable wasn't set until today.

Offline

#70 2011-05-23 03:57:02

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: devmon - bash udisks automounting & autostarting

Maybe its urxvtd. Because I don't use it and so all my terminals start up only after my WM has started up thereby also starting devmon by then. I don't even have consolekit installed.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#71 2011-09-12 23:14:12

gfei
Member
Registered: 2011-09-12
Posts: 1

Re: devmon - bash udisks automounting & autostarting

I have what I hope is a quick question.  I'm trying to use devmon to launch a script when a DVD is inserted but I get the following error from devmon:


devmon: mount /dev/sr0 --mount-options noexec,nosuid,noatime    (ULTRVIOLET)
Mount failed: A job is pending on /dev/sr0
devmon: error mounting /dev/sr0 (0)

Can anyone make any suggestions as to what may be causing this?

Thanks

Offline

#72 2011-09-13 16:27:14

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: devmon - bash udisks automounting & autostarting

gfei wrote:

devmon: mount /dev/sr0 --mount-options noexec,nosuid,noatime    (ULTRVIOLET)
Mount failed: A job is pending on /dev/sr0
devmon: error mounting /dev/sr0 (0)

Can anyone make any suggestions as to what may be causing this?

FYI, that 'Mount failed' error is produced by udisks.  For troubleshooting, you can manually do what devmon does.  After the DVD is inserted:

udisks --mount /dev/sr0

I haven't encountered that "job is pending" though.  Perhaps the drive was not unmounted before it was ejected?  You can both unmount and eject the drive in one step using (convenient when assigned to a key shortcut):

devmon --eject /dev/sr0

Last edited by IgnorantGuru (2011-09-13 16:28:56)

Offline

#73 2011-10-23 00:23:37

Evilandi666
Member
Registered: 2010-10-28
Posts: 105

Re: devmon - bash udisks automounting & autostarting

Just wanted to say: Thx for your nice work, works like a charm!

Last edited by Evilandi666 (2011-10-23 00:23:47)

Offline

#74 2012-05-04 20:13:10

asd01
Member
Registered: 2010-12-19
Posts: 19

Re: devmon - bash udisks automounting & autostarting

Brilliant! Works flawlessly with CDs/DVDs (data and video!) and all USB disks! One question: how can I get it to mount audio CDs under /media? After inserting audio CD I'm getting:

changed:     /org/freedesktop/UDisks/devices/sr0
device: [/dev/sr0]
    systeminternal: [0]
    usage:          []
    type:           []
    label:          []
    ismounted:      [0]
    nopolicy:       [0]
    hasmedia:       [1]
    opticaldisc:    [1]
    numaudiotracks: [12]
    blank:          [0]
    media:          [optical_cd]
    partition:      [0]
devmon: audiocd /dev/sr0 ()

But there is nothing under /media or /mnt... Having them mounted under /media would be preferred method - this way I can listen to them in Clementine.

Offline

#75 2012-05-04 20:18:18

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: devmon - bash udisks automounting & autostarting

asd01 wrote:

One question: how can I get it to mount audio CDs under /media? ...there is nothing under /media or /mnt... Having them mounted under /media would be preferred method - this way I can listen to them in Clementine.

You can't mount an audio CD because they don't have a filesystem.

Does Clementine just need a link than points "/dev/cdrom" to "/dev/sr0"?

Offline

Board footer

Powered by FluxBB