To prevent your Linux system from suspending or going into hibernation, you need to disable the following systemd targets:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
$ sudo systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target
[sudo] password for alexlai:
β sleep.target - Sleep
Loaded: loaded (/usr/lib/systemd/system/sleep.target; static)
Active: inactive (dead)
Docs: man:systemd.special(7)
β suspend.target - Suspend
Loaded: loaded (/usr/lib/systemd/system/suspend.target; static)
Active: inactive (dead)
Docs: man:systemd.special(7)
β hibernate.target - System Hibernation
Loaded: loaded (/usr/lib/systemd/system/hibernate.target; static)
Active: inactive (dead)
Docs: man:systemd.special(7)
β hybrid-sleep.target - Hybrid Suspend+Hibernate
Loaded: loaded (/usr/lib/systemd/system/hybrid-sleep.target; static)
Active: inactive (dead)
Docs: man:systemd.special(7)
ξ ξ° alexlai@hc4Gnome ξ° ο ξ° sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Created symlink /etc/systemd/system/sleep.target β /dev/null.
Created symlink /etc/systemd/system/suspend.target β /dev/null.
Created symlink /etc/systemd/system/hibernate.target β /dev/null.
Created symlink /etc/systemd/system/hybrid-sleep.target β /dev/null.
ξ° ο ξ° sudo systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target
β sleep.target
Loaded: masked (Reason: Unit sleep.target is masked.)
Active: inactive (dead)
β suspend.target
Loaded: masked (Reason: Unit suspend.target is masked.)
Active: inactive (dead)
β hibernate.target
Loaded: masked (Reason: Unit hibernate.target is masked.)
Active: inactive (dead)
β hybrid-sleep.target
Loaded: masked (Reason: Unit hybrid-sleep.target is masked.)
Active: inactive (dead)
To re-enable the suspend and hibernation modes, run the command:
$ sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
journalctl -b
noacpi
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noacpi" or "acpi=off apm=off"
# my orangepi5
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet acpi=off apm=off"
sudo update-grub
git clone https://aur.archlinux.org/update-grub.git
cd update-grub
makepkg -si
$ sudo mkdir /boot/grub
[alexlai@orangepi5 update-grub]$ sudo update-grub
Generating grub configuration file ...
Found linux image: /boot/Image
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
$ sudo vim /etc/systemd/logind.conf
Append the following lines to the file.
[Login]
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
Return to Top