systemd在响应udev事件时,会有一个超时时间,如果要处理的事件需要的时间较长,比如插入U盘,自动运行U盘里面的脚本,则很容易超时,导致事件未完全处理完成。通过修改systemd-udevd.service可以解决这个问题,修改如下:

diff --git a/rootfs/etc/udevd-conf b/rootfs/etc/udevd-conf
new file mode 100755
index 0000000000..889fefd894
--- /dev/null
+++ b/rootfs/etc/udevd-conf
@@ -0,0 +1 @@
+ARGS='--event-timeout=6000'
diff --git a/rootfs/usr/lib/systemd/system/systemd-udevd.service b/rootfs/usr/lib/systemd/system/systemd-udevd.service
old mode 100644
new mode 100755
index 3b6ff0e162..9b97ccee64
--- a/rootfs/usr/lib/systemd/system/systemd-udevd.service
+++ b/rootfs/usr/lib/systemd/system/systemd-udevd.service
@@ -21,9 +21,10 @@ OOMScoreAdjust=-1000
 Sockets=systemd-udevd-control.socket systemd-udevd-kernel.socket
 Restart=always
 RestartSec=0
-ExecStart=/usr/lib/systemd/systemd-udevd
+EnvironmentFile=/etc/udevd-conf
+ExecStart=/usr/lib/systemd/systemd-udevd $ARGS
 KillMode=mixed
-WatchdogSec=3min
+WatchdogSec=6min
 TasksMax=infinity
 MountFlags=shared
 MemoryDenyWriteExecute=yes

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐