Ivman
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
Goal
The goal of this article is to setup ivman to automount devices.
Please note: some of this information may be very out of date for older versions of ivman, especially ivman 0.5.x. Please use the most up-to-date Ivman marked stable in portage.
Required Software
All required packages are in the portage, so it's easy to obtain the software:
| Code: Installing ivman |
emerge -av ivman |
Unmask required packages if necessary.
If the HAL merge complains about "u64" or "BLKGETSIZE64" not being defined and you are using a 2.6 kernel, update your linux-headers:
| Code: Update linux-headers |
emerge --oneshot linux-headers |
As soon as the headers are successfully upgraded, remerge glibc:
| Code: Re-emerge glibc |
emerge --oneshot glibc |
Setting up
There are two ways to use Ivman: as root, or as a regular user. There are advantages and disadvantages to each method.
Starting ivman as root
- To start ivman, run: /etc/init.d/ivman start
- To make ivman start on every boot, run: rc-update add ivman default
- ivman drops privileges to user 'ivman' and group 'plugdev' when it starts. All subsequent commands are run from this user account.
- By default, removable drives will be mounted with read/write access to anyone in the 'plugdev' group (the group which users must be a member of to use pmount), and no access to anyone outside of this group. This is less secure than running Ivman as a regular user.
- Drives may be difficult to unmount as a regular user. You may need to use sudo pumount or sudo umount. Unmounting via the 'media:/' ioslave in KDE might not work.
- TIP: To umount as a regular user, you may also use a app-admin/sudo trick, to allow plugdev group members to use pumount. To do so, do # visudo and add the following line %plugdev ALL=/usr/bin/pumount /media/* to sudoers file. This will allow restricted users to run the command with restricted parameters.
- To unmount drives as a regular user:
- For versions of ivman upto 0.5.x, edit the file /usr/share/hal/fdi/policy/10osvendor/10-storage-policy.fdi, and change user to users in the line with <merge key="storage.policy.default.mount_option.user" type="bool">true</merge>. If you don't have that exact file, look for a similar file under the /usr/share/hal hierarchy.
- For versions of ivman later than 0.5.x, another instance of ivman must be run by the user in addition to the one run by root. This can be done by following the instructions below. If you are using pmount (which seems to be the default for 0.6.x atleast), use the pumount command instead of umount.
Starting ivman as a regular user
- First, you will need HAL running. As root, run: /etc/init.d/hald start
- To make HAL start every time you boot, run: rc-update add hald default
- To start ivman, simply run the 'ivman' command under your regular user account. To make Ivman start automatically when you log in, you can do one of:
- KDE: create a symbolic link to ivman in ~/.kde/Autostart: ln -s $(which ivman) ~/.kde/Autostart/ivman
- X: put ivman-launch --exit-with-session xinit & in ~/.xinitrc (requires Ivman 0.6.9 or later).
- E17: Create a ivman.eap (section GTK+ applications), and add it to ~/.e/e/applications/all/ . Then, edit ~/.e/e/applications/startup/.order and add ivman.eap
- Fluxbox: Edit ~/.fluxbox/startup and add ivman &
- WindowMaker: Edit your autostart script, usually found at ~/GNUstep/Library/WindowMaker/autostart (has to be executable) and add the line ivman & or run the command printf "ivman &">>~/GNUstep/Library/WindowMaker/autostart
- It is also possible to add Ivman daemon to your init scripts, so it can run as a regular user. Just copy following script and place it to your /etc/init.d directory under ivman-user and later:
| Code: Add ivman-user to start scripts |
rc-update add ivman-user default |
| File: /etc/init.d/ivman-user |
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/sys-apps/ivman/files/ivman-0.3.init,v 1.1 2004/10/19 17:15:33 eradicator Exp $
depend() {
need hald
}
start() {
ebegin "Starting Automounter (user)"
start-stop-daemon --background --start --chuid username --pidfile /var/run/ivman-user.pid --make-pidfile --exec /usr/bin/ivman > /dev/null
eend $?
}
stop() {
ebegin "Stopping Automounter (user)"
start-stop-daemon --stop --pidfile /var/run/ivman-user.pid
eend $?
}
|
- Others: please add your instructions here!
- Ivman runs under your user account.
- NOTE: you still have to belong to the plugdev group, but now devices are mounted so that only you have access (not the rest of the plugdev users, too)
- By default, removable drives will be mounted with read/write access for you, and no access for anyone else.
- Unmounting works as usual. Regular pumount will work. Unmounting via the 'media:/' ioslave in KDE works.
- It is possible - and in some cases necessary (to make automated umounting possible) - to run Ivman both as root and as a regular user. In this case, automounting will be done by the regular user instance of Ivman; once this Ivman exits, automounting will automatically fall back to the root instance. Do NOT run more than one instance of per-user Ivman, even under different user accounts - this will cause race conditions.
Ivman should not require any additional configuration for automounting. fstab entries are not required, and removable drives/disks will be mounted under /media. However, Ivman can be used to do much more than automounting. Feel free to add your extra rules to this page :-)
A Few Example Rules
Note: a couple of these just need to be uncommented in the file, but I figure it is nice to show the capabilities
Mount everything we can:
| File: /etc/ivman/IvmConfigActions.xml |
<ivm:Match name="ivm.mountable" value="true">
<ivm:Option name="mount" value="true" />
</ivm:Match>
|
A nice mounting script can be found in the article about UDEV. Here's how you can activate it:
| File: /etc/ivman/IvmConfigBase.xml |
<!-- mount command. default is autodetected. Must be specified with
umountcommand. -->
<ivm:Option name="mountcommand" value="mount-device.sh '$hal.block.device$'" />
<!-- umount command. default is autodetected. Must be specified with
mountcommand. -->
<ivm:Option name="umountcommand" value="umount '$hal.block.device$'" />
|
Open my mp3 player with mc when its plugged in:
| File: /etc/ivman/IvmConfigActions.xml |
<ivm:Match name="hal.info.product" value="IAUDIO">
<ivm:Option name="exec" value="xterm -e mc /home/share/music /media/IAUDIO" />
</ivm:Match>
|
Open my camera with mc when it's plugged in:
| File: /etc/ivman/IvmConfigActions.xml |
<ivm:Match name="hal.info.vendor" value="FUJIFILM">
<ivm:Option name="exec" value="xterm -e mc /home/share/pics /media/usbdisk/DCIM/100_FUJI" />
</ivm:Match>
|
This is helpful. I use it and I don't even have KDE. It pops up a little thing saying what device is plugged in.
| File: /etc/ivman/IvmConfigActions.xml |
<ivm:Match name="hal.info.category" value="storage">
<ivm:Match name="hal.storage.bus" value="usb">
<ivm:Option name="exec" value="kdialog --passivepopup 'USB storage device detected: $hal.info.vendor$ $hal.info.product$' 4" />
</ivm:Match>
</ivm:Match>
|
How to Make your own rules
There is probably a better way to do this, but this is what I did:
- Include the last example I put up there so that you computer tells you the name of the device
- then run the command lshal > halstuff
- use a text editor such as "vi" to find where the entry is
- find an original data item for the device (Notice that my examples above use different items. They aren't always consistent.)
- use the syntax in my examples above to come up with your own commands
Troubleshooting
Miscellaneous
HAL may require coldplug added to the boot runlevel in order to properly detect USB devices.
If you're having trouble getting the per-user ivman to automount your USB flash drive, you might need to add utf-8 support to your kernel. See this forum thread for details.
Using fstab entries (ivman 0.6.x or greater)
Ivman 0.6.x or greater uses pmount to mount your drives, and thus does NOT need any fstab entries. However, fstab entries may still be used if necessary, though you are suggested to avoid them when possible.
Special care must be followed with USB hard disk. For them to work well, init must be able to check them at boot time when needed. So, I recommand a fstab entry in this case.
pmount (and thus Ivman) will automatically respect your fstab entries. From version 0.6.0, even symbolic links are treated properly, without the use of IvmConfigMappings.xml. This means that any device present in your fstab, will not be created and mounted in /media.
Using fstab entries (ivman 0.5.x ONLY!)
Ivman 0.5.x still respects your /etc/fstab. If you were previously using supermount, the entries you had to use then won't work with ivman. Change them back. For example:
| File: /etc/fstab |
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0 |
It may also be necessary to disable devfs.
Mounting devices to be unmountable by normal users (ivman 0.5.x ONLY!)
When you plug in your USB key, a root instance of ivman mounts it automatically, but you can't unmount it unless you are root. This is a work around to solve it, although it tells HAL to mount all mass storage devices with the "users" option, which may be something you don't want.
Create a file called whatever.fdi in /usr/share/hal/fdi/95userpolicy/ with the following contents:
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<merge key="storage.policy.default.mount_option.users" type="bool">true</merge>
</device>
</deviceinfo>
For more info, look at the HAL Specifications.
Other Problems
ivman still doesn't work
If ivman still doesn't work, first stop it:
| Code: Stopping ivman |
/etc/init.d/ivman stop |
and then edit the base config:
| Code: Editing the base config |
nano -w /etc/ivman/IvmConfigBase.xml |
Disable fork, and set debugging to true. Then, start ivman from console
| Code: Starting ivman |
ivman |
Save the messages. If you need help understanding them, you're welcome to come to #love-sources or #ivman @ freenode irc://freenode.net/#love-sources or irc://freenode.net/#ivman .
USB disks don't mount (fixed in 0.6.14)
Ivman mounts by default only removable media. USB disks are not removable, only hotpluggable. Until ivman is fixed you can create a policy that all hotpluggable storage should be mounted. This can be done by copying the following as /etc/hal/fdi/policy/mountpolicies.fdi:
| File: /etc/hal/fdi/policy/mountpolicies.fdi |
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- -*- SGML -*- -->
<deviceinfo version="0.2">
<device>
<match key="info.category" string="storage">
<match key="storage.hotpluggable" bool="true">
<merge key="storage.policy.should_mount" type="bool">true</merge>
</match>
</match>
</device>
</deviceinfo>
|
Restart hald: /etc/init.d/hald restart
More info at Triggering software events from hardware changes with HAL and Ivman
See also
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.
