戴尔服务器进入睡眠状态后无法再访问:内核:PM:暂停条目(s2idle)

戴尔服务器进入睡眠状态后无法再访问:内核:PM:暂停条目(s2idle)

[原帖标题:《Ubuntu 在物理服务器上的 SSD NVME 磁盘(LVM)上定期关闭》

帖子的开头是出于历史原因而保留的,但下面的编辑倾向于表明这是一个触发暂停状态的问题,并且系统之后无法唤醒]

我正在使用 Ubuntu 物理服务器(Dell Precision 7920 Rack)(我确实可以物理访问它),它在过去几天内随机关闭(无论我做什么,当我不使用它时它也会停止)。

这可能是由于发行版升级(使用从 20.04 升级到 22.04 do-release-upgrade)导致的,但此后机器运行良好,并且已重启多次。我安装了一些新软件,主要是 python 库,没有任何问题。

电源和主板都换了,问题依然存在。

我拔下了用于数据存储的辅助硬盘。问题仍然存在。

memtest86+ 已经正常运行了几个小时。

我更换了主 SSD,并重新安装了 22.04。问题消失了。

我把旧的 SSD 插上电源以便能够检查它,但我不知道从哪里开始。也许在日志文件中?哪些?

该主磁盘(包含以前的 Ubuntu 22.04)现在仅作为辅助磁盘插入,是 1 TB SSD/NVME,分区如下:

$ lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
(....)
nvme1n1                     259:1    0 953.9G  0 disk 
├─nvme1n1p1                 259:2    0   512M  0 part 
├─nvme1n1p2                 259:3    0   488M  0 part 
└─nvme1n1p3                 259:5    0 952.9G  0 part 
  ├─ubuntu--vg-root         253:0    0 675.6G  0 lvm  /mnt/ubuntu-vg/root
  └─ubuntu--vg-swap_1       253:1    0 255.7G  0 lvm 

我真的不知道这些带有“vg”标记的分区是什么,也不知道“lvm”类型是什么。

我花了几个小时搜索它们的含义,看起来磁盘正在使用逻辑卷管理器。这个页面帮了我大忙:https://www.cyberciti.biz/faq/linux-mount-an-lvm-volume-partition-command/

以下是更多信息:

$ sudo vgscan 
  Found volume group "ubuntu-vg" using metadata type lvm2
$ sudo lvs
  LV     VG            Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   ubuntu-vg     -wi-ao----  675.63g                                                    
  swap_1 ubuntu-vg     -wi-a----- <255.69g

root分区是包含 Ubuntu 的分区。

使用以下方式显示详细信息lvdisplay

$ sudo lvdisplay 
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                <UUID-string>
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2018-01-19 14:11:21 +0100
  LV Status              available
  # open                 1
  LV Size                675.63 GiB
  Current LE             172962
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                <UUID-string>
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2018-01-19 14:11:21 +0100
  LV Status              available
  # open                 0
  LV Size                <255.69 GiB
  Current LE             65456
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

使用smartmontools:

$ sudo smartctl -a /dev/nvme1n1
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-48-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       THNSN51T02DU7 NVMe TOSHIBA 1024GB
Serial Number:                      <serial number>
Firmware Version:                   57DC4101
PCI Vendor/Subsystem ID:            0x1179
IEEE OUI Identifier:                0x00080d
Controller ID:                      0
NVMe Version:                       <1.2
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1,024,209,543,168 [1.02 TB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            00080d 0200119860
Local Time is:                      Sat Oct  8 16:02:51 2022 CEST
Firmware Updates (0x02):            1 Slot
Optional Admin Commands (0x0016):   Format Frmw_DL Self_Test
Optional NVM Commands (0x001e):     Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat
Warning  Comp. Temp. Threshold:     78 Celsius
Critical Comp. Temp. Threshold:     82 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     6.00W       -        -    0  0  0  0        0       0
 1 +     2.40W       -        -    1  1  1  1        0       0
 2 +     1.90W       -        -    2  2  2  2        0       0
 3 -   0.0120W       -        -    3  3  3  3     5000   10000
 4 -   0.0060W       -        -    4  4  4  4   100000   50000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         2
 1 -    4096       0         1

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        40 Celsius
Available Spare:                    100%
Available Spare Threshold:          50%
Percentage Used:                    11%
Data Units Read:                    13,261,121 [6.78 TB]
Data Units Written:                 62,390,020 [31.9 TB]
Host Read Commands:                 323,925,170
Host Write Commands:                2,274,659,640
Controller Busy Time:               6,206
Power Cycles:                       48
Power On Hours:                     41,151
Unsafe Shutdowns:                   34
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               40 Celsius

Error Information (NVMe Log 0x01, 16 of 128 entries)
No Errors Logged

nvme smart-log

$ sudo nvme smart-log /dev/nvme1n1
Smart Log for NVME device:nvme1n1 namespace-id:ffffffff
critical_warning            : 0
temperature                 : 40 C (313 Kelvin)
available_spare             : 100%
available_spare_threshold   : 50%
percentage_used             : 11%
endurance group critical warning summary: 0
data_units_read             : 13261121
data_units_written          : 62390020
host_read_commands          : 323925170
host_write_commands         : 2274659640
controller_busy_time        : 6206
power_cycles                : 48
power_on_hours              : 41151
unsafe_shutdowns            : 34
media_errors                : 0
num_err_log_entries         : 0
Warning Temperature Time        : 0
Critical Composite Temperature Time : 0
Temperature Sensor 1                : 40 C (313 Kelvin)
Thermal Management T1 Trans Count   : 0
Thermal Management T2 Trans Count   : 0
Thermal Management T1 Total Time    : 0
Thermal Management T2 Total Time    : 0

了解了这一点,是否可以判断磁盘是否不健康?

现在系统在另一个驱动器上启动,通过检查 SSD 的分区在哪里:

$ ls -lart /dev/ubuntu-vg/
total 0
lrwxrwxrwx  1 root root    7 Oct  8 14:48 root -> ../dm-0
lrwxrwxrwx  1 root root    7 Oct  8 14:48 swap_1 -> ../dm-1

我还可以安装它,以便我可以探索文件:

$ sudo mount /dev/dm-0 /mnt/ubuntu-vg/root/

从那时起,我真的不知道在哪里和要搜索什么。
任何帮助都非常感谢。journalctl对辅助驱动器没有帮助。

编辑

好的,在 @Hannu 的有用评论之后(谢谢!);我能够journalctl在我以前的/var/log/journal目录上运行(希望这是正确的目录journalctl?)。通过将时间窗口限制到我第一次明确丢失 SSH 会话的时间(无法恢复新的会话并且必须物理重新启动服务器),journalctl向我显示了以下几行:

$ journalctl --directory="/mnt/ubuntu-vg/root/var/log/journal/<journal-id>/" --since "2022-09-25 15:37" --until "2022-09-25 18:00"
Sep 25 15:37:35 ubuntu sudo[23028]:      username : TTY=pts/0 ; PWD=/etc/apt/sources.list.d ; USER=root ; COMMAND=/usr/bin/apt-get update
Sep 25 15:37:35 ubuntu sudo[23028]: pam_unix(sudo:session): session opened for user root(uid=0) by username(uid=1002)
Sep 25 15:37:37 ubuntu sudo[23028]: pam_unix(sudo:session): session closed for user root
Sep 25 15:37:37 ubuntu sudo[23398]:      username : TTY=pts/0 ; PWD=/etc/apt/sources.list.d ; USER=root ; COMMAND=/usr/bin/apt-get upgrade
Sep 25 15:37:37 ubuntu sudo[23398]: pam_unix(sudo:session): session opened for user root(uid=0) by username(uid=1002)
Sep 25 15:37:38 ubuntu sudo[23398]: pam_unix(sudo:session): session closed for user root
Sep 25 15:37:38 ubuntu sudo[23424]:      username : TTY=pts/0 ; PWD=/etc/apt/sources.list.d ; USER=root ; COMMAND=/usr/bin/apt-get dist-upgrade
Sep 25 15:37:38 ubuntu sudo[23424]: pam_unix(sudo:session): session opened for user root(uid=0) by username(uid=1002)
Sep 25 15:37:39 ubuntu sudo[23424]: pam_unix(sudo:session): session closed for user root
Sep 25 15:37:39 ubuntu sudo[23450]:      username : TTY=pts/0 ; PWD=/etc/apt/sources.list.d ; USER=root ; COMMAND=/usr/bin/apt-get autoremove --purge
Sep 25 15:37:39 ubuntu sudo[23450]: pam_unix(sudo:session): session opened for user root(uid=0) by username(uid=1002)
Sep 25 15:37:39 ubuntu sudo[23450]: pam_unix(sudo:session): session closed for user root
Sep 25 15:37:39 ubuntu sudo[23523]:      username : TTY=pts/0 ; PWD=/etc/apt/sources.list.d ; USER=root ; COMMAND=/usr/bin/apt-get autoclean
Sep 25 15:37:39 ubuntu sudo[23523]: pam_unix(sudo:session): session opened for user root(uid=0) by username(uid=1002)
Sep 25 15:37:39 ubuntu sudo[23523]: pam_unix(sudo:session): session closed for user root
Sep 25 15:37:39 ubuntu sudo[23528]:      username : TTY=pts/0 ; PWD=/etc/apt/sources.list.d ; USER=root ; COMMAND=/usr/sbin/ldconfig
Sep 25 15:37:39 ubuntu sudo[23528]: pam_unix(sudo:session): session opened for user root(uid=0) by username(uid=1002)
Sep 25 15:37:40 ubuntu sudo[23528]: pam_unix(sudo:session): session closed for user root
Sep 25 15:40:35 ubuntu ModemManager[3889]: <info>  [sleep-monitor] system is about to suspend
Sep 25 15:40:35 ubuntu NetworkManager[3980]: <info>  [1664113235.8663] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Sep 25 15:40:35 ubuntu NetworkManager[3980]: <info>  [1664113235.8667] device (eno3): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 25 15:40:35 ubuntu NetworkManager[3980]: <info>  [1664113235.9082] device (eno4): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 25 15:40:35 ubuntu NetworkManager[3980]: <info>  [1664113235.9477] device (eno1): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
Sep 25 15:40:35 ubuntu dbus-daemon[3769]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.15' (uid=0 pid=3980>
Sep 25 15:40:35 ubuntu systemd[1]: Starting Network Manager Script Dispatcher Service...
Sep 25 15:40:36 ubuntu dbus-daemon[3769]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 25 15:40:36 ubuntu systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 25 15:40:36 ubuntu NetworkManager[3980]: <info>  [1664113236.0052] device (eno1): state change: deactivating -> disconnected (reason 'sleeping', sys-iface-state: 'managed')
Sep 25 15:40:36 ubuntu avahi-daemon[3768]: Withdrawing address record for fe80::xxxx:xxxx:xxxx:xxxx on eno1.
Sep 25 15:40:36 ubuntu avahi-daemon[3768]: Leaving mDNS multicast group on interface eno1.IPv6 with address fe80::xxxx:xxxx:xxxx:xxxx.
Sep 25 15:40:36 ubuntu avahi-daemon[3768]: Interface eno1.IPv6 no longer relevant for mDNS.
Sep 25 15:40:36 ubuntu NetworkManager[3980]: <info>  [1664113236.0435] dhcp4 (eno1): canceled DHCP transaction
Sep 25 15:40:36 ubuntu NetworkManager[3980]: <info>  [1664113236.0436] dhcp4 (eno1): activation: beginning transaction (timeout in 45 seconds)
Sep 25 15:40:36 ubuntu NetworkManager[3980]: <info>  [1664113236.0436] dhcp4 (eno1): state changed no lease
Sep 25 15:40:36 ubuntu avahi-daemon[3768]: Withdrawing address record for 10.192.xxx.x on eno1.
Sep 25 15:40:36 ubuntu avahi-daemon[3768]: Leaving mDNS multicast group on interface eno1.IPv4 with address 10.192.xxx.x.
Sep 25 15:40:36 ubuntu systemd-resolved[4099]: eno1: Bus client reset search domain list.
Sep 25 15:40:36 ubuntu avahi-daemon[3768]: Interface eno1.IPv4 no longer relevant for mDNS.
Sep 25 15:40:36 ubuntu systemd-resolved[4099]: eno1: Bus client set default route setting: no
Sep 25 15:40:36 ubuntu systemd-resolved[4099]: eno1: Bus client reset DNS server list.
Sep 25 15:40:36 ubuntu NetworkManager[3980]: <info>  [1664113236.0687] device (eno1): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 25 15:40:36 ubuntu systemd[1]: Reached target Sleep.
Sep 25 15:40:36 ubuntu systemd[1]: Starting Record successful boot for GRUB...
Sep 25 15:40:36 ubuntu systemd[1]: Starting System Suspend...
Sep 25 15:40:36 ubuntu systemd[1]: grub-common.service: Deactivated successfully.
Sep 25 15:40:36 ubuntu systemd[1]: Finished Record successful boot for GRUB.
Sep 25 15:40:36 ubuntu systemd[1]: Starting GRUB failed boot detection...
Sep 25 15:40:36 ubuntu systemd-sleep[24557]: Entering sleep state 'suspend'...
Sep 25 15:40:36 ubuntu kernel: PM: suspend entry (s2idle)
Sep 25 15:40:36 ubuntu systemd[1]: grub-initrd-fallback.service: Deactivated successfully.
Sep 25 15:40:36 ubuntu systemd[1]: Finished GRUB failed boot detection.
Sep 25 15:40:36 ubuntu kernel: Filesystems sync: 0.010 seconds

我显然可以看到一些我手动运行的更新/升级/清理命令sudo,在我参加完会议之后,这些是机器完全无法访问之前的最后一行。它甚至似乎不是关键或失败消息......我真的不明白。此时,我甚至想知道这是否只是某种网络问题,即机器仍在运行,但我无法再访问它,也许吧(?)

这对我来说有点晦涩,我不知道如何解释这一点。

在机器发生其他“崩溃”之前,手动命令之后的所有这些行sudo总是会重复(我非常怀疑它是否真的崩溃了,但在发生这类“事件”之后肯定无法再访问)。

例如,另一个此类事件发生在11:07:25(请注意,从 开始,之前十秒内什么也没有发生11:07:15):

$ journalctl --directory="/mnt/ubuntu-vg/root/var/log/journal/<journal-id>/" --since "2022-09-28 11:07:15" --until "2022-09-28 11:07:35"

Sep 28 11:07:25 ubuntu ModemManager[4003]: <info>  [sleep-monitor] system is about to suspend
Sep 28 11:07:25 ubuntu NetworkManager[4121]: <info>  [1664356045.8836] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Sep 28 11:07:25 ubuntu NetworkManager[4121]: <info>  [1664356045.8840] device (eno3): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 28 11:07:25 ubuntu NetworkManager[4121]: <info>  [1664356045.9257] device (eno4): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 28 11:07:25 ubuntu NetworkManager[4121]: <info>  [1664356045.9649] device (eno1): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
Sep 28 11:07:25 ubuntu dbus-daemon[3905]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.15' (uid=0 pid=4121>
Sep 28 11:07:25 ubuntu systemd[1]: Starting Network Manager Script Dispatcher Service...
Sep 28 11:07:26 ubuntu dbus-daemon[3905]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 28 11:07:26 ubuntu systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 28 11:07:26 ubuntu NetworkManager[4121]: <info>  [1664356046.0080] device (eno1): state change: deactivating -> disconnected (reason 'sleeping', sys-iface-state: 'managed')
Sep 28 11:07:26 ubuntu avahi-daemon[3903]: Withdrawing address record for fe80::xxxx:xxxx:xxxx:xxxx on eno1.
Sep 28 11:07:26 ubuntu avahi-daemon[3903]: Leaving mDNS multicast group on interface eno1.IPv6 with address fe80::xxxx:xxxx:xxxx:xxxx.
Sep 28 11:07:26 ubuntu avahi-daemon[3903]: Interface eno1.IPv6 no longer relevant for mDNS.
Sep 28 11:07:26 ubuntu NetworkManager[4121]: <info>  [1664356046.0476] dhcp4 (eno1): canceled DHCP transaction
Sep 28 11:07:26 ubuntu NetworkManager[4121]: <info>  [1664356046.0476] dhcp4 (eno1): activation: beginning transaction (timeout in 45 seconds)
Sep 28 11:07:26 ubuntu NetworkManager[4121]: <info>  [1664356046.0477] dhcp4 (eno1): state changed no lease
Sep 28 11:07:26 ubuntu systemd-resolved[4232]: eno1: Bus client reset search domain list.
Sep 28 11:07:26 ubuntu avahi-daemon[3903]: Withdrawing address record for 10.192.xxx.x on eno1.
Sep 28 11:07:26 ubuntu avahi-daemon[3903]: Leaving mDNS multicast group on interface eno1.IPv4 with address 10.192.xxx.x.
Sep 28 11:07:26 ubuntu avahi-daemon[3903]: Interface eno1.IPv4 no longer relevant for mDNS.
Sep 28 11:07:26 ubuntu systemd-resolved[4232]: eno1: Bus client set default route setting: no
Sep 28 11:07:26 ubuntu systemd-resolved[4232]: eno1: Bus client reset DNS server list.
Sep 28 11:07:26 ubuntu NetworkManager[4121]: <info>  [1664356046.0741] device (eno1): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 28 11:07:26 ubuntu systemd[1]: Reached target Sleep.
Sep 28 11:07:26 ubuntu systemd[1]: Starting Record successful boot for GRUB...
Sep 28 11:07:26 ubuntu systemd[1]: Starting System Suspend...
Sep 28 11:07:26 ubuntu systemd-sleep[23486]: Entering sleep state 'suspend'...
Sep 28 11:07:26 ubuntu kernel: PM: suspend entry (s2idle)
Sep 28 11:07:26 ubuntu systemd[1]: grub-common.service: Deactivated successfully.
Sep 28 11:07:26 ubuntu systemd[1]: Finished Record successful boot for GRUB.
Sep 28 11:07:26 ubuntu systemd[1]: Starting GRUB failed boot detection...
Sep 28 11:07:26 ubuntu kernel: Filesystems sync: 0.009 seconds

如果我更加专注,例如​​:

$ journalctl --directory="/mnt/ubuntu-vg/root/var/log/journal/<journal-id>/" | grep -i "system is about to suspend\|sleep requested"

Sep 25 15:40:35 ubuntu ModemManager[3889]: <info>  [sleep-monitor] system is about to suspend
Sep 25 15:40:35 ubuntu NetworkManager[3980]: <info>  [1664113235.8663] manager: sleep: sleep requested (sleeping: no  enabled: yes)

Sep 28 11:07:25 ubuntu ModemManager[4003]: <info>  [sleep-monitor] system is about to suspend
Sep 28 11:07:25 ubuntu NetworkManager[4121]: <info>  [1664356045.8836] manager: sleep: sleep requested (sleeping: no  enabled: yes)

Sep 29 16:31:42 ubuntu NetworkManager[4023]: <info>  [1664461902.3198] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Sep 29 16:31:42 ubuntu ModemManager[3919]: <info>  [sleep-monitor] system is about to suspend

Sep 29 17:33:26 ubuntu ModemManager[4035]: <info>  [sleep-monitor] system is about to suspend
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.6327] manager: sleep: sleep requested (sleeping: no  enabled: yes)

Oct 03 10:53:22 ubuntu NetworkManager[4026]: <info>  [1664787202.5245] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Oct 03 10:53:22 ubuntu ModemManager[3937]: <info>  [sleep-monitor] system is about to suspend

Oct 03 15:40:28 ubuntu ModemManager[3876]: <info>  [sleep-monitor] system is about to suspend
Oct 03 15:40:28 ubuntu NetworkManager[3998]: <info>  [1664804428.9916] manager: sleep: sleep requested (sleeping: no  enabled: yes)

Oct 05 12:05:16 ubuntu ModemManager[4657]: <info>  [sleep-monitor] system is about to suspend
Oct 05 12:05:16 ubuntu NetworkManager[3968]: <info>  [1664964316.1700] manager: sleep: sleep requested (sleeping: no  enabled: yes)

Oct 05 13:14:53 ubuntu ModemManager[4657]: <info>  [sleep-monitor] system is about to suspend
Oct 05 13:14:53 ubuntu NetworkManager[3968]: <info>  [1664968493.9235] manager: sleep: sleep requested (sleeping: no  enabled: yes)

Oct 05 14:16:00 ubuntu NetworkManager[4162]: <info>  [1664972160.4328] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Oct 05 14:16:00 ubuntu ModemManager[4066]: <info>  [sleep-monitor] system is about to suspend

这些“事件”都与我认为的崩溃事件相对应。但它们似乎是实际的“睡眠”或“暂停”事件。我在这里用空行将它们分开,以便于阅读。奇怪的是,日志中和行
之间的顺序有点随机。好像它们发生的时间非常接近,以至于系统无法记录它们的真实时间顺序。可能是触发了睡眠?我不太确定……ModemManagerNetworkManagerNetworkManager

此外,正如下面的评论所建议的,这里有一个包含事件发生前(-10 分钟)一些信息的日志:

$ journalctl --directory=. --since "2022-09-29 17:20:00" --until "2022-09-29 17:40:00" 

Sep 29 17:22:55 ubuntu dockerd[5101]: time="2022-09-29T17:22:55.573071250+02:00" level=info msg="NetworkDB stats ubuntu(56f4cff42518) - netID:ej327ec80c49s1azrhnal3opf leaving:false netPeers:1 entries:2>
Sep 29 17:23:04 ubuntu dbus-daemon[3913]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.15' (uid=0 pid=4141>
Sep 29 17:23:04 ubuntu systemd[1]: Starting Network Manager Script Dispatcher Service...
Sep 29 17:23:04 ubuntu dbus-daemon[3913]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 29 17:23:04 ubuntu systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 29 17:23:07 ubuntu ntpd[5775]: 91.189.xxx.xxx local addr 10.192.xxx.x -> <null>
Sep 29 17:23:08 ubuntu ntpd[5775]: 91.189.xxx.x local addr 10.192.xxx.x -> <null>
Sep 29 17:23:16 ubuntu systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Sep 29 17:25:01 ubuntu CRON[19024]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 29 17:25:01 ubuntu CRON[19025]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Sep 29 17:25:01 ubuntu CRON[19024]: pam_unix(cron:session): session closed for user root
Sep 29 17:27:40 ubuntu systemd[1]: Starting Cleanup of Temporary Directories...
Sep 29 17:27:40 ubuntu systemd[1]: systemd-tmpfiles-clean.service: Deactivated successfully.
Sep 29 17:27:40 ubuntu systemd[1]: Finished Cleanup of Temporary Directories.
Sep 29 17:27:55 ubuntu dockerd[5101]: time="2022-09-29T17:27:55.573600169+02:00" level=info msg="NetworkDB stats ubuntu(58f4cee4b558) - netID:ej327ec80c49s1azrhnal3opf leaving:false netPeers:1 entries:2>
Sep 29 17:28:06 ubuntu ntpd[5775]: 140.238.xxx.xxx local addr 10.192.xxx.x -> <null>
Sep 29 17:29:26 ubuntu dbus-daemon[9792]: [session uid=113 pid=9792] Activating service name='org.freedesktop.Notifications' requested by ':1.23' (uid=113 pid=9954 comm="/usr/lib/unity-settings-daemon/unity>
Sep 29 17:29:26 ubuntu notify-osd[20628]: cannot open display: 
Sep 29 17:29:26 ubuntu dbus-daemon[9792]: [session uid=113 pid=9792] Activated service 'org.freedesktop.Notifications' failed: Process org.freedesktop.Notifications exited with status 1
Sep 29 17:30:01 ubuntu CRON[20664]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 29 17:30:01 ubuntu CRON[20665]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
Sep 29 17:30:01 ubuntu CRON[20664]: pam_unix(cron:session): session closed for user root
Sep 29 17:30:10 ubuntu systemd[1]: Starting Ubuntu Advantage Timer for running repeated jobs...
Sep 29 17:30:10 ubuntu systemd[1]: ua-timer.service: Deactivated successfully.
Sep 29 17:30:10 ubuntu systemd[1]: Finished Ubuntu Advantage Timer for running repeated jobs.
Sep 29 17:30:15 ubuntu ntpd[5775]: 212.xx.xx.xxx local addr 10.192.xxx.x -> <null>
Sep 29 17:30:41 ubuntu systemd[1]: Started Run anacron jobs.
Sep 29 17:30:41 ubuntu anacron[20976]: Anacron 2.3 started on 2022-09-29
Sep 29 17:30:41 ubuntu anacron[20976]: Normal exit (0 jobs run)
Sep 29 17:30:41 ubuntu systemd[1]: anacron.service: Deactivated successfully.
Sep 29 17:32:55 ubuntu dockerd[5101]: time="2022-09-29T17:32:55.773040019+02:00" level=info msg="NetworkDB stats ubuntu(56f4cff42518) - netID:ej327ec80c49s1azrhnal3opf leaving:false netPeers:1 entries:2>
Sep 29 17:33:26 ubuntu ModemManager[4035]: <info>  [sleep-monitor] system is about to suspend
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.6327] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.6330] device (eno3): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.6752] device (eno4): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.7148] device (eno1): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
Sep 29 17:33:26 ubuntu dbus-daemon[3913]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.15' (uid=0 pid=4141>
Sep 29 17:33:26 ubuntu systemd[1]: Starting Network Manager Script Dispatcher Service...
Sep 29 17:33:26 ubuntu dbus-daemon[3913]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 29 17:33:26 ubuntu systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.7566] device (eno1): state change: deactivating -> disconnected (reason 'sleeping', sys-iface-state: 'managed')
Sep 29 17:33:26 ubuntu avahi-daemon[3912]: Withdrawing address record for fe80::xxxx:xxxx:xxxx:xxxx on eno1.
Sep 29 17:33:26 ubuntu avahi-daemon[3912]: Leaving mDNS multicast group on interface eno1.IPv6 with address fe80::xxxx:xxxx:xxxx:xxxx.
Sep 29 17:33:26 ubuntu avahi-daemon[3912]: Interface eno1.IPv6 no longer relevant for mDNS.
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.7790] dhcp4 (eno1): canceled DHCP transaction
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.7791] dhcp4 (eno1): activation: beginning transaction (timeout in 45 seconds)
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.7791] dhcp4 (eno1): state changed no lease
Sep 29 17:33:26 ubuntu systemd-resolved[4260]: eno1: Bus client reset search domain list.
Sep 29 17:33:26 ubuntu avahi-daemon[3912]: Withdrawing address record for 10.192.xxx.x on eno1.
Sep 29 17:33:26 ubuntu avahi-daemon[3912]: Leaving mDNS multicast group on interface eno1.IPv4 with address 10.192.xxx.x.
Sep 29 17:33:26 ubuntu systemd-resolved[4260]: eno1: Bus client set default route setting: no
Sep 29 17:33:26 ubuntu avahi-daemon[3912]: Interface eno1.IPv4 no longer relevant for mDNS.
Sep 29 17:33:26 ubuntu systemd-resolved[4260]: eno1: Bus client reset DNS server list.
Sep 29 17:33:26 ubuntu NetworkManager[4141]: <info>  [1664465606.8093] device (eno1): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Sep 29 17:33:26 ubuntu systemd[1]: Reached target Sleep.
Sep 29 17:33:26 ubuntu systemd[1]: Starting Record successful boot for GRUB...
Sep 29 17:33:26 ubuntu systemd[1]: Starting System Suspend...
Sep 29 17:33:26 ubuntu systemd[1]: grub-common.service: Deactivated successfully.
Sep 29 17:33:26 ubuntu systemd[1]: Finished Record successful boot for GRUB.
Sep 29 17:33:26 ubuntu systemd-sleep[21965]: Entering sleep state 'suspend'...
Sep 29 17:33:26 ubuntu kernel: PM: suspend entry (s2idle)

在系统进入休眠状态之前,当没有人操作时,系统似乎会执行一些常规任务。但对我来说没什么特别的。

版本信息

此磁盘上有 Ubuntu 版本Linux version 5.15.0-48-generic (buildd@lcy02-amd64-080) (gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 (Ubuntu 5.15.0-48.54-generic 5.15.53)
新磁盘上也一样。

答案1

您可以通过创建文件/etc/systemd/sleep.conf并输入以下内容来配置 systemd 以禁止进入睡眠模式:

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

请参阅man systemd-sleep.conf。我不知道是否daemon-reload足以考虑到这一点,或者是否需要重新启动。

Debian维基百科还说你可以屏蔽适当的 systemd 目标:

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

相关内容