Ubuntu关闭休眠模式

There are 3 suspend modes in Linux:

  • Suspend to RAM (Normal Suspend): This is the mode that most laptops automatically enter incase of inactivity over a certain duration or upon closing the lid when the PC is running on the battery. In this mode, power is reserved for the RAM and is cut from most components.
  • Suspend to Disk (Hibernate): In this mode, the machine state is saved into swap space & the system is completely powered off. However, upon turning it on, everything is restored and you pick up from where you left.
  • Suspend to both (Hybrid suspend): Here, the machine state is saved into swap, but the system does not go off. Instead, the PC is suspended to RAM. The battery is not used and you can safely resume the system from the disk and get ahead with your work. This method is much slower than suspending to RAM.

命令如下:

$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Ubuntu关闭休眠模式_第1张图片

$ sudo vim /etc/systemd/logind.conf
[Login] 
HandleLidSwitch=ignore 
HandleLidSwitchDocked=ignore

 Ubuntu关闭休眠模式_第2张图片

$ sudo systemctl  restart systemd-logind.service

你可能感兴趣的:(『合集-System』,linux,运维,服务器,ubuntu)