Hi again,
@daringer thanks, I tried out your suggestions, but it still does not work. As you assumed it isn’t the script that does not work. I added the echo "hello hello" > /tmp/mytest
to the script and it hasn’t been run.
Now I installed a fresh Debian GNU/Linux 11 (bullseye) with GNOME 3.38.5 Wayland on my NitroPad X230 - and still nothing happens.
I also tried a lot a things for example I changeg several other key values as ATTRS{idVendor}=="20a0"
, ATTRS{idProduct}=="4108"
instead of ENV{PRODUCT}=="20a0/4108/101"
, ran udevadm control --reload-rules && udevadm trigger and also rebooted several times.
Here are my file permissions, content of my scripts and what udevadm monitor
does when the Nitrokey is removed. For me it looks correct, but I have no idea what the OS does in the background. Maybe anyone else has an idea.
$ ls -la /etc/udev/rules.d/85-nitrokey.rules
-rwxr-xr-x 1 root root 94 Oct 14 21:18 /etc/udev/rules.d/85-nitrokey.rules
$ sudo editor /etc/udev/rules.d/85-nitrokey.rules
ACTION=="remove", ENV{PRODUCT}=="20a0/4108/101", RUN+="/usr/local/bin/gnome-screensaver-lock"
$ ls -la /usr/local/bin/gnome-screensaver-lock
-rwxr-xr-x 1 root root 237 Oct 14 21:17 /usr/local/bin/gnome-screensaver-lock
(Note: the grave accent is used around the user attribute, but not displayed here in the forum)
$ sudo editor /usr/local/bin/gnome-screensaver-lock
user=ps axo user:30,comm | egrep "gdm-(wayland|x)" | awk '{print $1}'
if [ -n $user ]; then
su $user -c "/usr/bin/dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock"
fi`
$ lsusb
Bus 001 Device 009: ID 20a0:4108 Clay Logic Nitrokey Pro
$ udevadm monitor --property --subsystem-match=usb
UDEV [524.256033] unbind /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
ACTION=unbind
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=20a0/4108/101
TYPE=0/0/0
INTERFACE=3/0/0
SEQNUM=2904
USEC_INITIALIZED=469947382
ID_PATH=pci-0000:00:1a.0-usb-0:1.2:1.0
ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2_1_0
UDEV [524.256837] remove /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.1 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.1
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=20a0/4108/101
TYPE=0/0/0
INTERFACE=11/0/0
MODALIAS=usb:v20A0p4108d0101dc00dsc00dp00ic0Bisc00ip00in01
SEQNUM=2906
USEC_INITIALIZED=469946878
ID_VENDOR_FROM_DATABASE=Clay Logic
ID_PATH=pci-0000:00:1a.0-usb-0:1.2:1.1
ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2_1_1
UDEV [524.257826] remove /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=20a0/4108/101
TYPE=0/0/0
INTERFACE=3/0/0
MODALIAS=usb:v20A0p4108d0101dc00dsc00dp00ic03isc00ip00in00
SEQNUM=2905
USEC_INITIALIZED=469947382
ID_PATH=pci-0000:00:1a.0-usb-0:1.2:1.0
ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2_1_0
UDEV [524.259217] unbind /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)
ACTION=unbind
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/001/007
DEVTYPE=usb_device
PRODUCT=20a0/4108/101
TYPE=0/0/0
BUSNUM=001
DEVNUM=007
SEQNUM=2907
USEC_INITIALIZED=469940924
ID_PATH=pci-0000:00:1a.0-usb-0:1.2
ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2
ID_FOR_SEAT=usb-pci-0000_00_1a_0-usb-0_1_2
MAJOR=189
MINOR=6
TAGS=:seat:uaccess:systemd:security-device:
CURRENT_TAGS=:seat:
UDEV [524.261424] remove /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/001/007
DEVTYPE=usb_device
PRODUCT=20a0/4108/101
TYPE=0/0/0
BUSNUM=001
DEVNUM=007
SEQNUM=2908
USEC_INITIALIZED=469940924
ID_PATH=pci-0000:00:1a.0-usb-0:1.2
ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2
ID_FOR_SEAT=usb-pci-0000_00_1a_0-usb-0_1_2
MAJOR=189
MINOR=6
TAGS=:security-device:seat:uaccess:systemd:
CURRENT_TAGS=:seat:
When I got some time I will setup a new Ubuntu 20.04 VM and try it again from scretch…