FS#50529 - [systemd] Pacman hook to trigger `systemd daemon-reload` when nappropriate

Attached to Project: Arch Linux
Opened by John (graysky) - Friday, 26 August 2016, 22:03 GMT
Last edited by Dave Reisner (falconindy) - Friday, 10 March 2017, 12:18 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Seems like now might be a good time to implement this and avoid a manual call to `systemd daemon-reload` by rolling this into a hook. Are there any downsides to doing this?

This has been discussed several years back[1]; I just opened a new discussion thread[2].

1. https://bbs.archlinux.org/viewtopic.php?id=173341
2. https://bbs.archlinux.org/viewtopic.php?pid=1649916
This task depends upon

Closed by  Dave Reisner (falconindy)
Friday, 10 March 2017, 12:18 GMT
Reason for closing:  Deferred
Additional comments about closing:  Potential downsides to this outweight the benefits.
Comment by John (graysky) - Friday, 26 August 2016, 22:09 GMT
Dammit, that should have read `systemctl daemon-reload` not `systemd daemon-reload` but you get the idea.
Comment by John (graysky) - Friday, 26 August 2016, 22:14 GMT
Proposal for such a hook.
Comment by Doug Newgard (Scimmia) - Saturday, 27 August 2016, 14:20 GMT
Not a fan of this idea. daemon-reload does a whole lot of things and should not be done automatically IMO.
Comment by Dave Reisner (falconindy) - Saturday, 27 August 2016, 14:24 GMT
systemd already does daemon-reexec on install. I'd rather do this, than just reload.
Comment by Doug Newgard (Scimmia) - Saturday, 27 August 2016, 14:39 GMT
Every time a service file is installed?!? Oh, please don't.
Comment by John (graysky) - Saturday, 27 August 2016, 15:21 GMT
@Dave - That is true when [core]/systemd is updated I believe; this FS is about packages that supply their own units that when updated, cause systemd to warn the user to that files have been updated, run systemctl daemon-reload. I only added both pacman and systemd to the ticket because I didn't know which of the two packages should supply the hook. I hope that makes sense.
Comment by Dave Reisner (falconindy) - Saturday, 27 August 2016, 15:37 GMT
You're okay with this when systemd is updated but not when other things relating to systemd are updated? That doesnt make sense -- could you detail your concerns for me?
Comment by Doug Newgard (Scimmia) - Sunday, 28 August 2016, 23:20 GMT
I never said I was OK with it when systemd is updated. IMO, that should be left to the user. We don't restart any other daemons after they update, systemd isn't that special.

As for specific concerns, it reruns generators so the new units may no longer represent the current state of the system, it resets all OnActive timers, and I've heard (but not tested) that it reruns oneshot services. On my testing, it also screwed up the cursor in my X session.
Comment by Chris Severance (severach) - Sunday, 09 October 2016, 20:57 GMT
Why are socket and target left out of the hook? There are many other extensions. Why leave any out?

If Samba updates I can't restart smbd until I do a daemon-reload. What difference does it make if I do it manually or pacman forces it immediately? I'm instructed to do a daemon-reload, I do it, and something happens. There's no indication that daemon-reload will launch GTNW.

It looked like enable could fix per unit but testing smbd and nmbd shows that enable is not per unit and is no better than daemon-reload.

# cd /usr/lib/systemd/system
# rm -f {smbd,nmbd}.service
# systemctl daemon-reload
# pacman -S samba
# systemctl restart smbd
Failed to restart smbd.service: Unit smbd.service not found.
# systemctl restart nmbd
Failed to restart nmbd.service: Unit nmbd.service not found.
# systemctl enable smbd
(no message as it was already enabled)
# systemctl restart nmbd
(no error)

So Bad Things(tm) happen if I so much as enable a newly installed service? The only problem, if any, is that daemon-reload does too much and we need a command that does less.
Comment by Dave Reisner (falconindy) - Sunday, 09 October 2016, 21:03 GMT
As an example of why this shouldn't be done, upgrading from 231-1 to anything and then calling 'systemctl daemon-reexec' will cause Bad Things to happen: https://bugs.archlinux.org/task/51275.

Loading...