Press "Enter" to skip to content

Fix ‘libguestfs launch fail’

在小破本Thinkpad X200s升级为X201s之后,我将其重新安装了Ubuntu 16.04.3 LTS版本并将其升级到最新版本。在兴冲冲搭建完成KVM虚拟化环境之后,并成功完成Centos7和Ubuntu虚拟机的样本之后,我打算对其副本进行sysprep操作的时候,提示’export LIBGUESTFS_TRACE=1 LIBGUESTFS_DEBUG=1’,无法进行操作。
进行了libguest-test-tool进行了检查操作之后,系统提示‘libguestfs launch fail’错误。在排除了网上列出的库文件错误、版本bug和supermin配置文件错误之后,我把怀疑方向转向了内核,原因是有内核风暴的错误出现。
首先,安装了linux-generic-hwe-16.04-edge这个服务器内核,然后问题依旧。
然后,把hwe内核和最后升级得来的4.13版本内核卸载并重启之后,问题解决。

$ sudo virt-sysprep -d centos7
[   0.0] Examining the guest ...
[   6.9] Performing "abrt-data" ...
[   6.9] Performing "bash-history" ...
[   7.0] Performing "blkid-tab" ...
[   7.0] Performing "crash-data" ...
[   7.0] Performing "cron-spool" ...
[   7.0] Performing "dhcp-client-state" ...
[   7.0] Performing "dhcp-server-state" ...
[   7.0] Performing "dovecot-data" ...
[   7.0] Performing "logfiles" ...
[   7.1] Performing "machine-id" ...
[   7.1] Performing "mail-spool" ...
[   7.1] Performing "net-hostname" ...
[   7.1] Performing "net-hwaddr" ...
[   7.1] Performing "pacct-log" ...
[   7.1] Performing "package-manager-cache" ...
[   7.1] Performing "pam-data" ...
[   7.1] Performing "puppet-data-log" ...
[   7.1] Performing "rh-subscription-manager" ...
[   7.1] Performing "rhn-systemid" ...
[   7.1] Performing "rpm-db" ...
[   7.1] Performing "samba-db-log" ...
[   7.1] Performing "script" ...
[   7.1] Performing "smolt-uuid" ...
[   7.1] Performing "ssh-hostkeys" ...
[   7.1] Performing "ssh-userdir" ...
[   7.1] Performing "sssd-db-log" ...
[   7.1] Performing "tmp-files" ...
[   7.1] Performing "udev-persistent-net" ...
[   7.1] Performing "utmp" ...
[   7.1] Performing "yum-uuid" ...
[   7.1] Performing "customize" ...
[   7.1] Setting a random seed
[   7.2] Performing "lvm-uuids" ...

虚拟机的mac地址也得到更新,避免了删除网卡再新重建网卡的麻烦。
macdiff
最后,使用apt-mark来保留旧内核以解决使用apt upgrade会升级内核的问题。

$ sudo apt-mark hold linux-image-4.10.0-28-generic
linux-image-4.10.0-28-generic 设置为保留。
$ sudo apt-mark hold linux-image-extra-4.10.0-28-generic
linux-image-extra-4.10.0-28-generic 设置为保留。