1. Configuration of the Virt-install used when installing Ubuntu:
Virt-install \\1024x768 \path=/data/01_ubuntu/ubuntu4.img,size=6 \1 \ \--os-type linux \--network network=default \\--console Pty, target_type=serial \/data/00_osfile/ubuntu-16.04.1-server-amd64.iso \--extra-args ' Console=TTYS0,115200N8 serial '
The error is as follows:
ERROR couldn ' t find HVM kernel for Ubuntu tree. not appear to has been successful.
By checking the data found that Virt-install can open debug mode, adding the --debug option can be
The result of the debug mode of the 2.virt-install:
[Wed, 11:16:07 Virt-install 26900]DEBUG(urlfetcher:268) Local hasfile:couldn ' tFind/var/lib/libvirt/Boot/virtinstmnt.xpl9y1/current/images/manifest[wed, 11:16:07 Virt-install 26900]DEBUG(urlfetcher:89) Fetching URI:/var/lib/libvirt/Boot/virtinstmnt.xpl9y1/install/netboot/version.inforetrieving file Version. Info ... | B 00:00:00[Wed, 11:16:07 Virt-install 26900]DEBUG(urlfetcher:1164) Didn ' tFindAny known codename in the URL string[wed, 11:16:07 Virt-install 26900]DEBUG(urlfetcher:511) Detected distro Name=ubuntu osvariant=linux[wed, 11:16:07 Virt-install 26900]DEBUG(urlfetcher:268) Local hasfile:couldn ' tFind/var/lib/libvirt/Boot/virtinstmnt.xpl9y1/install/netboot/ubuntu-installer/i386/linux
Here can see the problem, obviously is 64-bit operating system, why go to find./install/netboot/ubuntu-install/i386/linux path
Let's go and see what the correct path is in the ISO file:
[[email protected] 01_ubuntu] $mount/data/00_osfile/ubuntu-16.04.1-server-amd64.iso//DEV/LOOP2 is write-protected, mounting read-only
[[email protected]11.102 01_ubuntu] $ls/mnt/install/netboot/ubuntu-installer/amd64//mnt/install/ Netboot/ubuntu-installer/amd64/linux
Basically, if you change the path's i386 to Amd64,virt-install installation, there is no problem.
Log remaining in debug mode:
[Wed, 11:16:07 Virt-install 26900]DEBUG(urlfetcher:320) Cleaning up Mount at/var/lib/libvirt/Boot/virtinstmnt.xpl9y1[wed, 11:16:07 Virt-install 26900]DEBUG(cli:305) File "/usr/share/virt-manager/virt-install", line 1077, in <module>SYS.Exit(Main ())File"/usr/share/virt-manager/virt-install", line 1071,In main Start_install(Guest, Continue_inst, options)File"/usr/share/virt-manager/virt-install", line 775,In Start_install fail(e, Do_exit=false)File"/usr/share/virt-manager/virtinst/cli.py", line 305,In fail logging.Debug("".Join(Traceback.format_stack ()))[Wed, 11:16:07 Virt-install 26900] ERROR (cli:306) couldn ' tFindHVM kernel forUbuntuTree.[Wed, 11:16:07 Virt-install 26900]DEBUG(cli:308)Traceback(Most recentPagerLast: File"/usr/share/virt-manager/virt-install", line 747,In Start_install Dom= Guest.start_install (Meter=meter, Noboot=options.noreboot)File"/usr/share/virt-manager/virtinst/guest.py", line 491,In start_install self. _prepare_install (meter, dry)File"/usr/share/virt-manager/virtinst/guest.py", line 304,In _prepare_install self. Installer.prepare (self, meter)File"/usr/share/virt-manager/virtinst/installer.py", line 200,In prepare self. _prepare (Guest, meter)File"/usr/share/virt-manager/virtinst/distroinstaller.py", line 451,In _prepare self. _prepare_kernel_url (Guest, fetcher)File"/usr/share/virt-manager/virtinst/distroinstaller.py", Line ,In _prepare_kernel_url kernel, initrd, args = Store.acquirekernel (guest)File"/usr/share/virt-manager/virtinst/urlfetcher.py", line 603,In Acquirekernel {"Distro": Self.name, "type": Self.type})runtimeerror:couldn ' tFindHVM kernel forUbuntuTree.
3. Modify the Virt-manager code:
Through the above error, found Virt-manager use Python write! Just want to see what source from, this happens!
Find the problem by debugging the Virt-manager Project step-by-step:
[[Email protected] ~] $grep-N-a22 "class Debiandistro"/usr/share/virt-manager/virtinst/urlfetcher.py1076: ClassDebiandistro (distro):1077-# Ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/1078-# daily Builds:http://d-i.debian.or G/daily-images/amd64/1079-name = "Debian" 1080-urldistro = "Debian" 1081-os_variant = "Linux" 1082-1083-def __init__ (self, *args, **kwargs):1084-distro.__init__ (self, *args, **kwargs) 1085-1086-# Pull theTree' s arch out of the URL text1087-self._treearch =' i386 '1088- forPattern in ["^.*/installer-(\w+)/?$", 1089-"^.*/daily-images/(\w+)/?$"]:1090-arch = Re.findall (pattern, Self.uri) 1091-ifArch:1092-self._treearch = arch[0]1093- Break1094-1095-self._url_prefix = ' current/Images '1096-self._installer_dirname = Self.name.lower () + "-installer" 1097-self._set_media_paths ()
Found Debian-based systems, __init__ method Self._treearch initialization is i386, is estimated to be virt-manager read Ubuntu ISO file, what is the problem, did not read the system is the x86_64 type, the value is changed to AMD64, you can do it.
Run Virt-install again to successfully enter the Ubuntu installation Interface!
Attached: The CentOS command line uses KVM to install the 64-bit Ubuntu newspaper "couldn ' t find HVM kernel for Ubuntu tree." The solution
grep-n-a21 ' class Debiandistro '/usr/lib/python2.6/site-packages/virtinst/osdistro.pycommand to view the __init__ method of the Debiandistro class
[[email protected] virtinst]$grep-N-a21 ' class Debiandistro '/usr/lib/python2.6/site-packages/virtinst/osdistro.py892: ClassDebiandistro (distro):893-# Ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/894-# daily BUILDS:HTTP://PEOPLE.DEBIAN.O rg/~joeyh/d-i/895-896-name = "Debian" 897-os_type = "Linux" 898-899-def __init__ (self, URI, arch, Vmtype=none, Scratchdir=none):900-distro.__init__ (self, URI, arch, Vmtype, ScratchDir) 901-ifUri.count ("installer-i386"):902-self._treearch = "i386" 903-elif uri.count ("Installer-amd64"):904-self._treearch = "AMD64" 905-Else:906-self._treearch = "i386" 907-908-ifRe.match (R ' i[4-9]86 ', arch):909-self.arch =' i386 '910-911-self._installer_name = Self.name.lower () + "-" + "installer" 912-self._prefix = ' current/Images '913-self._set_media_paths ()
Change the else in the __init__ method: the line below the condition, change "i386" to "AMD64"
-Self._treearch = ' i386 '+ self._treearch = ' AMD64 '
04.ubuntu under KVM command line installs 64-bit Ubuntu newspaper "couldn ' t find HVM kernel for Ubuntu tree." The problem