我最近注意到,当尝试启动 Linux 内核(5.8.0-55-generic
在标准 Ubuntu 20.04 发行版中)时,如果我使用指定根驱动器root=PARTUUID=.....
并以大写形式给出 ext4 分区 UUID,则内核会启动,但在启动过程中会挂起 30 秒(如以下几行所示/var/log/dmesg
):
[ 2.853379] kernel: input: HID 05ac:820b as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.8/2-1.8.1/2-1.8.1.2/2-1.8.1.2:1.0/0003:05AC:820B.0009/input/input10
[ 2.857488] kernel: hid-generic 0003:05AC:820B.0009: input,hidraw8: USB HID v1.11 Mouse [HID 05ac:820b] on usb-0000:00:1d.0-1.8.1.2/input0
[ 2.938013] kernel: usb 2-1.8.1.3: new full-speed USB device number 8 using ehci-pci
[ 3.057584] kernel: usb 2-1.8.1.3: New USB device found, idVendor=05ac, idProduct=8289, bcdDevice= 1.50
[ 3.067746] kernel: usb 2-1.8.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3.077779] kernel: usb 2-1.8.1.3: Product: Bluetooth USB Host Controller
[ 3.087836] kernel: usb 2-1.8.1.3: Manufacturer: Apple Inc.
[ 32.329915] kernel: EXT4-fs (sda4): mounted filesystem with ordered data mode. Opts: (null)
[ 32.498137] systemd[1]: Inserted module 'autofs4'
[ 33.091557] systemd[1]: systemd 245.4-4ubuntu3.7 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
[ 33.130184] systemd[1]: Detected architecture x86-64.
[ 33.179603] systemd[1]: Set hostname to <michael-MacBookPro>.
[ 33.342145] systemd[1]: Created slice system-modprobe.slice.
[ 33.350600] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 33.358792] systemd[1]: Created slice User and Session Slice.
如果我以小写形式指定完全相同的 PARTUUID,则不会挂起:
[ 2.643019] kernel: input: HID 05ac:820b as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.8/2-1.8.1/2-1.8.1.2/2-1.8.1.2:1.0/0003:05AC:820B.0009/input/input10
[ 2.652851] kernel: hid-generic 0003:05AC:820B.0009: input,hidraw8: USB HID v1.11 Mouse [HID 05ac:820b] on usb-0000:00:1d.0-1.8.1.2/input0
[ 2.685911] kernel: EXT4-fs (sda4): mounted filesystem with ordered data mode. Opts: (null)
[ 2.733247] kernel: usb 2-1.8.1.3: new full-speed USB device number 8 using ehci-pci
[ 2.852575] kernel: usb 2-1.8.1.3: New USB device found, idVendor=05ac, idProduct=8289, bcdDevice= 1.50
[ 2.860616] kernel: usb 2-1.8.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2.867916] kernel: usb 2-1.8.1.3: Product: Bluetooth USB Host Controller
[ 2.875182] kernel: usb 2-1.8.1.3: Manufacturer: Apple Inc.
[ 2.882524] systemd[1]: Inserted module 'autofs4'
[ 3.490681] systemd[1]: systemd 245.4-4ubuntu3.7 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
[ 3.529529] systemd[1]: Detected architecture x86-64.
[ 3.585335] systemd[1]: Set hostname to <michael-MacBookPro>.
[ 3.732416] systemd[1]: Created slice system-modprobe.slice.
[ 3.740515] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 3.748458] systemd[1]: Created slice User and Session Slice.
(请注意,两个日志中都存在相同的“已安装文件系统”消息,只是早了几行,并且在快速启动日志中没有长时间的延迟。)
然而,正在使用 PARTUUID 的大写版本(例如,不是被其他东西覆盖):如果我输入了错误的数字,那么在 30 秒后,内核会抱怨它无法找到根文件系统,如预期的那样。
谁能帮忙解释一下吗?如果情况很重要的话,至少看起来它根本不应该起作用,而不是延迟 30 秒后它应该起作用。
更新1:同样(上述行为以及与/etc/fstab
行为的相似/差异)适用于root=UUID=...
以及root=PARTUUID=...
。
更新2:我认为这一定与发生的情况有所不同/etc/fstab
(既因为挂载 root 必须在/etc/fstab
可以读取之前发生,也因为 - 正如评论中所讨论的 -/etc/fstab
只是因错误的情况 (PART)UUID 而失败,而root=...
在 30 秒暂停后成功)。