如果在 root 为只读时挂起,如何调试新贵?

anx*_*anx 5 boot mount upstart

我正在尝试在 14.04.2 LTS 上调试一个不连续/挂起的系统启动(新贵)。root 是 luks 容器中的 ext4 文件系统。文件系统处于干净状态。

启动过程在 upstart-socket-bridge 之后停止(不一定在该特定服务之后,例如安装 cups-daemon 之后,它就停止了)。init -v也不是很有帮助。唯一不只是记录各种服务的启动/停止的日志条目是关于 init 之前的 udev。

Begin: Running /scripts/init-bottom ... done.
udev exit failed --rc=2
Run Code Online (Sandbox Code Playgroud)

(编辑)重新安装根 rw 最初似乎总是导致干净启动,但事实是,它有点不可预测,无论哪种方式我都失败并成功启动。什么?

观察:一切似乎都很好,系统只是不重新挂载可写的 root 或继续引导。

问:我如何确定导致启动过程卡住的服务有问题?


更新:通过 getty 创建第二个 shell 可以initctl list在挂断后运行,这些是正在运行的作业

mountnfs-bootclean.sh start/running
udev start/running, process 438
upstart-udev-bridge start/running, process 432
plymouth start/running, process 122
resolvconf start/running
ssh start/running, process 767 <-- this one was manually started
mountall start/running, process 337
mountkernfs.sh start/running
mountnfs.sh start/running
bootmisc.sh start/running
upstart-socket-bridge start/running, process 745**
cryptdisks start/running
mountdevsubfs.sh start/running
mtab.sh start/running
network-interface (lo) start/running
network-interface (eth0) start/running
plymouth-ready (startup) start/running, process 315
plymouth-upstart-bridge start/running, process 316
mountall-bootclean.sh start/running
network-interface-security (network-interface/eth0) start/running
network-interface-security (network-interface/lo) start/running
Run Code Online (Sandbox Code Playgroud)

更新 2:

  • 重新安装 upstart 及其所有相关数据包(很痛苦并且)没有效果。
  • 使用第二个控制台,我可以init 5用来让卡住的系统继续正常启动。
  • 即使我手动重新安装了 root rw(或使用了 rw 内核参数),系统现在也卡住了 - 我最初观察到强制 root 可写解决这个问题是不正确的

解决方法:

看来是ureadaheads的错。清除它导致 5 个干净的靴子没有任何问题。我将把这个问题(和 100 个额外的代表)留给任何感兴趣或知道原始问题答案的人:如果不是通过随机试验,我本可以解决这个问题。

anx*_*anx 1

作为参考,我尝试过的(不成功的)调试步骤,但对其他人很有用:

  • 获取另一个可以启动的类似 debian 的系统(例如可启动 USB 笔驱动器上的实时 ubuntu),并使用 chroot 对检查的系统进行配置或软件更改。使用 qemu-static 可以在具有不同架构的系统上执行此操作。
  • 安装一个独立的 shell,例如sash,然后更改内核命令行(在 grub 中使用 e 键或编辑 grub.cfg/cmdline.txt)并添加init=/bin/sash,重新引导,检查该 shell 上的情况,然后使用exec init继续引导
  • init与交换机一起使用-v以增加日志记录
  • 尽早挂载可写的根文件系统(例如,在执行 init 之前将“rw”添加到内核命令行mount -o remount,rw /) - 这允许更多日志记录
  • 检查/var/log/upstart
  • 在执行 init 之前在 tty2 上启动一个额外的终端,例如getty -n -l /bin/bash 38400 tty2 &- 这有助于检查系统所处的状态(例如ps -Afiotop
  • 用于initctl list确定哪些服务处于哪个状态