首先查看哪些服务占用了开机时间:
systemd-analyze blame
本文示例中发现 networking.service 的时间长达 5 分钟。查看该服务状态可发现如下错误:
systemd[1]: networking.service: Start operation timed out. Terminating.
systemd[1]: networking.service: Main process exited, code=killed, status=15/TERM
systemd[1]: networking.service: Failed with result 'timeout'.
systemd[1]: Failed to start Raise network interfaces.
解决方案
编辑文件:
sudo vim /etc/network/interfaces
将原来的:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
改为:
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
重启查验结果。