Question

I have installed KVM on my Ubuntu system. Using vmbuilder, I setup a linux VM. When I tried to access the console using virsh console vm command, I was getting an error. I tried to follow the solution but, I cannot seem to be able to make permanent changes whatsoever to the configuration file. I tried both manually editing the xml config file as well as using the virsh edit command. But after I edit the file and close it, if I reopen the config file using virsh edit again, I get back the original file without any of my edits.

Can some one tell me where I could be going wrong.

Was it helpful?

Solution

First, make sure you have an XML file.

Then, be sure you have no machine's defined.

virsh list --all

If this returns any machines, run this on all of them.

virsh undefine <machine>

Now you should have a clear system.

Now start editing your xml file for the machine you are trying to set up. Make sure it has a definition for a tty so you can connect to the console later on. There should under device exist a console or serial part. Don't remember exactly.

When the xml file is ready, you can define it.

virsh define <path_to_xml>

What it does is that it puts the xml inside virsh so now it is that copy that is actually used for the machine and not the xml file you have on disk. This means that any modifications of this file will not be reflected in virsh. You can still modify the xml but now in order to do so you need to either undefine and define it again or use.

You can list the machines and check a specific machine's configuration with those commands (the machine's name is the one defined in the xml file).

virsh list --all
virsh edit <machine>

Now start the machine

virsh start <machine>

It should say the machine has started and you should be able to connect to the machine using the console

virsh console <machine>

The previous two commands can be written as a single command which will put you on the console immediatly.

virsh start <machine> --console

OTHER TIPS

You should be carefull when undefine the XML.

The first step before undefine is to make a copy of the actual xml.

Otherwise u'll find that $> virsh undefine file.xml deatach the virtual machine from the virsh list and also delete de actual xml file.

Make a copy and follow the procedure defined for origamicoder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top