用 systemd-analyze blame 找出拖慢开机的服务

systemd-analyze blame 按初始化耗时排序所有单元,揭示是什么拖慢了启动。

Linux启动性能systemd低风险
运行 `systemd-analyze blame` 可按初始化时间排序列出各单元,找出拖慢开机启动的服务;单独运行 `systemd-analyze` 可查看总耗时。

01命令

命令
$ systemd-analyze blame

02作用说明

不带参数的 `systemd-analyze` 输出总体数字,如 "Startup finished in 2.1s (kernel) + 8.4s (userspace)",而 blame 会把用户空间耗时按单元逐项拆分。注意这里统计的是各单元自身的初始化时间,不包括等待依赖的时间——要看依赖等待请使用 `systemd-analyze critical-chain`。blame 中耗时较高的服务通常可以禁用、mask 或改用其他配置方式。

03风险

风险低风险
使用条件systemd-based distribution.

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • systemd-analyze(1)
    Ubuntu Manpages · technical · 2026-09-17
    依据: blame prints a list of all currently running units, ordered by the time they took to initialize.

最后验证: 2026-09-17 · 分类: 系统与设置

06相关方案