Bug 1942956 - "systemd --user" instances are spawned unnecessarily, affecting system performances
Summary: "systemd --user" instances are spawned unnecessarily, affecting system perfor...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: systemd maint
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-25 11:48 UTC by Renaud Métrich
Modified: 2023-08-14 11:27 UTC (History)
11 users (show)

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


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github systemd systemd issues 23978 0 None open PR #23569 should be reworked ("Don't spawn systemd --user instance for background (i.e. cron) sessions") 2023-05-16 12:51:39 UTC
Red Hat Issue Tracker SSSD-3697 0 None None None 2021-12-08 12:30:16 UTC
Red Hat Knowledge Base (Solution) 5211801 0 None None None 2022-01-18 10:53:09 UTC

Internal Links: 2041815

Description Renaud Métrich 2021-03-25 11:48:13 UTC
Description of problem:

"systemd --user" instance is useful for tty sessions only, not for sftp or ftp sessions.

Currently, since the spawning is performed by pam_systemd, every single PAM aware service sourcing pam_systemd (usually because it includes password-auth) will see a "systemd --user" instance being spawned.

This makes the system perform poorly when it's designed to serve many requests from outside world, e.g. it hosts a ftp service implemented by vsftpd.

The available workarounds are not convenient at all:
Workaround 1: Disable user@.service globally. Impact: GUI sessions are not possible anymore
Workaround 2: De-duplicate the PAM stack and remove "pam_systemd" for the service not needing "systemd --user", but then cgroup creation is not performed anymore

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

systemd-239-41.el8_3.1.x86_64

How reproducible:

N/A

Comment 1 Michal Sekletar 2021-07-21 08:42:16 UTC
Whether pam_systemd.so is included in the setup of the PAM session depends entirely on the PAM configuration. In order to prevent launching systemd --user instances when it is not desirable we should fix the appropriate PAM configuration files. Also this RHEL-8 change should be coordinated with corresponding authselect changes so that we have the same behaviour in recent Fedoras and in RHEL-9.

Comment 4 Pavel Březina 2023-04-25 09:59:00 UTC
I'm sorry for the ping pong, but lets switch the component back to systemd.

We could fix this in pam/authselect and omit pam_systemd for some services, but the same can be done in pam_systemd itself - be a noop for services where it does not make sense to run it. This would be much better choice since from pam point of view, we can not decide (and guarantee) which services are valid for pam_systemd and which are not. It would be also safer for the future as only pam_systemd would need to be changed if the list of irrelevant services changes.


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