I have a udev rule for a 4-port USB-to-RS232 hub, created based on this question:
SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{serial}=="A4018BU0", SYMLINK+="ttyLumagen"
It does not create the symlink as expected, so to debug I tried udevadm test
and it seemed to work:
% sudo udevadm info --query=path --name=/dev/ttyUSB0
/devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9.1/3-9.1:1.0/ttyUSB0/tty/ttyUSB0
% sudo udevadm test /devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9.1/3-9.1:1.0/ttyUSB0/tty/ttyUSB0
calling: test
version 204
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.
=== trie on-disk ===
tool version: 204
file size: 5661386 bytes
header size 80 bytes
strings 1265626 bytes
nodes 4395680 bytes
load module index
read rules file: /lib/udev/rules.d/40-crda.rules
read rules file: /lib/udev/rules.d/40-gnupg.rules
read rules file: /lib/udev/rules.d/40-hyperv-hotadd.rules
read rules file: /lib/udev/rules.d/42-usb-hid-pm.rules
read rules file: /lib/udev/rules.d/50-firmware.rules
read rules file: /lib/udev/rules.d/50-udev-default.rules
read rules file: /lib/udev/rules.d/55-dm.rules
read rules file: /lib/udev/rules.d/60-cdrom_id.rules
read rules file: /lib/udev/rules.d/60-keyboard.rules
read rules file: /lib/udev/rules.d/60-persistent-alsa.rules
read rules file: /lib/udev/rules.d/60-persistent-input.rules
read rules file: /lib/udev/rules.d/60-persistent-serial.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
read rules file: /lib/udev/rules.d/60-persistent-storage.rules
read rules file: /lib/udev/rules.d/60-persistent-v4l.rules
read rules file: /lib/udev/rules.d/60-zvol.rules
read rules file: /lib/udev/rules.d/61-accelerometer.rules
read rules file: /lib/udev/rules.d/64-btrfs.rules
read rules file: /lib/udev/rules.d/64-md-raid.rules
read rules file: /lib/udev/rules.d/69-vdev.rules
read rules file: /lib/udev/rules.d/70-power-switch.rules
read rules file: /lib/udev/rules.d/70-uaccess.rules
read rules file: /lib/udev/rules.d/71-biosdevname.rules
read rules file: /lib/udev/rules.d/71-seat.rules
read rules file: /lib/udev/rules.d/73-idrac.rules
read rules file: /lib/udev/rules.d/73-seat-late.rules
read rules file: /lib/udev/rules.d/75-net-description.rules
read rules file: /lib/udev/rules.d/75-persistent-net-generator.rules
read rules file: /lib/udev/rules.d/75-probe_mtd.rules
read rules file: /lib/udev/rules.d/75-tty-description.rules
read rules file: /lib/udev/rules.d/78-graphics-card.rules
read rules file: /lib/udev/rules.d/78-sound-card.rules
read rules file: /lib/udev/rules.d/80-drivers.rules
read rules file: /lib/udev/rules.d/85-hdparm.rules
read rules file: /lib/udev/rules.d/85-keyboard-configuration.rules
read rules file: /lib/udev/rules.d/85-regulatory.rules
read rules file: /lib/udev/rules.d/95-udev-late.rules
read rules file: /etc/udev/rules.d/flirc.rules
read rules file: /etc/udev/rules.d/serialports.rules
read rules file: /etc/udev/rules.d/tivoslide.rules
rules contain 24576 bytes tokens (2048 * 12 bytes), 12172 bytes strings
1941 strings (23630 bytes), 1266 de-duplicated (12134 bytes), 676 trie nodes used
GROUP 20 /lib/udev/rules.d/50-udev-default.rules:19
IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-serial.rules:9
LINK 'serial/by-path/pci-0000:00:14.0-usb-0:9.1:1.0-port0' /lib/udev/rules.d/60-persistent-serial.rules:11
IMPORT builtin 'usb_id' /lib/udev/rules.d/60-persistent-serial.rules:13
/sys/devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9.1/3-9.1:1.0: if_class 255 protocol 0
LINK 'serial/by-id/usb-FTDI_FT232R_USB_UART_A4018BU0-if00-port0' /lib/udev/rules.d/60-persistent-serial.rules:18
IMPORT builtin skip 'usb_id' /lib/udev/rules.d/75-tty-description.rules:6
IMPORT builtin 'hwdb' /lib/udev/rules.d/75-tty-description.rules:6
LINK 'ttyLumagen' /etc/udev/rules.d/serialports.rules:2
handling device node '/dev/ttyUSB0', devnum=c188:0, mode=0660, uid=0, gid=20
preserve permissions /dev/ttyUSB0, 020660, uid=0, gid=20
preserve already existing symlink '/dev/char/188:0' to '../ttyUSB0'
found 'c188:0' claiming '/run/udev/links/\x2fserial\x2fby-id\x2fusb-FTDI_FT232R_USB_UART_A4018BU0-if00-port0'
creating link '/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4018BU0-if00-port0' to '/dev/ttyUSB0'
preserve already existing symlink '/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4018BU0-if00-port0' to '../../ttyUSB0'
found 'c188:0' claiming '/run/udev/links/\x2fserial\x2fby-path\x2fpci-0000:00:14.0-usb-0:9.1:1.0-port0'
creating link '/dev/serial/by-path/pci-0000:00:14.0-usb-0:9.1:1.0-port0' to '/dev/ttyUSB0'
preserve already existing symlink '/dev/serial/by-path/pci-0000:00:14.0-usb-0:9.1:1.0-port0' to '../../ttyUSB0'
creating link '/dev/ttyLumagen' to '/dev/ttyUSB0'
creating symlink '/dev/ttyLumagen' to 'ttyUSB0'
.ID_PORT=0
ACTION=add
DEVLINKS=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4018BU0-if00-port0 /dev/serial/by-path/pci-0000:00:14.0-usb-0:9.1:1.0-port0 /dev/ttyLumagen
DEVNAME=/dev/ttyUSB0
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9.1/3-9.1:1.0/ttyUSB0/tty/ttyUSB0
ID_BUS=usb
ID_MODEL=FT232R_USB_UART
ID_MODEL_ENC=FT232R\x20USB\x20UART
ID_MODEL_FROM_DATABASE=FT232 USB-Serial (UART) IC
ID_MODEL_ID=6001
ID_PATH=pci-0000:00:14.0-usb-0:9.1:1.0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_9_1_1_0
ID_REVISION=0600
ID_SERIAL=FTDI_FT232R_USB_UART_A4018BU0
ID_SERIAL_SHORT=A4018BU0
ID_TYPE=generic
ID_USB_DRIVER=ftdi_sio
ID_USB_INTERFACES=:ffffff:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=FTDI
ID_VENDOR_ENC=FTDI
ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd
ID_VENDOR_ID=0403
MAJOR=188
MINOR=0
SUBSYSTEM=tty
USEC_INITIALIZED=426370555
unload module index
The symlink was indeed created as expected. Then I ran udevadm trigger
, and it deleted the symlink.
Why would udevadm trigger
(and normal udev operation) not work, but udevadm test
works?
System is Ubuntu server 14.04 LTS: Linux jimmy 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux