KVM HVM virtual machines are connected using Virsh console mode

Source: Internet
Author: User
Tags fully qualified domain name


In the previous article http://blog.csdn.net/dobell/article/details/9003421, given the way Xen console connects Hvm, under KVM, how to use the Libvirt library Virsh Console connection HVM. It's also very simple.

In fact, it is not difficult to achieve. First, we need to insert the following tags in the Virsh-initiated virtual machine XML file kvm201.xml

<span style= "FONT-SIZE:14PX;" ><devices>
<serial type= ' pty '  tty= '/DEV/PTS/4 ' >
  <target port= ' 0 '/>
</ serial>
<console type= ' pty ' >
  <target type= ' serial ' port= ' 0 '/>
</console>
</devices></span>

Note that the serial and console tags must be added to the devcies tag, otherwise the Libvirt library does not recognize the console device to add .

Then we start the virtual machine, Virsh create Kvm201.xml, add the console to the /boot/grub/grub.cfg file of the virtual machine kvm201, as shown in the following figure

If it is a GRUB2 system, please modify the/etc/default/grub file,

grub_cmdline_linux= "Console=tty0 console=ttys0", then Update-grub

If you want to see and control grub when you enter the serial port, add the following paragraph

Grub_terminal=serial
grub_serial_command= "SERIAL--unit=0--speed=115200--word=8--parity=no--stop=1"

This paragraph indicates that grub itself supports serial output

Just so you can not log in with the console, only see the boot information, so we also add ttyS0 ssh boot. Add the following information to the/etc/init/ttys0.conf in the virtual machine

Then restart the virtual machine, Reboot,virsh console kmv201, found that you can connect the

* Starting ACPI daemon [OK]
* Starting regular background program processing daemon [OK]
* Starting deferred execution scheduler [OK]
* Starting CPU interrupts balancing daemon [OK]
* Starting crash report submission daemon [OK]
Apache2:could not reliably determine the server ' s fully qualified domain name, using 192.168.188.201 for ServerName
[OK]
* Starting Tomcat servlet engine TOMCAT7 [OK]
* Checking Battery State ... [OK]

Ubuntu 12.04.1 LTS kvm201 ttyS0

kvm201 Login:root

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.