VM recovery via cloud console: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 3: Line 3:


<!--T:3-->
<!--T:3-->
If the VM can't be accessed anymore via ssh or via a local user, the OS can be booted into single user mode or a recovery kernel can be launched, which provides privileged access to the OS image. The only requirement is that he boot manager is accessible and can be modified.
If the VM can't be accessed anymore via SSH or via a local user, the OS can be booted into single user mode or a recovery kernel can be launched, which provides privileged access to the OS image. The only requirement is that the boot manager is accessible and can be modified.


== Debian10 recovery == <!--T:4-->
== Debian10 recovery == <!--T:4-->


<!--T:5-->
<!--T:5-->
The recovery procedure is not that easy and convenient as you would expect from CentOS, the functionality is the same or at least similar. Most cloud images have the root account locked, so just booting single user won;t help us. However, when a Linux based system boots, regardless what flavor it is, the kernel gives up the control into userspace for all userspace related things like running daemons etc. That is done as soon as all the hardware is initialized, then the kernel runs a single userspace binary, called the init process which always has PID1, in most recent distributions it is either <code>systemd</code>, <code>systemV</code> or <code>upstart</code>. Via the bootmanager we are able to mdify that and tell the kernel to execute a shell instead and manually mount the image filesystem and do our recovery operations. The debian10 image comes with grub2 as well, the menu however looks a little different, but the keys and key combinations we need to use, are all the same. Reboot or boot the system until you see the grub menu then hit <code>e</code> for edit and remove the serial consoles and add <code>init=/bin/bash</code> to let the kernel know the new initprocess.
The recovery procedure is not that easy and convenient, as you would expect from CentOS; the functionality is the same or at least similar. Most cloud images have the root account locked, so just booting single user won't help us. However, when a Linux-based system boots, regardless what flavor it is, the kernel gives up the control into userspace for all things related to userspace, like running daemons, etc. That is done as soon as all the hardware is initialized, then the kernel runs a single userspace binary, called the <code>init</code> process which always has PID1; in most recent distributions it is either <code>systemd</code>, <code>systemV</code> or <code>upstart</code>. Via the bootmanager we are able to modify that and tell the kernel to execute a shell instead and manually mount the image filesystem and do our recovery operations. The debian10 image comes with grub2 as well, but the menu looks a little different; however, the keys and key combinations we need to use are all the same. Reboot or boot the system until you see the grub menu then hit <code>e</code> for edit and remove the serial consoles and add <code>init=/bin/bash</code> to let the kernel know the new <code>initprocess.


<!--T:6-->
<!--T:6-->
rsnt_translations
56,420

edits

Navigation menu