This is a cache of https://developer.ibm.com/tutorials/awb-troubleshoot-rhel-subscription-issues/. It is a snapshot of the page as it appeared on 2025-11-16T02:40:24.410+0000.
Subscribing RHEL on IBM Cloud after provisioning issues - IBM Developer

Tutorial

Subscribing RHEL on IBM Cloud after provisioning issues

Learn how to resolve RHEL subscription failures during first boot on IBM Cloud using cloud-init

By

Jorge Hernández Ramírez,

Francisco Javier Ramos Muñoz,

Krzysztof Rafalski,

Daniel Alejandro Alvarez Colina

This tutorial demonstrates how to subscribe a RHEL instance on IBM Cloud when the initial subscription fails during the first boot, often due to network issues. We’ll walk through how to fix this problem and also cover the different subscription options available, along with how cloud-init helps automate the process.

Test environment

This procedure has been tested on the following RHEL versions and images on IBM Cloud:

RHEL versioncloud-init versionVPC image
8.822.1-8.el8_8.1ibm-redhat-8-8-minimal-amd64-9
8.1023.4-7.el8_10.8ibm-redhat-8-10-minimal-amd64-4
9.222.1-10.el9_2ibm-redhat-9-2-minimal-amd64-8
9.423.4-7.el9_4.11ibm-redhat-9-4-minimal-amd64-7

VSI profile used: cx3d-2x5

Important Note: IBM may update the subscription process or cloud-init configuration in the future. If this procedure no longer works, please reach out to IBM Cloud Support for help.

Resubscribe RHEL on IBM Cloud after provisioning failure

  1. First, verify if your RHEL instance is not subscribed by running:

    subscription-manager status

    If the system is not subscribed, you’ll see something like this:

    +-------------------------------------------+
        System Status Details
     +-------------------------------------------+
     Overall Status: Unknown
    
     \ Checking server status

    Common reasons for subscription failure

    • No network connectivity to the Red Hat subscription endpoint.

    • A forced re-registration using subscription-manager register --force that didn’t complete properly.

  2. Run the following command to get the subscription server hostname and port:

    export RHEL_SUBSCRIPTION_HOSTNAME=$(cat /var/lib/cloud/instance/scripts/vendor/part-004 | grep -E "^REDHAT_CAPSULE_SERVER" | cut -d'=' -f 2 | sed 's/"//g')
     export RHEL_SUBSCRIPTION_PORT=8443

    Example (EU region)

    • Hostnames: rhha01.updates.eu-es.iaas.service.networklayer.com, rhha02.updates.eu-es.iaas.service.networklayer.com

    • Port: 8443

  3. Use the following command to test if your instance can reach the subscription server:

    You should see an output like:

    * Trying 161.26.216.24:8443...
     * Connected to rhha02.updates.eu-es.iaas.service.networklayer.com (161.26.216.24) port 8443 (#0)

    If not, check your security groups and subnet ACLs to make sure traffic is allowed to the host and port.

  4. To retry the subscription, restart the cloud-init process with these commands:

    cloud-init clean
     reboot

    This will re-run the cloud-init scripts that handle RHEL subscription.

    How it works

    The subscription happens through a script located at:

    /var/lib/cloud/instance/scripts/vendor/part-004

    This script is triggered by the scripts-vendor module in cloud-init, which runs during the first boot. If you restart cloud-init, it will attempt the subscription again using the data provided by IBM Cloud in the cloud-init volume.

    For reference, see the cloud-init GitHub repository.

RHEL subscription options on IBM Cloud

There are two main subscription models for RHEL on IBM Cloud:

  • Bring Your Own License (BYOL)

    In this model, you use your own Red Hat subscription. It’s ideal if your organization already has a Red Hat contract and wants to manage licenses centrally.

  • IBM-managed subscription

    This model applies when you use official RHEL images from the IBM Cloud catalog.

    • The system is automatically registered during provisioning using cloud-init.

    • IBM provides a cloud-init volume containing all subscription details (activation key, org info, and a few other details).

      To inspect this data, run:

      mkdir /mnt/cloud-init
      mount /dev/$(lsblk -f | grep cidata | awk '{print $1}') /mnt/cloud-init
      cat /mnt/cloud-init/vendor-data

      This file includes the subscription configuration used during the instance setup.

How RHEL subscription works with cloud-init

Here's a step-by-step overview of how the RHEL subscription is handled during instance provisioning:

StepDescriptionHandled by
1Virtual Server Instance (VSI) startsIBM
2cloud-init service startsRHEL
3DataSourceNoCloud is selectedcloud-init
4Cloud-init volume is mountedcloud-init
5/var/lib/cloud/instance/ folder is created from volume filescloud-init
6Init, config, and final modules are executedcloud-init
7scripts-vendor module is executedcloud-init
8part-004 script runs the subscription registrationRHEL
9Subscription settings updated in rhsm.conf and Red Hat repos are set upsubscription-manager
10Red Hat repositories file redhat.repo is generatedsubscription-manager

This process is triggered automatically during the first boot using the data provided by IBM Cloud.

Summary

This tutorial shows how to subscribe a RHEL instance on IBM Cloud if the initial attempt fails during the first boot, usually due to network issues. It also explains the different subscription models and how cloud-init helps automate the process.

FAQs

  1. How is the cloud-init volume identified?

    The cloud-init volume is identified by the label cidata.

    Run this command:

    lsblk -f | grep cidata

    Example output:

    /dev/vdc: LABEL="cidata" TYPE="iso9660"

    For more details, see the cloud-init GitHub repository.

  2. How to subscribe your RHEL OS using rh_subscription in user data?

    You can use the rh_subscription section in your cloud-init user data to register the OS.

    Note: This is not recommended if you're using an IBM-managed Subscription.

    Example:

    rh_subscription:
             rhsm-baseurl: "rhsm-baseurl"
             server-hostname: "server-hostname"
             add-pool: "add-pool"
             activation-key: "activation-key"
             org: "org"
             auto-attach: true
             enable-repo:
               - "rhel-9-for-x86_64-baseos-rpms"
               - "rhel-9-for-x86_64-appstream-rpms"
             service-level: "standard"
  3. How to manually register your RHEL OS?

    Note: This is not recommended if you're using an IBM-managed Subscription.

    Method 1:

    Run the following command:

    source /var/lib/cloud/instance/scripts/vendor/part-004

    Method 2:

    You can also use the subscription-manager command. First, get the necessary values from the part-004 file:

    OS_REDHAT_ORG_NAME=$(grep -E "^OS_REDHAT_ORG_NAME" /var/lib/cloud/instance/scripts/vendor/part-004 | cut -d'=' -f 2 | sed 's/"//g')
     ACTIVATION_KEYS=$(grep -E "^ACTIVATION_KEYS" /var/lib/cloud/instance/scripts/vendor/part-004 | awk -F'ACTIVATION_KEYS=' '{print $2}' | sed 's/"//g')
     PROFILENAME=$(grep -E "^PROFILENAME" /var/lib/cloud/instance/scripts/vendor/part-004 | cut -d'=' -f 2 | sed 's/"//g')
     REDHAT_CAPSULE_SERVER=$(grep -E "^REDHAT_CAPSULE_SERVER" /var/lib/cloud/instance/scripts/vendor/part-004 | cut -d'=' -f 2 | sed 's/"//g')

    Then, run the following command to register:

    sudo subscription-manager register --org="${OS_REDHAT_ORG_NAME}" --activationkey="${ACTIVATION_KEYS}" --name="${PROFILENAME}" --baseurl="https://${REDHAT_CAPSULE_SERVER}/pulp/repos" --force
  4. How to check the cloud-init datasource?

    You can use either of these commands:

    cloud-init status --long

    or

    cat /var/lib/cloud/instance/datasource

    Expected output:

    DataSourceNoCloud: DataSourceNoCloud [seed=/dev/vdb][dsmode=net]
  5. Who mounts the cloud-init volume?

    The DataSourceNoCloud.py file in the cloud-init GitHub repository is responsible for mounting the cloud-init volume.

  6. How to unregister your RHEL OS?

    Run the following command:

    subscription-manager unregister

References