如题,今天机子连接不上,🐱在官网上看到了下图
一开始怀疑被黑了,但是过了会机器自动正常了,且找不到任何被入侵的痕迹
看了眼 dmesg
[153688.134873] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=init.scope,mems_allowed=0,global_oom,task_memcg=/system.slice/system-getty.slice/getty@tty1.service,task=check-new-relea,pid=23879,uid=0
[153688.134884] Out of memory: Killed process 23879 (check-new-relea) total-vm:87964kB, anon-rss:20400kB, file-rss:2328kB, shmem-rss:0kB, UID:0 pgtables:216kB oom_score_adj:0
[153688.146328] oom_reaper: reaped process 23879 (check-new-relea), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
[153688.245905] systemd[1]: getty@tty1.service: A process of this unit has been killed by the OOM killer.
[153688.248551] systemd[1]: snapd.service: start operation timed out. Terminating.
[153688.251197] systemd[1]: snapd.service: Failed with result 'timeout'.
[153688.252637] systemd[1]: Failed to start Snap Daemon.
[153688.259129] systemd[1]: snapd.service: Consumed 5.770s CPU time.
[153688.275143] systemd[1]: getty@tty1.service: Failed with result 'oom-kill'.
[153688.275382] systemd[1]: getty@tty1.service: Consumed 6.439s CPU time.
[153688.361357] systemd[1]: getty@tty1.service: Scheduled restart job, restart counter is at 1.
[153688.361855] systemd[1]: snapd.service: Scheduled restart job, restart counter is at 34.
[153688.362025] systemd[1]: Stopped Getty on tty1.
[153688.362188] systemd[1]: getty@tty1.service: Consumed 6.439s CPU time.
[153688.366367] systemd[1]: Started Getty on tty1.
[153688.366705] systemd[1]: Stopped Snap Daemon.
[153688.366773] systemd[1]: snapd.service: Consumed 5.770s CPU time.
[153688.370141] systemd[1]: Starting Snap Daemon...
[153688.409943] systemd-journald[23944]: File /var/log/journal/33613059732686b5edff340734705df8/system.journal corrupted or uncleanly shut down, renaming and replacing.
[153690.249527] systemd[1]: Started Journal Service.
[153692.529580] loop5: detected capacity change from 0 to 8
发现出现是 OOM
,然后系统自动杀掉了下面这个
[ 23879] 0 23879 21991 5682 221184 0 0 check-new-relea
查了下,是 ubuntu 的 release
自动更新应用,扬了,顺便做点其他优化
apt-get remove ubuntu-release-upgrader-core # /etc/update-manager 下改配置也行
systemctl disable unattended-upgrades.service --now # 顺手关了
# 然后做个 swap 应该会好些
root@takina:/var# fallocate -l 4GiB swap
root@takina:/var# ls
backups cache crash lib local lock log mail opt run snap spool swap tmp www
root@takina:/var# chmod 600 swap
root@takina:/var# mkswap swap
Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
no label, UUID=02ee9106-424c-433a-8cd9-3f2148955a13
root@takina:/var# swapon /var/swap
# /etc/fstab 加上
# /var/swap none swap sw 0 0
root@takina:~# free -m
total used free shared buff/cache available
Mem: 341 179 45 0 116 142
Swap: 4095 26 4069
看看之后还会不会炸