[systemd-devel] Run "ipmitool power cycle" after lib/systemd/system-shutdown scripts

Etienne Champetier champetier.etienne at gmail.com
Thu Feb 10 11:44:24 UTC 2022


Le jeu. 10 févr. 2022 à 11:31, Lennart Poettering
<lennart at poettering.net> a écrit :
>
> On Mi, 09.02.22 22:05, Etienne Champetier (champetier.etienne at gmail.com) wrote:
>
> > Hello systemd hackers,
> >
> > After flashing the firmware of some pcie card I need to power cycle
> > the server to finish the flashing process.
> > For now I have a simple script in lib/systemd/system-shutdown/ running
> > "ipmitool power cycle" but I would like to make sure it runs after
> > other scripts like fwupd.shutdown or mdadm.shutdown
> >
> > Is there any way to have systemd cleanly power cycle my server instead
> > of rebooting it ?
>
> What does "power cycle" entail that "reboot" doesnt? i.e. why doesn't
> "systemctl reboot" suffice?

"power cycle" is "power off", wait ~2sec with server turned off, then "power on"
During a normal reboot a pcie card still gets power and just receive a
reset signal if I understand correctly

> /usr/lib/systemd/system-shutdown/ drop-ins are executed before the OS
> transitions back into the initrd — the initrd will then detach the
> root fs (i.e. undo what it attached at boot) and actually reboot. This
> means if your command turns off the power source you should stick it
> in the initrd's shutdown logic, and not into
> /usr/lib/systemd/system-shutdown/. If you are using RHEL this means
> into dracut. But adding it there is something to better discuss with
> the dracut community than here.

Thanks for the pointer, I'll look in that direction

Etienne

> Lennart
>
> --
> Lennart Poettering, Berlin


More information about the systemd-devel mailing list