The kernel loop driver has a race condition in LOOP_CONFIGURE when LO_FLAGS_PARTSCAN is set: it sends a KOBJ_CHANGE uevent (with GD_NEED_PART_SCAN set) before calling loop_reread_partitions(). If udev opens the device in response to the uevent before loop_reread_partitions() runs, the kernel's blkdev_get_whole() sees GD_NEED_PART_SCAN and triggers a first partition scan. Then loop_reread_partitions() runs a second scan that drops all partitions from the first scan (via blk_drop_partitions()) before re-adding them. This causes partition devices to briefly disappear (plugged -> dead -> plugged), which breaks systemd units with BindsTo= on the partition device: systemd observes the dead transition, fails the dependent units with 'dependency', and does not retry when the device reappears. Work around this in loop_device_make_internal() by splitting the loop device setup into two steps: first LOOP_CONFIGURE without LO_FLAGS_PARTSCAN, then LOOP_SET_STATUS64 to enable partscan. This avoids the race because: 1. LOOP_CONFIGURE without partscan: disk_force_media_change() sets GD_NEED_PART_SCAN, but GD_SUPPRESS_PART_SCAN remains set. If udev opens the device, blkdev_get_whole() calls bdev_disk_changed() which clears GD_NEED_PART_SCAN, but blk_add_partitions() returns early because disk_has_partscan() is false — no partitions appear, the flag is drained harmlessly. 2. Between the two ioctls, we open and close the device to ensure GD_NEED_PART_SCAN is drained regardless of whether udev processed the uevent yet. 3. LOOP_SET_STATUS64 with LO_FLAGS_PARTSCAN: clears GD_SUPPRESS_PART_SCAN and calls loop_reread_partitions() for a single clean scan. Crucially, loop_set_status() does not call disk_force_media_change(), so GD_NEED_PART_SCAN is never set again. A proper kernel fix has been submitted: https://lore.kernel.org/linux-block/20260330081819.652890-1-daan@amutable.com/T/#u This workaround should be dropped once the fix is widely available. Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
