为了
systemd-analyze && systemd-analyze blame | head && systemd-analyze critical-chain && echo
连接 USB 驱动器时:
Startup finished in 1.818s (kernel) + 50.866s (userspace) = 52.685s
graphical.target reached after 50.785s in userspace
50.254s dev-mmcblk0p2.device
5.192s systemd-udev-settle.service
944ms [email protected]
501ms systemd-journal-flush.service
428ms networkd-dispatcher.service
419ms acct.service
325ms apport.service
315ms systemd-udev-trigger.service
301ms sysstat.service
300ms hddtemp.service
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.
graphical.target @50.785s
└─multi-user.target @50.773s
└─getty.target @50.761s
└─[email protected] @50.749s
└─dev-ttyAML0.device @50.724s
当 USB 驱动器拔出时:
Startup finished in 1.833s (kernel) + 3.249s (userspace) = 5.082s
graphical.target reached after 3.191s in userspace
1.205s dev-mmcblk1p2.device
822ms [email protected]
534ms blk-availability.service
474ms systemd-journal-flush.service
464ms apport.service
423ms networkd-dispatcher.service
398ms systemd-udev-settle.service
345ms systemd-logind.service
325ms lm-sensors.service
295ms systemd-udev-trigger.service
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.
graphical.target @3.191s
└─multi-user.target @3.179s
└─postfix.service @3.147s +18ms
└─[email protected] @2.300s +822ms
└─basic.target @2.208s
└─sockets.target @2.196s
└─acpid.socket @2.182s
└─sysinit.target @2.039s
└─systemd-update-utmp.service @1.913s +19ms
└─systemd-tmpfiles-setup.service @1.780s +58ms
└─local-fs.target @1.743s
└─media-boot.mount @1.674s +57ms
└─dev-disk-by\x2duuid-F702\x2d39CB.device @1.623s
目前USB驱动器有
usb-storage.quirks=0bc2:ab38:,0bc2:2022:,0bc2:3312:u"
让 SMART 发挥作用。
我的其他 USB 驱动器不会导致此问题...
那么有什么方法可以告诉 systemd 在启动时不要等待选定的驱动器吗?
编辑:
https://www.systutorials.com/docs/linux/man/5-systemd.device/
表示可能添加
SYSTEMD_READY=0
到
/etc/udev/rules.d/99-local.rules
不知何故... udevadm 监视器输出很长,我不知道我的 udev 规则。明智的时机可能是其中之一
KERNEL[2185.507867] add /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2.1/2-1.1.2.1:1.0/host1/target1:0:0 (scsi)
KERNEL[2185.507927] add /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2.1/2-1.1.2.1:1.0/host1/target1:0:0/1:0:0:0 (scsi)
KERNEL[2185.507968] add /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2.1/2-1.1.2.1:1.0/host1/target1:0:0/1:0:0:0/scsi_device/1:0:0:0 (scsi_device)
KERNEL[2185.508051] add /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2.1/2-1.1.2.1:1.0/host1/target1:0:0/1:0:0:0/scsi_disk/1:0:0:0 (scsi_disk)
KERNEL[2185.508203] add /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2.1/2-1.1.2.1:1.0/host1/target1:0:0/1:0:0:0/bsg/1:0:0:0 (bsg)
与很久以后的情况相比
KERNEL[2209.775922] add /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.1/2-1.1.1/2-1.1.1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)