Phenomenon:
Ping does not pass the virtual machine, SSH login, console mode login, virtual machine can not shutdown, seemingly power management has not been installed successfully.
To solve the network problem first:
Fortunately, you can check the files inside the virtual machine by Virt-cat.
Turn off the virtual machine first
Virsh Destroy VM1
Then check the NIC settings file:
root@dbkvm:~# virt-cat-d vm1/etc/network/interfaces
# This file describes the network interfaces available on your s Ystem # and how to
activate them. For more information, interfaces (5).
# The Loopback network interface
Auto lo
iface lo inet Loopback
# The Primary network interface
Auto eth0< C9/>iface eth0 inet Static address
192.168.1.51
netmask
255.255.255.0 network 192.168.1.0 Broadcast 192.168.1.255
Gateway 192.168.1.1
# Dns-* options are implemented by the resolvconf package, if instal LED
dns-nameservers 8.8.8.8
dns-search localdomain
This dns-search localdomain looks strange. is generally defaultdomain.
The Localdomain is configured in the/etc/hosts of the host machine:
127.0.0.1 Localhost.localdomain DBKVM
Change it to this configuration:
127.0.0.1 localhost
127.0.1.1 DBKVM
Then create the virtual machine, the network is normal. Can ping, can ssh login. Console problem and.
The network settings inside the virtual machine Dns-search are set to DefaultDomain.
Therefore, the assumption is that the Hosts file configuration error, resulting in the virtual Machine network card set Dns-search error, resulting in the network can not be connected, so can not be downloaded from the network installation openssh-server.
Take a look at power management
If you do not install power management, you will not be able to shut down the virtual machine via shutdown on the host.
The option to create the VM needs to be filled in:
--addpkg=acpid
An afterthought is to log in to the virtual machine, and then run the command:
Apt-get Install Acpid
Again to handle the problem that the console cannot log on.
Stop the virtual machine first.
Virsh Stop VM1
Prepare a file ttys0.conf that reads as follows:
# Ttys0.conf-getty
# This service maintains a Getty ' ttyS0 from ' point the ' system is
# started until it is Shut down again.
Start on stopped RC runlevel=[2345]
stop on RunLevel [!2345]
respawn
Install the Guestfish program:
Apt-get Install Guestfish
Now copy the files to the VM's/etc/init directory with virt-copy-in:
virt-copy-in-d VM1 Ttys0.conf/etc/init
Then call Virsh edit Vm1 to edit the VM1 configuration file and add the following:
<devices> ...
<serial type= ' pty ' >
<source path= '/dev/pts/2 '/> <target ' port=
' 0 '/>
</serial>
<console type= ' pty ' tty= '/DEV/PTS/2 ' > <source path= '/dev/pts/2 '/> <target '
0 '/ >
</console>
</devices>
Finally try:
Virsh start vm1
Domain vm1 started
root@dbkvm:~/kvm_scripts# virsh console vm1
Connected to Domain vm1< C15/>escape character is ^]
Ubuntu 12.04.2 LTS vm1 ttyS0 vm1 login:root
-Password: Last
Login:thu May 2 09:21:03 UTC 2013 from 192.168.1.4 on PTS/1
Welcome to Ubuntu 12.04.2 LTS (gnu/linux 3.2.0-41-virtual x86_64)
OK. All the problems are rooted in the/etc/hosts configuration on that incorrect host machine.