<div dir="ltr"><div>I set <span style="color:rgb(0,0,0);font-family:monospace"><a href="mailto:pkg-systemd-maintainers@lists.alioth.debian.org">pkg-systemd-maintainers@lists.alioth.debian.org</a> to CC on this as it is almost more a dh_*systemd* question/bug than of libvirt.</span></div><div><span style="color:rgb(0,0,0);font-family:monospace">Libvirt just happens to be the package getting into this situation.</span></div><div><span style="color:rgb(0,0,0);font-family:monospace">And their expertise might help to resolve this bug (#905772)</span></div><div><br></div><div>Trying an interim TL;DR:</div><div>- Service A - --no-stop-on-upgrade</div><div>  A Requires A1.socket</div><div>  A Requires A2.socket</div><div>- Service B - --restart-after-upgrade</div><div>  B Requires=A1.socket</div><div>- A and B have also sysV scripts.</div><div>- d/rules calls dh_installinit and dh_systemd_start</div><div>- maintscripts get:</div><div>  - invoke.rc start A - ok</div><div>  - invoke.rc restart B - ok</div><div>  - deb-systemd-invoke A.socket - this will restart A.service and breaks --no-stop-on-upgrade</div><div><br></div><div><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">This is confusing enough - re-summarize the approaches I had so far.</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">Remember:<br>- when there is a sysV script it will call invoke.rc<br>- without sysV script it will call deb-systemd-invoke</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">Original Issue:<br>- invoke.rc on virtlogd<br>  - this will realize the new dependency to virtlogd-admin.socket<br>  - virtlogd-admin.socket can't be started because<br>    virtlogd-admin.socket: Socket service virtlogd.service already active, refusing.<br>  - virtlogd.service is running fine, but the start returns RC!=0<br>  - that makes the upgrade fail</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px"><br></p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">Fix I:<br>- drop both sysV scripts (virtlogd/libvirtd)<br>  - virtlogd will be started via deb-systemd-invoke<br>    This ignores errors in the postinst and is fine on upgrade<br>  - but libvirtd being taken over by deb-systemd-invoke is bad<br>    - the dh_systemd_start checks the service file and adds dependencies to the line<br>      deb-systemd-invoke restart 'libvirtd.service' 'virtlockd.socket' 'virtlogd.socket'<br>    - it knows that to restart a socket the service has to be stopped and started<br>    - so virtlogd is restarted ignoring the --no-restart-on-upgrade of the actual virtlogd<br>      service</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px"><br></p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">Fix II:<br>- drop only virtlogd sysV script<br>  - virtlogd will be started via deb-systemd-invoke<br>    This ignores errors in the postinst and is fine on upgrade<br>  - libvirtd will continue to be started by invoke.rc which will restart "just" libvirtd<br>    (from dh_installinit)<br>  - but dh_systemd_start will have added a restart section<br>    deb-systemd-invoke $_dh_action 'virtlockd.socket' 'virtlogd.socket' >/dev/null || true<br>  - this will still restart the virtlogd service which has originally<br>    dh_installinit -p libvirt-daemon-system --name=virtlogd --no-restart-on-upgrade<br>  - We have two dh-systemd_start calls in d/rules, assuming retain order<br>    dh_systemd_start -p libvirt-daemon-system --restart-after-upgrade libvirtd.service<br>    is the one which makes it generate the restart on the sockets.<br>    It seems to realize that libvirtd will be started by invoke.rc, so it leaves that out, but<br>    will trigger the two dependencies.</p><p id="gmail-yui_3_10_3_1_1533881063640_1895" style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px"><br></p><p id="gmail-yui_3_10_3_1_1533881063640_1895" style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">Fix III:<br>- drop virtlogd sysV script and change the dh_systemds_start order<br>  - hope is that the dh_systemd_start of libvirtd considers the .socket<br>    files already handled and would no more add them with restart due to dependencies.<br>  - It changed the order in the generated maintainer script<br>  - But the section triggered by libvirtd.service still adds the sockets to the restart action<br>    deb-systemd-invoke $_dh_action 'virtlockd.socket' 'virtlogd.socket' >/dev/null || true<br>  - Please do mind, as in other cases here libvirtd itself is not here<br>    as it is taken over by the sysV start via invoke.rc</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px"><br></p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">Fix IV:</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">  - a try to convert to compat 11 and onyl dh_installsystemd but failed<br>    at too many compat-11 implications</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px"><br></p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">Fix V:<br> - drop virtlogd sysV script (to fix the original issue) and drop the dh_systemd__start call to<br>   libvirtd (to avoid the secondary issue)<br> - Intention: libvirtd (re)start is taken care of by dh_installinit anyway, avoid the bad restarts<br>   on virtlogd with this tweak<br> - with that it seems to work, but it might have other implications that I missed<br>   - the new virtlogd-admin.socket is down (as it would need to restart the service)<br>   - service itself is up and still has the old PID so all is good<br>   - installation works, no more breaking the upgrade.<br></p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px"><br></p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">I'm not so sure if "Fix V" has other bad implications that I miss.<br>But currently that seems to work as needed - so feel free to consider [1] which is the code for it.</p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px"><br></p><p style="margin:0px 0px 0.8em;padding:0px;width:auto;max-width:45em;color:rgb(51,51,51);font-family:monospace;font-size:12px">I think I'd want/need a "dh_systemd_start --no-dependent-services/sockets" option to intentionally have it generate "just" for libvirt.service and not the sockets it depends on.<br></p></div><div>As mentioned, for all of the complexity pulling in the systemd people might help as well.</div><div>So I'm eager to see what they will reply here as well.</div><div><br></div><div>[1]: <a href="https://git.launchpad.net/~libvirt-maintainers/ubuntu/+source/libvirt/commit/?h=ubuntu/cosmic-4.6&id=16bece58d55e50ca6d192714a3581ef981974288">https://git.launchpad.net/~libvirt-maintainers/ubuntu/+source/libvirt/commit/?h=ubuntu/cosmic-4.6&id=16bece58d55e50ca6d192714a3581ef981974288</a></div></div>