Bug 1829799 - logind: user managers should not be started in offline upgrade mode
Summary: logind: user managers should not be started in offline upgrade mode
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-30 12:01 UTC by Barry Scott
Modified: 2023-09-15 11:00 UTC (History)
22 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
log of off line system upgrade showing logind and user services running (2.94 MB, text/plain)
2020-07-30 19:36 UTC, Barry Scott
no flags Details

Description Barry Scott 2020-04-30 12:01:23 UTC
Description of problem:

When upgrading F31 to F32 using system-upgrade I notice that
user services are allowed to start and run.

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

How reproducible:

I have not tried.

Steps to Reproduce:
1. Configure a user service
2. Set the user to linger
3. system upgrade from F31 to F32

Actual results:

User services are starting at the same time as DNF is doing the system upgrade.
This is seen clearly in the journal logs.

Expected results:

Only services that must be run to support the system-upgrade are run.

Additional info:

Comment 1 Barry Scott 2020-04-30 12:04:09 UTC
The system did not reboot after DNF completed installing all RPMs.

Comment 2 Barry Scott 2020-04-30 12:18:32 UTC
Here is a log extract showing the user sessions starting up while DNF is running:

2020-04-29T21:43:08+0100 dnf[1083]:   Running scriptlet: filesystem-3.14-2.fc32.x86_64                          1/1
2020-04-29T21:43:08+0100 dnf[1083]:   Running scriptlet: copy-jdk-configs-3.7-5.fc32.noarch                     1/1
2020-04-29T21:43:08+0100 audit[1112]: USER_ACCT pid=1112 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="alex" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
2020-04-29T21:43:08+0100 kernel: audit: type=1101 audit(1588192988.619:133): pid=1112 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="alex" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
2020-04-29T21:43:08+0100 audit[1113]: USER_ACCT pid=1113 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="barry-mail" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
2020-04-29T21:43:08+0100 audit[1110]: USER_ACCT pid=1110 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="barry" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
2020-04-29T21:43:08+0100 systemd[1110]: pam_unix(systemd-user:session): session opened for user barry by (uid=0)
2020-04-29T21:43:08+0100 audit[1110]: USER_START pid=1110 uid=0 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_selinux,pam_selinux,pam_loginuid,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="barry" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
2020-04-29T21:43:08+0100 audit: AUDIT1334 prog-id=32 op=LOAD
2020-04-29T21:43:08+0100 audit: AUDIT1334 prog-id=32 op=UNLOAD
2020-04-29T21:43:08+0100 audit: AUDIT1334 prog-id=33 op=LOAD
2020-04-29T21:43:08+0100 audit: AUDIT1334 prog-id=33 op=UNLOAD
2020-04-29T21:43:08+0100 audit: AUDIT1334 prog-id=34 op=LOAD
2020-04-29T21:43:08+0100 audit: AUDIT1334 prog-id=34 op=UNLOAD
2020-04-29T21:43:08+0100 systemd[1112]: /home/barry/.config/systemd/user/default.target:1: .include directives are deprecated, and support for them will be removed in a future version of systemd. Please use drop-in files instead.

Comment 3 Barry Scott 2020-05-03 10:02:26 UTC
I have seen this problem on a second system hich has user systemd services fail to reboot as well.

Three systems I upgraded that do not have user services rebooted as expected.

Comment 4 Daniel Mach 2020-05-11 11:23:17 UTC
DNF/RPM are just executing what's in the scriptlets.
Assigning to systemd for investigation if this behavior is expected and to check the rpm macros eventually.

Comment 5 Barry Scott 2020-05-12 08:35:18 UTC
The logs do not support your claim.

The logs show code that I wrote on my machine is running as a user service.
That code is not in a RPM script.

Comment 6 Zbigniew Jędrzejewski-Szmek 2020-07-26 14:57:19 UTC
Barry, I don't see anything in that log that would look particularly wrong. Please
provide a reproduction procedure and describe clearly *which* services were started
and when and why you didn't expect that. The fact that *some* user services are running
(esp. with linger set) by itself is not a bug. Also please attach the full log, that
snipped is nearly not enough to say anything useful.

Comment 7 Barry Scott 2020-07-27 12:51:51 UTC
Of cource its a bug that user services are running during a system upgrade.

If you think it is fine to have user services running why not system services like samba, httpd etc?

I'l email you about setting up a call to discuss this.

Comment 8 Barry Scott 2020-07-27 13:29:46 UTC
Let me try putting it a different way.

The systemd target that does the upgrade only includes the services that are necessary to do the upgrade.

The systemd user services cannot possible be necessary to do an upgrade in a controlled target.

Barry

Comment 9 Zbigniew Jędrzejewski-Szmek 2020-07-27 13:56:56 UTC
Oh, OK, you were using dnf system-upgrade and you mean that the user services are running in
the offline upgrade mode. I missed that bit. This indeed doesn't sound right.

Can you attach the full log from the upgrade? It seems something is pulling in systemd-logind.service
during the upgrade...

Comment 10 Barry Scott 2020-07-30 19:36:52 UTC
Created attachment 1702993 [details]
log of off line system upgrade showing logind and user services running

Here is the full log of the system upgrade from the journal.

It does not show a reboot as it hangs.
But you can see the user services having problems with hosts.

Comment 11 Barry Scott 2020-08-30 08:53:58 UTC
Do you have an update on this bug?

Comment 12 Lennart Poettering 2020-11-03 19:46:17 UTC
Does Fedora have pam_nologin in the "systemd-user" PAM stack? (The upstream version doesn't, but not sure what the packaged version does. — Too lazy to check myself, I have the systemd upstream version self-compiled installed over the packaged version).

Comment 13 Michael Catanzaro 2020-11-03 23:33:23 UTC
Nope:

$ cat /etc/pam.d/systemd-user 
# This file is part of systemd.
#
# Used by systemd --user instances.

account  include system-auth

session  required pam_selinux.so close
session  required pam_selinux.so nottys open
session  required pam_loginuid.so
session  include system-auth

Comment 14 Fedora Program Management 2021-04-29 16:22:04 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 15 Barry Scott 2021-04-29 17:16:57 UTC
I pushed to 34 as I am assuming this is not fixed.

Comment 16 Ben Cotton 2022-05-12 16:35:01 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 17 Zbigniew Jędrzejewski-Szmek 2022-05-25 13:01:08 UTC
We discussed adding support for a more flexible pam_systemd module. Something like
a switch in the pam_systemd config line that specifies if the user manager should
be started it it wasn't running yet (yes, no, auto?). For things like cron sessions,
it'd be "no". It might 

But for this particular issue, I think we want a more direct solution. logind should
just not starting lingering users. (And in addition, maybe we could avoid starting
logind altogether…).


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