你的 Linux 系统开机时间已经击败了 99% 的电脑
但是如果你很想知道你的 Linux 系统需要很长时间才能启动完成呢？使用秒表是一种方法，但在 Linux 中，你有一种更好、更轻松地了解系统启动时间的方法。
开机 时间
223.154.60.114
启动的可能有点久，因为用的是虚拟机Cent OS
弑魘妖帝 [Chrome 76.0|Windows 7]
2019-08-17T14:42:14.000
223.89.136.102
我的启动时间55s
来自河南商丘的 Firefox 60.0|GNU/Linux 用户
2019-08-18T14:09:49.000
111.47.22.71
henghai@debian:~$&nbsp; &nbsp;&nbsp;&nbsp;systemd-analyze blame<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;25.007s man-db.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;18.553s docker.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;10.776s apt-daily.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;10.085s snapd.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 9.087s ModemManager.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 7.993s logrotate.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 7.848s udisks2.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 7.562s NetworkManager-wait-online.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 6.875s nginx.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 6.664s accounts-daemon.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4.237s networking.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4.234s snapd.seeded.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4.204s avahi-daemon.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4.190s lvm2-lvmpolld.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4.009s vboxdrv.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4.005s rsyslog.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 3.989s systemd-logind.service
程海 [Firefox 60.0|GNU/Linux]
2019-08-19T14:54:28.000
122.4.249.36
debian10：<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 9.244s plymouth-quit-wait.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 3.499s docker.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 3.336s mysqld.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 3.045s vmware-tools.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 2.559s apt-daily.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 2.174s vmware-tools-thinprint.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 2.147s man-db.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 1.666s dev-sda1.device<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 1.462s apt-daily-upgrade.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 1.054s udisks2.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;938ms NetworkManager-wait-online.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;798ms logrotate.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;616ms apache2.service
来自山东的 Firefox 56.0|Windows 7 用户
2019-08-19T15:05:48.000
115.201.52.61
~ systemd-analyze blame<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 1.701s man-db.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 1.102s lvm2-monitor.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;961ms dev-sdb2.device<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;591ms systemd-udevd.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;562ms systemd-journald.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;524ms systemd-logind.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;163ms ldconfig.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;143ms systemd-udev-trigger.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;83ms systemd-journal-flush.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;77ms NetworkManager.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;74ms user@1000.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;70ms systemd-rfkill.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;
来自浙江台州的 Chrome 76.0|GNU/Linux 用户
2019-08-21T22:23:09.000
222.44.86.175
ArchLinux 系统，用的 DWM 窗口管理器，启动 7 秒多点。<br />
<br />
$ systemd-analyze<br />
Startup finished in 3.421s (kernel) + 3.697s (userspace) = 7.118s<br />
graphical.target reached after 3.694s in userspace<br />
<br />
$ systemd-analyze blame<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 2.024s lvm2-monitor.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 1.326s dev-sdb2.device<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;998ms systemd-logind.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;417ms systemd-udevd.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;366ms systemd-journald.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;236ms systemd-udev-trigger.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;164ms dhcpcd.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;111ms systemd-remount-fs.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;94ms sys-kernel-config.mount<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;84ms systemd-random-seed.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;75ms systemd-sysctl.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;67ms systemd-tmpfiles-setup-dev.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;66ms user@1000.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;47ms dev-mqueue.mount<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;41ms kmod-static-nodes.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;33ms systemd-tmpfiles-setup.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;32ms systemd-journal-flush.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;29ms sys-kernel-debug.mount<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;28ms dev-hugepages.mount<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;24ms tmp.mount<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;14ms systemd-tmpfiles-clean.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;13ms systemd-update-utmp.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;12ms user-runtime-dir@1000.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 8ms systemd-user-sessions.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5ms home-zp-.cache.mount<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4ms var-cache.mount
zplinux [Chrome 76.0|GNU/Linux]
2019-08-22T16:37:23.000
106.37.233.66
HQLM。
来自北京的 Chrome 76.0|GNU/Linux 用户
2019-09-05T14:58:11.000
111.47.22.71
_,met$$$$$gg.&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; chenghai@debian <br />
&nbsp; &nbsp; ,g$$$$$$$$$$$$$$$P.&nbsp; &nbsp;&nbsp; &nbsp; --------------- <br />
&nbsp;&nbsp;,g$$P&quot;&nbsp; &nbsp;&nbsp;&nbsp;&quot;&quot;&quot;Y$$.&quot;.&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;OS: Debian GNU/Linux 10 (buster) x86_64 <br />
 ,$$P'&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;`$$$.&nbsp; &nbsp;&nbsp;&nbsp;Host: B250-HD3 <br />
',$$P&nbsp; &nbsp;&nbsp; &nbsp; ,ggs.&nbsp; &nbsp;&nbsp;&nbsp;`$$b:&nbsp; &nbsp;Kernel: 4.19.0-8-amd64 <br />
`d$$'&nbsp; &nbsp;&nbsp;&nbsp;,$P&quot;'&nbsp; &nbsp;.&nbsp; &nbsp; $$$&nbsp; &nbsp; Uptime: 22 mins <br />
 $$P&nbsp; &nbsp;&nbsp; &nbsp;d$'&nbsp; &nbsp;&nbsp;&nbsp;,&nbsp; &nbsp; $$P&nbsp; &nbsp; Packages: 3363 (dpkg), 7 (snap) <br />
 $$:&nbsp; &nbsp;&nbsp; &nbsp;$$.&nbsp; &nbsp;-&nbsp; &nbsp; ,d$$'&nbsp; &nbsp; Shell: bash 5.0.3 <br />
 $$;&nbsp; &nbsp;&nbsp; &nbsp;Y$b._&nbsp; &nbsp;_,d$P'&nbsp; &nbsp;&nbsp; &nbsp;Resolution: 1152x864, 1600x900 <br />
 Y$$.&nbsp; &nbsp; `.`&quot;Y$$$$P&quot;'
来自湖北的 Firefox 68.0|GNU/Linux 用户
2020-04-14T08:32:34.000
111.47.22.71
systemd-analyze blame<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;40.204s man-db.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;23.052s snapd.seeded.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;15.840s snapd.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;14.419s apt-daily.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;13.762s logrotate.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;12.291s NetworkManager-wait-online.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;11.848s ModemManager.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;10.885s udisks2.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 7.236s accounts-daemon.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.869s avahi-daemon.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.769s lvm2-lvmpolld.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.703s NetworkManager.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.503s wpa_supplicant.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.499s systemd-logind.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.498s lm-sensors.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.492s rsyslog.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.440s alsa-restore.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.435s vboxdrv.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 5.433s pppd-dns.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 4.419s teamviewerd.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 3.675s dev-sda1.device<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 3.614s systemd-tmpfiles-setup.service<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 3.518s colord.service<br />
<br />
什么情况？
程海 [Firefox 68.0|GNU/Linux]
2020-04-14T08:34:10.000
210.30.193.75
systemd-analyze time&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;  ✔  19:12:04 <br />
Startup finished in 6.309s (firmware) + 513ms (loader) + 2.471s (kernel) + 3.066s (userspace) = 12.360s <br />
graphical.target reached after 3.065s in userspace.<br />
 ~  systemd-analyze blame&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ✔  19:12:10 <br />
753ms dev-nvme0n1p3.device<br />
605ms home-sirius-storage.mount<br />
332ms systemd-tmpfiles-setup.service<br />
328ms systemd-udev-trigger.service<br />
来自210.30.193.75的 Chrome 111.0|GNU/Linux 用户
2023-03-19T19:13:05.000
171.88.109.220
5min 160ms archlinux-keyring-wkd-sync.service<br />
&nbsp; &nbsp; 6.373s NetworkManager-wait-online.service<br />
&nbsp; &nbsp; 1.476s updatedb.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;794ms dev-nvme1n1p2.device<br />
&nbsp; &nbsp;&nbsp;&nbsp;671ms accounts-daemon.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;546ms mysqld.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;300ms boot.mount<br />
&nbsp; &nbsp;&nbsp;&nbsp;282ms systemd-udev-trigger.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;243ms systemd-remount-fs.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;213ms systemd-modules-load.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;167ms user@1000.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;157ms systemd-vconsole-setup.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;150ms systemd-tmpfiles-setup-dev.service<br />
&nbsp; &nbsp;&nbsp;&nbsp;145ms modprobe@fuse.servi
来自四川成都的 Chrome 114.0|GNU/Linux 用户
2023-08-17T15:52:40.000
但是如果你很想知道你的 Linux 系统需要很长时间才能启动完成呢？使用秒表是一种方法，但在 Linux 中，你有一种更好、更轻松地了解系统启动时间的方法。
当你打开系统电源时，你会等待制造商的徽标出现，屏幕上可能会显示一些消息（以非安全模式启动），然后是 [Grub](https://www.gnu.org/software/grub/) 屏幕、操作系统加载屏幕以及最后的登录屏。


你检查过这花费了多长时间么？也许没有。除非你真的需要知道，否则你不会在意开机时间。


但是如果你很想知道你的 Linux 系统需要很长时间才能启动完成呢？使用秒表是一种方法，但在 Linux 中，你有一种更好、更轻松地了解系统启动时间的方法。


### 在 Linux 中使用 systemd-analyze 检查启动时间


![](/data/attachment/album/201908/17/104358s1ho8ug868hso1y8.jpg)


无论你是否喜欢，[systemd](https://en.wikipedia.org/wiki/Systemd) 运行在大多数流行的 Linux 发行版中。systemd 有许多管理 Linux 系统的工具。其中一个就是 `systemd-analyze`。


`systemd-analyze` 命令为你提供最近一次启动时运行的服务数量以及消耗时间的详细信息。


如果在终端中运行以下命令：



```
systemd-analyze
```

你将获得总启动时间以及固件、引导加载程序、内核和用户空间所消耗的时间：



```
Startup finished in 7.275s (firmware) + 13.136s (loader) + 2.803s (kernel) + 12.488s (userspace) = 35.704s

graphical.target reached after 12.408s in userspace
```

正如你在上面的输出中所看到的，我的系统花了大约 35 秒才进入可以输入密码的页面。我正在使用戴尔 XPS Ubuntu。它使用 SSD 存储，尽管如此，它还需要很长时间才能启动。


不是那么令人印象深刻，是吗？为什么不共享你们系统的启动时间？我们来比较吧。


你可以使用以下命令将启动时间进一步细分为每个单元：



```
systemd-analyze blame
```

这将生成大量输出，所有服务按所用时间的降序列出。



```
7.347s plymouth-quit-wait.service
6.198s NetworkManager-wait-online.service
3.602s plymouth-start.service
3.271s plymouth-read-write.service
2.120s apparmor.service
1.503s [email protected]
1.213s motd-news.service
 908ms snapd.service
 861ms keyboard-setup.service
 739ms fwupd.service
 702ms bolt.service
 672ms dev-nvme0n1p3.device
 608ms [email protected]:intel_backlight.service
 539ms snap-core-7270.mount
 504ms snap-midori-451.mount
 463ms snap-screencloud-1.mount
 446ms snapd.seeded.service
 440ms snap-gtk\x2dcommon\x2dthemes-1313.mount
 420ms snap-core18-1066.mount
 416ms snap-scrcpy-133.mount
 412ms snap-gnome\x2dcharacters-296.mount
```

#### 额外提示：改善启动时间


如果查看此输出，你可以看到网络管理器和 [plymouth](https://wiki.archlinux.org/index.php/Plymouth) 都消耗了大量的启动时间。


Plymouth 负责你在 Ubuntu 和其他发行版中在登录页面出现之前的引导页面。网络管理器负责互联网连接，可以关闭它来加快启动时间。不要担心，在你登录后，你可以正常使用 wifi。



```
sudo systemctl disable NetworkManager-wait-online.service
```

如果要还原更改，可以使用以下命令：



```
sudo systemctl enable NetworkManager-wait-online.service
```

请不要在不知道用途的情况下自行禁用各种服务。这可能会产生危险的后果。


现在你知道了如何检查 Linux 系统的启动时间，为什么不在评论栏分享你的系统的启动时间？




---


via: <https://itsfoss.com/check-boot-time-linux/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出

