启动速度非常慢(6m),如何强制将`systemd-udevd`超时更改为5秒?

启动速度非常慢(6m),如何强制将`systemd-udevd`超时更改为5秒?

本质上发生的事情是这样的:

linuxgrub 命令,我添加debug --verbose并得到了这个!

60秒等待后:
systemd-udevd 'SomeDevicePartition' is taking a long time

120 秒以上后:
systemd-udevd 'SomeDevicePartition' killed

它们发生在+-:60秒、180秒、240秒、365秒,
所以总共6分钟!!!

我想知道 udevd 终止超时是否可以降低到 10 秒并且不重试? (使用 grub 条目中的一些配置)


如果您需要更多信息,整个问题的详细信息都在这里(以上只是重要部分):https://askubuntu.com/questions/1196874/18-04-grub-takes-about-6-minutes-to-boot-problem-systemd-udevd-somedevice


我得到了解决这个问题的提示:
udevadm --timeout=10

但我可能需要使用 LiveCD iso 映像来撤消它,因此:
udevadm它的配置存储在哪里?我尝试过cat ./udev/rules.d/* |grep timeout -i但什么也没发现......

它也适用于一般事件,因此,作为奖励:我可以配置一些特定的超时来处理分区检测吗?


这是 grub cfg 中的内容:

linux /vmlinuz-4.15.0-72-generic \
  root=/dev/mapper/MyLvmGroupName ro \
  nosplash $vt_handoff debug --verbose

作为提示https://unix.stackexchange.com/a/559979/30352(这里),我尝试过:

linux /vmlinuz-4.15.0-72-generic \
  root=/dev/mapper/MyLvmGroupName ro \
  rd.udev.event-timeout=10 \
  nosplash $vt_handoff debug --verbose

但由于某种原因它似乎被忽略了:(因为我仍然有很长的超时(相同,没有任何改变)


我自 2019 年 10 月 12 日起就遇到了这个问题:/(上次我在 Ubuntu18 上进行了完整更新)

答案1

看起来你的系统使用了systemd的udev。

那么,让我们开始查看此服务手册页 (systemd-udevd.service(8)):

       The behavior of the daemon can be configured using udev.conf(5), its command line options,
       environment variables, and on the kernel command line, or changed dynamically with udevadm
       control.

并进一步:

KERNEL COMMAND LINE
       Parameters starting with "rd." will be read when systemd-udevd is used in an initrd.

       udev.log-priority=, rd.udev.log-priority=
           Set the log level.

       udev.children-max=, rd.udev.children-max=
           Limit the number of events executed in parallel.

       udev.exec-delay=, rd.udev.exec-delay=
           Delay the execution of RUN instructions by the given number of seconds. This option might
           be useful when debugging system crashes during coldplug caused by loading non-working
           kernel modules.

       udev.event-timeout=, rd.udev.event-timeout=
           Wait for events to finish up to the given number of seconds. This option might be useful
           if events are terminated due to kernel drivers taking too long to initialize.

       net.ifnames=
           Network interfaces are renamed to give them predictable names when possible. It is enabled
           by default; specifying 0 disables it.

因此,也许您可​​以尝试将(如果问题出在 initrd 阶段,udev.event-timeout=10则添加相同的前缀)到内核命令行。rd.

相关内容