About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
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
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 version | cloud-init version | VPC image |
|---|---|---|
| 8.8 | 22.1-8.el8_8.1 | ibm-redhat-8-8-minimal-amd64-9 |
| 8.10 | 23.4-7.el8_10.8 | ibm-redhat-8-10-minimal-amd64-4 |
| 9.2 | 22.1-10.el9_2 | ibm-redhat-9-2-minimal-amd64-8 |
| 9.4 | 23.4-7.el9_4.11 | ibm-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
First, verify if your RHEL instance is not subscribed by running:
subscription-manager statusIf the system is not subscribed, you’ll see something like this:
+-------------------------------------------+ System Status Details +-------------------------------------------+ Overall Status: Unknown \ Checking server statusCommon reasons for subscription failure
No network connectivity to the Red Hat subscription endpoint.
A forced re-registration using
subscription-manager register --forcethat didn’t complete properly.
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=8443Example (EU region)
Hostnames:
rhha01.updates.eu-es.iaas.service.networklayer.com,rhha02.updates.eu-es.iaas.service.networklayer.comPort:
8443
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.
To retry the subscription, restart the
cloud-initprocess with these commands:cloud-init clean rebootThis will re-run the
cloud-initscripts that handle RHEL subscription.How it works
The subscription happens through a script located at:
/var/lib/cloud/instance/scripts/vendor/part-004This script is triggered by the
scripts-vendormodule incloud-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.
Use a custom VPC image.
Subscription and license activation are handled by you, not IBM.
Learn more at BYOL for Linux on IBM Cloud
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-initvolume 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-dataThis 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:
| Step | Description | Handled by |
|---|---|---|
| 1 | Virtual Server Instance (VSI) starts | IBM |
| 2 | cloud-init service starts |
RHEL |
| 3 | DataSourceNoCloud is selected |
cloud-init |
| 4 | Cloud-init volume is mounted | cloud-init |
| 5 | /var/lib/cloud/instance/ folder is created from volume files |
cloud-init |
| 6 | Init, config, and final modules are executed | cloud-init |
| 7 | scripts-vendor module is executed |
cloud-init |
| 8 | part-004 script runs the subscription registration |
RHEL |
| 9 | Subscription settings updated in rhsm.conf and Red Hat repos are set up |
subscription-manager |
| 10 | Red Hat repositories file redhat.repo is generated |
subscription-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
How is the cloud-init volume identified?
The cloud-init volume is identified by the label
cidata.Run this command:
lsblk -f | grep cidataExample output:
/dev/vdc: LABEL="cidata" TYPE="iso9660"For more details, see the cloud-init GitHub repository.
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"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-004Method 2:
You can also use the
subscription-managercommand. First, get the necessary values from thepart-004file: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" --forceHow to check the
cloud-initdatasource?You can use either of these commands:
cloud-init status --longor
cat /var/lib/cloud/instance/datasourceExpected output:
DataSourceNoCloud: DataSourceNoCloud [seed=/dev/vdb][dsmode=net]Who mounts the
cloud-initvolume?The
DataSourceNoCloud.pyfile in the cloud-init GitHub repository is responsible for mounting thecloud-initvolume.How to unregister your RHEL OS?
Run the following command:
subscription-manager unregister