Skip to content

Conversation

@natenasby
Copy link
Contributor

@natenasby natenasby commented Dec 22, 2025

Changed code in subscription_manager_unregister() to correctly unregister the RHEL subscription on both RHEL 9 and RHEL 10, removing a blocker for migrating from RHEL 10 -> AlmaLinux 10.

Tested on RHEL 9 and RHEL 10 VMs. Since the tool targets EL8/EL9 conversions per the documentation, I haven’t yet validated this on RHEL 8 but am happy to do so if you’d like.

Link to bug report

Changed code in subscription_manager_unregister() function to unregister RHEL subscription on both RHEL 9 and RHEL 10.
@yuravk
Copy link
Contributor

yuravk commented Jan 2, 2026

@natenasby

Thank you for reporting the issue. I can confirm it exists on RHEL 10, and it doesn't on RHEL 8 and 9.

@yuravk
Copy link
Contributor

yuravk commented Jan 2, 2026

My proposed changes to fix the issue look like:

diff --git a/almalinux-deploy.sh b/almalinux-deploy.sh
index 3f37bae..baf7476 100755
--- a/almalinux-deploy.sh
+++ b/almalinux-deploy.sh
@@ -1266,13 +1266,19 @@ disable_redhat_dnf_plugins() {
 }
 
 subscription_manager_unregister() {
+    local -r os_version="${1%%.*}"
     if get_status_of_stage "subscription_manager_unregister"; then
         return 0
     fi
     if subscription-manager status >/dev/null 2>&1; then
-        subscription-manager remove --all
+        if [[ "${os_version}" -lt "10" ]]; then
+            subscription-manager remove --all
+        fi
         subscription-manager unregister
         subscription-manager clean
+        test -e /etc/dnf/plugins/subscription-manager.conf && \
+            sed -i 's/^enabled=.*/enabled=0/' /etc/dnf/plugins/subscription-manager.conf || \
+            true
     fi
     report_step_done "Red Hat Subscription Manager deactivated"
     save_status_of_stage "subscription_manager_unregister"
@@ -1351,7 +1357,7 @@ main() {
         backup_issue
 
         if [[ "${os_type}" == "rhel" ]]; then
-            subscription_manager_unregister
+            subscription_manager_unregister "${os_version}"
             remove_redhat_rhsm_rpms
             remove_redhat_repo_files
         fi

@yuravk yuravk merged commit a30cb3f into AlmaLinux:master Jan 13, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants