
我最近注意到,當嘗試啟動 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 秒暫停後成功)。