Black screen after CentOS7 combination on laptop but not sleep mode
CentOS 7 is built with a black screen, but does not enter sleep mode. Modify systemd to handle some power-related ACPI events. You can configure it by using the following options from/etc/system/logind. conf:
HandlePowerKey action after pressing the power key
HandleSleepKey: the behavior of pressing the hold key
HandleHibernateKey action after pressing the sleep key
HandleLidSwitch
The behavior can be ignore, poweroff, reboot, halt, suspend, hibernate, hybrid-sleep, lock, or kexec.
The default settings are as follows:
HandlePowerKey = poweroff
HandleSuspendKey = suspend
HandleHibernateKey = hibernate
HandleLidSwitch = suspend
You only need to set the HandleLidSwitch option to the following:
HandleLidSwitch = lock
Note: After the settings are saved, run the systemctl restart systemd-logind command.