由于 systemd 设备启动作业超时而导致启动延迟

由于 systemd 设备启动作业超时而导致启动延迟

问题描述

我最终解决了系统启动速度慢于应有速度的问题。我的第一步是查看启动日志,其中显示设备超时的启动作业,然后直接导致设备的加密设置失败,引用为cr_usb-General_USB_Flash_Disk。我不确定这两者是否有联系。

         Starting Switch Root...
[  ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m* ^[[0m] (1 of 3) A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (19s / 1min 30s)
^[[K[ ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*  ^[[0m] (1 of 3) A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (20s / 1min 30$
^[[K[^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*   ^[[0m] (2 of 3) A start job is running for Cryptography Setup for cr_sda2 (14s / no limit)
^[[K[^[[0;1;31m*^[[0m^[[0;31m*    ^[[0m] (2 of 3) A start job is running for Cryptography Setup for cr_sda2 (15s / no limit)
^[[K[^[[0m^[[0;31m*     ^[[0m] (2 of 3) A start job is running for Cryptography Setup for cr_sda2 (15s / no limit)
^[[K[^[[0;32m  OK  ^[[0m] Found device /dev/disk/by-uuid/3f9a66f0-dea7-4d5d-a200-bd1033718af8.
[^[[0;32m  OK  ^[[0m] Started Cryptography Setup for cr_sda2.
         Starting File System Check on /dev/disk/by-uuid/3f9a66f0-dea7-4d5d-a200-bd1033718af8...
[^[[0;32m  OK  ^[[0m] Started File System Check on /dev/disk/by-uuid/3f9a66f0-dea7-4d5d-a200-bd1033718af8.
         Mounting /home...
[^[[0;32m  OK  ^[[0m] Mounted /home.
[^[[0;32m  OK  ^[[0m] Reached target Local File Systems.
         Starting Restore /run/initramfs on shutdown...
         Starting Create Volatile Files and Directories...
         Starting Tell Plymouth To Write Out Runtime Data...
[^[[0;32m  OK  ^[[0m] Started Tell Plymouth To Write Out Runtime Data.
[^[[0;32m  OK  ^[[0m] Started Restore /run/initramfs on shutdown.
[^[[0;32m  OK  ^[[0m] Started Create Volatile Files and Directories.
         Starting Security Auditing Service...
[^[[0;32m  OK  ^[[0m] Started Security Auditing Service.
         Starting Update UTMP about System Boot/Shutdown...
[^[[0;32m  OK  ^[[0m] Started Update UTMP about System Boot/Shutdown.
^[[K[     ^[[0;31m*^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 22s / 1min 30s)
^[[K[    ^[[0;31m*^[[0;1;31m*^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 23s / 1min 30s)
^[[K[   ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 23s / 1min 30s)
^[[K[  ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m* ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 24s / 1min 30s)
^[[K[ ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*  ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 24s / 1min 30s)
^[[K[^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*   ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 25s / 1min 30s)
^[[K[^[[0;1;31m*^[[0m^[[0;31m*    ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 25s / 1min 30s)
^[[K[^[[0m^[[0;31m*     ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 26s / 1min 30s)
^[[K[^[[0;1;31m*^[[0m^[[0;31m*    ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 26s / 1min 30s)
^[[K[^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*   ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 27s / 1min 30s)
^[[K[ ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*  ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 27s / 1min 30s)
^[[K[  ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m* ^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 28s / 1min 30s)
^[[K[   ^[[0;31m*^[[0;1;31m*^[[0m^[[0;31m*^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 28s / 1min 30s)
^[[K[    ^[[0;31m*^[[0;1;31m*^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 29s / 1min 30s)
^[[K[     ^[[0;31m*^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 29s / 1min 30s)
^[[K[    ^[[0;31m*^[[0;1;31m*^[[0m] A start job is running for dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device (1min 30s / 1min 30s)
^[[K[^[[0;1;31m TIME ^[[0m] Timed out waiting for device dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device.
[^[[0;1;33mDEPEND^[[0m] Dependency failed for Cryptography Setup for cr_usb-General_USB_Flash_Disk_0349315060001623-0:0-part2.
[^[[0;1;33mDEPEND^[[0m] Dependency failed for Encrypted Volumes.
[^[[0;32m  OK  ^[[0m] Reached target System Initialization.

这特别奇怪,因为我的系统没有连接 USB 驱动器。

我在systemd中找到了对应的设备服务(粘贴链接,参见第 67 行),但是我无法说出这个设备到底是什么或者为什么它会在那里。

事实证明,不祥的 USB 设备有一个条目/etc/crypttab

cr_sda2  UUID=7f99168c-4972-468b-900f-fb5bbfb90e66
cr_usb-General_USB_Flash_Disk_0349315060001623-0:0-part2  UUID=00a69115-956d-41b3-83 

问题

我如何确定这是什么设备?
是否可以安全地将其从启动中删除?如果可以,如何删除?

类似问题

在研究这个问题时,我发现了几篇描述类似症状但显然原因不同的帖子。这些例子是这个博客条目关于超级用户 SE 的这个问题,都将此问题跟踪到 fstab 中的错误交换分区/条目。然而,引导日志的摘录让我相信这些与我的特定问题无关。

系统信息

基本信息
我正在运行 OpenSUSE Leap 15,并连接了 HDD (sda)、SSD (sdb) 和 sd 卡 (mmcblk0)。

黑子

/dev/sda1: UUID="7b4cf082-a27d-458a-b92b-bc4eb3f81dc5" TYPE="ext4" PARTUUID="b9b6e898-306d-4834-bc40-b06a0b05c255"
/dev/sda2: UUID="7f99168c-4972-468b-900f-fb5bbfb90e66" TYPE="crypto_LUKS" PARTUUID="eda06af5-b65d-4a41-88f3-76c884eda694"
/dev/sda3: UUID="35de195e-c983-4f53-9ef2-f3e9f42539e7" TYPE="swap" PARTUUID="15489cc9-d2c6-4446-b7fc-0efdb26c3dfe"
/dev/sdb1: UUID="3DC1-430C" TYPE="vfat" PARTUUID="7093ce52-e282-45ef-a09a-b19eb54a268e"
/dev/sdb3: UUID="1f987306-6da7-4393-b1cb-eb9c541da80c" TYPE="ext4" PARTUUID="96e413c8-1b55-4383-87f1-5c2094c27b47"
/dev/mmcblk0p1: UUID="77FB-45CC" TYPE="vfat" PARTUUID="09b07cfe-1f9b-40e9-aa52-27892b6971ff"
/dev/mapper/cr_sda2: UUID="3f9a66f0-dea7-4d5d-a200-bd1033718af8" TYPE="ext4"
/dev/mmcblk0: PTUUID="21d3220a-de4c-4f1c-9abc-e57d62434b4e" PTTYPE="gpt"

/etc/fstab

UUID=7b4cf082-a27d-458a-b92b-bc4eb3f81dc5  /          ext4  acl,user_xattr               0  1
UUID=35de195e-c983-4f53-9ef2-f3e9f42539e7  swap       swap  defaults                     0  0
UUID=1f987306-6da7-4393-b1cb-eb9c541da80c  /boot      ext4  data=ordered,acl,user_xattr  0  2
UUID=3f9a66f0-dea7-4d5d-a200-bd1033718af8  /home      ext4  data=ordered,acl,user_xattr  0  2
UUID=3DC1-430C                             /boot/efi  vfat  defaults                     0  0

ls -l /dev/disk/by-uuid

total 0
lrwxrwxrwx 1 root root 10 Nov 29 08:59 1f987306-6da7-4393-b1cb-eb9c541da80c -> ../../sdb3
lrwxrwxrwx 1 root root 10 Nov 29 08:59 35de195e-c983-4f53-9ef2-f3e9f42539e7 -> ../../sda3
lrwxrwxrwx 1 root root 10 Nov 29 08:59 3DC1-430C -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov 29 08:25 3f9a66f0-dea7-4d5d-a200-bd1033718af8 -> ../../dm-0
lrwxrwxrwx 1 root root 15 Nov 29 08:59 77FB-45CC -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Nov 29 08:59 7b4cf082-a27d-458a-b92b-bc4eb3f81dc5 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 29 08:59 7f99168c-4972-468b-900f-fb5bbfb90e66 -> ../../sda2

答案1

  • 我如何确定这是什么设备?

您可以通过将其与块设备及其 UUID 列表进行比较来仔细检查该设备是否存在。您已经用来列出它们的命令就可以了。设备逻辑由内部udev使用的驱动。blkid

  • 是否可以安全地将其从启动中删除?如果可以,如何删除?

您可以创建该行的备份副本crypttab,然后删除该行,或者#在该行的开头添加 来将其注释掉。

(我喜欢使用 etckeeper,它就像在 /etc 中为各个配置文件提供“系统还原点”:-)。不过,您必须知道如何使用版本控制系统)。

在研究这个问题时,我发现了几篇描述类似症状但显然原因不同的帖子。例如,这个博客条目和 Superuser SE 上的这个问题,都将此问题跟踪到 fstab 中的错误交换分区/条目。然而,引导日志的摘录让我相信这些与我的特定问题无关。

公平的。但这是一个非常密切相关的问题。您有一个被列为引导过程所需的设备。因此你的靴子会等待找到它。超时后,设备被视为失败。

(根据我的文档,启动过程也应该要求此设备,意味着失败或超时将引导到emergency.targetshell,而不是default.target)。 甚至支持与修改此行为crypttab相同的命名选项: 、和。fstabnoautonofailx-systemd.device-timeout=...

对于fstab条目,systemd 生成.mount.swap单位。对于条目,它仅生成模板单元crypttab的实例。.service[email protected]

.device单元出现在 systemd 中是因为它需要一些东西来表示它正在等待匹配的设备。这是预期的行为。

启动日志,显示设备超时的启动作业,并且随后导致引用为 cr_usb-General_USB_Flash_Disk 的设备的加密设置失败。我不确定这两者是否有联系。

他们是。超时设备的 UUID 与 crypttab 列出的属于该 USB 闪存盘的 UUID 相同。编辑:啊,你的意思是启动缓慢。是的,一点没错。


[ TIME ] Timed out waiting for device dev-disk-by\x2duuid-00a69115\x2d956d\x2d41b3\x2d830c\x2d9a3878087d41.device.
[DEPEND] Dependency failed for Cryptography Setup for cr_usb-General_USB_Flash_Disk_0349315060001623-0:0-part2.

/etc/crypttab

cr_sda2 UUID=7f99168c-4972-468b-900f-fb5bbfb90e66
cr_usb-General_USB_Flash_Disk_0349315060001623-0:0-part2 UUID=00a69115-956d-41b3-83

相关内容