受到“有多快”视频的启发,我最近一直在尝试尽可能加快我的启动速度。
我阅读了许多论坛上关于不同方法的文章,但最近遇到了一个特殊问题。我打开了详细启动,一切似乎都进行得非常快,除了某一时刻,它在某些地方暂停了大约十秒钟,如下所示:
'Begin running /scripts/init/bottom.... done'
它为什么会在这个特定点停这么久?它几乎立即显示“完成”。记录显示,这是一个全新安装。
任何帮助将不胜感激。
我显示了启动时运行的脚本
initctl list
结果是:
-avahi-daemon start/running, process 858 -mountall-net stop/waiting -nmbd start/running, process 24028 -rc stop/waiting -rsyslog start/running, process 846 -tty4 start/running, process 941 -udev start/running, process 335 -upstart-udev-bridge start/running, process 331 -ureadahead-other stop/waiting -whoopsie start/running, process 1024 -apport start/running -console-setup stop/waiting -hwclock-save stop/waiting -irqbalance start/running, process 1027 -plymouth-log stop/waiting -smbd start/running, process 801 -tty5 start/running, process 948 -failsafe stop/waiting -hybrid-gfx stop/waiting -modemmanager start/running, process 830 -rfkill-store stop/waiting -atd start/running, process 1025 -dbus start/running, process 809 -failsafe-x stop/waiting -mounted-var stop/waiting -plymouth stop/waiting -resolvconf start/running -udev-fallback-graphics stop/waiting -control-alt-delete stop/waiting -hwclock stop/waiting -mounted-proc stop/waiting -network-manager start/running, process 841 -alsa-store stop/waiting -module-init-tools stop/waiting -setvtrgb stop/waiting -shutdown stop/waiting -alsa-restore stop/waiting -cron start/running, process 1026 -lightdm start/running, process 1166 -mountall stop/waiting -mounted-debugfs stop/waiting -binfmt-support stop/waiting -console stop/waiting -mounted-run stop/waiting -acpid start/running, process 1009 -bluetooth start/running, process 832 -plymouth-stop stop/waiting -rcS stop/waiting -ufw start/running -wait-for-state stop/waiting -flush-early-job-log stop/waiting -friendly-recovery stop/waiting -rc-sysinit stop/waiting -cups start/running, process 900 -upstart-socket-bridge start/running, process 699 -anacron stop/waiting -tty2 start/running, process 969 -udevtrigger stop/waiting -container-detect stop/waiting -mounted-dev stop/waiting -tty3 start/running, process 974 -udev-finish stop/waiting -hostname stop/waiting -mountall-reboot stop/waiting -mountall-shell stop/waiting -mounted-tmp stop/waiting -network-interface (lo) start/running -network-interface (eth0) start/running -network-interface (eth1) start/running -plymouth-splash stop/waiting -plymouth-upstart-bridge stop/waiting -tty1 start/running, process 2021 -udevmonitor stop/waiting -dmesg stop/waiting -network-interface-security (network-manager) start/running -network-interface-security (network-interface/eth1) start/running -network-interface-security (network-interface/eth0) start/running -network-interface-security (network-interface/lo) start/running -network-interface-security (networking) start/running -networking stop/waiting -procps stop/waiting -rfkill-restore stop/waiting -tty6 start/running, process 977 -network-interface-container stop/waiting -ureadahead stop/waiting
抱歉,我无法复制卡住的确切代码,我一直在通过“查找”功能搜索 /var/log 中的日志文件,但到目前为止我还没有找到任何东西。
我发现了许多不同的启动日志文件,但没有一个显示我上面提到的 /init/bottom。
答案1
您所看到的是从 initramfs 转向真正的根并开始启动真实事物之前的最后一些内部管理工作。
你可以在/usr/share/initramfs-tools/init
run_scripts /scripts/init-bottom
[ "$quiet" != "y" ] && log_end_msg
这log_end_msg
就是您的“...完成”,因此在那之后的所有内容都可能是延迟。这都是非常轻量级的东西。主要是将全局内容(如 /sys 和 /proc)移动到真正的根文件系统,然后运行 init。也可能 init 已经运行,您正处于“启动”阶段,现在您正在唤醒磁盘以安装它们,并赶上在根文件系统旋转时可能错过的任何 udev 事件。
如果你还没有尝试过 bootchart,那值得一看。只需sudo apt-get install bootchart
。这应该会告诉你很多有关系统在启动过程中花费时间的信息。