kubernetes-sigs/image-builder

Unable to create RHEL-8 AMI

snehala27 opened this issue · 3 comments

What steps did you take and what happened:
Pulled latest master branch and installed all the pre-requisites.
Run make build-ami-rhel-8
The build gets stuck at:

    amazon-ebs.{{user `build_name`}}:
    amazon-ebs.{{user `build_name`}}: TASK [sysprep : Remove subscriptions] ******************************************
    amazon-ebs.{{user `build_name`}}: fatal: [default]: FAILED! => {"changed": false, "msg": "This system has no repositories available through subscriptions"}
    amazon-ebs.{{user `build_name`}}:
    amazon-ebs.{{user `build_name`}}: PLAY RECAP *********************************************************************
    amazon-ebs.{{user `build_name`}}: default                    : ok=60   changed=46   unreachable=0    failed=1    skipped=242  rescued=0    ignored=0
    amazon-ebs.{{user `build_name`}}:
==> amazon-ebs.{{user `build_name`}}: Provisioning step had errors: Running the cleanup provisioner, if present...
==> amazon-ebs.{{user `build_name`}}: Terminating the source AWS instance...
==> amazon-ebs.{{user `build_name`}}: Cleaning up any extra volumes...
==> amazon-ebs.{{user `build_name`}}: No volumes to clean up, skipping
==> amazon-ebs.{{user `build_name`}}: Deleting temporary security group...
Build 'amazon-ebs.{{user `build_name`}}' errored after 17 minutes 58 seconds: Error executing Ansible: Non-zero exit status: exit status 2

On commenting this particular role in https://github.com/kubernetes-sigs/image-builder/blob/master/images/capi/ansible/roles/sysprep/tasks/redhat.yml#L54

    - name: Remove subscriptions
      rhsm_repository:
        name: '*'
        state: absent

The build succeeds and AMI is created.On launching an instance from that AMI, unable to ssh into the machine(made sure that the port is open). I also tried to login the instance from EC2 serial console which requires login and password(Had provided the same in https://github.com/kubernetes-sigs/image-builder/blob/master/images/capi/packer/ami/rhel-8.json as ssh_password) but that also does not work.

What did you expect to happen:
The AMI should be generated and creating an instance with this AMI, it should be accessible

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]

Environment:

Project (Image Builder for Cluster API, kube-deploy/imagebuilder, konfigadm):

Additional info for Image Builder for Cluster API related issues:

  • OS (e.g. from /etc/os-release, or cmd /c ver):
  • Packer Version: v1.8.6
  • Packer Provider:
  • Ansible Version: 2.14.3
  • Cluster-api version (if using):
  • Kubernetes version: (use kubectl version):

/kind bug
[One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels]

@snehala27 I just ran the build and it seems to be building fine with out any issues

    rhel-8: TASK [sysprep : exclude the packages from upgrades] ****************************
    rhel-8: changed: [default]
    rhel-8:
    rhel-8: TASK [sysprep : enable repo mgmt with subscription-manager] ********************
    rhel-8: changed: [default]
    rhel-8:
    rhel-8: TASK [sysprep : Remove subscriptions] ******************************************
    rhel-8: changed: [default]
    rhel-8:
    rhel-8: TASK [sysprep : Unregister system] *********************************************
    rhel-8: changed: [default]
    rhel-8:
    rhel-8: TASK [sysprep : clean local subscription data] *********************************
    rhel-8:     "summary": {
    rhel-8:         "failed-count": 0,
    rhel-8:         "summary-line": "Count: 53, Failed: 0, Duration: 0.593s",
    rhel-8:         "test-count": 53,
    rhel-8:         "total-duration": 592579940
    rhel-8:     }
    rhel-8: }
==> rhel-8: Goss validate ran successfully
==> rhel-8:
==> rhel-8:
==> rhel-8:
==> rhel-8: Downloading spec file and debug info
    rhel-8: Downloading Goss specs from, /tmp/goss-spec.yaml and /tmp/debug-goss-spec.yaml to current dir
==> rhel-8: Stopping the source instance...
    rhel-8: Stopping instance
==> rhel-8: Waiting for the instance to stop...
==> rhel-8: Creating AMI capa-ami-rhel-8-v1.24.11-1680712933 from instance i-0cbd788e16cf173b9
    rhel-8: AMI: ami-04ea7a9d348ac488d
==> rhel-8: Waiting for AMI to become ready...

I'll check the login issue but my guess is you should be able to ssh into the vm with the ssh key you used to launch it with.

The AMI creation failing was because of expired RHEL subscription that I was using. AMI is generated successfully now. However unable to ssh into it. Will raise a separate issue for the same. Closing this issue.