Re: No daemon-reload or restart with %systemd_postun_with_restart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 24, 2022 at 08:38:39AM +0100, Fabio Valentini wrote:
> On Tue, Mar 22, 2022, 00:12 Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx> wrote:
> > [mrsam@jack tmp]$ systemctl status testsystemd | cat
> > Warning: The unit file, source configuration file or drop-ins of
> > testsystemd.service changed on disk. Run 'systemctl daemon-reload' to
> > reload
> > units.
> > ● testsystemd.service - testsystemd
> >      Loaded: loaded (/usr/lib/systemd/system/testsystemd.service;
> > enabled;
> > vendor preset: disabled)
> >      Active: active (exited) since Mon 2022-03-21 19:02:37 EDT; 4min 35s
> > ago
> >     Process: 88834 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
> >    Main PID: 88834 (code=exited, status=0/SUCCESS)
> >       Tasks: 0 (limit: 76902)
> >      Memory: 0B
> >         CPU: 0
> >      CGroup: /system.slice/testsystemd.service
> >
> > Mar 21 19:02:37 jack systemd[1]: Starting testsystemd…
> > Mar 21 19:02:37 jack systemd[1]: Finished testsystemd.
> >
> > A loud complaint at the beginning that systemd wasn't reload. Same,
> > unchanged, syslog timestamp from the initial start.
> >
> > This is on up to date F35.
> >
> > Then, at this point:
> >
> > sudo systemctl daemon-reload
> > sudo systemctl reload-or-restart --marked
> >
> > [mrsam@jack tmp]$ systemctl status testsystemd
> > ● testsystemd.service - testsystemd
> >      Loaded: loaded (/usr/lib/systemd/system/testsystemd.service;
> > enabled;
> > vend>
> >      Active: active (exited) since Mon 2022-03-21 19:08:29 EDT; 26s ago
> >     Process: 89032 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
> >    Main PID: 89032 (code=exited, status=0/SUCCESS)
> >         CPU: 1ms
> >
> > Mar 21 19:08:29 jack systemd[1]: Starting testsystemd…
> > Mar 21 19:08:29 jack systemd[1]: Finished testsystemd.
> >
> > Now, everything is normal, and new syslogs showing a restart.
> >
> > So, as far as I can tell: %systemd_postun_with_restart did not restart
> > anything.

> I wonder if this behaves the way it does because you're using a oneshot
> service as an example here? It exits as soon as it starts, so there is not
> even a running process to "restart" on package upgrade.

There are two separate steps here: "daemon-reload" and "restart
testsystemd.service".  Systemd is complaining about "daemon-reload"
missing. It isn't internally cognizant of the fact that
testsystemd.service should be restarted, that is managed by the rpm
scriptlets and "needs-restart" markers. Internally, it just looks at
the file timestamps and knows that it has old config.
RemainAfterExit=true means that the service is pinned even though it
exited, so systemd remembers the old config of the service from before
the upgrade and hence the complaint. The warning goes away after
"daemon-reload".

That the service is "oneshot" matters for the "restart" part. What
systemd actually does, is queue a "try-restart" job for the marked units.
Since this service is not running, that should become noop.
There seems to be a bug in the implementation though: try-restart always
restarts the unit → https://github.com/systemd/systemd/issues/22850.

Zbyszek
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux