Prevent restart/hiberate while upgrading

Today I lost yet again another install of Manjaro, which I hibernated while it was installing 360+ packages. (It no longer boots - kernel is missing.)

Is there any way to configure Manjaro so that it doesn’t allow me to hibernate or reboot/shutdown while pacman/pamac is running? I would really like to avoid having to reinstall and reconfigure again (this is the 4th time already IIRC).

Well you can create a script, which will run as a service which will check for conditions…

There are these options for a unit:



The script should then add a overwrite file for the systemd service, for example reboot.service, refuse the start by any user while the condition is true.

Here is an example, but it is old and I have no idea if it works: GitHub - ryran/reboot-guard: Block systemd-initiated poweroff/reboot/halt until configurable condition checks pass

If some would write such a service with python3 or bash, then it could fit your needs. Python2 was recently removed from the repo.

No need to reinstall in such a case.
Use the live USB to chroot into the system and run (and properly finish) the interrupted update again.

Take a look at systemd-inhibit:

1 Like