05 August 2008

automounting - part 2

Here is a brief (!) summary of the problems I encountered in setting up automounting in SkinnyDebbie and what I did to get it to behave. The whole process relies on hal and ivman. Maybe there is a better way to do this; if so I would love to learn how.

In no particular order ...

If media is present when user starts machine, the media automounts under ivman's account, and then a regular user can't unmount it.

Solution:
  • Disable ivman daemon so that the ivman user doesn't do any mounting:
    # update-rc.d -f ivman remove
  • Start ivman under the user's account at login so the regular user can mount via ivman.
In other words, have ivman run as user and do not have it run as ivman (which is what the daemon makes happen). The major consequence of this approach is that it will only work if one user at a time is logged into the machine or only one user at a time is authorized to use automounting.

Turning off the ivman daemon is handled by the SkinnyDebbie installer. I wrote a custom script (start-ivman) to handle user startup that checks the above at IceWM startup. I also wrote a control panel widget that repairs the above if it breaks (e.g., after an ivman package update).

The default SkinnyDebbie behavior is that automounting will be started for the first user that is logged in and not for subseqent users until the first user logs off. In practice this is fine because SkinnyDebbie is intended for single-user logins. The start-ivman script warns the user if someone else is already using automounting.

Not all media automounts, USB hard drives in particular

Solution:
These are done automatically by the SkinnyDebbie installer, except for removing CDROM and DVD links from /. The repair control panel applet also removes directories in /media that do not appear in /etc/fstab.

It's not at all obvious to the regular user where/when removable media is inserted

Solution:
  • Edit ~/.ivman/IvmConfigActions.xml so that:
    ROX-Filer announces the insertion of media and prompts the user for desired action (e.g., open /media directory, launch CD ripper, etc.)
    ivman scans on init
  • Add /media link to the desktop
  • Add /media link to Rox's bookmarks
  • Add /media link to IceWM's "start" menu
SkinnyDebbie's ~/.ivman/IvmConfigActions.xml is configured to handle CD-ROM, CD-Audio, DVD-video, and USB-based storage devices. At the present time I don't know what it will do with other removable media ( e.g., Compact Flash). It will also scan on init.

There are several custom "annc" scripts (anncRoxMedia, anncCDDA, anncDVDvideo) that get called per media type. These scripts check to see if ROX's pinboard is running; if it is, then it will announce the insertion of media. The IceWM startup delays the start of ROX's pinboard by a few seconds so that the user doesn't get bombarded with media announcements when logging in.

If user logs off without unmounting stuff, the folders remain in /media but the media is not mounted

Solution:
  • Write script pumountall that pumounts everthing and use it to unmount everything at logoff (via ~/.icewm/shutdown).

User needs guidance in good habits (i.e., unmount before remove)
Solution:
  • Write script pumount-fb, which does pumount with GUI feedback.
  • Tell ROX-Filer to use script pumount-fb to unmount.

CD and DVD media don't mount ... ever
See "Not all media automounts, USB hard drives in particular" above.

No comments: