systemd icon indicating copy to clipboard operation
systemd copied to clipboard

path unit does not trigger on atomic symlink replacement

Open Tom-Hubrecht opened this issue 1 year ago • 1 comments

systemd version the issue has been seen with

255.2

Used distribution

NixOS unstable (24.05)

Linux kernel version used

6.1.66

CPU architectures issue was seen on

x86_64

Component

systemctl

Expected behaviour you didn't see

Given the following path unit :

[Unit]

[Path]
PathModified=/run/current-system/
Unit=arkheon-record.service

[Install]
WantedBy=multi-user.target

I would expect the service arkheon-record.service to be activated when the path /run/current-system is replaced with ln -snf /toto/tata /run/current-system.

Unexpected behaviour you saw

The selected unit is not started, even though inotifywait shows that the following events are triggered :

/run/current-system ATTRIB 
/run/current-system DELETE_SELF 

Steps to reproduce the problem

  • Create a test folder TEST_FOLDER
  • Create the required files :
touch TEST_FOLDER/{toto,tata}
ln -s TEST_FOLDER/toto TEST_FOLDER/test
  • Create the following unit :
[Unit]

[Path]
PathModified=TEST_FOLDER/test
Unit=test-unit.service

[Install]
WantedBy=multi-user.target

Run ln -snf TEST_FOLDER/tata TEST_FOLDER/test and nothing happens even though the test path was modified. (It also doesn't work with PathChanged)

Additional program output to the terminal or log subsystem illustrating the issue

No response

Tom-Hubrecht avatar Mar 25 '24 16:03 Tom-Hubrecht

This was supposedly fixed in #19726, but I can confirm I'm seeing the same behaviour with systemd 252 on Debian.

me-and avatar Jun 28 '24 11:06 me-and

I ran into this issue last night trying to get Satisfactory Dedicated server to run in Nixos-unstable.

(Apparently "mistakenly" believed running the steam-run binary via /run/current-system/bin/steam-run would work -- the service reported success on activation via systemctl status, but did not activate properly. Swapping the command in the service from /run/current-system/bin/steam-run to the ${pkgs.steam-run}/bin/steam-run made it fire properly.

ziasquinn avatar Sep 11 '24 20:09 ziasquinn

also getting this on NixOS Unstable with systemd 256.8 with the following path:

# /etc/systemd/system/pozback-watcher.path
[Unit]

[Path]
PathModified=/srv/web/poz.pet

[Install]
WantedBy=multi-user.target

where /srv/web/poz.pet is a symlink to the nix store created using nix build -o /srv/web/poz.pet

imnotpoz avatar Jan 03 '25 10:01 imnotpoz