Skip navigation.

HAL and ROX (auto-detecting USB sticks, etc)

strict warning: Only variables should be passed by reference in /home/tal/rox/htdocs/desktop/modules/book/book.module on line 559.


With httpHAL and httpIvman and httppmount,
you can have devices like CD-ROMs and USB flash sticks be automatically mounted and added to your panel. When you unmount it the mountpoint will be removed from your panel.


The following was tried with Udev 070, HAL 0.5.4, DBus 0.50, Ivman 0.6.4, and pmount 0.9.3.
We are going to set things up so that Ivman is run as root and handles the automounting under /media , with the help of pmount.
Then users can run their own instances of Ivman too, to handle desktop specific stuff (like adding devices to the panel).

  • Make sure there is nothing in /etc/hal/device.d that does any mounting, becouse we want ivman to handle the mounting!
  • Patch pmount to check for group. http This way users can unmount the devices even though it was mounted by the root ivman.
  • Make sure there is a haldaemon system group and user, and a plugdev group. Add all users that should be able to access and unmount removable media to the plugdev group. Note that users must log out and in again for the group changes to take effect
  • Make sure the DBus system bus is started:
dbus-daemon --system
  • Make sure that /media (or whatever is configured) is existing, or else create it.
  • Start HAL as root:
hald --daemon=yes --retain-privileges
  • Start Ivman as root:

NOTE: If all this works, don't forget to check that dbus, hald and ivman is started as above in your bootscripts...

  • Make sure Ivman is started as your user too: Add this script in your Auto Start folder:
exec 1>&2
echo -n "Launching volume manager... "
if ps -C ivman -o user | grep -q $USER
  echo "Already running."
  echo "OK"
  exec ivman
  • Disable mounting with usermode ivman, or else there will be problems if more than one user is logged in and running ivman at the same time... We want the root ivman to handle mounting. In ~/.ivman/IvmConfigActions.xml, comment out this section:
    <ivm:Match name="ivm.mountable" value="true">
        <ivm:Option name="mount" value="true" />


Ivman rules to add devices to your panel

  • For this to work, HAL needs this small patch applied:
--- hal-0.5.4/hald/linux2/blockdev.c    2005-08-10 06:05:58.000000000 -0300
+++ hal-0.5.4-lijon/hald/linux2/blockdev.c      2005-10-21 19:15:28.000000000 -0200
@@ -202,7 +202,7 @@

        device_property_atomic_update_begin ();
        hal_device_property_set_bool (d, "volume.is_mounted", FALSE);
-       hal_device_property_set_string (d, "volume.mount_point", "");
+//     hal_device_property_set_string (d, "volume.mount_point", "");
        device_property_atomic_update_end ();

        HAL_INFO (("Clearing mount point for %s", device_file));
  • Create a script named ~/bin/rox.panelput and make it executable:
### Change "Top" below to the panel you want your devices on...
rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="">
 <env:Body xmlns="">

  • And here comes the ivman rule, which should be inserted in your ~/.ivman/IvmConfigProperties.xml
    <ivm:Match name="ivm.mountable" value="true">
        <ivm:Property name="hal.volume.is_mounted">
          <ivm:Action value="true" exec='rox.panelput Add "$hal.volume.mount_point$"' />
          <ivm:Action value="false" exec='rox.panelput Remove "$hal.volume.mount_point$"' />

A nice ~/bin/eject script:

This lets you unmount your media and also FUSE mountpoints with the Eject entry on the ROX-Filer file menu.
Don't forget to make the script executable.

pumount "$1" 2>/dev/null || fusermount -u "$1" 2>/dev/null ||
echo "Could not unmount with pumount or fusermount -u" >&2

More patches

Spaces in mountpoint names

Ivman 0.9.3 has the problem that mountpoints are not enclosed by quotes when passed as arg to pmount. So if a inserted media has spaces in the desired mount point, pmount will fail! look in ivmans src/manager.c:619 and put \" around the $hal.volume.desired_mount_point$ thing...

Better mountpoint names

At least for me, my CD-ROM's got mounted as /media/hde and stuff like that, this patch to /usr/share/hal/fdi/policy/10osvendor/10-storage-policy.fdi fixed it so that media is mounted with the volume label as mountpoint:

--- /System/Links/Shared/hal/fdi/policy/10osvendor/10-storage-policy.fdi        2005-10-21 19:18:07.000000000 -0200
+++ /System/Settings/hal/fdi/policy/10-storage-policy.fdi       2005-10-22 13:12:44.000000000 -0200
@@ -96,8 +96,7 @@
     <match key="block.is_volume" bool="true">
       <match key="volume.fsusage" string="filesystem">
        <!-- skip for drives with the no partitions hint (they are handled above) -->
-       <match key="@block.storage_device:storage.no_partitions_hint" bool="false">
+<!--   <match key="@block.storage_device:storage.no_partitions_hint" bool="false"> -->

          <merge key="volume.policy.should_mount" type="bool">true</merge>
          <merge key="volume.policy.mount_filesystem" type="copy_property">volume.fstype</merge>

@@ -173,7 +172,7 @@
              <merge key="volume.policy.should_mount" type="bool">true</merge>

-       </match>
+<!--   </match> -->

Good luck!

Syndicate content