systemd / systemd/systemd

udev rules may get missed due to rule caching

Open
#3,134 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-discussion 🤔 udev
Dominant language
C
Stars
16.7k
Forks
4.7k
Avg merge
1d 6h
Merged PRs (30d)
140

Description

Submission type
  • Bug report
systemd version the issue has been seen with

Tested with 229

Used distribution

RHEL, Fedora, LFS

In case of bug report: Expected behaviour you didn't see

Newly added rules are immediately effective

In case of bug report: Unexpected behaviour you saw

Rules may get ignored due to caching

In case of bug report: Steps to reproduce the problem
#!/bin/bash                                                                                                                                                                              

chown root.root /dev/zero
echo "KERNEL==\"zero\", GROUP=\"nobody\"" > 80-zero.rules

udevadm trigger --sysname-match=zero --action=add
cp -v 80-zero.rules /usr/lib/udev/rules.d/
test "$1" && udevadm control --reload
udevadm trigger --sysname-match=zero --action=add
ls -l /dev/zero
sleep 1
udevadm trigger --sysname-match=zero --action=add
ls -l /dev/zero
sleep 1
udevadm trigger --sysname-match=zero --action=add
ls -l /dev/zero
sleep 1
udevadm trigger --sysname-match=zero --action=add
ls -l /dev/zero
sleep 1
udevadm trigger --sysname-match=zero --action=add
ls -l /dev/zero
sleep 1
udevadm trigger --sysname-match=zero --action=add
ls -l /dev/zero
sleep 1
udevadm trigger --sysname-match=zero --action=add
ls -l /dev/zero
[root@kha foo2]# ./utest.sh
‘80-zero.rules’ -> ‘/usr/lib/udev/rules.d/80-zero.rules’
crw-rw-rw-. 1 root root 1, 5 27. 4. 13:39 /dev/zero
crw-rw-rw-. 1 root root 1, 5 27. 4. 13:39 /dev/zero
crw-rw-rw-. 1 root root 1, 5 27. 4. 13:39 /dev/zero
crw-rw-rw-. 1 root root 1, 5 27. 4. 13:39 /dev/zero
crw-rw-rw-. 1 root nobody 1, 5 27. 4. 13:39 /dev/zero
crw-rw-rw-. 1 root nobody 1, 5 27. 4. 13:39 /dev/zero
crw-rw-rw-. 1 root nobody 1, 5 27. 4. 13:39 /dev/zero
[root@kha foo2]# 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the shell script in the issue, then trace udev's rule reload and rule-cache handling. Confirm when a newly installed rule becomes effective and verify that the expected device ownership is applied immediately after reload.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, linux
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.