Ubuntu 20.04.5 专用服务器一直处于休眠或挂起状态

Ubuntu 20.04.5 专用服务器一直处于休眠或挂起状态

我目前遇到了一个问题,过去几周一直存在这个问题,我的 Ubuntu 20.04.5 专用服务器不断进入睡眠或休眠状态,导致 SSH 和 FTP 无响应。我的服务器目前托管在 Hetzner,他们进行了完整的系统测试,结果一切都按预期运行(硬件等)。

它不是每隔一定时间或每天的特定时间发生,而只是偶尔发生,并且重新获得 SSH 或 FTP 访问权限的唯一方法是转到 Hetzners 面板并重新启动整个系统。

我已完成以下操作:

使用以下操作确保睡眠、休眠和挂起功能已禁用

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

产生以下响应:

● sleep.target - Sleep
     Loaded: loaded (/lib/systemd/system/sleep.target; static; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

● suspend.target - Suspend
     Loaded: loaded (/lib/systemd/system/suspend.target; static; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

● hibernate.target - Hibernate
     Loaded: loaded (/lib/systemd/system/hibernate.target; static; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

● hybrid-sleep.target - Hybrid Suspend+Hibernate
     Loaded: loaded (/lib/systemd/system/hybrid-sleep.target; static; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

我还确保已删除所有 GUI 包,因为我知道这些包可能包含桌面样式的休眠命令。

我已在线查看关机日志和重启日志,然而经检查发现只有重启日志来自 Hetzner 面板,其他关机和启动日志也是如此,它们要么来自 Hetzner,要么来自我自己。

我已确保所有软件包均已更新。

我唯一还没有做的事情是升级到 22.04.2,因为我担心它会破坏一些软件包,而且据我所知,新的操作系统版本是没有必要的。

任何帮助都将非常感谢,它目前是我的 plex 服务器,在观看电影的过程中随机重新启动它并不理想。

编辑:

附加信息,我已经运行以下命令。

journalctl  -b -1 -e

其结果是:

Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: kvm: Nested Virtualization enabled
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: kvm: Nested Paging enabled
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: SVM: Virtual VMLOAD VMSAVE supported
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: snd_hda_intel 0000:09:00.1: Disabling MSI
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: snd_hda_intel 0000:09:00.1: Handle vga_switcheroo audio client
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: MCE: In-kernel MCE decoding enabled.
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: Node 0: DRAM ECC enabled.
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: F17h_M70h detected (node 0).
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC MC: UMC0 chip selects:
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: MC: 0:     0MB 1:     0MB
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: MC: 2: 16384MB 3: 16384MB
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC MC: UMC1 chip selects:
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: MC: 0:     0MB 1:     0MB
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: MC: 2: 16384MB 3: 16384MB
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: using x16 syndromes.
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC amd64: MCT channel count: 2
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC MC0: Giving out device to module amd64_edac controller F17h_M70h: DEV 0000:00:18.3 (INTERRUPT)
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: EDAC PCI0: Giving out device to module amd64_edac controller EDAC PCI controller: DEV 0000:00:18.0 (POLLED)
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal kernel: AMD64 EDAC driver v3.5.0
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal systemd[1]: Found device /dev/disk/by-uuid/927341e0-d572-4001-8c39-6d03382e681e.
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal systemd[1]: Found device /dev/disk/by-uuid/4c2da277-0b96-4d99-90b9-716f01eb43c0.
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal systemd[1]: Found device /dev/disk/by-uuid/af5d28ee-4c10-49e0-a3f1-fbf36fe8fa4d.
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal systemd[1]: Activating swap /dev/disk/by-uuid/4c2da277-0b96-4d99-90b9-716f01eb43c0...
Mar 08 23:16:53 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting /boot...
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: EXT4-fs (md1): mounting ext3 file system using the ext4 subsystem
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting /home...
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Started MD array monitor.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Starting Load Kernel Module chromeos_pstore...
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Condition check resulted in Load Kernel Module efi_pstore being skipped.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Starting Load Kernel Module pstore_blk...
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Starting Load Kernel Module pstore_zone...
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Condition check resulted in Load Kernel Module ramoops being skipped.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Condition check resulted in Set Up Additional Binary Formats being skipped.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: modprobe@pstore_blk.service: Succeeded.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Load Kernel Module pstore_blk.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: modprobe@pstore_zone.service: Succeeded.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Load Kernel Module pstore_zone.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Found device /dev/disk/by-uuid/5ded13df-c205-4fca-a4da-5d4499eec78e.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: var.mount: Directory /var to mount over is not empty, mounting anyway.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting /var...
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: Adding 33519612k swap on /dev/md0.  Priority:-2 extents:1 across:33519612k FS
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Activated swap /dev/disk/by-uuid/4c2da277-0b96-4d99-90b9-716f01eb43c0.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: modprobe@chromeos_pstore.service: Succeeded.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Load Kernel Module chromeos_pstore.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Reached target Swap.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: EXT4-fs (md1): recovery complete
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: EXT4-fs (md1): mounted filesystem with ordered data mode. Opts: (null)
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Mounted /boot.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: EXT4-fs (md3): recovery complete
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Mounted /home.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: EXT4-fs (md3): mounted filesystem with ordered data mode. Opts: (null)
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal systemd[1]: Reached target Sound Card.
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input2
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input3
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input4
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input5
Mar 08 23:16:54 Ubuntu-2004-focal-64-minimal kernel: input: HDA NVidia HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:03.1/0000:09:00.1/sound/card0/input6
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal kernel: EXT4-fs (md4): recovery complete
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounted /var.
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for bare, revision 5...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal kernel: EXT4-fs (md4): mounted filesystem with ordered data mode. Opts: (null)
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for core18, revision 2679...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for core18, revision 2697...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for core20, revision 1822...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for core20, revision 1828...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for gnome-3-38-2004, revision 115...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for gnome-3-38-2004, revision 119...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for gtk-common-themes, revision 1535...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for snapd, revision 17950...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Mounting Mount unit for snapd, revision 18357...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Starting Flush Journal to Persistent Storage...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Condition check resulted in Platform Persistent Storage Archival being skipped.
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd[1]: Starting Load/Save Random Seed...
Mar 08 23:16:56 Ubuntu-2004-focal-64-minimal systemd-journald[463]: Time spent on flushing to /var/log/journal/84281756b5ee4a3ba12d56f7152e2846 is 4.631ms for 1160 entries.

我还检查了系统日志,发现系统在 23:12 左右关闭/休眠,然后我在 23:18 手动重启了系统,因为 23:11 是我最后一次运行 cronjob。系统在 23:19 终于重新启动后继续运行。

系统日志文件:

Mar  8 23:10:10 Ubuntu-2004-focal-64-minimal CRON[1289553]: (root) CMD (find /var/www/html/Shows/* -type f ! -name "*.*" ! -name "*-*" ! -name "*download-*" -exec realpath {} \; -exec /usr/bin/ffmpeg -i {} -acodec aac -ac 6 -vcodec copy -sn -start_number 0 -hls_time 10 -hls_list_size 0 -f hls -hls_segment_filename '{}-P%03d' {}.m3u8 \; -exec rm -f {} \;)
Mar  8 23:10:11 Ubuntu-2004-focal-64-minimal postfix/pickup[1287355]: 6B7A1B60068: uid=0 from=<root>
Mar  8 23:10:24 Ubuntu-2004-focal-64-minimal postfix/cleanup[1288640]: 6B7A1B60068: message-id=<20230308221007.6B7A1B60068@REDACTED>
Mar  8 23:10:53 Ubuntu-2004-focal-64-minimal postfix/pickup[1287355]: CD3E2B60065: uid=0 from=<root>
Mar  8 23:11:01 Ubuntu-2004-focal-64-minimal postfix/cleanup[1288640]: CD3E2B60065: message-id=<20230308221007.CD3E2B60065@REDACTED>
Mar  8 23:12:01 Ubuntu-2004-focal-64-minimal kernel: [77425.656486] [ 864486]     0 864486      652        0    45056       2Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd-sysctl[488]: Not setting net/ipv4/conf/all/promote_secondaries (explicit setting exists).
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd-sysctl[488]: Not setting net/ipv4/conf/default/promote_secondaries (explicit setting exists).
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Create System Users.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Starting Create Static Device Nodes in /dev...
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: modprobe@chromeos_pstore.service: Succeeded.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Load Kernel Module chromeos_pstore.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Set the console keyboard layout.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: [email protected]: Succeeded.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Load Kernel Module drm.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: [email protected]: Succeeded.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Load Kernel Module ramoops.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Finished Create Static Device Nodes in /dev.
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Reached target Local File Systems (Pre).
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Starting udev Kernel Device Manager...
Mar  8 23:18:16 Ubuntu-2004-focal-64-minimal systemd[1]: Started udev Kernel Device Manager.

对我来说这看起来像是标准启动,但服务器上的任何日志中都没有提及睡眠、休眠或关机。

相关内容