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 2170084

Summary: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Product: Red Hat Enterprise Linux 8 Reporter: James Petrini <jpetrini>
Component: systemdAssignee: David Tardon <dtardon>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.7CC: dtardon, jamacku, systemd-maint-list
Target Milestone: rcKeywords: Improvement, Reproducer, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-239-72.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-16 09:07:47 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:

Description James Petrini 2023-02-15 15:33:01 UTC
Description of problem:

using sudo yields many unhelpful warning messages in /var/log/secure for a user
fixed in rhel 9 need to suppress in rhel 8 


Version-Release number of selected component (if applicable):

rhel 8.7 

systemd-239-68.el8.x86_64                                   Mon Jan 30 04:17:08 2023
systemd-libs-239-68.el8.x86_64                              Mon Jan 30 04:17:01 2023
systemd-pam-239-68.el8.x86_64                               Mon Jan 30 04:17:05 2023
systemd-udev-239-68.el8.x86_64                              Mon Jan 30 04:17:07 2023

How reproducible:

Easy

Steps to Reproduce:
1. create user on rhel 8.7 host
2. add user to /etc/sudoers
3. use sudo to run command as root or switch user to root 


Actual results:

/var/log/secure  

initially this bloc repeating 

Feb  1 09:57:48 xxxxx sudo[2361]: XXansible : problem with defaults entries ; TTY=pts/0 ; PWD=/home/XXansible ; USER=root ;
Feb  1 09:57:48 xxxxx sudo[2361]: XXansible : TTY=pts/0 ; PWD=/home/Xansible ; USER=root ; COMMAND=/bin/sh -c echo BECOME-SUCCESS-lqtfhcuzwgabaitmjgsvngohihlgbyge ; /usr/libexec/platform-python /home/XX
ansible/.ansible/tmp/ansible-tmp-1675241868.1771603-243-215661766349891/AnsiballZ_user.py
Feb  1 09:57:48 xxxxx sudo[2361]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Feb  1 09:57:48 xxxxx sudo[2361]: pam_unix(sudo:session): session opened for user root by XXansible(uid=0)
Feb  1 09:57:48 xxxxx usermod[2376]: change user 'root' password
Feb  1 09:57:49 xxxxx sudo[2361]: pam_unix(sudo:session): session closed for user root
 
 
after 5 mins message continues in a modified form   ( no more ref to defaults entries) 

Feb  1 10:03:12 xxxxx sudo[42735]: XXansible : TTY=pts/0 ; PWD=/home/XXansible ; USER=root ; COMMAND=/bin/sh -c echo BECOME-SUCCESS-rbvjkpvcqgtkwkkjfftbtjhjrpydqxbl ; /usr/libexec/platform-python /home/XXansible/.ansible/tmp/ansible-tmp-1675242192.0043979-3232-34524493803229/AnsiballZ_stat.py
Feb  1 10:03:12 xxxxx sudo[42735]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Feb  1 10:03:12 xxxxx sudo[42735]: pam_unix(sudo:session): session opened for user root by XXansible(uid=0)
Feb  1 10:03:12 xxxxx sudo[42735]: pam_unix(sudo:session): session closed for user root



Expected results:

suppressed warning message 

Additional info:

This appears to be https://github.com/systemd/systemd/issues/10822 which has been fixed in v240 systemd and later (per https://github.com/systemd/systemd/commit/2675747f3cdd6f1e6236bbb2f79abfa53fb307f1) and the latest available version in RHEL8 is v239 while RHEL9 has v250 of systemd-pam.


solution to filter messages rejected due to production pipeline constraints  see  https://access.redhat.com/solutions/539093

Comment 1 Plumber Bot 2023-02-16 14:40:26 UTC
fix merged to github main branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/361

Comment 7 errata-xmlrpc 2023-05-16 09:07:47 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 (systemd 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-2023:2985