While features like suspend and hibernate offer energy savings, some users prefer their systems to stay awake. This might be for servers, running long tasks, or simply a preference for uninterrupted operation. This guide will walk you through how to completely disable suspend and hibernate on your Linux machine, using systemd, the modern system manager.
Server operations: Servers need constant uptime. Sleep modes can interrupt crucial processes.Long-running tasks: Suspend or hibernate can interrupt tasks like downloads, compilations, or complex calculations.User preference: Some users simply prefer their system to remain active, eliminating the potential for unwanted sleep interruptions.
sudo nano /etc/systemd/sleep.conf
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
Power menu: The "Suspend" option should disappear from the power-off menu.Command line: The systemctl suspend command should fail with a message indicating that suspend is disabled.
sudo nano /etc/systemd/sleep.conf.d/disable-sleep.conf
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no
Edit sleep.conf: Comment out the four lines in the /etc/systemd/sleep.conf file by adding a "#" at the beginning of each line.Delete the custom file: Remove the file you created in the /etc/systemd/sleep.conf.d directory. For example, to remove disable-sleep.conf, use the following command:
sudo rm /etc/systemd/sleep.conf.d/disable-sleep.conf
0 comments:
Post a Comment