Comments (5)
These lines are relevant:
May 12 12:08:27 nas systemd-udevd[282449]: sdd: Received inotify event for /dev/sdd.
May 12 12:08:38 nas systemd-udevd[282449]: sdd: device is closed, synthesising 'change' on /sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/0000:02:08.0/0000:05:00.0/0000:06:00.0/0000:07:00.0/host12/port-12:0/end_device-12:0/target12:0:0/12:0:0:0/block/sdd
So udev watches block devices via inotify for IN_CLOSE_WRITE events: i.e. whenever a block device that was opened by userspace for writing is closed, we'll retrigger the device so that the partition table is reread and similar things.
hence, figure out what tool is responsible for opening the block device writable.
udev itself never opens a block device writable, it just probes it in read-only mode. Hence it must be some other component of your OS. Once you fix that, then udev won't do a thing anymore either.
Closing, since this isn't a systemd problem, but some other tool is triggering this.
from systemd.
This device is not mounted, and this is a headless server with no such userspace program which would open the block device in write mode (except sg_start
itself).
strace
shows that sg_start
opens the HDD in read-write mode by default. After sg_start
closes the fd, systemd-udevd
rechecks the partition table which triggers unexpected spin-up.
Fortunately, sg_start
has an option --readonly, -r
which opens the block device in read-only mode. But still, the interaction between sg_start
and systemd-udevd
worth some documentation.
I opened an issue in sg3_utils asking if it's possible to make sg_start
read-only by default.
from systemd.
Can you check which command run by udev actually causes the call to sd_revalidate_disk
? Is it the scsi_id
call?
Fortunately, sg_start has an option --readonly, -r which opens the block device in read-only mode.
Right. Looking at it this way, runningn sg_start --stop
without --readonly
may be considered a user error. Note that the "nuisance spin-up" is actually mentioned in the sg_start man page.
But still, the interaction between sg_start and systemd-udevd worth some documentation.
udevd's close-after-write behavior is documented, although not very prominently. Search for watch
in udev(7). If you don't want this, you can set OPTIONS:="nowatch"
in a custom udev rule.
This is not the only use case in which udev's watch mechanism is causing unexpected effects. But there are only very few reports of this kind, so it doesn't seem to be a big problem for most users. OTOH, it makes sure that the OS notices partition table changes, which is a nice feature that would be thoroughly missed by users if it didn't exist.
from systemd.
Can you check which command run by udev actually causes the call to
sd_revalidate_disk
? Is it thescsi_id
call?
Last time I checked via kernel ftrace, userland process was systemd-udevd
. Double checked by commenting out scsi_id
line in udev rule file, restart systemd-udevd, and execute sg_start --stop
, the issue still exists.
from systemd.
Yeah, we should check if the disk is stopped before running scsi_id or blkid. But how?
from systemd.
Related Issues (20)
- TEST-64-UDEV-STORAGE fails under sanitizers with `systemctl-list-unit-files.c:82:55: runtime error: applying zero offset to null pointer`
- Ordering cycle on credential units during shutdown HOT 1
- User sessions take longer to log out with systemd 256 HOT 3
- tmpfiles.extra credential applies to both initrd and rootfs
- Add RFC-5424 syslog forwarding support to `journald` HOT 2
- systemd-networkd: Support DHCPv{4,6} snooping, IPv{4,6} source address filtering, and ARP and NDP spoofing prevention on bridges
- Assertion 'unit' failed at src/journal/journald-server.c:3015, function config_parse_compress(). Aborting.
- [Networkd][DHCP] Allow users to provide custom DHCP client identifier via DUIDRawData
- TEST-85-NETWORK-NetworkdNetDevTests is flaky in Github Actions HOT 1
- resolved fails to resolve "ai." HOT 2
- homed disklabel corrupt after systemd-homework was terminated due to timeout HOT 3
- run0 invoked at cli can not open display HOT 1
- systemd-nspawn --setenv fails when passing multiple variables and not specifying values HOT 1
- logging: unexpected leading "%s" in UNIT/INVOCATION_ID HOT 1
- TEST-13-NSPAWN (machinectl) failed in GitHub Action
- TEST-85-NETWORK-NetworkdDHCPServerRelayAgentTests is flaky in Github Actions
- TEST-09-REBOOT is flaky in Github Actions HOT 1
- 'udevadm wait' should optionally wait for .device unit being activated HOT 2
- systemd-tpm2-setup-early fails with TPM error
- resolved: NXDOMAIN in cache after resolving local domain for the first time HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from systemd.