在/etc/systemd/logind.conf文件中添加一行配置HandleLidSwitch=ignore
在/etc/systemd/logind.conf
HandleLidSwitch=ignore
然后重启就可以了