<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 10, 2018 at 10:38 PM, Boyce, Kevin P [US] (AS) <span dir="ltr"><<a href="mailto:Kevin.Boyce@ngc.com" target="_blank">Kevin.Boyce@ngc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_6158190618813345071WordSection1">
<p class="MsoNormal">Good Afternoon list,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am having a problem with my systemd service file and I think I now understand the problem. I’ll describe below, but I’m hoping there is a way around it which someone may be able to illuminate me on.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am developing an rpm package with software which gets installed under /opt/my/bin/service. Imagine I have a corresponding directory in /opt/my/etc/systemd/system/my-<wbr>service.service incorporated into the package. As part of the package
installation the post install script runs systemctl enable /opt/my/etc/systemd/system/my-<wbr>service.service<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">My service file has an After=basic.target, Before=network.target, WantedBy=Default.target, and ExecStart=/opt/my/bin/service.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">All of the symlinks appear to be ok. After installation when the user runs systemctl start my-service.service everything works as expected.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">However, when rebooting everything is not so nice. In the journal one can observe the error “Cannot add dependency job for unit my-service.service, ignoring: Unit not found.”<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">/opt happens to be on a separate partition than / and /usr. I’m assuming during systemd startup that systemd is parsing everything before /opt is moutned and coming across a broken symlink /etc/systemd/system/my-<wbr>service.service.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Is there any other solution than removing the symlink and installing my-service.service unit file in /etc/systemd/system directly?<u></u><u></u></p>
<p class="MsoNormal">We have a requirement to keep our software neatly confined in /opt/my.</p></div></div></blockquote><div><br></div><div>I guess you could pre-mount /opt from your initramfs, similar to the way an external /usr is mounted?</div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div>
</div></div>