1.新增nosuspend.conf文件

sudo mkdir /etc/systemd/sleep.conf.d
sudo vim /etc/systemd/sleep.conf.d/nosuspend.conf

##添加以下内容
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

2.修改greeter.dconf-defaults文件

sudo vim /etc/gdm3/greeter.dconf-defaults
解开注释,并设置值为0
sleep-inactive-ac-timeout=0
sleep-inactive-battery-timeout=0

3.重启gdm3

sudo systemctl restart gdm3

4.修改grub

sudo vim /etc/default/grub
添加以下内容
pcie_aspm=off
例如:
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
pcie_aspm=off

5.执行

sudo update-grub && sudo update-grub2