<div dir="ltr"><div dir="ltr">On Thu, Feb 10, 2022 at 3:11 PM Ulrich Windl <<a href="mailto:Ulrich.Windl@rz.uni-regensburg.de">Ulrich.Windl@rz.uni-regensburg.de</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>>> Etienne Champetier <<a href="mailto:champetier.etienne@gmail.com" target="_blank">champetier.etienne@gmail.com</a>> schrieb am 10.02.2022 um<br>
12:47 in Nachricht<br>
<CAOdf3grZ2wUOkJ8Pzu-EM=+ZCKY4b6XK9dyZoh=<a href="mailto:QpX5HgHJfxA@mail.gmail.com" target="_blank">QpX5HgHJfxA@mail.gmail.com</a>>:<br>
> Le jeu. 10 févr. 2022 à 11:49, Ulrich Windl<br>
> <<a href="mailto:Ulrich.Windl@rz.uni-regensburg.de" target="_blank">Ulrich.Windl@rz.uni-regensburg.de</a>> a écrit :<br>
>><br>
>> >>> Lennart Poettering <<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>> schrieb am 10.02.2022 um<br>
11:31<br>
>> in<br>
>> Nachricht <YgTpdVFRgL+uQoY9@gardel-login>:<br>
>> > On Mi, 09.02.22 22:05, Etienne Champetier (<a href="mailto:champetier.etienne@gmail.com" target="_blank">champetier.etienne@gmail.com</a>)<br>
>> > wrote:<br>
>> ><br>
>> >> Hello systemd hackers,<br>
>> >><br>
>> >> After flashing the firmware of some pcie card I need to power cycle<br>
>> >> the server to finish the flashing process.<br>
>> >> For now I have a simple script in lib/systemd/system-shutdown/ running<br>
>> >> "ipmitool power cycle" but I would like to make sure it runs after<br>
>> >> other scripts like fwupd.shutdown or mdadm.shutdown<br>
>> >><br>
>> >> Is there any way to have systemd cleanly power cycle my server instead<br>
>> >> of rebooting it ?<br>
>> ><br>
>> > What does "power cycle" entail that "reboot" doesnt? i.e. why doesn't<br>
>> > "systemctl reboot" suffice?<br>
>><br>
>> My guess is that some smart cards with their own firmware and CPu do not<br>
>> reboot unless they are power cycled, so maybe if the firmware upgrade on<br>
the<br>
>> card does not force it to reboot, it my need a power cycle.<br>
>><br>
>> ><br>
>> > /usr/lib/systemd/system-shutdown/ drop-ins are executed before the OS<br>
>> > transitions back into the initrd — the initrd will then detach the<br>
>> > root fs (i.e. undo what it attached at boot) and actually reboot. This<br>
>> > means if your command turns off the power source you should stick it<br>
>> > in the initrd's shutdown logic, and not into<br>
>> > /usr/lib/systemd/system-shutdown/. If you are using RHEL this means<br>
>> > into dracut. But adding it there is something to better discuss with<br>
>> > the dracut community than here.<br>
>><br>
>> My guess is that it would be handled best by some special GRUB boot menu <br>
> entry<br>
>> (like "boot 'power cycle' once).<br>
> <br>
> This is pretty clean but it means going through "BIOS" init twice<br>
> which can be pretty long on physical servers<br>
<br>
Hi!<br>
<br>
Of course I have a better solution: Use an external server and just before<br>
restarting send a command to that server that will, after a carefully tuned<br>
delay, will trigger the IPMI power-cycle remotely ;-)<br>
I believe that it's almost impossible to trigger a power cycle through IPMI<br>
while also doing a clean shutdown/reboot, unless the the IPMI features a<br>
delayed execution itself.<br></blockquote><div><br></div><div>Asking the BMC to power the system off is no different than asking the system to power itself off – what makes it a "clean shutdown" is stopping services, syncing and unmounting filesystems, etc. So in theory these shutdown hooks should do the job.</div><div><br></div><div>Though a better place would be a "shutdown initramfs" which runs from a tmpfs after *all* storage has been unmounted. I think Dracut has that, and explicitly specifies the order for its shutdown hooks, so it should be possible to put ipmitool there.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>