1.安装ubuntu时使用的virt-install的配置:

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'

报错如下:

ERROR Couldn't find hvm kernel for Ubuntu tree.
Domain installation does not appear to have been successful.

通过查资料发现,virt-install可以开debug模式的,加入--debug选项即可

2.virt-install的debug模式得到的结果:

[Wed, 30 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, 30 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...                                                                                                                      |   58 B  00:00:00
[Wed, 30 Nov 2016 11:16:07 virt-install 26900] DEBUG (urlfetcher:1164) Didn't find any known codename in the URL string
[Wed, 30 Nov 2016 11:16:07 virt-install 26900] DEBUG (urlfetcher:511) Detected distro name=Ubuntu osvariant=linux
[Wed, 30 Nov 2016 11:16:07 virt-install 26900] DEBUG (urlfetcher:268) local hasFile: Couldn't find /var/lib/libvirt/boot/virtinstmnt.xPL9y1/install/netboot/ubuntu-installer/i386/linux

这里就可以看出问题了,明明是64位的操作系统,为什么去找./install/netboot/ubuntu-install/i386/linux的路径

我们去看看iso文件中正确的路径是什么:

[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

基本确定,如果将路径的i386改为amd64,virt-install安装就没有问题。

debug模式剩余的log:

[Wed, 30 Nov 2016 11:16:07 virt-install 26900] DEBUG (urlfetcher:320) Cleaning up mount at /var/lib/libvirt/boot/virtinstmnt.xPL9y1
[Wed, 30 Nov 2016 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 mainstart_install(guest, continue_inst, options)File "/usr/share/virt-manager/virt-install", line 775, in start_installfail(e, do_exit=False)File "/usr/share/virt-manager/virtinst/cli.py", line 305, in faillogging.debug("".join(traceback.format_stack()))[Wed, 30 Nov 2016 11:16:07 virt-install 26900] ERROR (cli:306) Couldn't find hvm kernel for Ubuntu tree.
[Wed, 30 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_installdom = guest.start_install(meter=meter, noboot=options.noreboot)File "/usr/share/virt-manager/virtinst/guest.py", line 491, in start_installself._prepare_install(meter, dry)File "/usr/share/virt-manager/virtinst/guest.py", line 304, in _prepare_installself.installer.prepare(self, meter)File "/usr/share/virt-manager/virtinst/installer.py", line 200, in prepareself._prepare(guest, meter)File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 451, in _prepareself._prepare_kernel_url(guest, fetcher)File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 360, in _prepare_kernel_urlkernel, 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 kernel for Ubuntu tree.

3.修改virt-manager代码:

通过上面的报错,发现virt-manager使用python写的!正好想看什么源码来自,这个正好!

通过对virt-manager这一项目一步步debug,找到问题:

[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 = "debian"
1081-    os_variant = "linux"
1082-
1083-    def __init__(self, *args, **kwargs):
1084-        Distro.__init__(self, *args, **kwargs)
1085-
1086-        # Pull the tree's arch out of the URL text
1087-        self._treeArch = 'i386'
1088-        for pattern in ["^.*/installer-(\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()

发现基于Debian的系统,__init__方法中self._treeArch初始化时是i386,估计是virt-manager读取ubuntu的iso文件时,出了什么问题,没读出该系统是x86_64类型,将该值改为amd64,就可以了。

再次运行virt-install,成功进入ubuntu安装界面!

附:CentOS命令行使用KVM安装64位ubuntu报"Couldn't find hvm kernel for Ubuntu tree."的解决办法

grep -n -A21 'class DebianDistro' /usr/lib/python2.6/site-packages/virtinst/OSDistro.py 命令可以查看DebianDistro类的__init__方法
[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()

改变__init__方法里的else:条件下面的一行,将"i386"改为"amd64"即可

- self._treeArch = 'i386'
+ self._treeArch = 'amd64'

转载于:https://www.cnblogs.com/ruo-yu/p/6117134.html

04.ubuntu下kvm 命令行安装64位ubuntu报Couldn't find hvm kernel for Ubuntu tree.的问题相关推荐

  1. ubuntu下用命令行安装Qt

    虽然网络上很多人使用 Redhat 或者Fedora 作为上位机操作系统,但是我觉得使用Ubuntu最为方便,因为需要的软件包大部分都可以通过 apt-get 方式来安装,而不必从源代码开始自己编译. ...

  2. cento7安装kvm并通过kvm命令行安装centos7

    这里写自定义目录标题 一.KVM简介 二.KVM虚拟化平台构建 三.创建虚拟机并安装CentOS7 一.KVM简介 KVM(名称来自英语:Kernel-basedVirtual Machine的缩写, ...

  3. linux终端上网,ubuntu中上网-如何使用ubuntu下用命令行上网?ubuntu下用命令行上网, 爱问知识人...

    2013-08-01 09:07:16 用于基本接口与IP配置的ifconfig ifconfig工具(interface configurator,接口配置器)提供了一些非常基本但是非常重要的功能. ...

  4. linux运行java程序引用jar包,ubuntu下java 命令行引用jar包的方法

    推荐文章 Ubuntu常用快捷键总结 桌面常用快捷键 Alt + F1:聚焦到桌面左侧任务导航栏,可按上下键进行导航 Alt + F2:运行命令 Alt + F4:关闭当前窗口 Alt + Tab:切 ...

  5. linux kvm 命令行安装Windows xp虚拟机

    古老的操作系统Windowsxp还是比较香的,有一些单机游戏或者其它比较旧的软件还是需要Windowsxp的,那么,使用kvm安装一个Windowsxp是一个不错的主意了. 一,实验目标 通过linu ...

  6. Ubuntu下用命令行快速打开各类型文件

    博客原文地址:http://blog.chinaunix.net/uid-9112803-id-1876985.html 摘要:     在Ubuntu下,当需要打开其他格式文件时,咱们通常做法是进入 ...

  7. ubuntu下使用命令行调用USB热敏票据打印机

    Linux下通过USB端口进行打印票据或者其它打印,某些时候我们需要检测打印机是否正常工作,在没有安装驱动程序的情况下,我们也可以通过命令行执行打印操作,如果命令行可以正常打印,表明打印机和Linux ...

  8. ubuntu20.04 server 无图形命令行安装

    ubuntu20.04 server 安装 1.网络配置 1.1网络管理工具 netplan 在 Ubuntu20.04 版本中使用 netplan 管理网络 在安装好的 Ubuntu20.04 中没 ...

  9. 在Ubuntu上通过命令行安装Elisa KDE音乐播放器

    2019独角兽企业重金招聘Python工程师标准>>> 我们已经测试了不同的Linux音乐播放器,以创建最佳列表. 而Elisa也属于开源类别的优秀音乐播放器,以及良好的界面和Pla ...

最新文章

  1. lnmp环境搭建:Centos7 + Nginx1.12.2 + Mysql-5.6.38 + PHP7.2.0
  2. 前端学习(2768):上拉加载
  3. 快速配置 Samba 将 Linux 目录映射为 Windows 驱动器
  4. 16.1117 NOIP 模拟赛
  5. 51Nod 1445 变色DNA
  6. CSS默认可继承样式
  7. h2 mysql mode_H2 数据库快速入门
  8. jquery快速入门(二)
  9. table 条数过大优化_MySQL数据库优化的介绍(图文)
  10. 七月算法机器学习1 相关数学基础
  11. [学习]啦啦外卖定位修复,商家经纬度保存修复
  12. 用 windows 资源监视器 查看 被占用的文件
  13. 笔记本电脑耳机插入后声音还是外放的解决办法
  14. 定时任务task:annotation-driven配置
  15. 软件工程师日语词汇表
  16. excel入门,如何玩转excel,你早该这么玩Excel笔记12
  17. 【大学生数学建模竞赛时间一览表】
  18. 根据先序遍历建立一个二叉树
  19. springmvc集成shiro后,session、request姓汪还是姓蒋 ?
  20. CodeForces - 581B - Luxurious Houses 逆序处理水

热门文章

  1. 宝来客分享怎样才能让每一位导购主动成为金店的增长发动机
  2. 天天酷跑神兽年年怎么搭配比较好 怎么得高分
  3. dropzone.js php,dropzone-js
  4. 计算机辅助药物设计的相关论文,中国药科大学计算机辅助药物设计(CADD)整理.doc...
  5. hive中order by详解
  6. 一文教你如何用JS代码来操作元素拖拽移动的效果
  7. vim配置python命令自动补全
  8. Q_D指针(d指针)和Q_Q指针(q指针)简介
  9. c 语言如何打开d盘文件夹,如何通过cmd命令符进入d盘以及c盘?介绍详情进入教程...
  10. 我用奔跑告诉你、不回头……