断电后我的服务器(Ubuntu 16.04)无法启动,我不明白为什么它会给我“输入 root 密码进行维护”的消息。
我做了fsck
根分区并且它正在以 RW 模式挂载:
root@dev:~# cat /proc/mounts|grep ' / '
/dev/sda1 / ext4 rw,relatime,errors=remount ro,data=ordered 0 0
root@dev:~#
root@dev:~# touch /works
root@dev:~# rm /works
root@dev:~#
日志没有提供任何线索:
-- Unit plymouth-read-write.service has begun starting up.
oct 27 19:03:36 dev systemd[1]: Reached target Emergency Mode.
-- Subject: Unit emergency.target has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit emergency.target has finished starting up.
--
-- The start-up result is done.
oct 27 19:03:36 dev systemd[1]: Started Stop ureadahead data collection.
-- Subject: Unit ureadahead-stop.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ureadahead-stop.service has finished starting up.
--
-- The start-up result is done.
oct 27 19:03:36 dev systemd[1]: Started Update UTMP about System Runlevel Changes.
-- Subject: Unit systemd-update-utmp-runlevel.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-update-utmp-runlevel.service has finished starting up.
--
-- The start-up result is done.
oct 27 19:03:36 dev systemd[1]: Stopped Read required files in advance.
-- Subject: Unit ureadahead.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ureadahead.service has finished shutting down.
oct 27 19:03:36 dev systemd[1]: Started Tell Plymouth To Write Out Runtime Data.
-- Subject: Unit plymouth-read-write.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit plymouth-read-write.service has finished starting up.
--
我可以手动设置以太网接口并启动 SSH 守护进程,我可以登录,一切似乎都很好,除了它卡在阶段init
。
如果一切正常,我该如何找出导致维护提示出现的原因?初始化脚本位于哪里以及如何使其能够打印调试消息或更详细?
答案1
我发现了这个问题,因此我将为可能遇到同样问题的人发布答案。
我在 /etc/fstab 中有一个 /volume,但后来这个 /volume 被文件系统替换了bcache
,从那以后我就再也没有重启过。现在,在非正常关机后,当我重启时,bcache
这个分区被锁定,无法使用,并且 init 进程无法将其挂载到 /volume 挂载点。我在 /etc/fstab 中注释了这个分区,就这样。
为了找到这个错误,我必须启动到文本模式(通过删除中的“splash, quiet”属性/etc/defaults/grub
),因为在图形中我什么都看不到。