1. The Virt-install configuration used when installing Ubuntu:
Virt-install \
--name test4 \
--ram 1024 \
--disk path=/data/01_ubuntu/ubuntu4.img,size=6 \
--vcpus 1 \
--HVM \
--os-type linux \
--network network=default \--os-variant
ubuntuquantal \
--graphics None \
--console pty,target_type=serial \
--location/data/00_osfile/ubuntu-16.04.1-server-amd64.iso \
--extra-args ' CONSOLE=TTYS0,115200N8 serial '
The error is as follows:
The ERROR couldn ' t find HVM kernel for the Ubuntu tree.
Domain installation does not appear to have been successful.
Through the data found that Virt-install can open the debug mode, add the--debug option can be
Results from the debug mode of 2.virt-install:
[Wed, Nov 2016 11:16:07 Virt-install 26900] DEBUG (urlfetcher:268) local hasfile:couldn ' t find/var/lib/libvirt/boot/virtinstmnt.xpl9y1/current/images/manifest
[Wed, Nov 2016 11:16:07 virt-install 26900] DEBUG (urlfetcher:89) fetching URI:/var/lib/libvirt/boot/virtinstmnt Xpl9y1/install/netboot/version.info
retrieving file Version.info ... | 00:00:00
[Wed, Nov, 2016 11:16:07 v Irt-install 26900] DEBUG (urlfetcher:1164) didn ' t find any known codename in the URL string
[Wed, Nov 2016 11:16:07 Virt-install 26900] DEBUG (urlfetcher:511) detected distro name=ubuntu osvariant=linux
[Wed, Nov 2016 11:16:07 vir T-install 26900] DEBUG (urlfetcher:268) local hasfile:couldn ' t find/var/lib/libvirt/boot/virtinstmnt.xpl9y1/install/ Netboot/ubuntu-installer/i386/linux
Here you can see the problem, obviously is 64-bit operating system, why to find./install/netboot/ubuntu-install/i386/linux's Path
Let's take a look at what the correct path is in the ISO file:
[root@11.102 01_ubuntu] $mount/data/00_osfile/ubuntu-16.04.1-server-amd64.iso/mnt
mount:/DEV/LOOP2 is write-protected, mounting read-only
[root@11.102 01_ubuntu] $ls/mnt/install/netboot/ubuntu-installer/amd64/ Linux
/mnt/install/netboot/ubuntu-installer/amd64/linux
Basically, it's OK if you change the path i386 to Amd64,virt-install installation.
Log remaining in debug mode:
[Wed, Nov 2016 11:16:07 Virt-install 26900] DEBUG (urlfetcher:320) Cleaning up Mount At/var/lib/libvirt/boot/virtinstmnt.xpl9y1 [Wed, Nov 2016, 11:16:07 Virt-insta ll 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, Nov 2016 11:16:07 virt-inst
All 26900] ERROR (cli:306) couldn ' t find HVM kernel to Ubuntu tree. [Wed, Nov 2016 11:16:07 Virt-install 26900] DEBUG (cli:308) Traceback (most recent call last): File "/usr/share/virt-manager/virt-install", line 747, in Start_instal L 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 360, 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 ' t find HVM Kern El for the Ubuntu tree.
3. Modify Virt-manager Code:
Through the above error, found Virt-manager using Python write! Just want to see what source from, this is right!
To find the problem, step by step, debug the Virt-manager project:
[root@11.102 ~] $grep-N-a22 "class Debiandistro"/usr/share/virt-manager/virtinst/ urlfetcher.py 1076:class Debiandistro (distro): 1077-# Ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/ installer-i386/1078-# Daily Builds:http://d-i.debian.org/daily-images/amd64/1079-name = "Debian" 1080-urldistro = "D" Ebian "1081-os_variant =" Linux "1082-1083-def __init__ (self, *args, **kwargs): 1084-distro.__init__ (Self, *args, **kw args) 1085-1086-# Pull The tree's arch out of the URL text 1087-self._treearch = ' i386 ' 1088-for pattern in [' ^.*/inst aller-(\w+)/?$ ", 1089-" ^.*/daily-images/(\w+)/?$ "]: 1090-arch = Re.findall (pattern, Self.uri) 1091-if arch:1092-self. _treearch = arch[0] 1093-break 1094-1095-self._url_prefix = ' current/images ' 1096-self._installer_dirname = self.name. Lower () + "-installer" 1097-self._set_media_paths ()
The discovery of Debian based systems, Self._treearch initialization in the __init__ method is i386, estimated Virt-manager read Ubuntu ISO file, what went wrong, did not read the system is x86_64 type, Change the value to AMD64.
Run Virt-install again, successfully enter the Ubuntu installation Interface!
Attached: CentOS command line uses KVM to install 64-bit Ubuntu newspaper "couldn ' t find HVM kernel to Ubuntu tree." The solution
Grep-n-a21 ' class Debiandistro '/usr/lib/python2.6/site-packages/virtinst/osdistro.py command to view DebianDistro class __init__ Method
[Root@2 Virtinst] $grep-n-a21 ' class Debiandistro '/usr/lib/python2.6/site-packages/virtinst/osdistro.py
892: Class Debiandistro (distro):
893-# Ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/
894- # daily builds:http://people.debian.org/~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-if uri.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-if re.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 '