I hate udev. It does not work in settings very crucial and important to me (ldap-nss) and it's a huge step back from hotplug in terms of useful functionality. Stupid complicated config environment, bloated and it does not load modules on demand. Dear udev authors: you can keep that crap and i'll stick to what works, is small and almost semi-elegant: hotplug.

So, on my machines there is hotplug and no udev (and, of course no dbus or hal, because they're bloat-squared IMNSHO). But how about one of the main bennies of the hal+udev frankenstein combo, which is handling of removeable storage devices? Easy, says I.

Using just hotplug this is not hard to achieve, only the standard hotplug package doesn't come with such functionality. So here's my block-device hotplug agent, which automounts and umounts devices when they're plugged in or pulled (not that you shouldn't unmount manually).

This block device handler needs to be told what devices should be auto-mounted, and who should own the stuff (necessary for VFAT filesystems which don't support file ownership). It supports wildcards and defaults, and can be told to leave things alone (for stuff where I do have an explicit fstab entry).

Simple, trivial, sufficient. The only wrinkle is that unmounting as a normal user doesn't work because there is no entry in /etc/fstab: the workarounds for this are either to install pmount or to use sudo (sudo without authentication for /bin/umount is easy:

%staff ALL=(ALL) NOPASSWD: /bin/umount

adds that for members of group staff).

Plop the block.agent and the example block.settings in /etc/hotplug, add execute perms to the agent, modify the settings file to your heart's delight and you're set. Share and enjoy!

[ published on Mon 18.08.2008 14:40 | filed in interests/comp | ]
Debian Silver Server
© Alexander Zangerl