Systemctl commands with --user flag broke after upgrade to Fedora 34

Hi,

I’ve upgraded my fedora KDE installation from 33 to 34 and I noticed that sound and wireless networking isn’t working properly. I’ve managed to do some digging and the source problem seems to be that User Manager service isn’t staring on login and XDG_SESSION_ID variable isn’t set at all.
Perhaps pam_systemd isn’t properly configured? I’ve taken a look in /etc/pam.d folder and *.rpmnew files look troubling…

    # ls -la /etc/pam.d
    total 184
    drwxr-xr-x.   2 root root  4096 05-21 09:37 .
    drwxr-xr-x. 183 root root 12288 05-21 09:37 ..
    -rw-r--r--.   1 root root   272 01-26 02:18 atd
    -rw-r--r--.   1 root root   192 02-12 16:21 chfn
    -rw-r--r--.   1 root root   192 02-12 16:21 chsh
    -rw-r--r--.   1 root root   997 05-12 11:36 cockpit
    -rw-r--r--.   1 root root   232 04-20 09:23 config-util
    -rw-r--r--.   1 root root   322 2019-02-15  crond
    -r--r--r--.   1 root root   146 05-13 12:57 cups
    lrwxrwxrwx.   1 root root    32 05-21 09:37 fingerprint-auth -> /etc/authselect/fingerprint-auth
    -rw-r--r--.   1 root root   617 04-20 09:23 fingerprint-auth.rpmnew
    -rw-r--r--.   1 root root   134 04-20 21:01 kcheckpass
    -rw-r--r--.   1 root root   798 05-05 14:47 kde
    -rw-r--r--.   1 root root   134 04-20 21:01 kscreensaver
    -rw-r--r--.   1 root root    70 03-01 22:51 ksu
    -rw-r--r--.   1 root root    97 2018-06-07  liveinst
    -rw-r--r--.   1 root root   676 02-12 16:21 login
    -rw-r--r--.   1 root root   154 04-20 09:23 other
    -rw-r--r--.   1 root root   168 01-30 18:53 passwd
    lrwxrwxrwx.   1 root root    29 05-21 09:37 password-auth -> /etc/authselect/password-auth
    -rw-r--r--.   1 root root   663 04-20 09:23 password-auth.rpmnew
    -rw-r--r--.   1 root root   510 04-10 22:59 pluto
    -rw-r--r--.   1 root root   155 01-28 05:14 polkit-1
    lrwxrwxrwx.   1 root root    25 05-21 09:37 postlogin -> /etc/authselect/postlogin
    -rw-r--r--.   1 root root   300 04-20 09:23 postlogin.rpmnew
    -rw-r--r--.   1 root root   144 01-28 05:23 ppp
    -rw-r--r--.   1 root root   640 02-12 16:21 remote
    -rw-r--r--.   1 root root   143 02-12 16:21 runuser
    -rw-r--r--.   1 root root   138 02-12 16:21 runuser-l
    -rw-r--r--.   1 root root   177 04-29 12:40 samba
    -rw-r--r--.   1 root root   923 04-23 08:11 sddm
    -rw-r--r--.   1 root root   668 04-23 08:11 sddm-autologin
    -rw-r--r--.   1 root root   397 04-23 08:13 sddm-greeter
    lrwxrwxrwx.   1 root root    30 05-21 09:37 smartcard-auth -> /etc/authselect/smartcard-auth
    -rw-r--r--.   1 root root   646 04-20 09:23 smartcard-auth.rpmnew
    -rw-r--r--.   1 root root   727 03-09 16:42 sshd
    -rw-r--r--.   1 root root   214 02-19 16:57 sssd-shadowutils
    -rw-r--r--.   1 root root   540 02-12 16:21 su
    -rw-r--r--.   1 root root   238 01-26 21:09 sudo
    -rw-r--r--.   1 root root   178 01-26 21:09 sudo-i
    -rw-r--r--.   1 root root   137 02-12 16:21 su-l
    lrwxrwxrwx.   1 root root    27 05-21 09:37 system-auth -> /etc/authselect/system-auth
    -rw-r--r--.   1 root root   663 04-20 09:23 system-auth.rpmnew
    -rw-r--r--.   1 root root   248 05-15 19:14 systemd-user
    -rw-r--r--.   1 root root   452 2020-09-08  tigervnc
    -rw-r--r--.   1 root root    84 01-27 02:20 vlock
    -rw-r--r--.   1 root root   159 04-06 19:25 vmtoolsd
    -rw-r--r--.   1 root root   370 05-01 01:48 xrdp-sesman
    -rw-r--r--.   1 root root   163 04-14 12:58 xserver

After login i can start User manager service as root without problems, but it does not fix my desktop session.

I mean… those .rpmnew files are likely just failed attempts to re-create the symbolic links that the actual files they correspond to represent, because the pam RPM correctly doesn’t update configuration files when installing updates. It’s not likely those are causing you any issues and can probably be safely deleted.

But, if you want to make sure the configuration is correct you can use sudo authselect current to see your current configuration, sudo authselect check to verify it, and commands like sudo authselect test and sudo authselect -b apply-changes to examine/execute the results of reapplying the config (the second, with a backup made of the previous config). See man authselect for more details.

(Doing that still won’t delete those .rpmnew files, you’ll have to do that yourself no matter what.)

When you say the user manager service isn’t running… you mean the user@1000.service unit isn’t activated when you log in? I didn’t realize it was possible to log in without that service starting, as it’s the one that’s supposed to own every one of your user processes. Perhaps there’s a botched install of the KDE greeter?

(Also, don’t be thrown by the dizzying array of feature switches available in authselect profiles, it’s easy to go down a rabbit hole with those. Out of the… 20 features listed for the default sssd profile, the only one enabled in my config is with-sudo.* None of the others are likely to be necessary/useful unless you’re dealing with enterprise-managed, network-based authentication.)

* - (And honestly I don’t even think that does anything for me. It doesn’t activate sudo, it lets sudo use SSSD as a source for sudoer identities… again, enterprise-type stuff. My sudo access is configured via a file in /etc/sudoers.d/, not from SSSD.)

Thanks for your reply,

I’ve toyed with authselect commands you wrote and user manager service for my uid is starting correctly now.

[root@local ~]# systemctl status user@<myuid>
● user@<myuid>.service - User Manager for UID <myuid>
     Loaded: loaded (/usr/lib/systemd/system/user@.service; static)
    Drop-In: /usr/lib/systemd/system/user@.service.d
             └─10-oomd-user-service-defaults.conf
     Active: active (running) since Fri 2021-05-21 13:02:08 CEST; 1min 43s ago
       Docs: man:user@.service(5)
   Main PID: 2803 (systemd)
     Status: "Startup finished in 146ms."
      Tasks: 2
     Memory: 10.4M
        CPU: 155ms
     CGroup: /user.slice/user-<myuid>.slice/user@<myuid>.service
             └─init.scope
               ├─2803 /usr/lib/systemd/systemd --user
               └─2825 (sd-pam)

User@1000 service is inactive trough…

○ user@1000.service - User Manager for UID 1000
     Loaded: loaded (/usr/lib/systemd/system/user@.service; static)
    Drop-In: /usr/lib/systemd/system/user@.service.d
             └─10-oomd-user-service-defaults.conf
     Active: inactive (dead)
       Docs: man:user@.service(5)

However this does not fix my issues. Variable XDG_SESSION_ID still isn’t set for me and i am unable to execute any systemctl command with --user flag:

$ systemctl --user
Failed to list units: Process org.freedesktop.systemd1 exited with status 1
$ systemctl --user status pulseaudio
Failed to get properties: Process org.freedesktop.systemd1 exited with status 1
$ systemctl --user status dbus.service
Failed to get properties: Process org.freedesktop.systemd1 exited with status 1
$ echo $XDG_SESSION_ID

$ 

Any ideas why despite running user manager service i am still unable to use systemctl as user?