Bug 2246833 - subscription-manager dnf plugin always assumes that the host system uses RHEL
Summary: subscription-manager dnf plugin always assumes that the host system uses RHEL
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: subscription-manager
Version: 39
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Chris Snyder
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-10-29 12:38 UTC by Zbigniew Jędrzejewski-Szmek
Modified: 2024-02-16 12:37 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-1100 0 None None None 2024-02-01 09:47:09 UTC

Description Zbigniew Jędrzejewski-Szmek 2023-10-29 12:38:56 UTC
Description of problem:
I'm using a Fedora box to build RHEL container and images (with mkosi, but this doesn't really matter). I use a developer subscription on the box. But the system tself is just Fedora and all the 'rhel-*' repositories are disabled.

subscription-manager dnf plugin emits the warning on every dnf operation:
  This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.

This doesn't cause problems, but is rather annoying. I think the warning could be conditionalized to only emit the warning if os-release indicates that the system is a RHEL system.

Version-Release number of selected component (if applicable):
subscription-manager-1.29.38-1.fc39.x86_64

How reproducible:
deterministic

Steps to Reproduce:
1. sudo dnf install subscription-manager 
2. sudo subscription-manager register ...
3. sudo dnf update

Actual results:
Updating Subscription Management repositories.
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
Last metadata expiration check: 0:06:17 ago on Sun Oct 29 13:30:32 2023.
...

Expected results:
The same but without the warning.

Comment 1 Debarshi Ray 2023-12-21 01:28:06 UTC
One short-term remedy could be to disable the DNF plugin shipped by subscription-manager by default through /etc/dnf/plugins/subscription-manager.conf

Comment 2 Debarshi Ray 2024-01-11 15:21:10 UTC
I found that some subscription-manager commands re-enable the plugin:

$ sudo subscription-manager list
[sudo] password for rishi: 
No installed products to list

WARNING

The yum/dnf plugins: /etc/dnf/plugins/subscription-manager.conf were automatically enabled for the benefit of Red Hat Subscription Management. If not desired, use "subscription-manager config --rhsm.auto_enable_yum_plugins=0" to block this behavior.

$ cat /etc/dnf/plugins/subscription-manager.conf
[main]
enabled=1

# When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
# every time subscription-manager plugin is triggered by dnf or yum

Comment 3 Pino Toscano 2024-01-11 15:29:17 UTC
(In reply to Debarshi Ray from comment #2)
> I found that some subscription-manager commands re-enable the plugin:

There's an option for that in /etc/rhsm/rhsm.conf, i.e. "auto_enable_yum_plugins" (which defaults to "1") ...

> $ sudo subscription-manager list
> [sudo] password for rishi: 
> No installed products to list
> 
> WARNING
> 
> The yum/dnf plugins: /etc/dnf/plugins/subscription-manager.conf were
> automatically enabled for the benefit of Red Hat Subscription Management. If
> not desired, use "subscription-manager config
> --rhsm.auto_enable_yum_plugins=0" to block this behavior.

... which is even explicitly mentioned here ;-)

Comment 4 Debarshi Ray 2024-01-11 16:09:29 UTC
(In reply to Pino Toscano from comment #3)
> (In reply to Debarshi Ray from comment #2)
> > I found that some subscription-manager commands re-enable the plugin:
> 
> There's an option for that in /etc/rhsm/rhsm.conf, i.e.
> "auto_enable_yum_plugins" (which defaults to "1") ...
> 
> > $ sudo subscription-manager list
> > [sudo] password for rishi: 
> > No installed products to list
> > 
> > WARNING
> > 
> > The yum/dnf plugins: /etc/dnf/plugins/subscription-manager.conf were
> > automatically enabled for the benefit of Red Hat Subscription Management. If
> > not desired, use "subscription-manager config
> > --rhsm.auto_enable_yum_plugins=0" to block this behavior.
> 
> ... which is even explicitly mentioned here ;-)

Sorry for the incomplete stream of consciousness.  Yes, I already edited /etc/rhsm/rhsm.conf.

Now I am grappling with the follow-up problem that subscription-manager pulls in /usr/bin/dnf-3 and
/usr/bin/dnf4 through python3-dnf:
https://github.com/fedora-silverblue/issue-tracker/issues/521

This is a problem because we don't want DNF on Fedora Silverblue.

Comment 5 Debarshi Ray 2024-01-11 17:09:21 UTC
I attempted to disable the DNF support to see if 'subscription-manager register' on the host will still upgrade UBI OCI containers to RHEL, but it didn't work:

From 72975545559821159ceb3915848cfe733849b633 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <rishi>
Date: Thu, 11 Jan 2024 16:57:42 +0100
Subject: [PATCH] Disable DNF plugin on Fedora

---
 subscription-manager.spec | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/subscription-manager.spec b/subscription-manager.spec
index 637c4080df77..d20e914c1bc9 100644
--- a/subscription-manager.spec
+++ b/subscription-manager.spec
@@ -6,8 +6,16 @@
 # Plugin for container (docker, podman) is not supported on RHEL
 %if 0%{?rhel}
 %global use_container_plugin 0
+%global use_dnf 1
 %else
 %global use_container_plugin 1
+%global use_dnf 0
+%endif
+
+%if 0%{?rhel} > 8
+%global create_libdnf_rpm 1
+%else
+%global create_libdnf_rpm 0
 %endif
 
 %global dmidecode_arches %{ix86} x86_64 aarch64
@@ -23,9 +31,6 @@
 %global use_inotify 0
 %endif
 
-%global use_dnf (0%{?fedora} || (0%{?rhel}))
-%global create_libdnf_rpm (0%{?fedora} || 0%{?rhel} > 8)
-
 %global python_sitearch %python3_sitearch
 %global python_sitelib %python3_sitelib
 %global __python %__python3
@@ -96,7 +101,7 @@
 
 Name: subscription-manager
 Version: 1.29.39
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: Tools and libraries for subscription and repository management
 %if 0%{?suse_version}
 Group:   Productivity/Networking/System
@@ -186,6 +191,7 @@ BuildRequires: openssl-devel
 BuildRequires: gcc
 BuildRequires: %{py_package_prefix}-setuptools
 BuildRequires: gettext
+BuildRequires: glib2-devel
 
 %if 0%{?suse_version}
 BuildRequires: distribution-release
@@ -734,6 +740,9 @@ rmdir %{python_sitearch}/subscription_manager-*-*.egg-info --ignore-fail-on-non-
 rm -f /var/lib/rhsm/cache/rhsm_icon.json
 
 %changelog
+* Thu Jan 11 2024 Debarshi Ray <rishi> 1.29.39-2
+- Disable DNF plugin on Fedora
+
 * Thu Nov 23 2023 Pino Toscano <ptoscano> 1.29.39-1
 - tito: drop bz requirement (ptoscano)
 - Translated using Weblate (Chinese (Simplified) (zh_CN)) (jsefler)
-- 
2.43.0

Comment 6 Debarshi Ray 2024-01-11 17:24:59 UTC
It seems to me that disabling the DNF plugin through /etc/rhsm/rhsm.conf and /etc/dnf/plugins/subscription-manager.conf doesn't work either.

I tried to disable the plugin, then unregistered my host with 'subscription-manager unregister', rebooted the host, registered it again with 'subscription-manager register', created a new UBI OCI container, tried to install the vulkan-loader RPM that's only present in RHEL, and it doesn't see it.

Comment 7 Pino Toscano 2024-02-16 12:37:36 UTC
(In reply to Debarshi Ray from comment #6)
> It seems to me that disabling the DNF plugin through /etc/rhsm/rhsm.conf and
> /etc/dnf/plugins/subscription-manager.conf doesn't work either.

What do you mean exactly? Do you still get the Subscription Management messages in dnf commands?

> I tried to disable the plugin, then unregistered my host with
> 'subscription-manager unregister', rebooted the host, registered it again
> with 'subscription-manager register', created a new UBI OCI container, tried
> to install the vulkan-loader RPM that's only present in RHEL, and it doesn't
> see it.

Does it see other RHEL content? After you start the container and run eg `dnf update`, what does /etc/yum.repos.d/redhat.repo contain?


Note You need to log in before you can comment on or make changes to this bug.