[libvirt-users] Objective: run commands in the domain. Trouble: setting up a console

Osier Yang jyang at redhat.com
Mon May 9 06:41:55 UTC 2011


于 2011年05月06日 22:39, Guilherme Santos 写道:
> I've installed libvirt and also Virtual Box OSE hypervisor, in order to
> see if I could properly manage it through virsh.
> I could easily set up, start, pause, resume, shutdown and destroy the
> newly created domains, from a XML file.
>
> Then I was wondering how could I be able to spawn commands in the domain
> through virsh, and the command 'console' gave me a the thought that I
> should connect to the domain's console, so that, once connected, I would
> be able to "do anything". Am I right?
>
> I need to be able to run commands in the virtual machine. If the only
> way is by accessing the domain's console, how can I properly set up one?
> I tried several ways, following the examples in the documentation.
>
> Problem is that no matter what I wrote in the xml file about serial or
> console devices, it aways get overriden by null configuration when I
> start the domain (I can see it by using command 'edit' <domain> ).
>
> So then I tried to edit the XML through virsh and insert specifications
> about console or serial devices, but I never was able to sucessfully
> edit the file. I always got the same error message: "could not define a
> domain, rc=80bb0004", although the domain is in fact defined! I tried
> editing the XML both with the domain running and stopped.
>
> My final alternative was using command 'attach-device' passing a xml
> containing only the specifications of serial or console devices. I aways
> received an error message saying that memory limit was exceeded,
> although I strongly suppose that's not the real problem.

If it says "no memory", it's bug.

>
> I am sure that I am configuring something (or many things) wrongly, so
> that I am getting all those errors... My initial problem is just to be
> able to run commands in the newly created domain. Anybody can tell me an
> easier way to do this? If setting up consoles is the only way, what is
> going on wrongly for me?

You need to configure your guest kernel command line. E.g. Append
following to your guest kernel command line.

  console=ttyS0,115200

For more how to connect to linux via serial console, search web, :)

Then something like following in domain xml:

   <serial type='pty'>
     <target port='0'/>
   </serial>
   <console type='pty'>
     <target port='0'/>
   </console>

Hope you can connect to the domain via console then by:

# virsh console domain

>
> Sorry if an answer for this issue is already somewhere in the
> documentation, I tried to find it hard before emailing you guys!
>
> Thanks anyway!!
>
> --
> Guilherme Santos G. Baptista
> Graduando em Ciência da Computação pela UFCG
> LSD - Laboratório de Sistemas Distribuídos
>
>
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users




More information about the libvirt-users mailing list