bento icon indicating copy to clipboard operation
bento copied to clipboard

Cleanup.sh fails with RHEL7.5

Open jshimkus-rh opened this issue 7 years ago • 6 comments

https://github.com/chef/bento/blob/f72f0d1e6e2fe108d9b11e70a26e3510993f8ffa/centos/scripts/cleanup.sh#L62

Creating a new REHL7.5 vagrant box using the defaults results in a failure at the cleanup stage.

    virtualbox-iso: + yum install -y yum-utils
    virtualbox-iso: Loaded plugins: product-id, search-disabled-repos, subscription-manager
    virtualbox-iso: This system is not registered with an entitlement server. You can use subscription-manager to register.
    virtualbox-iso: There are no enabled repos.
    virtualbox-iso:  Run "yum repolist all" to see the repos you have.
    virtualbox-iso:  To enable Red Hat Subscription Management repositories:
    virtualbox-iso:      subscription-manager repos --enable <repo>
    virtualbox-iso:  To enable custom repositories:
    virtualbox-iso:      yum-config-manager --enable <repo>
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 1

This is not unique to virtualbox; it happens with qemu as well.

jshimkus-rh avatar Aug 02 '18 14:08 jshimkus-rh

The catch with RHEL is that you need subscription manager for anything useful so the templates are provided as reference but almost definitely need some tweaking to work properly. We don't build these as it's somewhat useless to have a RHEL box without subscription manager enabled. There is probably some work that can be done to make this a bit easier but given the difficulty in hosting these (legally) we haven't spent much time on it.

cheeseplus avatar Aug 02 '18 15:08 cheeseplus

I think we might be able to work around this one with something like

https://github.com/lavabit/robox/blob/master/scripts/rhel7/yum.sh#L8-L11

cheeseplus avatar Aug 03 '18 13:08 cheeseplus

Considering that this is just a clean up step, maybe something similar to https://github.com/chef/bento/blob/f72f0d1e6e2fe108d9b11e70a26e3510993f8ffa/centos/scripts/cleanup.sh#L9 will work?

outcoldman avatar Sep 03 '18 19:09 outcoldman

What about adding yum-utils to centos/7/ks.cfg? Isn't this where it really belongs if it's expected to be installed and ran every time in cleanup.sh?

externl avatar Dec 18 '18 21:12 externl

The problem isn't yum-utils as such, it's that there aren't any enabled repos because the scripts punt on adding an entitlement server. This might be avoided with https://github.com/chef/bento/issues/1093#issuecomment-410257449

cheeseplus avatar Dec 19 '18 18:12 cheeseplus

Repos aren't available to yum, but anything specified in the kickstart file is installed just fine. Adding yum-utils to 7/ks.cfg and 6/ks.cfg, and removing that line from cleanup.sh resolved this for me, and doesn't seem to affect CentOS builds. This allows you to continue to punt to the final deployment of the box.

I am using the Bento packer templates (and a small script to modify the JSON files in a consistent way) to build non-Vagrant VM templates in a consistent manner for testing. We do have an internal RHUI server that they can be hooked up to if necessary once the test environment is deployed. That is, there are uses! :-)

howardjones avatar Feb 16 '19 11:02 howardjones

Latest build of centos 7.9 is currently working with the cleanup.sh scripts. I assume this will work with rhel 7.9 then. Please feel free to open a new issue or reopen this one if needed.

Stromweld avatar Jan 20 '23 00:01 Stromweld