「KVM」- Virt-Manager

  CREATED BY JENKINSBOT

问题描述

Virt-Manager 是个 GUI 程序,基于 libvirtd 服务来管理 KVM 虚拟机。

该笔记将记录:在 Linux 中,安装及使用 Virt-Manager 程序,以及常见问题处理。

解决方案

官方站点:Virtual Machine Manager Home
仓库地址:virt-manager/virt-manager: Desktop tool for managing virtual machines via libvirt

安装最新版本(v3.2.0)

Debian GNU/Linux 10 (buster)

# 安装依赖
# gettext >= 0.19.6
# python >= 3.4
# gtk3 >= 3.22
# libvirt-python >= 0.6.0
# pygobject3 >= 3.22
# libosinfo >= 0.2.10
# gtksourceview >= 3


# 安装 Virt Manager 工具
git clone https://github.com/virt-manager/virt-manager.git
cd virt-manager
git checkout v3.2.0 -b v3.2.0 

virtinst/build.cfg # prefix = /usr/local

./setup.py install --reocrd install.logs

# virtinst/build.cfg:默认会安装到 /usr 目录下,但它会安装某些模块(这会修改系统的原有模块),所以我们修改安装目录
# --reocrd install.logs:记录安装文件,将来在卸载时使用;

on macOS Big Sur 11.2.3(失败)

参考 GitHub – jeffreywildman/homebrew-virt-manager 仓库

我们遇到 Given no hashes to check 131 links for project ‘pip’: discarding no candidates · Issue #142 问题,简单折腾之后,并未解决,所以我们不弄了(毕竟是开会划水,想安装试试,不行就算了)。

常见问题汇总

客户端不断地提示输入 SSH 密码

Virt-Manager to Remote host – continuous password prompt over ssh
ubuntu – (KVM) virt-manager stuck in password prompt after open VM – Server Fault

问题描述:
打开远程连接中的虚拟机时,**不断的**提示输入 SSH 密码

原因分析:
虚拟机的 Display 使用 Spice server,而其近支持本地连接

解决方案:
1)方法一:Menubar => View => Details => Display Spice/Display VNC => Address: All interfaces
2)方法二:将 SSH 公钥复制到主机,即实现免密登录(参考 OpenSSH/Distributing SSH keys 笔记)

Unable to complete install: xxx Could not open ‘/path/to/iso’: Permission denied

问题描述:
在创建虚拟机后,当启动时产生如下错误:

Unable to complete install: 'internal error: process exited while connecting to monitor: 2020-04-07T00:42:54.883472Z qemu-system-x86_64: -drive file=/path/to/Microsoft Windows 2000 [Professional + Server + Advanced Server + Datacenter Server] SP4.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on: Could not open '/path/to/Microsoft Windows 2000 [Professional + Server + Advanced Server + Datacenter Server] SP4.iso': Permission denied'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 2119, in _do_async_install
    guest.installer_instance.start_install(guest, meter=meter)
  File "/usr/share/virt-manager/virtinst/installer.py", line 419, in start_install
    doboot, transient)
  File "/usr/share/virt-manager/virtinst/installer.py", line 362, in _create_guest
    domain = self.conn.createXML(install_xml or final_xml, 0)
  File "/usr/lib/python3/dist-packages/libvirt.py", line 3732, in createXML
    if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirt.libvirtError: internal error: process exited while connecting to monitor: 2020-04-07T00:42:54.883472Z qemu-system-x86_64: -drive file=/path/to/Microsoft Windows 2000 [Professional + Server + Advanced Server + Datacenter Server] SP4.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on: Could not open '/path/to/Microsoft Windows 2000 [Professional + Server + Advanced Server + Datacenter Server] SP4.iso': Permission denied

原因分析:
镜像文件名 Microsoft Windows 2000 [Professional + Server + Advanced Server + Datacenter Server] SP4.iso 包含特殊字符。

解决方案:
重命名文件,去掉在文件名中的特殊字符。

参考文献

Virtual Machine Manager Home
virt-manager/INSTALL.md at v3.2.0 · virt-manager/virt-manager
macos – Is there a virt-manager alternative for Mac OS X? – Stack Overflow