[Bug 1641440] [NEW] systemd-udevd does not work as expected using custom rules
Launchpad Bug Tracker
1641440 at bugs.launchpad.net
Sun Nov 13 21:07:04 UTC 2016
You have been subscribed to a public bug:
Hi!
In this example I'm using an external USB-Keyboard to trigger a rule on
plugin/-off. The same example works in Arch, but not in (K)Ubuntu 16.10.
System:
Thinkpad X220:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety
Kernel: Linux x220 4.8.0-27-generic #29-Ubuntu SMP Thu Oct 20 21:03:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I used following steps to reproduce:
Check device:
cmd: lsusb
output: Bus 001 Device 005: ID 1267:0103 Logic3 / SpectraVideo plc G-720 Keyboard
cmd: udevadm monitor
1.Plugin keyboard
2.Check shortest path
my example: /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2
cmd: udevadm -a -p /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 | egrep "SUBSYSTEM|idProduct|idVendor"
output:
SUBSYSTEM=="usb"
ATTR{idProduct}=="0103"
ATTR{idVendor}=="1267"
Create rule:
nano /etc/udev/rules.d/99-numlocker.rules
content: ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1267",
ATTRS{idProduct}=="0103" RUN+="/bin/sh -c '/usr/bin/touch
/home/kubuntu/plugged'", ENV{REMOVE_CMD}="/bin/sh -c '/bin/rm
/home/kubuntu/plugged'"}}}
Test rule:
cmd: udevadm test /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2
shortened output:
...Reading rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 37025 bytes strings
27127 strings (224162 bytes), 23453 de-duplicated (190812 bytes), 3675 trie nodes used
value '[dmi/id]sys_vendor' is 'LENOVO'
value '[dmi/id]sys_vendor' is 'LENOVO'
IMPORT builtin 'usb_id' /lib/udev/rules.d/50-udev-default.rules:13
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:13
MODE 0664 /lib/udev/rules.d/50-udev-default.rules:41
PROGRAM 'mtp-probe /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 1 6' /lib/udev/rules.d/69-libmtp.rules:2167
starting 'mtp-probe /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 1 6'
'mtp-probe /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 1 6'(out) '0'
Process 'mtp-probe /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 1 6' succeeded.
RUN '/lib/udev/tlp-usb-udev %p' /lib/udev/rules.d/85-tlp.rules:10
RUN '/bin/sh -c '/bin/rm /home/kubuntu/plugged'' /etc/udev/rules.d/99-numlocker.rules:6
handling device node '/dev/bus/usb/001/006', devnum=c189:5, mode=0664, uid=0, gid=0
preserve permissions /dev/bus/usb/001/006, 020664, uid=0, gid=0
preserve already existing symlink '/dev/char/189:5' to '../bus/usb/001/006'
created db file '/run/udev/data/c189:5' for '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2'
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/006
DEVNUM=006
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=0103
ID_MODEL_ENC=0103
ID_MODEL_FROM_DATABASE=G-720 Keyboard
ID_MODEL_ID=0103
ID_REVISION=0101
ID_SERIAL=1267_0103
ID_USB_INTERFACES=:030101:030000:
ID_VENDOR=1267
ID_VENDOR_ENC=1267
ID_VENDOR_FROM_DATABASE=Logic3 / SpectraVideo plc
ID_VENDOR_ID=1267
MAJOR=189
MINOR=5
PRODUCT=1267/103/101
REMOVE_CMD=/bin/sh -c '/bin/rm /home/kubuntu/plugged'
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=68681993
run: '/lib/udev/tlp-usb-udev /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2'
run: '/bin/sh -c '/usr/bin/touch /home/kubuntu/plugged''
Unload module index
Unloaded link configuration context.
I've tried following to load rules:
> udevadm control -R
> systemctl restart systemd-udevd
> reboot
Nothing seems to work. Even after a few days and reboots it keeps the same,
BUT there's a "workaround":
After every reboot use:
systemctl stop systemd-udevd
systemctl start systemd-udevd
and the rule works.
Could anyone give me a hint why this does not work as expected in
Kubuntu 16.10 or can confirm this?
Thanks in advance!
** Affects: systemd (Ubuntu)
Importance: Undecided
Status: New
** Tags: 16.10 bot-comment rules systemd-udevd udev
--
systemd-udevd does not work as expected using custom rules
https://bugs.launchpad.net/bugs/1641440
You received this bug notification because you are a member of Ubuntu Foundations Bugs, which is subscribed to systemd in Ubuntu.
More information about the foundations-bugs
mailing list