Red Hat Bugzilla – Bug 1345813
virt-sysprep --install always failed to install the packages specified
Last modified: 2016-11-03 14:01:43 EDT
Created attachment 1167303 [details] log.virt-sysprep Description of problem: virt-sysprep --install always failed to install the packages specified. You can see the full log with -v -x in the attachment: log.virt-sysprep Version-Release number of selected component (if applicable): libguestfs-1.32.5-3.el7.x86_64 How reproducible: Always Steps to Reproduce: 1. Prepare an rhel7 image: RHEL-Server-7.2-64-hvm.raw 2. Use virt-sysprep --install to install package: # virt-sysprep -a RHEL-Server-7.2-64-hvm.raw --install pki-base [ 0.0] Examining the guest ... [ 3.6] Performing "abrt-data" ... [ 3.6] Performing "bash-history" ... [ 3.6] Performing "blkid-tab" ... [ 3.6] Performing "crash-data" ... [ 3.6] Performing "cron-spool" ... [ 3.6] Performing "dhcp-client-state" ... [ 3.6] Performing "dhcp-server-state" ... [ 3.6] Performing "dovecot-data" ... [ 3.6] Performing "logfiles" ... [ 3.6] Performing "machine-id" ... [ 3.6] Performing "mail-spool" ... [ 3.6] Performing "net-hostname" ... [ 3.7] Performing "net-hwaddr" ... [ 3.7] Performing "pacct-log" ... [ 3.7] Performing "package-manager-cache" ... [ 3.7] Performing "pam-data" ... [ 3.7] Performing "puppet-data-log" ... [ 3.7] Performing "rh-subscription-manager" ... [ 3.7] Performing "rhn-systemid" ... [ 3.7] Performing "rpm-db" ... [ 3.7] Performing "samba-db-log" ... [ 3.7] Performing "script" ... [ 3.7] Performing "smolt-uuid" ... [ 3.7] Performing "ssh-hostkeys" ... [ 3.7] Performing "ssh-userdir" ... [ 3.7] Performing "sssd-db-log" ... [ 3.7] Performing "tmp-files" ... [ 3.7] Performing "udev-persistent-net" ... [ 3.7] Performing "utmp" ... [ 3.7] Performing "yum-uuid" ... [ 3.7] Performing "customize" ... [ 3.7] Setting a random seed [ 3.7] Installing packages: pki-base Loaded plugins: langpacks, product-id, search-disabled-repos, subscription- : manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. http://download.eng.pek2.redhat.com/pub/rhel/rel-eng/latest-RHEL-7/compose/Server/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: download.eng.pek2.redhat.com; Unknown error" Trying other mirror. One of the configured repositories failed (rhel7.2), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Disable the repository, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable rhel7 4. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=rhel7.skip_if_unavailable=true failure: repodata/repomd.xml from rhel7: [Errno 256] No more mirrors to try. http://download.eng.pek2.redhat.com/pub/rhel/rel-eng/latest-RHEL-7/compose/Server/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: download.eng.pek2.redhat.com; Unknown error" virt-sysprep: error: yum -y install 'pki-base': command exited with an error If reporting bugs, run virt-sysprep with debugging enabled and include the complete output: virt-sysprep -v -x [...] Actual results: It failed with above errors. Expected results: It should executed successfully and install the package correctly. Additional info: I use virt-customize to install the package in the same guest, it can be installed successfully. # virt-customize -a RHEL-Server-7.2-64-hvm.raw --install pki-base [ 0.0] Examining the guest ... [ 4.0] Setting a random seed [ 4.0] Installing packages: pki-base [ 5.2] Finishing off # guestfish -a RHEL-Server-7.2-64-hvm.raw -i sh 'rpm -qa | grep pki-base' pki-base-10.2.5-6.el7.noarch # virt-cat -a RHEL-Server-7.2-64-hvm.raw /etc/yum.repos.d/rhel7.repo [rhel7] name=rhel7.2 baseurl = http://download.eng.pek2.redhat.com/pub/rhel/rel-eng/latest-RHEL-7/compose/Server/x86_64/os/ enabled=1 gpgcheck=0
virt-sysprep isn't calling guestfs_set_network (g, true), so there is no network access. Should be a simple fix, looking at it now.
Patch posted: https://www.redhat.com/archives/libguestfs/2016-June/msg00056.html
Hello out there I'm kind of new to these as to I am seeking to get better results to this. So here goes nothing. Moe
Tested with the packages: libguestfs-1.32.5-6.el7.x86_64 Steps: 1. Prepare an rhel7 image: RHEL-Server-7.2-64-hvm.raw 2. Use virt-sysprep --install to install package: ----------------------------------------------------------- # virt-sysprep -a RHEL-Server-7.2-64-hvm.raw --install pki-base [ 0.0] Examining the guest ... [ 3.2] Performing "abrt-data" ... [ 3.2] Performing "bash-history" ... [ 3.2] Performing "blkid-tab" ... [ 3.2] Performing "crash-data" ... [ 3.2] Performing "cron-spool" ... [ 3.2] Performing "dhcp-client-state" ... [ 3.2] Performing "dhcp-server-state" ... [ 3.2] Performing "dovecot-data" ... [ 3.2] Performing "logfiles" ... [ 3.2] Performing "machine-id" ... [ 3.2] Performing "mail-spool" ... [ 3.2] Performing "net-hostname" ... [ 3.2] Performing "net-hwaddr" ... [ 3.2] Performing "pacct-log" ... [ 3.2] Performing "package-manager-cache" ... [ 3.2] Performing "pam-data" ... [ 3.2] Performing "puppet-data-log" ... [ 3.2] Performing "rh-subscription-manager" ... [ 3.2] Performing "rhn-systemid" ... [ 3.2] Performing "rpm-db" ... [ 3.2] Performing "samba-db-log" ... [ 3.2] Performing "script" ... [ 3.2] Performing "smolt-uuid" ... [ 3.2] Performing "ssh-hostkeys" ... [ 3.2] Performing "ssh-userdir" ... [ 3.2] Performing "sssd-db-log" ... [ 3.2] Performing "tmp-files" ... [ 3.2] Performing "udev-persistent-net" ... [ 3.2] Performing "utmp" ... [ 3.2] Performing "yum-uuid" ... [ 3.2] Performing "customize" ... [ 3.2] Setting a random seed [ 3.2] Installing packages: pki-base Loaded plugins: langpacks, product-id, search-disabled-repos, subscription- : manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. http://download.englab.nay.redhat.com/pub/rhel/rel-eng/latest-RHEL-7/compose/Server/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: download.englab.nay.redhat.com; Unknown error" Trying other mirror. One of the configured repositories failed (rhel7.2), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Disable the repository, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable rhel7 4. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=rhel7.skip_if_unavailable=true failure: repodata/repomd.xml from rhel7: [Errno 256] No more mirrors to try. http://download.englab.nay.redhat.com/pub/rhel/rel-eng/latest-RHEL-7/compose/Server/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: download.englab.nay.redhat.com; Unknown error" virt-sysprep: warning: the command may have failed because the network is disabled. Try either removing '--no-network' or adding '--network' on the command line. virt-sysprep: error: yum -y install 'pki-base': command exited with an error If reporting bugs, run virt-sysprep with debugging enabled and include the complete output: virt-sysprep -v -x [...] --------------------------------------------------- The error is still there.
You need to add the --network option, as described in the manual: --network --no-network Enable or disable network access from the guest during the installation. In virt-sysprep, the network is disabled by default. You must use --network to enable it, in order that options such as --install or --update will work. virt-builder(1) has more information about the security advantages of disabling the network.
Verified with the packages: libguestfs-1.32.5-6.el7.x86_64 Verify steps: 1. Prepare an rhel7 image: RHEL-Server-7.2-64-hvm.raw 2. Use virt-sysprep --install to install package: # virt-sysprep -a RHEL-Server-7.2-64-hvm.raw --install pki-base --network # guestfish -a RHEL-Server-7.2-64-hvm.raw -i sh 'rpm -qa |grep -i pki-base' pki-base-10.2.5-6.el7.noarch The commands finished successfully and there is pki-base package installed.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2576.html