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 2014458

Summary: Please backport checking multiple motd_pam paths from 1.4.0 to RHEL 8
Product: Red Hat Enterprise Linux 8 Reporter: Jose <jnoguera>
Component: pamAssignee: Iker Pedrosa <ipedrosa>
Status: CLOSED ERRATA QA Contact: Anuj Borah <aborah>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: aborah, minl, pbrezina, perobins, shshang, wshi, xiliang, yacao
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pam-1.3.1-19.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 10:48:39 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:
Embargoed:
Bug Depends On: 2088455    
Bug Blocks:    

Description Jose 2021-10-15 09:44:33 UTC
Description of problem: Support for multiple MOTD paths was included in v1.4.0 https://github.com/linux-pam/linux-pam/releases/tag/v1.4.0 but this version hasn't been published for RHEL 8. This is the cause of the following bug: https://bugzilla.redhat.com/show_bug.cgi?id=1897307.

Please backport this functionality to 1.3.1 for RHEL 8.

Comment 2 Iker Pedrosa 2021-10-18 08:27:59 UTC
I think that it would be enough to include https://github.com/linux-pam/linux-pam/commit/f9c9c72121eada731e010ab3620762bcf63db08f#diff-8cbd5642ddf07f4ddb1a7cc36599f7f96ec3a0cc765b647516a11f3a125df848 in RHEL8 to fix this problem. Can you provide more information, for example the reproduction steps, to check that we are on the same page?

Comment 3 Jose 2021-10-18 10:48:00 UTC
Hi Iker,

Yes, I think that's the commit. The steps to reproduce are:
- sudo dnf install -y greenboot greenboot-status
- sudo systemctl enable greenboot-healthcheck greenboot-status greenboot-task-runner
- sudo reboot
- ssh into the machine, check MOTD. `Boot Status is GREEN - Health Check SUCCESS` should appear.
- With pam-1.3.1-14.el8.x86_64, it doesn't work. With that commit backported, it should appear there. The boot message is written in `/run/motd.d/boot-status`.

Let me know if you need anything else.

Thanks!

Comment 12 minl 2022-05-26 08:29:13 UTC
Hi, I want to update some information during my testing,I met the error in journalctl about scanning directory /run/motd.d and /usr/lib/motd.d. Then I found this should be fixed in 1.3.1-19, so I download it for testing, but the error still there after reboot VM with the updated pam:

Guest: RHEL-8.7.0-20220524.0

1. Found journalctl error in VM:

# journalctl | grep error
May 25 23:57:24 minl-VMscript-8.7 sshd[4505]: pam_motd(sshd:session): pam_motd: error scanning directory /run/motd.d
May 25 23:57:24 minl-VMscript-8.7 sshd[4505]: pam_motd(sshd:session): pam_motd: error scanning directory /usr/lib/motd.d

# rpm -qa pam
pam-1.3.1-18.el8.x86_64

2. Found change log about pam, so upgrade pam to for testing:

Changelog	* Mon May 23 2022 Iker Pedrosa <ipedrosa> - 1.3.1-19
- Add the motd.d directories (empty) to silence warnings and to
  provide proper ownership for them. Resolves: #2014458

# rpm -U pam-1.3.1-19.el8.x86_64.rpm

# rpm -qa pam
pam-1.3.1-19.el8.x86_64

3. After upgratding pam, the directory be created:

# ll /run/motd.d/
Total 0
# ll /usr/lib/motd.d/
Total 0

4. But after rebooting the VM, there is no directory of /run/motd.d

# reboot

# journalctl | grep error
May 26 04:20:50 minl-VMscript-8.7 sshd[1441]: pam_motd(sshd:session): pam_motd: error scanning directory /run/motd.d

# ll /run/motd.d
ls: cannot access '/run/motd.d': No such file or directory
# ll /usr/lib/motd.d/
Total 0
# rpm -qa pam
pam-1.3.1-19.el8.x86_64

Expect:
There should be /run/motd.d after rebooting VM
Actual:
There is no /run/motd.d after rebooting VM

Comment 13 Iker Pedrosa 2022-05-26 09:35:02 UTC
Well, this is quite normal since /run folder is recreated after every boot. Even if /run/motd.d folder would be recreated by PAM after every boot, which I'm not sure should be done, pam_motd wouldn't show any welcome message because that folder would be empty.

If you want a welcome message to be shown even after a reboot I'd recommend you using other available folders (i.e. /etc/motd.d/).

If you still would like to use /run/motd.d, reboot the machine and get a welcome message; then I guess that you should create a startup script to handle the creation of the aforementioned folder and the welcome message.

Comment 14 minl 2022-05-26 12:14:00 UTC
 (In reply to minl from comment #12)
> Hi, I want to update some information during my testing,I met the error in
> journalctl about scanning directory /run/motd.d and /usr/lib/motd.d. Then I
> found this should be fixed in 1.3.1-19, so I download it for testing, but
> the error still there after reboot VM with the updated pam:
> 
> Guest: RHEL-8.7.0-20220524.0
> 
> 1. Found journalctl error in VM:
> 
> # journalctl | grep error
> May 25 23:57:24 minl-VMscript-8.7 sshd[4505]: pam_motd(sshd:session):
> pam_motd: error scanning directory /run/motd.d
> May 25 23:57:24 minl-VMscript-8.7 sshd[4505]: pam_motd(sshd:session):
> pam_motd: error scanning directory /usr/lib/motd.d
> 
> # rpm -qa pam
> pam-1.3.1-18.el8.x86_64
> 
> 2. Found change log about pam, so upgrade pam to for testing:
> 
> Changelog	* Mon May 23 2022 Iker Pedrosa <ipedrosa> - 1.3.1-19
> - Add the motd.d directories (empty) to silence warnings and to
>   provide proper ownership for them. Resolves: #2014458
> 
> # rpm -U pam-1.3.1-19.el8.x86_64.rpm
> 
> # rpm -qa pam
> pam-1.3.1-19.el8.x86_64
> 
> 3. After upgratding pam, the directory be created:
> 
> # ll /run/motd.d/
> Total 0
> # ll /usr/lib/motd.d/
> Total 0
> 
> 4. But after rebooting the VM, there is no directory of /run/motd.d
> 
> # reboot
> 
> # journalctl | grep error
> May 26 04:20:50 minl-VMscript-8.7 sshd[1441]: pam_motd(sshd:session):
> pam_motd: error scanning directory /run/motd.d
> 
> # ll /run/motd.d
> ls: cannot access '/run/motd.d': No such file or directory
> # ll /usr/lib/motd.d/
> Total 0
> # rpm -qa pam
> pam-1.3.1-19.el8.x86_64
> 
> Expect:
> There should be /run/motd.d after rebooting VM
> Actual:
> There is no /run/motd.d after rebooting VM

One more update, there is no journalctl error against RHEL 8.6 (pam-1.3.1-16.el8.x86_64) while there is no such directory /run/motd.d and /usr/lib/motd.d

Guest:RHEL-8.6.0-20220420.d.0

# rpm -qa pam
pam-1.3.1-16.el8.x86_64

# journalctl | grep error
# journalctl | grep pam
May 26 08:05:41 minl-disk-8.6-0420 systemd[4856]: pam_unix(systemd-user:session): session opened for user root by (uid=0)
May 26 08:05:41 minl-disk-8.6-0420 sshd[4850]: pam_unix(sshd:session): session opened for user root by (uid=0)

# ll /run/motd.d
ls: cannot access '/run/motd.d': No such file or directory

# ll /usr/lib/motd.d
ls: cannot access '/usr/lib/motd.d': No such file or directory

Comment 17 errata-xmlrpc 2022-11-08 10:48:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (pam bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7723