Saturday, 11 April 2020

How to Interrupt GRUB and Override init process in Linux

Interrupt GRUB and Override init

This can be achieved by making temporary changes to a kernel menu entry
requirements: cent OS 7 installed in a virtual machine.

Booting with rdinit=/bin/sh will start with a shell in the initramfs.
while booting with init=/bin/bash will complete the initramfs and then start with a shell on the disk.

Scenario 1:  Change kernel parameters only during a single boot process. reboot vm on the GRUB 2 boot screen press 'e' key for edit regular kernel entry
at the end of last to previous line, add rdinit=/bin/sh



Press Ctrl+x, it will boot as shell prompt with logged in.
The init is restarted process as /bin/sh.
There will be a limited file system loaded in RAM











Scenario 2: reboot vm, on the GRUB 2 boot screen press 'e' key for edit regular kernel entry. At the end of last to previous line, add init=/bin/bash.



Press Ctrl+x to boot, It will boot as shell prompt with logged in.
The init is restarted process as /bin/bash, with no ordinary service like GUI or init processes.



No comments:

Post a comment