[systemd-devel] Possible bug when a dummy service declares After= and/or Conflicts= a .mount unit?

Didier Roche didrocks at ubuntu.com
Wed Mar 4 00:21:48 PST 2015


Hey,

It seems that we discovered an issue if a service declares some 
relationship with a .mount unit.
For instance, having tmp.mount disable (and nothing mounting /tmp as 
tmpfs in fstab):

foo.service:
[Unit]
After=tmp.mount

[Service]
ExecStart=/bin/echo foo

[Install]
WantedBy=multi-user.target


Then, enable foo.service
Many reboots will have /tmp not mounted, but after some reboots (mostly 
< 5), we can get:

tmpfs on /tmp type tmpfs (rw)
status on tmp.mount:
    Loaded: loaded (/lib/systemd/system/tmp.mount; disabled; vendor 
preset: enabled)
    Active: active (mounted) since Wed 2015-03-04 08:54:37 CET; 18min ago

rebooting systemd with debug logs, only one mention of foo.service, but 
we clearly see that tmp.mount is executed, even disabled:
Mar 04 08:54:37 autopkgtest systemd[1]: Deleting job tmp.mount/stop as 
dependency of job systemd-timesyncd.service/stop
Mar 04 08:54:37 autopkgtest systemd[1]: Deleting job foo.service/start 
as dependency of job tmp.mount/stop

Mar 04 08:54:37 autopkgtest systemd[1]: Installed new job 
tmp.mount/start as 50
Mar 04 08:54:37 autopkgtest systemd[1]: 
ConditionPathIsSymbolicLink=!/tmp succeeded for tmp.mount.
Mar 04 08:54:37 autopkgtest systemd[1]: About to execute: /bin/mount 
tmpfs /tmp -n -t tmpfs -o mode=1777,strictatime
Mar 04 08:54:37 autopkgtest systemd[1]: Forked /bin/mount as 171
Mar 04 08:54:37 autopkgtest systemd[1]: tmp.mount changed dead -> mounting
Mar 04 08:54:37 autopkgtest systemd[1]: Mounting Temporary Directory...

Mar 04 08:54:37 autopkgtest systemd[1]: tmp.mount changed mounting -> 
mounting-done
Mar 04 08:54:37 autopkgtest systemd[1]: Job tmp.mount/start finished, 
result=done
Mar 04 08:54:37 autopkgtest systemd[1]: Mounted Temporary Directory.


It seems then that any relationship (at least After/Conflicts) to a 
mount unit from a enabled service will trigger that mount unit to executes.

Did anyone else have seen something similar?
Cheers,
Didier



More information about the systemd-devel mailing list