Udevil

Resources

Udevil is a small auto-mount utility created to be a "a hassle-free replacement for udisks."[1] It can be used with or without systemd, ConsoleKit, policykit, D-Bus, udisks, gvfs and FUSE.

Note
It is important to know Udevil does not play nicely with encrypted filesystems. If an encrypted filesystem is being used consider looking for an alternate auto-mount utility, such as sys-fs/udiskie.

Installation[edit | edit source]

Kernel[edit | edit source]

Kernel eventpolling may need to be enabled for device media to be properly detected by the kernel:

KERNEL Enable eventpolling (CONFIG_EPOLL)
General setup  --->
   [*] Configure standard kernel features (expert users)  --->
      [*]   Enable eventpoll support

After enabling eventpolling confirm operation by running:

root #cat /sys/module/block/parameters/events_dfl_poll_msecs
root #cat /sys/block/sr0/events_poll_msecs

If either command returns 0 or -1 then there will be issues detecting device media. Create a small script in /etc/local.d that will force event polling for each device:

FILE /etc/local.d/eventpolling.startEnable event polling
#!/bin/bash
source /etc/profile
echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs
echo 2000 > /sys/block/sr0/events_poll_msecs

Be sure to make the script executable:

root #chmod +x /etc/local.d/eventpolling.start

Emerge[edit | edit source]

Install Udevil:

root #emerge --ask sys-apps/udevil

Configuration[edit | edit source]

Global[edit | edit source]

Udevil's operation can be configured using the global configuration file:

  • /etc/udevil/udevil.conf

Local[edit | edit source]

According to official documentation[2] it is possible to configure auto-mount permissions on an individual basis by creating an /etc/udevil/ configuration file in this following format:

  • /etc/udevil/udevil-user-USERNAME.conf

Where USERNAME is replaced by the user's user name.

devmon[edit | edit source]

A configuration file called devmon is also installed in the /etc.

  • /etc/conf.d/devmon

Usage[edit | edit source]

Daemon mode[edit | edit source]

OpenRC[edit | edit source]

Udevil can be configured to operate as a daemon by calling the devmon command. It is possible to run this command in the background by calling it as a job using the ampersand (&). Users can add the following line to their ~/.bashrc file which will start devmon as a daemon each time the system boots:

FILE ~/.bashrcStarting devmon in daemon mode
devmon 2>&1 > /dev/null &

Systemd[edit | edit source]

To start devmon as a systemd service:

root #systemctl start devmon@<user>

Invocation[edit | edit source]

user $udevil mount <device>
user $udevil unmount <device>

Troubleshooting[edit | edit source]

If you get permission denied while trying to invoke udevil, make sure your user belongs to the setuid executable's group, which is most likely plugdev.

See also[edit | edit source]

External resources[edit | edit source]

References[edit | edit source]

This article is issued from Gentoo. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.