Rescue Boot an OpenStack VM
Warning: these instructions are meant for advanced users only.
Sometimes you want to repair a broken system using a rescue boot. Some examples of problems:
ssh key is lost → temporarily enable password login
broken network configuration
broken boot configuration
interactive fsck needed
Think of a PC that does not boot, but it has a CD drive. You insert a rescue CD, boot from it and repair the problem on the hard drive.
Similarly you can dismount the problematic hard drive and attach it to a different PC, repair the problem and put it back.
Depending on the broken system and the repair work that needs to be done, choose a suitable rescue system. E.g. when you look at an Ubuntu system, it is often easiest to just use a fresh Ubuntu system launched from a standard SWITCHengines image.
Root Disk on Volume
When the problematic root disk is an OpenStack volume, then you can remove the VM but keep the volume. Attach it to a different VM as an additional disk to do the repair work. This can be a temporary VM that you can throw away afterwards. Then launch a new VM from the volume.
There may be more complicated cases where you want to use a specialized repair system. Example of such a system: http://www.system-rescue-cd.org/ (some more explanations: http://www.linux-magazine.com/Online/Features/SystemRescueCd ).
Get CD Image
We will need an image file of the rescue CD, i.e. a file with type iso. Download from http://www.system-rescue-cd.org/Download/ or whatever suits you.
Upload CD Image
Upload the iso file:
openstack image create --file systemrescuecd-6.0.1.iso --disk-format iso --container-format bare --min-ram 800 --property hw_cdrom_bus=scsi systemrescuecd
The rescue command adds the rescue image as boot device and boots:
openstack server rescue --image 'Ubuntu Xenial 16.04 (SWITCHengines)' VM
openstack server rescue --image systemrescuecd VM
In the case of a regular SWITCHengines image, login using SSH.
If you are using a the systemrescuecd, go to the console. Do the rescue work.
When you are finished, shut down the VM. Then end the rescue mode:
openstack server unrescue VM
This will also start the VM again.