RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1345813 - virt-sysprep --install always failed to install the packages specified
Summary: virt-sysprep --install always failed to install the packages specified
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-13 08:58 UTC by Xianghua Chen
Modified: 2016-11-03 18:01 UTC (History)
4 users (show)

Fixed In Version: libguestfs-1.32.5-4.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:01:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
log.virt-sysprep (133.62 KB, text/plain)
2016-06-13 08:58 UTC, Xianghua Chen
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2576 0 normal SHIPPED_LIVE Moderate: libguestfs and virt-p2v security, bug fix, and enhancement update 2016-11-03 12:06:51 UTC

Description Xianghua Chen 2016-06-13 08:58:41 UTC
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

Comment 1 Richard W.M. Jones 2016-06-13 09:45:58 UTC
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.

Comment 2 Richard W.M. Jones 2016-06-13 10:23:41 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2016-June/msg00056.html

Comment 3 Moymee 2016-06-14 05:35:30 UTC
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

Comment 5 Xianghua Chen 2016-06-28 05:17:54 UTC
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.

Comment 6 Richard W.M. Jones 2016-06-28 07:50:03 UTC
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.

Comment 7 Xianghua Chen 2016-06-29 08:49:33 UTC
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.

Comment 9 errata-xmlrpc 2016-11-03 18:01:43 UTC
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


Note You need to log in before you can comment on or make changes to this bug.