[systemd-devel] systemd-timesyncd with read-only root filesystem

Martin Pitt martin.pitt at ubuntu.com
Thu Dec 1 09:20:24 UTC 2016


Hello André,

André Hartmann [2016-12-01  9:50 +0100]:
> So I naively created the following link structure (which works):
> 
> /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service ->
> /mnt/writeable/systemd-timesyncd ->
> /lib/systemd/system/systemd-timesyncd.service
> 
> But if I remove /mnt/writeable/systemd-timesyncd and reboot,
> the command 'timedatectl status' still reports enabled, which is unexpected.

This is because systemd only really looks at the foo.wants/bar.service
symlink itself -- it's actually okay for that to point into
nothingness. I think this is mostly due to the fact that the actual
units can be in /etc, /usr, or /run, and even move between those.

For example, you might have

  /usr/lib/systemd/system/foo.service
  /usr/lib/systemd/system/multi-user.target.wants/foo.service → ../foo.service

and then override this with

  /etc/systemd/system/foo.service

Then multi-user.target will still use the unit from /etc, *not* the
one from  /usr, even though that's where the symlink points to. In
this case this is pretty obviously the correct behaviour; in your case
it's admittedly confusing.

I'm not entirely sure if dangling symlinks should be counted as
"enabled", but this should least explain your observation.

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the systemd-devel mailing list