virsh frustrations

Some of you, I hope, will be familiar with a command called “virsh”. This command in Linux is the shell command to control KVM VMs. It works great, if you know how to use it and, for the record, KVM is a fantastic virtual host environment. Although I have run my home server infrastructure on it for a couple years now, I still am learning new things all the time and there is much more to learn and try.
Today’s issue was caused by a typo. I went to disable selinux (blech) on a machine and I made a typo in the /etc/selinux/config file and rebooted the machine, which promptly hung on the reboot forever. The fix is simple – get into that file and fix the typo, but how to get to get in there when the machine doesn’t work? Well, you, of course, need to pass a boot parameter to get the machine to ignore selinux, but for the life of me I couldn’t get into the booter from KVM. KVM was just too freaking fast for me to start the VM, get into the console and press “e”. Sometimes I wonder if this weird stuff only happens to me. Anyhow, I had to start the VM in the paused state “virsh start vmname –paused” and then I could connect to the paused console. After that I did “sleep 2; virsh resume vmname”, which gave me 2 seconds to get over to the console and start pressing the “e” key before the vm actually resumed and booted. That did the trick! From there I was able to pass the boot parameter I needed “selinux=0” and boot up and fix the typo.

Comments are closed.