# Automount removable devices without hal

## kingfame_147

Hi,

as of xorg-server-1.8.0 I removed hal from my system (never liked it mutch, and hal isn't developed anymore).

I allways used "halevt" for automountig usb sticks, cameras, mobiles etc.

How u guys do that without hal? Is there a good solution with udev?

I don't want to mount only specific devices with 2-3 udev rules. I need a way to mount any remv. device :)

Regards,

fame

----------

## dalek

Have you looked into ivman.  I'm not sure but I think it does what you want.  

 :Very Happy: 

----------

## kingfame_147

No, it is based on HAL :/

----------

## dalek

Well, it won't be for long.  Hal is going out soon.  I don't recall it using hal a while back tho.  I guess it got snuck in somehow.  

Maybe this will work.

 *Quote:*   

> root@smoker ~ # eix autofs
> 
> * net-fs/autofs
> 
>      Available versions:  3.1.7-r5 ~3.1.7-r6 4.1.3-r7 ~4.1.3-r9 5.0.3-r6 ~5.0.4 ~5.0.4-r2 ~5.0.4-r3 ~5.0.4-r4 ~5.0.4-r5 {ldap sasl}                                                                                                                         
> ...

 

I don't think it uses hal.  

 :Very Happy:   :Very Happy: 

----------

## kingfame_147

I thought about that autofs stuff, too. I'm not quite sure if it doe's what I need, but i'll take a closer look at it.

Thanks :)

----------

## yzg

If you are using KDE, the device notifier widget will do the mounting for you.

----------

## dalek

If he has removed hal, I don't think he has KDE.  I'm pretty sure KDE depends on hal being there since pmount requires it.  It does here but maybe I have some weird USE flag set somewhere.

 :Very Happy:   :Very Happy: 

----------

## SamuliSuominen

 *yzg wrote:*   

> If you are using KDE, the device notifier widget will do the mounting for you.

 

not without hal... everything in kde that's hardware specific relies on HAL

----------

## kingfame_147

Hehe, yeah,  no KDE here.

Act. I'm using fluxbox.

If autofs isn't what I'm looking for maybe i'll just wait until hal is gone and use a new mechanism :D

----------

## SamuliSuominen

 *kingfame_147 wrote:*   

> Hehe, yeah,  no KDE here.
> 
> Act. I'm using fluxbox.
> 
> If autofs isn't what I'm looking for maybe i'll just wait until hal is gone and use a new mechanism 

 

You could try "uam", see here: https://bugs.gentoo.org/show_bug.cgi?id=278363 and here http://proj.mgorny.alt.pl/uam/

----------

## kingfame_147

Sounds great. I'll have a look at it when I'm at home again.

----------

## M

 *Quote:*   

> You could try "uam", see here: https://bugs.gentoo.org/show_bug.cgi?id=278363  and here http://proj.mgorny.alt.pl/uam/

 

Great, I just tried it, works perfectly, too bad it can't mount cds but I rarely use it and when I do I can mount cd manually. I used skvm before, from suckless project but that also uses hal.

----------

## kingfame_147

Well, for CDs u can easly use the fstab, or why u didn't want to use that?

----------

## M

Well, it doesn't make any difference if I will type mount /dev/sr0 /mnt/cdrom or just mount /mnt/cdrom , I can assign some shortcut for that, but I didn't bother because as I said lately I rarely use them.

----------

## kingfame_147

If u use the auto-option u just have to 'cd' in that folder, don't u?

----------

## M

I think auto will work just when you turn on computer and all fstab lines are processed and you have disk inside, not later on, for something like that you use autofs. But maybe I am wrong... I remember automounter from mandrake linux worked like that but now with hal polling is used so every n seconds drive is polled for status.

Edit: now I remembered what I also used before, you have some nice settings in /proc/sys/dev/cdrom, you can echo commands or add them in /etc/sysctl.conf, I used lock 0 and wm shortcuts for mount cdrom and sys-apps/eject, you only have to know if app is capable to handle force eject but that is up to you and your usage, so you can use happily http://proj.mgorny.alt.pl/uam/ , those are just udev rules with some nice shell scripts to handle all usb sticks, there is no daemon. Then just set some shortcuts for mount/umount/eject cdrom... It is a little stupid to have daemon to always poll for this info (for laptop especially), but udev also doesn't export this info so for fluxbox, openbox or similar uam and some shortcuts seems like a good combination.Last edited by M on Wed Apr 21, 2010 8:46 pm; edited 1 time in total

----------

## dalek

Well, you do have another option.  It is what is replacing hal anyway.  There are two entries and I am not sure which you will need.  Here they are:

 *Quote:*   

> * sys-auth/polkit
> 
>      Available versions:  ~0.96 ~0.96-r1 {debug doc examples expat nls pam}
> 
>      Homepage:            http://hal.freedesktop.org/docs/PolicyKit
> ...

 

They both have the same link to their home page, they both have the same description as well.  Sort of weird.  It may be worth a look since things are going that way anyway.

 :Very Happy:   :Very Happy: 

----------

## kingfame_147

CD support is planed for UAM for the 0.4 release :)

I use cd-roms once in 2 months, nothing important for me.

@dalek

What does the policykit have to do with automounting removable devices?

BTW:

UAM works great. Thats exactly what i wanted: An easy and leightweigth solution with udev, thx for the hint!

----------

## dalek

 *kingfame_147 wrote:*   

> 
> 
> @dalek
> 
> What does the policykit have to do with automounting removable devices?
> ...

 

I was thinking that it would automount your devices.  I have not read up on it yet so it may not do that at all.  It is what is replacing hal tho.  

 :Very Happy:   :Very Happy: 

----------

## M

Actually udisks is replacing hal, PolicyKit was/is used also with hal, they also changed names and confused everyone, as I understand PolicyKit is now polkit, devkit is renamed to udisks, consolekit is still consolekit I guess etc.

So after all these years we still have no standard way of mounting removable devices   :Laughing:  I will stick to uam and ignore all others.

----------

## dalek

Actually, devicekit is replacing hal according to the home page.  The names have changed so much that who knows what it will be in the end.    :Laughing: 

Just stick with what works.  When that stops working, try something else.  That's what I usually do.

 :Very Happy:   :Very Happy: 

----------

## discomfitor

 *M wrote:*   

> Actually udisks is replacing hal, PolicyKit was/is used also with hal, they also changed names and confused everyone, as I understand PolicyKit is now polkit, devkit is renamed to udisks, consolekit is still consolekit I guess etc.
> 
> So after all these years we still have no standard way of mounting removable devices   I will stick to uam and ignore all others.

 

Close.  Devicekit was a daemon which was going to run in the same way as HAL.  It has been deprecated in favor of udisks+upower, both of which are activated through dbus calls and managed through permissions granted through policykit.

As of now, the only desktops that can use udisks/upower are gnome and e17, and there are very few cmd apps that can make use of them.  This does not, however, mean that they are not fully functional.

----------

## dalek

I was going by what the home page says.  From my understanding the same person wrote both hal and policykit or whatever they are calling this week.  

 :Very Happy:   :Very Happy: 

----------

## SamuliSuominen

1. udiskie, sys-fs/udiskie in Portage. udisks based automounter. python.

2. wmudmount, x11-plugins/wmudmount in Portage. udisks based dockapp.

3. traydevice, sys-fs/traydevice in Portage. udisks based trayicon. python.

4. udisksevt, haskell(!) based, http://github.com/dpx-infinity/udisksevt

5. package.masked thunar+thunar-volman (using gvfsd+udev+gnome-disk-utility)

6. pcmanfm (using gvfsd or later versions, like git, using udisks)

7. uam (based only on udev), in Gentoo bugzilla, https://bugs.gentoo.org/278363

8. nautilus, of course with gvfsd+udev+and co.

9. ???

I hope that helps.

----------

## kingfame_147

10. profit :)

Thanks again. I'm using uam since the time I started the topic and it's working great :)

Btw: The uam homepage seems to be down. Bad that such a good approach will not be developed anymore :<

----------

## M

 *Quote:*   

> Btw: The uam homepage seems to be down. Bad that such a good approach will not be developed anymore :<

 

Nope, look here http://github.com/mgorny/uam/ . Also, uam developer will soon be a gentoo developer  :Wink: 

----------

## kingfame_147

Ah, ok :) I downloaded it from his website in the past. And that site is down right now. Thanks for the hint!

----------

## madness465

Hi there,

i have more general question concerning udev and automount and hope this question doesnt go to much away from original topic.

i am bit confused with all the new stuff around udev.  i dont have hal anymore. all strength to get my udev automounting working steams anywhere. 

You mentioned programms like uam and udiskie and i tried a lot of things.

Which daemons have to run when i have just udev only system. which automount programs are recommended and how do i have to start them.

for example i have udev-postmount running and before my openbox starts i start udiskie like this: udiskie & and my /media folder is still empty

what do i wrong, sorry when that sounds all nooby but all that udev stuff and rules etc. i am little bit overstrained

thanks a lot

----------

## kingfame_147

Well I never used udiskie, so I can't help you there.

I am using uam. That are just some udev rules (and small scripts) which do the work for you :)

If you want to use uam you just have to install it, that's all. Ok, you should look at the config file and change some settings if you want too.

I found a small tutorial for udiskie: https://wiki.archlinux.org/index.php/Udiskie

Seems to be no big thing. 

I'll stay at uam for now because it's a really simple and lightweight solution because it only needs udev.

----------

## madness465

Hi there!

Thank you for your response!

I now installed uam, but i am not finding for example my ipod or usbstick in any common directory mountet. I seeked for some information about uam but i didnt find anything. So do you know what i am missing. I looked in the directories /media and /mnt is there an other directory where it will be mounted. Or are there any special daemons which have to run. For my udev configuration i just used the offical gentoo udev howto.

Thank you again

Greetings

----------

## netguy

 *madness465 wrote:*   

> Hi there!
> 
> Thank you for your response!
> 
> I now installed uam, but i am not finding for example my ipod or usbstick in any common directory mountet. I seeked for some information about uam but i didnt find anything. So do you know what i am missing. I looked in the directories /media and /mnt is there an other directory where it will be mounted. Or are there any special daemons which have to run. For my udev configuration i just used the offical gentoo udev howto.
> ...

 

Do you emerge pmount ?

----------

## madness465

Hi there,

no i didnt had but now i did but it dont work, either. There shouldnt be a daemon running, should there?

----------

## swimmer

Did you restart udev?

----------

## madness465

I had some reboots since then so udev should be restarted.

----------

## dusik

 *madness465 wrote:*   

> I now installed uam, but i am not finding for example my ipod or usbstick in any common directory mountet.

 

I had the same problem -- when I plugged in a USB stick nothing was mounted.  Turns out I had to remove a conflicting line from my /etc/fstab file, which specified a mount point for /dev/sdd1.  I have permanent storage drives at sda-sdc, so the first external volume always gets sdd.

In other words, check your /etc/fstab file and make sure you have no entries for volumes you want uam to auto-mount.

----------

## hoaoaihuong

I'm a newcomer..all of these are useful information.

----------

## madness465

Hi dusik,

my /etc/fstab is clean i am just using some sda and cdrom mount points.

----------

## Beetle B.

AARGH!!

I'm using uam. Note that udev as a service is not running, yet udevd is. What in my system config is starting it up?

Anyway - that was a side question. The real question I have is: How can I get uam not to automount a certain USB device? I just want to disable automounting that device. All udev rules I've written seem to have no impact!

Ideas?

----------

## M

Beetle B.

Did you change 80-uam.rules file? Maybe you can try to change line for usb and add something like this:

ATTRS{model}!="Your USB device"

Not sure if negative != works but I think it should...

----------

## Beetle B.

I tried that, and it didn't work. 

Specifically, I changed it from 

```

SUBSYSTEM=="block", ACTION=="add", SUBSYSTEMS=="usb", ENV{ID_FS_USAGE}=="filesystem", RUN+="/lib64/udev/uam/uam-mount.sh"

```

to 

```

SUBSYSTEM=="block", ACTION=="add", SUBSYSTEMS=="usb", ATTRS{serial}!="0123456789012345", ENV{ID_FS_USAGE}=="filesystem", RUN+="/lib64/udev/uam/uam-mount.sh"

```

Yes, != should work, according to the udev man page.

----------

## kingfame_147

 *madness465 wrote:*   

> Hi dusik,
> 
> my /etc/fstab is clean i am just using some sda and cdrom mount points.

 

Could you post your dmesg output after plugging in a device that isn't mounted.

Are you able to mount those devices by hand?

----------

## madness465

Hi kingfame,

yes i am able to mount all the devices manually.

Here is the dmesg output for a usb samsung storage:

```

[ 5123.456056] usb 2-4: new high speed USB device using ehci_hcd and address 4

[ 5123.507274] ehci_hcd 0000:00:1d.7: port 4 high speed

[ 5123.507287] ehci_hcd 0000:00:1d.7: GetStatus port 4 status 001005 POWER sig=se0 PE CONNECT

[ 5123.572792] usb 2-4: default language 0x0409

[ 5123.575172] usb 2-4: udev 4, busnum 2, minor = 131

[ 5123.575178] usb 2-4: New USB device found, idVendor=040d, idProduct=6204

[ 5123.575185] usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3

[ 5123.575191] usb 2-4: Product: USB 2.0 IDE Bridge

[ 5123.575198] usb 2-4: Manufacturer: VIA Technologies Inc.

[ 5123.575204] usb 2-4: SerialNumber: 000000000001

[ 5123.575381] usb 2-4: usb_probe_device

[ 5123.575390] usb 2-4: configuration #1 chosen from 1 choice

[ 5123.575710] usb 2-4: adding 2-4:1.0 (config #1, interface 0)

[ 5123.575798] usb-storage 2-4:1.0: usb_probe_interface

[ 5123.575811] usb-storage 2-4:1.0: usb_probe_interface - got id

[ 5123.576058] scsi6 : usb-storage 2-4:1.0

[ 5123.576392] drivers/usb/core/inode.c: creating file '004'

[ 5129.927322] scsi 6:0:0:0: Direct-Access     SAMSUNG  SP2514N          VF10 PQ: 0 ANSI: 2

[ 5129.927692] sd 6:0:0:0: Attached scsi generic sg2 type 0

[ 5129.929524] sd 6:0:0:0: [sdb] 488397168 512-byte logical blocks: (250 GB/232 GiB)

[ 5129.930041] sd 6:0:0:0: [sdb] Write Protect is off

[ 5129.930049] sd 6:0:0:0: [sdb] Mode Sense: 00 00 00 00

[ 5129.930054] sd 6:0:0:0: [sdb] Assuming drive cache: write through

[ 5129.931397] sd 6:0:0:0: [sdb] Assuming drive cache: write through

[ 5129.931404]  sdb: sdb1

[ 5129.938119] sd 6:0:0:0: [sdb] Assuming drive cache: write through

[ 5129.938122] sd 6:0:0:0: [sdb] Attached SCSI disk

```

Thank you.

----------

## madness465

Hi again,

i now looked again into the my media file directory, without changing anything on my system and after a lots of reboots and now suddenly i find my devices mounted. I really dont get that. I hope i find the course of this for posting.

Sorry for wasting your time.

----------

## tuber

Besides autofs, can any of other options automatically unmount the filesystems? That is, I want to be able to plug in a USB drive, copy some files over, then when the write light goes off, just pull the drive out without manually unmounting.

----------

## M

tuber

don't know about other options, but I never manually umount usb, I just copy some files, enter sync in terminal and pull the drive, uam will notify about unmount and clean mount dir. Never had problems.

----------

## the_mgt

 *tuber wrote:*   

> Besides autofs, can any of other options automatically unmount the filesystems? That is, I want to be able to plug in a USB drive, copy some files over, then when the write light goes off, just pull the drive out without manually unmounting.

 

Iirc, autofs only mounts a dir as long as it is used and a few seconds more. So it should be autounmounted shortly after finishing copying. And even if pwd is  still the mounted dir.

I used it long ago when I didnt have desktop icons, until I switched to hal because that was more convenient and e17 started to have icons on desktop. (And it still is more convenient, since I cant get udisks-daemon to autostart...)

----------

## 22decembre

anyone knows here where to find a good and simple tutorial in order to name my (our) removable devices ?

Right now, all the things I found about udev rules are really non-understandable !

Hal was maybe crap (don't know and don't care !), but it was easy to mount your device with a pretty name !

----------

## Gusar

Why don't you just stick with HAL? It still works. If the apps you used have moved on from HAL to udisks, they should still provide mounting with pretty names. All you have to do is make sure udisks works. There's documentation for that somewhere.

----------

## 22decembre

I haven't removed hal... so, I can make what you said. But I don't know if my current kde release still rely on hal !

I care also of the day where it won't be possible to do that. And I think it can happen fast, as even software with slow dev cycle have began to switch off from hal (I speak here of synce) !

What is udisk in fact ? Is it a daemon, like hal ? Or it's more close to the kernel, like udev ?

----------

## Gusar

udisks works on top of udev. Yeah, it's a daemon, which loads automatically when an app uses it. KDE 4.6 has support for it, earlier KDEs support only HAL.

----------

## kingfame_147

 *22decembre wrote:*   

> anyone knows here where to find a good and simple tutorial in order to name my (our) removable devices ?
> 
> Right now, all the things I found about udev rules are really non-understandable !
> 
> Hal was maybe crap (don't know and don't care !), but it was easy to mount your device with a pretty name !

 

Just use UAM which is mentioned in this thread :) It does mount the devices with a pretty name (like the label of the filesystem). There is no need for a tutorial, just install uam :)

----------

## 22decembre

does it work with kde and without any command line ?

without this two points, no way !

by the way, how to create a label for a usb key (for exemple) ?

----------

## kingfame_147

It does work with every windowmanager. It just needs udev. You don't need any command line.

It depends on the filesystem. If you create e.g. fat32, just use 

```
mkfs.vfat -n $name $device
```

. That is for the command line, I don't use any kind of gui, sorry :)

----------

## 22decembre

actually, my fat32 usb key doesn't like label like this !

A software is even saying me that "this filesystem doesn't support label"...

----------

## kingfame_147

Sorry, I can't help you with that problem.

If I'm using vfat I'm using labels this way, and it allways worked for me with every device I tried.

----------

