Hide Forgot
Description of problem: I want to write a systemd unit for handling OpenNebula contextualization CDROM. The CDROM virtual media has label "CONTEXT", and the original (pre-systemd) contextualization scripts try to mount it from /dev/disk/by-label/CONTEXT. I have used the addon-context-linux RPM package https://github.com/OpenNebula/addon-context-linux and tried to modify it for systemd: I have removed the sysvinit script from /etc/init.d/vmcontext, and created the following /lib/modules/systemd/system/vmcontext.service: ============== [Unit] Description=OpenNebula contextualization script After=dev-disk-by\x2dlabel-CONTEXT.device Before=network.service [Service] Type=oneshot ExecStart=/usr/sbin/one-contextd [Install] WantedBy=multi-user.target ============== This works reliably under CentOS 7, but fails in about 75% of cases in Fedora 23. When I log into the Fedora instance, and run # systemctl status vmcontext.service # ls -l --full-time /dev/disk/by-label/CONTEXT the mtime of the /dev/disk/by-label/CONTEXT symlink (i.e. its creation time) is older or the same as the startup time of vmcontext.service for the VMs where the contextualization was done correctly, and about a second or two newer on the VMs where the contextualization failed. So it seems that systemd in Fedora 23 (and not in CentOS 7) does not handle the "After=...device" dependency correctly: the symlink is in some cases created a whole second or two after the vmcontext.service has been started. Version-Release number of selected component (if applicable): systemd-222-14.fc23.x86_64 How reproducible: about 75 % - verified by mass-deploying tens of identical Fedora 23 instances and counting which went up with networking correctly set up by contextualization and which did not.
The issue is that After= has narrower meaning than what you describe. It only means that if two units are started (or stopped) in the same transaction, their jobs will be ordered. But in this case, the .device unit is not pulled in into the initial transaction, so there's no guarantee that the After setting does anything. It only works if the device is detected early enough and happens to be ready when systemd gets to run the .service unit. I'm not quite sure what the proper form here is, but BindsTo=dev-disk-by\x2dlabel-CONTEXT.device should work. Can you try that?
I tried Requires=dev-disk-by\x2dlabel-CONTEXT.device which helped. Maybe the documentation should be more clear on what Before= and After= means.
Is the documentation in the man page (https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=) insufficient?
This message is a reminder that Fedora 23 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 23. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '23'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 23 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.