为什么我的 ubuntu 19.10 启动时间太长 [超过 10 分钟]?

为什么我的 ubuntu 19.10 启动时间太长 [超过 10 分钟]?

昨天,当我打开电脑时,我的 ubuntu 启动时间太长了,超过了 10 分钟。我受够了这种情况,我按住电源键将其关闭,然后再次重新启动它。同样的事情再次发生。然后我决定进入启动设置,什么也不做,保存更改并再次启动它。它工作了,并且在不到 1 分钟的时间内启动了。但我真的想知道为什么会发生这种情况?所以,如果您知道答案,请告诉我。今天早上,它再次花了很长时间才能启动,我鼓起勇气看看启动需要多长时间。40 分钟后,我厌倦了看到同样的屏幕。我失去了耐心,按住电源键关闭电脑,然后再次按下它重新启动。然后它在大约几秒钟后启动了。现在发生了同样的事情 - 我不得不使用电源键将其关闭一次,当我再次打开它时,它又恢复了工作。但我不想一次又一次地这样做。好吧!我提供了您可能需要的屏幕截图来帮助我。

这是我的终端的屏幕截图free -hgrep -i swap /etc/fstab/以及sudo blkid 这是智能数据和智能测试的第一张屏幕截图这是智能数据和智能测试的第二张屏幕截图

这是智能数据和智能测试的第三张屏幕截图

答案1

您可以使用它systemd-analyze来概览您的启动时间。

例子:Startup finished in 12.749s (firmware) + 6.025s (loader) + 4.668s (kernel) + 9.488s (userspace) = 32.932s graphical.target reached after 9.474s in userspace

通过systemd-analyze blame,您可以看到启动时间方面的主要问题是什么。

对我来说,这些是花费时间超过一秒钟的操作:

6.535s NetworkManager-wait-online.service
1.094s dev-sda5.device
1.067s udisks2.service
1.029s smartmontools.service
...

答案2

您的 HDD 出现故障,或者您的 SATA 电缆有缺陷,并且您的交换太小(我们稍后会处理这个问题)。

文件系统检查

让我们检查一下您的文件系统。

  • 以“试用 Ubuntu”模式启动 Ubuntu Live DVD/USB
  • terminalCtrl+ Alt+打开窗口T
  • 类型sudo fdisk -l
  • 识别“Linux 文件系统”的 /dev/sdXX 设备名称
  • 输入sudo fsck -f /dev/sdXX,替换sdXX为您之前找到的数字
  • fsck如果有错误则重复命令

坏块

让我们看看是否可以解决您的硬盘上的坏块问题。

注意:不要中止坏块扫描!

注意:不要对 SSD 造成坏块

注意:请先备份您的重要文件!

注意:这将花费很多小时

注意:您可能面临硬盘故障

在“尝试 Ubuntu”模式下启动 Ubuntu Live DVD/USB。

terminal...

sudo fdisk -l# 识别所有“Linux 文件系统”分区

sudo e2fsck -fcky /dev/sdXX# 只读测试

或者

sudo e2fsck -fccky /dev/sdXX# 非破坏性读写测试(受到推崇的)

-k 很重要,因为它会保存之前的坏块表,并将任何新的坏块添加到该表中。如果没有 -k,您将丢失所有之前的坏块信息。

-fccky 参数...

   -f    Force checking even if the file system seems clean.

   -c    This option causes e2fsck to use badblocks(8) program to do
         a read-only scan of the device in order to find any bad blocks.
         If any bad blocks are found, they are added to the bad block
         inode to prevent them from being allocated to a file or direc‐
         tory.  If this option is specified twice, then the bad block scan
         will be done using a non-destructive read-write test.

   -k    When combined with the -c option, any existing bad blocks in the
         bad blocks list are preserved, and any new bad blocks found by
         running badblocks(8) will be added to the existing bad blocks
         list.

   -y    Assume an answer of `yes' to all questions; allows e2fsck to be
         used non-interactively. This option may not be specified at the
         same time as the -n or -p options.

相关内容