Results 1 to 1 of 1

Thread: Problems with udev acl rule

Threaded View

  1. #1
    Join Date
    Aug 2010

    Problems with udev acl rule

    I am trying to create a udev rule that will allow me to mount an ext4 disk with acl option while preserving user unmountability. The following rule (adapted from will work, but I have to unmount the volume partition by partition; there is no "Safely remove drive". Adding myself to the "disk" group won't work either, or changing device node permissions. I also tried using pmount, but that has no acl option and is therefore useless.

    # Leave sda to fstab
    KERNEL!="sd[b-z]*", GOTO="media_by_label_auto_mount_end"

    # We are handling only ext4 partitions
    ENV{ID_FS_TYPE}!="ext4", GOTO="media_by_label_auto_mount_end"

    # Import FS info
    IMPORT{program}="/sbin/blkid -o udev -p %N"

    # Get a label if present, otherwise specify one
    ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
    ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

    # Mount options
    ACTION=="add", ENV{mount_options}="nodev,nosuid,relatime,acl ,uhelper=udisks"

    # Mount the device
    ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -t %E{ID_FS_TYPE} -o %E{mount_options} /dev/%k /media/%E{dir_name}"

    # Clean up after removal
    ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"

    # Exit

    This works when copied to /etc/udev/rules.d/11-some-name.rules or /etc/udev/user.rules (the exact number does not seem to matter much), but unmounting as user does not work, also the devices appear twice in the nautilus side pane (a sure sign that something is fishy). Does udev use mount at all by default? And what else is there?

    The file /lib/udev/rules.d/50-udev-default.rules does not seem to have a KERNEL=="sd*" entry at all, so maybe that's the problem. A half-solution is to add a mount -o remount,acl line to my backup scripts, but mount will hang when another program is accessing the disk.

    Another problem is that the entries in /media will remain if the disk is unmounted but not actually unplugged, which will cause my backup scripts to fill up the root partition (this never happens with the default udev setup. Of course I could rewrite the scripts if necessary, but I'd rather fix this behaviour).

    I am using ubuntu maverick with kernel 2.6.35-29-generic.

    Sorry, tried to edit the uhel per, did not work. Should be "uhelper"
    Last edited by nokangaroo; May 12th, 2011 at 07:27 AM. Reason: Misprint

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts