Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Boot in recovery mode an ubuntu server KVM virtual machine from a remote pc

Digital Innovation Partner

Boot in recovery mode an ubuntu server KVM virtual machine from a remote pc

Why you should need to restart a VM ubuntu 12.04 server on your KVM remote server?

Simple: just miss an apparently innocuous command (in my case I needed to add a user to a group).

Then I typed the command:

Unfortunately I forgot the “-a” option thus erasing all user groups including the group “sudo” that makes my user “sudoer”.

What to do when the only user having the login permission (unfortunately for root the login was not enabled…) cannot execute sudo commands???

the only chance that I found was to start the server in recovery mode…
So below a short guide to do the trick connecting through virt-viewer from a Desktop ubuntu pc to the remote KVM server.

1) @client: install virt-viewer if not already installed.

2) @client: generate ssh key in order to log in to the KVM server without typing the password (!!!)

3) @client: s-copy the generate key on the KVM server

4) @server: authorize the rsa key

5) @server: shutdown the guest VM to restore (virsh list for getting the correct VM_DOMAIN)

6) @client: connect virt-viewer with the “–wait” option to the KVM server asking for VM_DOMAIN

7) @server: start the VM to restore

At this point, the client will launch automatically virt-viewer showing the bootloader menu of the remote VM through which start the server in recovery mode
In my case it was essential in order to log in as root and restore the groups (basically the group “sudo”) of the user.

In addition, entering as root, I encountered problems launching the command “usermod” beacuse the main disk was not correctly mounted.
Then:

Lascia un commento