I later discovered “ interactive startup mode” is almost useless, firstly, it is hard to active this mode by press “I” key, secondly not all services observe this mode. Network service seems to be the only one.
A flag file: /var/run/confirm will be created, when key “I” (case insensitive) is pressed. It seems only network service check this file.
[root@centos64 init.d]# grep -C 2 /var/run/confirm /etc/init.d/*/etc/init.d/network- fi/etc/init.d/network- # If we're in confirmation mode, get user confirmation./etc/init.d/network: if [ -f /var/run/confirm ]; then/etc/init.d/network- confirm $i/etc/init.d/network- test $? = 1 && continue
So how can you gain shell access without rescue CD? The answer is to append “init=/bin/sh” to kernel line in grub boot loader.
Let’s review the Linux boot order
The BIOS ->MBR->Boot Loader->Kernel->/sbin/init->
By default “init=/sbin/init”, which will transfer control in above order./etc/inittab->/etc/rc.d/rc.sysinit->/etc/rc.d/rcX.d/ #where X is run level in /etc/inittabrun script with K then script with S
If you set “init=/bin/sh”, it will stop there and give login shell.
Booting to single user mode won’t fix udev startup issue, because udev starts before single user mode (udev is in /etc/rc.d/rc.sysinit , single user mode is in /etc/rc.d/rc1.d)
Instructions:
In Grub menu, select the kernel, press “a” to edit boot option, then append “init=/bin/sh”, then press enter to boot
After gaining the login shell, the fs is most likely in Read-only file system state.
Remount partitions to rewrite mode by “mount –o rw,remount / “
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.