Search This Blog

Tuesday 25 October 2016

How to Login Single user mode in Boot Grub

Kernel Selection menu, press e to modify the parameters to boot the kernel.

centos7 single user mode 1

The next screen will show you a confusing screen of kernel parameters. It'll look like this.

centos7 single user mode 2

Scroll down until you find the actual kernel line. It starts with linux16 /vmlinuz-... and will span a couple of lines. You're now looking for the ro keyword in the kernel linux, which would start the OS with a read only (ro) file system.

centos7 single user mode 3

Use your arrow keys to go to the ro line and replace it with rw init=/sysroot/bin/bash. The result should look like this. If that's the case, press ctrl+x to boot the kernel with those options.

centos7 single user mode 4

If everything went fine, you're now in a limited shell with access to the entire filesystem. To make things easier, you can chroot the filesystem so you can access all your known files/directories with the same paths.

centos7 single user mode 5

After you typed chroot /sysroot/, you'll find your familiar files in /etc, /usr,/var, ...

If you're done working in single user mode, reboot again by pressing ctrl+alt+del.

Update: as a reader pointed out, you may have to remount the filesystem from readonly to read-write, too.

mount -o remount,rw /

After that, you should be able to make changes to files on the disk that persist on reboot.


No comments:

Post a Comment