编辑下面的文件 sudo vim /etc/systemd/logind.conf 然后将其中的#HandleLidSwitch=suspend改成HandleLidSwitch=ignore(注意要去掉#号),然后重启电脑即可。