Ubuntu 21.04 冻结

Ubuntu 21.04 冻结

我的 Ubuntu 21.04 每次启动和重启后都能正常工作。但 3-4 小时后,它就“冻结”了。除了强制重启外,没有其他办法。如何避免后者?

终端运行:

<free -h
              total        used        free      shared  buff/cache   available
Mem:          3.5Gi       2.2Gi       243Mi       278Mi       1.1Gi       832Mi
Swap:         2.0Gi        17Mi       2.0Gi

vm.swappiness = 60

Filename                Type        Size    Used    Priority
/swapfile                               file        2097148 17772   -2

top - 09:32:34 up 26 min,  1 user,  load average: 0.26, 0.59, 1.18
Tasks: 203 total,   3 running, 200 sleeping,   0 stopped,   0 zombie
%Cpu(s): 42.9 us,  0.0 sy,  0.0 ni, 57.1 id,  0.0 wa,  0.0 hi,  0.0 si,  0top - 09:33:54 up 27 min,  1 user,  load average: 0.72, 0.73, 1.18
Tasks: 203 total,   3 running, 200 sleeping,   0 stopped,   0 zombie
%Cpu(s): 25.0 us, 18.8 sy,  0.0 ni, 56.2 id,  0.0 wa,  0.0 hi,  0.0 si, top - 09:33:54 up 27 min,  1 user,  load average: 0.72, 0.73, 1.18
Tasks: 203 total,   4 running, 199 sleeping,   0 stopped,   0 zombie
%Cpu(s): 40.0 us, 20.0 sy,  0.0 ni, 40.0 id,  0.0 wa,  0.0 hi,  0.0 si,top - 09:33:54 up 27 min,  1 user,  load average: 0.72, 0.73, 1.18
Tasks: 203 total,   2 running, 201 sleeping,   0 stopped,   0 zombie
%Cpu(s): 33.3 us, 33.3 sy,  0.0 ni, 33.3 id,  0.0 wa,  0.0 hi,  0.0 si,top - 09:33:54 up 27 min,  1 user,  load average: 0.72, 0.73, 1.18
Tasks: 203 total,   5 running, 198 sleeping,   0 stopped,   0 zombie
%Cpu(s): 28.6 us, 42.9 sy,  0.0 ni, 28.6 id,  0.0 wa,  0.0 hi,  0.0 si,
MiB Mem :   3623.3 total,    139.9 free,   2286.0 used,   1197.4 buff/c
MiB Swap:   2048.0 total,   2029.4 free,     18.6 used.    822.0 avail> 


# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=28539ebd-a6e3-4fa7-8dcc-8bdc31b0f505 /               ext4    errors=remount-ro 0       1
/swapfile                                 none            swap    sw 

首先,最有价值的东西应该放在硬盘上(例如,Transcend),并且每天更新(关闭互联网)。还要准备好安装工具。当冻结严重且无法获得建议时,请强制关闭,插入安装工具,按下 F2 启动。从启动菜单中,选择上述工具并重新安装系统。更喜欢 LTS 版本。注意 Livepatch。这对我来说很有效。

答案1

您的 RAM 不足,或者交换空间不足。

              total        used        free      shared  buff/cache   available
Mem:          3.5Gi       2.2Gi       243Mi       278Mi       1.1Gi       832Mi
Swap:         2.0Gi        17Mi       2.0Gi

我们会将您的交换从 2G 增加到 4G,看看是否有帮助......

笔记:错误使用rmdd命令可能会导致数据丢失。建议复制/粘贴。

在里面terminal...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm 4G RAM and 4G swap

sudo -H gedit /etc/fstab使用或编辑 /etc/fstab sudo pico /etc/fstab

确认 /etc/fstab 中的此 /swapfile 行...并确认没有其他“交换”行...在此行中使用空格...确认没有制表符...

/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation

更新#1:

重新安装 Ubuntu 以解决问题。

相关内容