Automount per udev-rule geht nicht mehr

Hast Du Probleme mit Hardware, die durch die anderen Foren nicht abgedeckt werden? Schau auch in den "Tipps und Tricks"-Bereich.
Antworten
debianoli
Beiträge: 4072
Registriert: 07.11.2007 13:58:49
Lizenz eigener Beiträge: MIT Lizenz

Automount per udev-rule geht nicht mehr

Beitrag von debianoli » 07.05.2018 09:54:51

Hallo,

unter Jessie habe ich ein extern, per luks verschlüsselte Festplatte durch eine udev-Rule beim Einschalten der Fastplatte automatisch gemountet. Unter Stretch geht das nicht mehr. Die funktionierende udev-Rule hatte ich irgendwo im Netz gefunden, selber kenne ich mich mit udev nur rudimentär aus. (EDIT: Ich hab es wieder gefunden, das Skript kommt von hier: https://dasmaeh.de/2014/03/27/luks-automount/ )

Irgendwelche Ideen?

Code: Alles auswählen

cat /etc/udev/rules.d/85-usb-backup-hdd.rules 
##################################################################################
# rule 1: decrypt the disk once it gets plugged in
##################################################################################

# matches partitions (there is precisely one) of block devices with the serial
# number of my backup external hard disk

ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", ATTRS{serial}=="000000000009800DW", \
RUN+="/sbin/cryptsetup --key-file /home/ichuser/Dokumente/Keys/Backup_HDD_Buero luksOpen $env{DEVNAME} backup-crypt"

##################################################################################
# rule 2: as soon as the crypt container is opened, mount the filesystem inside it
##################################################################################

# we (also) match on change because the device name is known only after some time
ACTION=="add|change", SUBSYSTEM=="block", ENV{DM_NAME}=="backup-crypt", \
RUN+="/bin/mount /dev/mapper/$env{DM_NAME}"
Und udevadmin monitor sagt:

Code: Alles auswählen

KERNEL[4157.157562] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6 (usb)
KERNEL[4157.158391] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0 (usb)
KERNEL[4157.158870] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5 (scsi)
KERNEL[4157.158896] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/scsi_host/host5 (scsi_host)
UDEV  [4157.186053] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6 (usb)
UDEV  [4157.189330] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0 (usb)
UDEV  [4157.190451] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5 (scsi)
UDEV  [4157.193578] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/scsi_host/host5 (scsi_host)
KERNEL[4158.177658] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0 (scsi)
KERNEL[4158.178903] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0 (scsi)
KERNEL[4158.178930] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/scsi_disk/5:0:0:0 (scsi_disk)
KERNEL[4158.178951] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/scsi_device/5:0:0:0 (scsi_device)
KERNEL[4158.178980] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/scsi_generic/sg6 (scsi_generic)
KERNEL[4158.179007] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/bsg/5:0:0:0 (bsg)
UDEV  [4158.179924] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0 (scsi)
KERNEL[4158.182387] add      /devices/virtual/bdi/8:80 (bdi)
UDEV  [4158.185800] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0 (scsi)
UDEV  [4158.188054] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/scsi_disk/5:0:0:0 (scsi_disk)
UDEV  [4158.188938] add      /devices/virtual/bdi/8:80 (bdi)
UDEV  [4158.190353] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/bsg/5:0:0:0 (bsg)
KERNEL[4158.190691] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/block/sdf (block)
KERNEL[4158.190717] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/block/sdf/sdf1 (block)
UDEV  [4158.191220] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/scsi_generic/sg6 (scsi_generic)
UDEV  [4158.193424] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/scsi_device/5:0:0:0 (scsi_device)
UDEV  [4158.371939] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/block/sdf (block)
UDEV  [4158.426630] add      /devices/pci0000:00/0000:00:1a.7/usb7/7-6/7-6:1.0/host5/target5:0:0/5:0:0:0/block/sdf/sdf1 (block)

Antworten