[systemd-devel] Shutdown behavior follow up
All, Referring to my last email regarding the systemd shutdown behavior. I am working on the assumption that the idea of honoring the first shutdown request is the preferred way to go. If not this email can be ignored. I have reproduced the same behavior using a fedora 31 machine with systemd v243. I have a proposed fix, including source file change, patch file and sample service which can be used to both show the problem and show the fix. I am not sure if this is the right forum to attach those files. If this is the desired behavior, I am wondering what are my next steps to get this into the next systemd delivery. I have not done this before so I am looking for some instruction? Thanks in advance, -Jay -Original Message- From: Lennart Poettering Sent: Monday, January 13, 2020 4:33 AM To: Burger, Jay Cc: systemd-devel@lists.freedesktop.org; Dang, James ; Berger, Daniel ; Mahabaleshwar, Niranjan Subject: Re: [systemd-devel] Shutdown behavior On Fr, 10.01.20 10:56, Jay Burger (jay.bur...@us.fujitsu.com) wrote: > I made the same type of change in the emergency_action() function in v232. > > Question 1: Would this be considered a problem with the design, > needing an upstream fix? Or would this be considered a particular user > issue, to be fixed with an isolated patch, like we have done? If the > latter is the answer to this then would this be considered a legit fix > for our purposes? Or is there a better way to handle this use case? I > know fixing my user services to not fail on the shutdown would be > preferable, but pulling teeth is not in my skillset. Hmm, so what is the expected behaviour here? If one service requires a reboot and another a poweroff, and one is triggered first and the other second, then I can at least think of four policies that make sense: 1. first requested always wins 2. last requested always wins 3. reboot is the positive outlook, and thus always wins 4. poweorff is the positive outlook, and thus always wins. Unless I am mistaken we currently implement policy 2. Which one would you prefer? Can you make a good case why it would be better in the general case? I have the suspicion we should just adopt the best possible policy here and stick to it and not make things needlessly configurable. But it's a matter of discussion which one that is... > Question 2: I recently found a case where a poweroff shutdown was > triggered while the system was in the "starting" state and a service > failure occurred during the shutdown. In this case my logic change did > not prevent the shutdown from changing to a reboot. This check of the > manager_state found the state was still "starting" and the poweroff > was again changed to a reboot. Is there a different logic path taken > when in the starting state as opposed to the running state? Not really, no. Lennart -- Lennart Poettering, Berlin ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] question about poweroff issue
-Original Message- From: systemd-devel On Behalf Of systemd-devel-requ...@lists.freedesktop.org Sent: Wednesday, February 26, 2020 6:00 AM To: systemd-devel@lists.freedesktop.org Subject: systemd-devel Digest, Vol 118, Issue 15 Send systemd-devel mailing list submissions to systemd-devel@lists.freedesktop.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.freedesktop.org/mailman/listinfo/systemd-devel or, via email, send a message with subject or body 'help' to systemd-devel-requ...@lists.freedesktop.org You can reach the person managing the list at systemd-devel-ow...@lists.freedesktop.org When replying, please edit your Subject line so it is more specific than "Re: Contents of systemd-devel digest..." Today's Topics: 1. question about a poweroff issue (piliu) 2. Antw: [EXT] Infinite loop at startup on var fsck failure (Ulrich Windl) 3. Re: Antw: [EXT] Infinite loop at startup on var fsck failure (Michael Biebl) 4. Antw: Re: Antw: [EXT] Infinite loop at startup on var fsck failure (Ulrich Windl) 5. Read-only /etc, machine-id with an overlay - journald failing (Andreas Kempe) -- Message: 1 Date: Wed, 26 Feb 2020 13:50:55 +0800 From: piliu To: SystemD Devel Subject: [systemd-devel] question about a poweroff issue Message-ID: Content-Type: text/plain; charset=utf-8 Hi, I encountered a systemd bug during saving vmcore for kdump kernel. I got the following message: [ 60.283489] systemd[1]: Started Reload Configuration from the Real Root. [ 60.290912] systemd[1]: Reached target Initrd File Systems. [ 60.296162] systemd[1]: Reached target Initrd Default Target. [ 60.299343] systemd[1]: Starting dracut pre-pivot and cleanup hook... Starting dracut pre-pivot and cleanup hook... [ OK ] Started dracut pre-pivot and cleanup hook. [ 60.338320] systemd[1]: Started dracut pre-pivot and cleanup hook. [ 60.340503] systemd[1]: Starting Kdump Vmcore Save Service... Starting Kdump Vmcore Save Service... kdump: dump target /dev/mapper/rhel_storageqe--25-root is not mounted, trying to mount... kdump: saving to /sysroot//mnt/kdump_multi/var/crash/127.0.0.1-2020-02-20-05:00:45/ kdump: saving vmcore-dmesg.txt kdump: saving vmcore-dmesg.txt complete kdump: saving vmcore Copying data : [100.0 %] / eta: 0s kdump: saving vmcore complete Bus n/a: changing state UNSET ? OPENING Bus n/a: changing state OPENING ? AUTHENTICATING Bus n/a: changing state AUTHENTICATING ? RUNNING Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=Reboot cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a [ 66.032946] systemd[1]: Shutting down. Got message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=n/a error-name=n/a error-message=n/a Bus n/a: changing state RUNNING ? CLOSED [ 66.060777] printk: systemd-shutdow: 350 output lines suppressed due to ratelimiting [ 66.316784] printk: systemd-journal: 13 output lines suppressed due to ratelimiting [ 156.506161] qla2xxx [:08:00.1]-fffa:1: Adapter shutdown [ 156.535660] qla2xxx [:08:00.1]-00af:1: Performing ISP error recovery - ha=350c9f53. [ 156.581142] qla2xxx [:08:00.1]-fffe:1: Adapter shutdown successfully. [ 156.612816] qla2xxx [:08:00.0]-fffa:0: Adapter shutdown [ 156.638997] qla2xxx [:08:00.0]-00af:0: Performing ISP error recovery - ha=7acbb643. [ 156.681032] qla2xxx [:08:00.0]-fffe:0: Adapter shutdown successfully. In the kdump script, for the final step, it calls "systemctl reboot -f". But it seems the system is experiencing poweroff instead of reboot. Further more, in kdump script, even if I placed "sleep 60" before "systemctl reboot -f", the extra command did not take effect, and the system just start to poweroff immediately. So I guess there is another process to launch the poweroff action, but how to know what is it? Any suggestion? Thanks, Pingfan There has been discussion on how systemd should behave if multiple shutdowns are received. I for one think the first shutdown received should be honored through to completion. I have submitted a pull request that does exactly that. It is under review and not accepted yet, but it is out there. It would hide the issue you are seeing but then again you are shutting down. https://github.com/systemd/systemd/pull/14945 -Jay -- Message: 2 Date: Wed, 26 Feb 2020 10:05:21 +0100 From: "Ulrich Windl" To: "systemd-devel@lists.freedesktop.org" , Subject: [systemd-devel] Antw: [EXT] Infinite loop at startup on var fsck failure Message-ID: <5e5634d102a100037...@gwsmtp
[systemd-devel] Recommended shutdown method
All, I have a debate going on over which is the best way to recommend to a development organization how to design a service shutdown. There are two camps. 1. Use the ExecStop with an additional process that needs to ipc to the services main pid and wait for a response. 2. Use the SigTerm that systemd sends to the main pid which can use a "quit" flag that the main process will use to shutdown. I know this is kind of an large issue but now that systemd is more widespread is there any momentum in either method? If so could someone point me to examples or documentation? Thanks, -Jay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel