检查谁在搞鬼
$ systemd-analyze blame
结果
39.828s plymouth-quit-wait.service 39.311s apt-daily.service 30.937s NetworkManager-wait-online.service 21.015s dev-sda2.device 18.972s systemd-journal-flush.service 17.187s snapd.service 14.972s networkd-dispatcher.service 14.438s mysql.service 13.989s dev-loop10.device 13.345s dev-loop8.device 13.249s dev-loop14.device 13.076s dev-loop13.device 13.076s dev-loop6.device 13.068s dev-loop11.device 12.958s dev-loop16.device 12.774s dev-loop15.device ...
第一项为开机动画,用 mask 干掉 (要恢复使用 unmask)
$ sudo systemctl mask plymouth-quit-wait.service
第二项,延迟 apt-daily 服务
$ sudo systemctl edit apt-daily.timer
在打开的窗口填入如下内容 (这将把此服务,延迟到 boot 后的 15 到 45 分钟后再执行,并且每天只执行 1 次,详情可见 https://askubuntu.com/questions/800479/ubuntu-16-04-slow-boot-apt-daily-service)
# apt-daily timer configuration override [Timer] OnBootSec=15min OnUnitActiveSec=1d AccuracySec=1h RandomizedDelaySec=30min
第三项,直接 disable (要恢复使用 enable )
$ sudo systemctl disable NetworkManager-wait-online.service
第五项,systemd-journal-flush.service,更改 journal 记录方式 (详见:https://askubuntu.com/questions/1094389/what-is-the-use-of-systemd-journal-flush-service)
打开,
$ sudo vim /etc/systemd/journald.conf
修改如下,
[Journal] Storage=auto #Compress=yes #Seal=yes #SplitMode=uid #SyncIntervalSec=5m #RateLimitIntervalSec=30s #RateLimitBurst=1000 #SystemMaxUse= #SystemKeepFree= SystemMaxFileSize=1G SystemMaxFiles=5 #RuntimeMaxUse= #RuntimeKeepFree=
先这样。