在 MacOS 上的 Parallels 下作为 VM 运行。以前启动正常 - 大约 10 秒 - 现在需要 2 分钟以上,而且全部在内核中(系统分析时间):
Startup finished in 2min 2.911s (kernel) + 5.163s (userspace) = 2min 8.075s
graphical.target reached after 5.138s in userspace
这可以在 dmesg 中看到,下面复制了其中的一部分:
...[snip]...
[ 2.673238] fb0: switching to prldrmfb from VESA VGA
[ 2.673270] usb usb4: Manufacturer: Linux 5.11.0-34-generic xhci-hcd
[ 2.673658] scsi host4: ahci
[ 2.674010] usb usb4: SerialNumber: 0000:00:1d.6
[ 2.674971] Console: switching to colour dummy device 80x25
[ 2.676406] scsi host5: ahci
[ 2.679839] scsi host6: ahci
[ 2.680667] input: Parallels Virtual Mouse as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/0003:203A:FFFC.0001/input/input5
[ 2.680864] hid-generic 0003:203A:FFFC.0001: input,hidraw0: USB HID v1.10 Mouse [Parallels Virtual Mouse] on usb-0000:00:1d.0-1/input0
[ 2.683355] input: Parallels Virtual Mouse as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.1/0003:203A:FFFC.0002/input/input6
[ 2.683414] hid-generic 0003:203A:FFFC.0002: input,hidraw1: USB HID v1.10 Mouse [Parallels Virtual Mouse] on usb-0000:00:1d.0-1/input1
[ 2.683596] scsi host7: ahci
[ 2.683829] ata3: SATA max UDMA/133 abar m8192@0xf0200000 port 0xf0200100 irq 26
[ 2.683834] ata4: SATA max UDMA/133 abar m8192@0xf0200000 port 0xf0200180 irq 26
[ 2.683836] ata5: SATA max UDMA/133 abar m8192@0xf0200000 port 0xf0200200 irq 26
[ 2.683839] ata6: SATA max UDMA/133 abar m8192@0xf0200000 port 0xf0200280 irq 26
[ 2.683860] ata7: SATA max UDMA/133 abar m8192@0xf0200000 port 0xf0200300 irq 26
[ 2.683864] ata8: SATA max UDMA/133 abar m8192@0xf0200000 port 0xf0200380 irq 26
[ 2.685452] hub 4-0:1.0: USB hub found
[ 2.686996] hub 4-0:1.0: 12 ports detected
[ 2.688647] fbcon: prldrmfb (fb0) is primary device
[ 2.689689] Console: switching to colour frame buffer device 100x37
[ 2.690984] prl_vid 0000:01:00.0: [drm] fb0: prldrmfb frame buffer device
[ 2.693005] virtio_net virtio0 enp0s5: renamed from eth0
[ 2.709721] [drm] Initialized prl_vid 1.7.0 20210909 for 0000:01:00.0 on minor 0
[ 3.002031] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 3.002473] ata3.00: ATA-8: Ubuntu Linux-0 SSD, F.NB0GRW, max UDMA/100
[ 3.002509] ata3.00: 1073741824 sectors, multi 0: LBA48 NCQ (depth 32)
[ 3.002963] ata3.00: configured for UDMA/100
[ 3.003413] scsi 2:0:0:0: Direct-Access ATA Ubuntu Linux-0 S 0GRW PQ: 0 ANSI: 5
[ 3.003754] sd 2:0:0:0: Attached scsi generic sg0 type 0
[ 3.004067] sd 2:0:0:0: [sda] 1073741824 512-byte logical blocks: (550 GB/512 GiB)
[ 3.004093] sd 2:0:0:0: [sda] 4096-byte physical blocks
[ 3.004954] sd 2:0:0:0: [sda] Write Protect is off
[ 3.005716] sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
[ 3.005762] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 3.027611] sda: sda1 sda2 < sda5 >
[ 3.050540] sd 2:0:0:0: [sda] Attached SCSI disk
[ 3.318699] ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 3.320847] ata4.00: ATAPI: Virtual DVD-ROM [1], FWR1, max UDMA/25
[ 3.322856] ata4.00: configured for UDMA/25
[ 3.325443] scsi 3:0:0:0: CD-ROM Virtual DVD-ROM R103 PQ: 0 ANSI: 5
[ 3.383265] sr 3:0:0:0: [sr0] scsi3-mmc drive: 44x/44x cd/rw xa/form2 cdda tray
[ 3.384340] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 3.446214] sr 3:0:0:0: Attached scsi CD-ROM sr0
[ 3.446545] sr 3:0:0:0: Attached scsi generic sg1 type 5
[ 3.563878] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input4
[ 3.764290] ata5: SATA link down (SStatus 0 SControl 300)
[ 4.082980] ata6: SATA link down (SStatus 0 SControl 300)
[ 4.397906] ata7: SATA link down (SStatus 0 SControl 300)
[ 4.718538] ata8: SATA link down (SStatus 0 SControl 300)
[ 122.808488] EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.
[ 122.927189] systemd[1]: Inserted module 'autofs4'
[ 122.947246] systemd[1]: systemd 245.4-4ubuntu3.11 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)
[ 122.948345] systemd[1]: Detected virtualization kvm.
[ 122.948681] systemd[1]: Detected architecture x86-64.
[ 122.967752] systemd[1]: Set hostname to <ubuntu-vm>.
[ 123.102544] systemd[1]: /etc/systemd/system/prltoolsd.service:13: PIDFile= references a path below legacy directory /var/run/, updating /var/run/prltoolsd.pid → /run/prltoolsd.pid; please update the unit file accordingly.
[ 123.143913] systemd[1]: Created slice system-modprobe.slice.
[ 123.149406] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 123.150410] systemd[1]: Created slice User and Session Slice.
...[snip]...
我无法判断延迟是否是由安装 sda5(它确实显示“已安装...”,这意味着它已完成)或其他原因引起的,例如 ata8 的问题。我对 Linux 了解不够,无法对这一说法有信心,但我想知道这么多驱动器是否与(A)我的 Mac 硬盘;(B)我连接的 SSD 上装有 Linux VM;(c)来自 Mac 的映射文件夹有关。
我尝试过不使用 grub 中的 quiet 和 splash 选项进行启动,但我看到的只是如上所示的长时间停顿。这一切都发生在 Journalctl 和 syslog 进入之前,所以我无法在其中找到任何东西。
系统分析指责或关键链没有显示出任何有用的信息。
我尝试过将 grub 设置为不执行 fsck 来启动,但没有帮助。我比较了 UUID:
/dev/sda5: UUID="0363354f-f8fb-46b5-a6f3-2cdefd508240" TYPE="ext4" PARTUUID="77746e54-05"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda1: UUID="D46A-1225" TYPE="vfat" PARTUUID="77746e54-01"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
# /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/sda5 during installation
UUID=0363354f-f8fb-46b5-a6f3-2cdefd508240 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=D46A-1225 /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
fdisk -l 显示:
...[snip]...
Disk /dev/sda: 512 GiB, 549755813888 bytes, 1073741824 sectors
Disk model: Ubuntu Linux-0 S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x77746e54
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1050623 1048576 512M b W95 FAT32
/dev/sda2 1052670 1073739775 1072687106 511.5G 5 Extended
/dev/sda5 1052672 1073739775 1072687104 511.5G 83 Linux
Partition 2 does not start on physical sector boundary.
...[snip]...
我不认为分区对齐是问题所在,但我想这可能是错的,因为自从创建磁盘映像以来,我还没有对它进行任何操作,而且正如我所说,问题最近才开始出现。最近安装的唯一东西是通过软件更新程序进行的 Ubuntu 基础修复,但我无法将其归因于特定的时间或事件。
我不知道如何进一步解决这个问题,有人有什么想法吗?
编辑:磁盘映射
ls -l /dev/disk/by-path/
total 0
lrwxrwxrwx 1 root root 9 Sep 13 16:24 pci-0000:00:1f.2-ata-1 -> ../../sda
lrwxrwxrwx 1 root root 10 Sep 13 16:24 pci-0000:00:1f.2-ata-1-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Sep 13 16:24 pci-0000:00:1f.2-ata-1-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Sep 13 16:24 pci-0000:00:1f.2-ata-1-part5 -> ../../sda5
lrwxrwxrwx 1 root root 9 Sep 13 16:24 pci-0000:00:1f.2-ata-2 -> ../../sr0
还:
grep '[0-9]' /sys/class/scsi_host/host{0..9}/unique_id
/sys/class/scsi_host/host0/unique_id:1
/sys/class/scsi_host/host1/unique_id:2
/sys/class/scsi_host/host2/unique_id:3
/sys/class/scsi_host/host3/unique_id:4
/sys/class/scsi_host/host4/unique_id:5
/sys/class/scsi_host/host5/unique_id:6
/sys/class/scsi_host/host6/unique_id:7
/sys/class/scsi_host/host7/unique_id:8
ls -lisah /sys/block
total 0
3899 0 drwxr-xr-x 2 root root 0 Sep 13 16:22 .
1 0 dr-xr-xr-x 13 root root 0 Sep 13 16:22 ..
17686 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop0 -> ../devices/virtual/block/loop0
17831 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop1 -> ../devices/virtual/block/loop1
29992 0 lrwxrwxrwx 1 root root 0 Sep 13 16:39 loop10 -> ../devices/virtual/block/loop10
17976 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop2 -> ../devices/virtual/block/loop2
18121 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop3 -> ../devices/virtual/block/loop3
18266 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop4 -> ../devices/virtual/block/loop4
18411 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop5 -> ../devices/virtual/block/loop5
18556 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop6 -> ../devices/virtual/block/loop6
18701 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop7 -> ../devices/virtual/block/loop7
26265 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop8 -> ../devices/virtual/block/loop8
26417 0 lrwxrwxrwx 1 root root 0 Sep 13 16:24 loop9 -> ../devices/virtual/block/loop9
25047 0 lrwxrwxrwx 1 root root 0 Sep 13 16:22 sda -> ../devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sda
25348 0 lrwxrwxrwx 1 root root 0 Sep 13 16:34 sr0 -> ../devices/pci0000:00/0000:00:1f.2/ata4/host3/target3:0:0/3:0:0:0/block/sr0
因此,我定义了主机 4-6,但对这些主机没有任何定义,只有主机 2 和 3(在启动消息中看起来正常)。
答案1
发现问题了。Parallels VM 配置了断开连接的 CD-ROM 驱动器 - 选项为断开连接或选择 ISO 映像。内核启动时,它显示一个空的 CD-ROM,并尝试查找磁盘,然后超时。如果我将 VM 配置为使用 ISO,它会立即启动。这从内核 5.11.0-34-generic 开始,但我不知道这是内核问题还是 Parallels 问题。启动到旧版本的内核似乎可以“解决问题”。
注意:这还会导致与 cd-rom 相关的失控 systemd-udevd 更改事件问题,从而导致 systemd-udevd 的 CPU 利用率达到 100%。
答案2
根据您的发现,在硬件配置设置中完全移除 CD/DVD 驱动器似乎也可以解决问题,并且无需永久连接 ISO 映像。