嘟嘟社区

[经验] 如果用debian小鸡装桌面可能需要关掉自动休眠


本帖最后由 好鸭 于 2022-8-1 09:45 编辑

有些桌面的电源管理可能会触发"休眠",需要关掉,否则会导致失联

参考的这个https://blog.csdn.net/weixin_45980458/article/details/122952607

1、查看休眠状态

systemctl status sleep.target

2、设置禁止休眠

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

3、再查看

systemctl status sleep.target

不会再出现自动休眠状态

用debian装xfce+xrdp还挺舒服的,有点小卡(windows小鸡应该更卡一点点)

用来运行一些gui应用

装了好多了 没遇到这个情况
本帖最后由 好鸭 于 2022-8-1 09:13 编辑

职业菜鸟 发表于 2022-8-1 09:08
装了好多了 没遇到这个情况

我以前也没遇到过,应该是特定版本的问题。具体不知道是啥引起的,但知道是装桌面的过程(装了不止一个桌面)

https://wiki.debian.org/Suspend

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

create /etc/systemd/sleep.conf.d/nosuspend.conf as

[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

这样就可以了吧?
  1. [email protected]:~# systemctl status sleep.target
  2. ● sleep.target – Sleep
  3.      Loaded: loaded (/lib/systemd/system/sleep.target; static)
  4.      Active: inactive (dead)
  5.        Docs: man:systemd.special(7)
  6. [email protected]:~# systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
  7. Created symlink /etc/systemd/system/sleep.target → /dev/null.
  8. Created symlink /etc/systemd/system/suspend.target → /dev/null.
  9. Created symlink /etc/systemd/system/hibernate.target → /dev/null.
  10. Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null.
  11. [email protected]:~# systemctl status sleep.target
  12. ● sleep.target
  13.      Loaded: masked (Reason: Unit sleep.target is masked.)
  14.      Active: inactive (dead)
  15. [email protected]:~#

复制代码