You are not logged in.

#1 2026-04-28 18:07:50

florosus
Member
Registered: 2015-03-19
Posts: 27

udev rule for /dev/sdbX no longer works while /dev/sdb does

I had a udev rule to automatically create a symlink for my iPod when I plug it in:

SUBSYSTEMS=="scsi", KERNEL=="sd?2", ATTRS{vendor}=="Apple*", ATTRS{model}=="iPod*", SYMLINK+="ipod", GROUP="plugdev"

It has recently stopped working.

If I change KERNEL to sdb or "sd?", it will trigger, but the symlink will be to the wrong device (I want the second partition, not the entire disk)

I've tested this with a simpler rule:

KERNEL=="sdb", RUN+="/test.sh"

where test.sh echoes 1 to a file. This works, while

KERNEL=="sdb2", RUN+="/test.sh"

doesn't

How can I diagnose this?

Last edited by florosus (2026-04-28 18:15:04)

Offline

#2 2026-04-28 19:17:10

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,177

Re: udev rule for /dev/sdbX no longer works while /dev/sdb does

Should™ be block and you also probably want to filter for "add"?

ACTION=="add", SUBSYSTEM=="block", …

?

How can I diagnose this?

https://bbs.archlinux.org/viewtopic.php … 1#p2295641

udevadm monitor

Online

#3 2026-04-28 19:25:38

florosus
Member
Registered: 2015-03-19
Posts: 27

Re: udev rule for /dev/sdbX no longer works while /dev/sdb does

sdb2 does come online in monitor, just doesn't trigger the rule. The simple KERNEL=sdb vs sdb2 test demonstrates that I think.

Offline

#4 2026-04-28 19:28:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,177

Re: udev rule for /dev/sdbX no longer works while /dev/sdb does

You can enable the udev debug setting, prints to the system journal.
The wrong or simple rule might get skipped by a more specific match.

Online

#5 2026-04-28 19:33:53

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 595

Re: udev rule for /dev/sdbX no longer works while /dev/sdb does

florosus wrote:

I had a udev rule to automatically create a symlink for my iPod when I plug it in

Isn't it more suitable to hook to SUBSYSTEM=="block" and ATTR{partition}=="2" with other required attribute checks in addition?

florosus wrote:

How can I diagnose this?

Increace udev verbosity and watch journal during plug in:

# udevadm control --log-level=debug
# journalctl -f -b -u systemd-udevd

Also "udevadm monitor" often can help.

Offline

Board footer

Powered by FluxBB