0

I run a kvm image with

sudo kvm -m 512 -vnc :1,password /home/kvm/image/debian-8.2.qed ...

how can I control this VM with virsh ?

# virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes

#
user3313834
  • 5,701
  • 4
  • 40
  • 76

2 Answers2

0

You can connect through vnc, spice or with

virsh console _vmname_ 

but to use console through virsh you need configure the TTY on the VM, i don't remember how at this time, but google can help for that ;)

Cheers

0

If you're trying to get to the console, you can either use virt-viewer for the graphical console or attach to a serial TTY (as Carlos mentioned) with the "virsh console" command.

Assuming your vm is named "myvm", you'd use virt-viewer like this:

# virt-viewer -c qemu:///system myvm

For a serial console, you'll need to modify the kernel command line in grub (in the VM). In Fedora/RHEL/CentOS you'd do it this way:

1. Edit /etc/default/grub and add the following to the "GRUB_CMDLINE_LINUX=" line:

console=tty0 console=ttyS0,115200

2. # grub2-mkconfig -o /boot/grub2/grub.cfg

3. Reboot the VM

4. # virsh console myvm

The procedure should be similar on Debian and Ubuntu but you'll need to search for the proper way to update grub2 for that platform.

foobrew
  • 1,756
  • 1
  • 11
  • 3