Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the failure of UBuntu system installing KVM to create virtual machine

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "UBuntu system installation KVM creation virtual machine failure how to solve", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "UBuntu system installation KVM creation virtual machine failure how to solve" it!

This time, the installation of KVM on the UBuntu12.04.2 system, and then the creation of virtual machines, there are new problems.

Phenomenon:

Ping is not connected to the virtual machine, ssh login is not available, console login is not available, and the virtual machine cannot be shutdown. It seems that power management has not been successfully installed.

Let's solve the network problem first:

Fortunately, files inside the virtual machine can be checked through virt-cat.

Shut down the virtual machine first

Virsh destroy vm1 then check the Nic settings file:

The code is as follows:

Root@dbkvm:~# virt-cat-d vm1 / etc/network/interfaces

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces (5).

# The loopback network interface

Auto lo

Iface lo inet loopback

# The primary network interface

Auto eth0

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 installed

Dns-nameservers 8.8.8.8

Dns-search localdomain

This dns-search localdomain looks strange. It's usually defaultdomain.

Localdomain is because the / etc/hosts of the host machine is configured to:

The code is as follows:

127.0.0.1 localhost.localdomain dbkvm

Replace it with this configuration:

The code is as follows:

127.0.0.1 localhost

127.0.1.1 dbkvm

Create a virtual machine again, and the network is normal. You can communicate with ping and log in with ssh. There are more questions about console.

The network setting dns-search in the virtual machine is set to defaultdomain.

Therefore, it is speculated that the configuration error of the hosts file leads to the dns-search error set by the network card in the virtual machine, which leads to the inability to connect to the network, so it is impossible to download and install openssh-server from the network during the creation process.

Take a look at power management.

If you do not install power management, you cannot shut down the virtual machine through shutdown on the host host.

You need to add the following in the options for creating vm:

The code is as follows:

-- addpkg=acpid

To make up for it afterwards, log in to the virtual machine and run the command:

The code is as follows:

Apt-get install acpid

Let's deal with the problem that console cannot log in.

Stop the virtual machine first.

The code is as follows:

Virsh stop vm1

Prepare a file ttyS0.conf with the following contents:

The code is as follows:

# ttyS0.conf-getty

# This service maintains a getty on ttyS0 from the 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:

The code is as follows:

Apt-get install guestfish

Now use virt-copy-in to copy the file to the / etc/init directory of vm:

The code is as follows:

Virt-copy-in-d vm1 ttyS0.conf / etc/init

Then call virsh edit vm1 to edit the configuration file of vm1, adding the following:

The code is as follows:

...

Finally, try it out:

The code is as follows:

Virsh start vm1

Domain vm1 started

Root@dbkvm:~/kvm_scripts# virsh console vm1

Connected to domain vm1

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 x86room64)

Yes. The root of all the problems lies in the / etc/hosts configuration on the incorrect host machine.

At this point, I believe you have a deeper understanding of "UBuntu system installation KVM creation virtual machine failure how to solve", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report