Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
If a process modifies /etc/rhsm/rhsm.conf (say by running the sed command on it) changes to this file will not be reflected in output of follow-up Get()/GetAll() calls over the RHSM DBus interface.
Only after restarting the rhsm.service systemd unit, the changes are visible in the DBus call output.
Version-Release number of selected component (if applicable):
subscription-manager-1.29.21-1.el9.x86_64
running on the
RHEL-9.0.0-20220119.0-BaseOS-x86_64-boot.iso
How reproducible:
always
Steps to Reproduce:
0. prepare the environment
- download RHEL-9.0.0-20220119.0-BaseOS-x86_64-boot.iso or similar with subscription-manager-1.29.21-1.el9.x86_64,
- use inst.sshd boot option to enable SSH access to the installation environment when booting the image
- once it boots up, switch to TTY2 and run "ip a" to find what ip address the VM got
- connect to the ip address as root via SSH for easy access
(This is the environment where I debugged this, most likely the issue will also be replicable on an installed system with the same RHSM version.)
1. create a local copy of "clean" rhsm.conf:
cp /etc/rhsm/rhsm.conf rhsm.conf_backup
2. put the following script into a file and run it:
#!/bin/bash
echo "** stopping rhsm.service **"
systemctl stop rhsm.service
echo "** resetting rhsm.conf **"
cp rhsm.conf_backup /etc/rhsm/rhsm.conf
echo "** starting rhsm.service **"
systemctl start rhsm.service
echo "** using sed to change server.hostname in rhsm.conf **"
sed -i "s/^hostname\s*=.*/hostname = FOO/g" /etc/rhsm/rhsm.conf
echo "** using DBus Get() method to get values use server.hostname **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config Get ss "server.hostname" ""
echo "** checking hostname key in /etc/rhsm/rhsm.conf **"
cat /etc/rhsm/rhsm.conf | grep -e "^hostname ="
echo "** using DBus GetAll() to list all values **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config GetAll s ""
echo "** restarting rhsm.service **"
systemctl restart rhsm.service
echo "** trying again after rhsm.service restart **"
echo "** using DBUS Get() method to get values use server.hostname - after rhsm.service restart **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config Get ss "server.hostname" ""
echo "** checking hostname key in /etc/rhsm/rhsm.conf - after rhsm.service restart **"
cat /etc/rhsm/rhsm.conf | grep -e "^hostname ="
echo "** using DBus GetAll() to list all values - after rhsm.service restart **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config GetAll s ""
3. Note that the change to the server.hostname key done via sed is not "visible" over DBus until the rhsm.service is restarted.
4. For comparison I've created a variant of the script using subscription-manager config instead of sed:
#!/bin/bash
echo "** stopping rhsm.service **"
systemctl stop rhsm.service
echo "** resetting rhsm.conf **"
cp rhsm.conf_backup /etc/rhsm/rhsm.conf
echo "** starting rhsm.service **"
systemctl start rhsm.service
echo "** using subscription-manager config --server.hostname to set server.hostname **"
subscription-manager config --server.hostname BAR
echo "** using DBus Get() method to get values use server.hostname **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config Get ss "server.hostname" ""
echo "** checking hostname key in /etc/rhsm/rhsm.conf **"
cat /etc/rhsm/rhsm.conf | grep -e "^hostname ="
echo "** using DBus GetAll() to list all values **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config GetAll s ""
echo "** restarting rhsm.service **"
systemctl restart rhsm.service
echo "** trying again after rhsm.service restart **"
echo "** using DBUS Get() method to get values use server.hostname - after rhsm.service restart **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config Get ss "server.hostname" ""
echo "** checking hostname key in /etc/rhsm/rhsm.conf - after rhsm.service restart **"
cat /etc/rhsm/rhsm.conf | grep -e "^hostname ="
echo "** using DBus GetAll() to list all values - after rhsm.service restart **"
busctl call com.redhat.RHSM1 /com/redhat/RHSM1/Config com.redhat.RHSM1.Config GetAll s ""
5. Note that this time the server.hostname change is visible immediately.
To summarize, RHSM DBus API should either reflect changes to the config file in follow-up DBus calls or at least this behaviour should be documented as intentional.
Also at the moment due to this behaviour the Anaconda installer needs to always restart rhsm.service during registration to a Satellite instance, because the satellite bootstrap script currently uses sed to directly change values in rhsm.conf. Without rhsm.service being restarted, these changes would not be taken into account by RHSM and the registration attempt would fail (RHSM would try to connect to hosted Candlepin with the provided credentials instead of to the given Satellite instance).
This results in the Anaconda code being more complex (as we need to make sure rhsm.service is restarted) and the registration attempt taking longer (as we need to wait for the rhsm.service to restart).
Comment 1RHEL Program Management
2023-09-22 13:51:37 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.
Comment 2RHEL Program Management
2023-09-22 13:51:54 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.
Due to differences in account names between systems, some fields were not replicated. Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.
To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer. You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:
"Bugzilla Bug" = 1234567
In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.