1

I have a rather simple set of custom rules:

ACTION=="add", SUBSYSTEM=="usb", ENV{ID_MODEL_ID}=="0748", ENV{ID_VENDOR_ID}=="05e3", TAG+="my-card-reader"
TAGS=="my-card-reader", ENV{DEVTYPE}=="disk", ENV{ID_INSTANCE}=="0:1", SYMLINK+="sdcard"
TAGS=="my-card-reader", ENV{ID_INSTANCE}=="0:1", ENV{DEVTYPE}=="partition", SYMLINK+="sdcard%n"

I'm trying to identify my USB card reader and then give the microSD card well-known names in /dev. This set of rules used to work in 16.04, in 18.04 it doesn't.

When checking udevadm monitor -p, I can see that the USB reader is recognized:

UDEV  [1832291.742219] add      /devices/pci0000:00/0000:00:14.0/usb4/4-2 (usb)
ACTION=add
[…]
SUBSYSTEM=usb
TAGS=:my-card-reader:
[…]

But when I check the sysfs path later with udevadm info /sys/devices/pci0000:00/0000:00:14.0/usb4/4-2, my TAG isn't shown anymore—in fact, there is no E: TAGS entry available at all.

For other devices, for example a partition on my microSD card, Ubuntu's default systemd TAG remains available:

P: /devices/pci0000:00/0000:00:14.0/usb4/4-2/4-2:1.0/host3/target3:0:0/3:0:0:2/block/sdf
N: sdf
[…]
E: SUBSYSTEM=block
E: TAGS=:systemd:
[…]

Update 1

I've been running with udev_log="debug" while unplugging and replugging the reader and the SD card, suddenly and until now only once, my rules were applied. However, looking at the journalctl debug logs from udev and comparing, I cannot see a difference other than the race between kernel log, udev daemon log, and forked udev worker as well as the seq numbers.

Update 2

I have pretty much reduced the problem. The tag is available when the USB card reader is attached during boot. When I (re-)attach it later, the tag is missing.

What am I missing?

2 Answers 2

0

Most probably, that tag was overwritten by another rule.

  • Ubuntu 18.04 got updated rules .. Check using grep -r TAG in system rules folders, see man udev.
  • Custom rules file given low number .. Use udevadm test ... and udevadm trigger ... to verify which rules processed for that event.
1
  • There are exactly two files ordered after my rules (/etc/…/99-sdcard-reader.rules): /lib/…/99-systemd.rules and /lib/…/99-vmware-scsi-udev.rules. When running the test command, my tag is shown. May 15, 2019 at 9:05
0

Apparently, there is a whole thing going on: https://github.com/systemd/systemd/issues/7587

Long story short: TAGS are only valid per event and not persisted. Removing ACTION=="add", from my rules file made it work

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .