报错信息:
[root@monitor log]# virt-sysprep -d centos6-raw40 [ 0.0] Examining the guest ... virt-sysprep: error: libguestfs error: qemu-img: /tmp/libguestfs6olf8r/overlay1: qemu-img exited with error status 1. To see full error messages you may need to enable debugging. See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs If reporting bugs, run virt-sysprep with debugging enabled and include the complete output: virt-sysprep -v -x [...]
因为virt-sysprep命令是libguestfs-tools工具下命令的一个,所以先查看了libguestfs-tools的版本:
[root@monitor qemu]# rpm -qa|grep libguestfs-tools libguestfs-tools-1.28.1-1.55.el7.centos.4.noarch libguestfs-tools-c-1.28.1-1.55.el7.centos.4.x86_64
发现版本是libguestfs-tools-1.28.1-1.55。而另外一台执行virt-sysprep -d可以成功的。所以看一下另外一台的libguestfs-tools版本:
[root@zabbix ~]# virt-sysprep -V virt-sysprep 1.36.3rhel=7,release=6.el7_4.3,libvirt [root@zabbix ~]# rpm -qa|grep libguestfs-tools libguestfs-tools-1.36.3-6.el7_4.3.noarch libguestfs-tools-c-1.36.3-6.el7_4.3.x86_64
发现版本是libguestfs-tools-1.36.3,于是就升级libguestfs-tools。
[root@monitor qemu]# yum upgrade libguestfs-tools
此时发现版本为:libguestfs-tools-1.36.3
[root@monitor qemu]# virt-sysprep -V virt-sysprep 1.36.3rhel=7,release=6.el7_4.3,libvirt
最后清理信息成功:
[root@monitor qemu]# virt-sysprep -d centos6.5 [ 0.0] Examining the guest ... [ 53.5] Performing "abrt-data" ... [ 53.5] Performing "backup-files" ... [ 54.5] Performing "bash-history" ... [ 54.6] Performing "blkid-tab" ... [ 54.6] Performing "crash-data" ... [ 54.6] Performing "cron-spool" ... [ 54.6] Performing "dhcp-client-state" ... [ 54.6] Performing "dhcp-server-state" ... [ 54.6] Performing "dovecot-data" ... [ 54.6] Performing "logfiles" ... [ 54.6] Performing "machine-id" ... [ 54.6] Performing "mail-spool" ... [ 54.6] Performing "net-hostname" ... [ 54.6] Performing "net-hwaddr" ... [ 54.6] Performing "pacct-log" ... [ 54.6] Performing "package-manager-cache" ... [ 54.6] Performing "pam-data" ... [ 54.6] Performing "passwd-backups" ... [ 54.6] Performing "puppet-data-log" ... [ 54.6] Performing "rh-subscription-manager" ... [ 54.6] Performing "rhn-systemid" ... [ 54.6] Performing "rpm-db" ... [ 54.6] Performing "samba-db-log" ... [ 54.6] Performing "script" ... [ 54.6] Performing "smolt-uuid" ... [ 54.6] Performing "ssh-hostkeys" ... [ 54.6] Performing "ssh-userdir" ... [ 54.6] Performing "sssd-db-log" ... [ 54.6] Performing "tmp-files" ... [ 54.7] Performing "udev-persistent-net" ... [ 54.7] Performing "utmp" ... [ 54.7] Performing "yum-uuid" ... [ 54.7] Performing "customize" ... [ 54.7] Setting a random seed [ 54.7] Performing "lvm-uuids" ...