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.

Bug 1806156

Summary: [Insights/Client(RHEL8) Motd message handling needs improvement.
Product: Red Hat Enterprise Linux 8 Reporter: Amar Huchchanavar <ahuchcha>
Component: insights-clientAssignee: Link Dupont <link>
Status: CLOSED ERRATA QA Contact: Pavol Kotvan <pakotvan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.2CC: achadha, andy.speagle, dajohnso, davdunc, fstavela, jerome.meyer, joerg.kastning, kdixon, klape, link, lphiri, mpitt, mvanderw, peter.vreman, rkarimpa, sbrown, shivagup, stefw
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.3   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-08 19:50:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 3.1.1
Embargoed:

Description Amar Huchchanavar 2020-02-22 13:29:07 UTC
Description of problem:
insights-client pkg re-installation does not consider the real status of the client.

A reproducer can be:

- Install insights client
- Run insights client
- Remove /var/lib/insights/newest*
- Remove /etc/motd.d/insights-client
- Re-install insights-client rpm (to force the execution of the rpm %post)

Now the file /etc/motd.d/insights-client shall not be created again


What for me is still unclear is who and when the  /etc/motd.d/insights-client is going to be removed if the insights-client is being running/registered again. Is the insights-client egg doing that removal?

if the egg is removing files in /etc/... outside of /etc/insights-client is a violation of the trust of insights-client that it should not modify the system (and motd is part of the system) except for its own state files.



Version-Release number of selected component (if applicable):
# insights-client --version 
Client: 3.0.8-2
Core: 3.0.121-1


How reproducible:
Always


Actual results:
pkg re-installation does not verify the system registration.



Additional info:

Customer Comments:

Chanign to Insighst client as i found the handling to be included in the insights-client rpm
And that is relying on the downloda of newest.egg which is not a mandatory file for insights-client to work

From the .spec
------
#Link motd into place. Only do so if motd file doesn't exist and insights hasn't been used
if [ ! -e /etc/motd.d/insights-client -a ! -L /etc/motd.d/insights-client ]; then
    mkdir -p /etc/motd.d
    if [ -e /var/lib/insights/newest.egg ]; then
        ln -sn /dev/null /etc/motd.d/insights-client
    else
        ln -sn /etc/insights-client/insights-client.motd /etc/motd.d/insights-client
    fi
fi
---------

My insights-client has auto_update disabled and is puppet managed and installs only the last_stable.egg.


I am really surprised that there is re-invent-of-the-wheel to look for newest.egg and that not the real status file like /etc/insights-client/.registered is not used.

Comment 1 Link Dupont 2020-02-24 15:28:04 UTC
Really, the logic of determining when to create or remove the /etc/motd.d/insights-client file belongs in the client, not in the spec file. There is definitely room to improve this.

Comment 3 Stef Walter 2020-07-14 12:13:55 UTC
Bug fixes for

Comment 4 Link Dupont 2020-08-25 14:27:04 UTC
We have identified a solution to this bug and will be releasing a fix for it in the next client RPM release.

Comment 5 Joerg K 2020-08-26 08:56:37 UTC
That's good news. Looking forward to testing it soon.

Comment 6 Steve Brown 2020-11-04 13:29:54 UTC
Good morning.

When we first set up our RHEL8 server, the 'motd' was saying that our server needed to be registered with insights even though it already was.  Red Hat Support recommended editing /etc/insights-client/insights-client.motd to remove the message, which I did.  This morning I performed a large update with yum.  This included an update to insights-client which apparently overwrote the motd file with:

==
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
==

I ran the registration command which just told me that the server was already registered.  The .motd file was not updated to reflect this, so now I must edit the .motd file again.

==
~ $ sudo insights-client --register
This host has already been registered.
Automatic scheduling for Insights has been enabled.
Starting to collect Insights data for...
Uploading Insights data.
Successfully uploaded report from...
==

Comment 7 Link Dupont 2020-11-05 14:15:00 UTC
Hi Steve,

Removing or editing the contents of /etc/insights-client/insights-client.motd is not going to be a permanent solution for you. That file is tracked as part of the RPM, so when you ran your update, the file was rewritten by the RPM upgrade process. The right way to remove the message from appearing as part of the login motd is to remove the symlink file /etc/motd.d/insights-client (if you look at the file that symlink points to, it should be /etc/insights-client/insights-client.motd). The update you installed should include a fix for this bug, assuming you leave the contents of /etc/insights-client/insights-client.motd unmodified. The pam_motd module reads files from /etc/motd.d, so removing the symlink should effectively mute the motd message from appearing.

Thanks for the feedback! Let me know if removing the symlink works for you.

Comment 8 Matt 2020-11-07 12:10:19 UTC
We removed the /etc/motd.d/insights-client already when the system was built but every time there's a new update to insights-client, it always puts the symlink back, putting the messages back in our MOTD. We don't use insights-client and don't want it showing this message in the MOTD, as we have our own MOTD we use with information for our users. Why does the symlink always come back? Any way to not use insights-client and not have this symlink keep getting re-created? This is a serious annoyance and really bad for RH to try to force this on us.

Comment 9 Steve Brown 2020-11-09 13:26:18 UTC
(In reply to Link Dupont from comment #7)
> Hi Steve,
> 
> Removing or editing the contents of
> /etc/insights-client/insights-client.motd is not going to be a permanent
> solution for you. That file is tracked as part of the RPM, so when you ran
> your update, the file was rewritten by the RPM upgrade process. The right
> way to remove the message from appearing as part of the login motd is to
> remove the symlink file /etc/motd.d/insights-client (if you look at the file
> that symlink points to, it should be
> /etc/insights-client/insights-client.motd). The update you installed should
> include a fix for this bug, assuming you leave the contents of
> /etc/insights-client/insights-client.motd unmodified. The pam_motd module
> reads files from /etc/motd.d, so removing the symlink should effectively
> mute the motd message from appearing.
> 
> Thanks for the feedback! Let me know if removing the symlink works for you.

Good morning, Link.

I've had a three-day weekend since I last logged in to our RHEL8 server.  This morning, although I haven't done anything, the insights-client no longer appears when I log in. The symlink, dated 11/6/2020 -- a day that I did not work -- now points to 'dev/null'. Perhaps some cron job running at around 1 AM took care of it?  Anyway, thank you for your help.

Steve

Comment 10 Link Dupont 2020-11-09 14:50:15 UTC
(In reply to Matt from comment #8)
> We removed the /etc/motd.d/insights-client already when the system was built
> but every time there's a new update to insights-client, it always puts the
> symlink back, putting the messages back in our MOTD. We don't use
> insights-client and don't want it showing this message in the MOTD, as we
> have our own MOTD we use with information for our users. Why does the
> symlink always come back? Any way to not use insights-client and not have
> this symlink keep getting re-created? This is a serious annoyance and really
> bad for RH to try to force this on us.

Rather than removing the symlink, point it to /dev/null. That will mute the message and prevent the symlink from being recreated upon RPM update.

Comment 11 Link Dupont 2020-11-18 13:49:58 UTC
*** Bug 1898775 has been marked as a duplicate of this bug. ***

Comment 12 Kathryn Dixon 2021-01-08 19:50:38 UTC
This was resolved in RHEL 8.3 on Dec 15, 2020 in the 3.1.1 Insights-client RPM.

Comment 13 Steve Brown 2021-05-06 22:18:51 UTC
I have the same issue with /etc/motd.d/cockpit.  It said I needed to run systemctl enable --now cockpit.socket, even though it's already been enabled.

Running Red Hat Enterprise Linux release 8.3 (Ootpa)

Comment 14 Link Dupont 2021-05-07 13:34:27 UTC
@(In reply to Steve Brown from comment #13)
> I have the same issue with /etc/motd.d/cockpit.  It said I needed to run
> systemctl enable --now cockpit.socket, even though it's already been enabled.
> 
> Running Red Hat Enterprise Linux release 8.3 (Ootpa)

While insights-client and cockpit both make use of the PAM motd.d module, this bug fixed an error in the way insights-client was managing its entry in /etc/motd.d. If you're seeing a problem with cockpit, you should file a bug against cockpit. They have different logic for controlling the entry in /etc/mot.d, so any code that fixed it for insights-client won't fix it for cockpit.

Comment 15 Steve Brown 2021-05-10 16:55:17 UTC
OK, Link -- I will file a separate bug against cockpit, per your suggestion.