How is this not a built-in function of pacman?
Idk if you’re looking for a solution, but if you are… I think
systemd-inhibitis what you’re looking for. Something likesystemd-inhibit --what=sleep pacman -Syushould work.It might need a d-bus hook built into it, idk
I think other packet managers don’t, either.
As an upside you won’t run into situations like a big Windows update blocking the entire computer 20mins before your meeting and you’d really need to close the lid, throw it in the backpack and walk to the meeting room. Or you spontaneously talk to someone and return to a laptop with a drained battery. Probably more of an issue with automatic-upgrades, though.
Zypper and dnf do block suspend during download and installation of packages, I see them as ‘sleep blockers’ in KDE’s battery settings, unlike for pacman
I don’t remember what the Linux equivalent is but in macOS I just prefix commands with
caffeinate. It’s super helpful when I want to do things like restore a large database then walk away. I can’t imagine it doesn’t exist on Linux.Why should it?
Downloads are interrupted by sleep, but they can be safely interrupted.
Installing packages or other core changes are not interrupted by entering sleep mode. Although, they would be interrupted by shutdown/rebooting, sometimes to catastrophic consequences.
Other distros are a bit more resilient, with things like installing and managing multiple kernels, that way even if one breaks (like via a borked/interrupted update), you can still boot.
But pacman/Arch Linux is designed with a certain philosphy in mind. You are supposed to be reading the pacman output, that way you can respond if anything needs to be done. If you don’t respond accordingly when certain manual changes are needed, then bad things can happen. For example, if the grub package gets updated, then you might need to manually generate a new grub config file. If the grub config file and grub itself are out of sync, your system could be rendered unbootable.
One good reason is so that you can start an update, walk away, and it’ll run to completion.
So then Unix philosophy way just
yes pacman -Syyu && systemctl suspendor whatever. It only runs if the update is successful, and waits until it’s finished, orpacman -Syyu; systemctl suspendif you want it to suspend regardless of success or failureNeither of these actually inhibit sleep during the update though…
Thanks for answering. I guess having a laptop fully charged but not on AC-power doing even the smallest update still enters sleep for some reason, even during installation of new files for me





