The reason why it is fast under upstart is that with upstart the entire session is running in the logind scope/session, in particular unity-settings-daemon; and then pkexec causes
Okt 06 22:10:46 donald pkexec[9943]: pam_systemd(polkit-1:session): Cannot create session: Already running in a session
This is why the entire pam_systemd, systemd --user etc. for root are entirely skipped.
Under the "user session" paradigm that we get with dbus-user-session, most session processes (including gnome-terminal-server and unity-settings-daemon) run *outside* of the logind session/scope and thus not technically within a PAM session. That's why pam_systemd actually does start a new full session which makes this slow.
In conclusion: Under an upstart session we never actually had a "full" new interactive PAM session for the target user anyway, as this was *already* a PAM session. Thus changing pkexec to common-session-noninteractive is actually doing (mostly) the same as we previously did in 16.04 under an upstart session. Thus I am much more convinced now that switching to common-session-noninteractive is not only correct (and also fixing this bug), but also not actually that regression prone.
The reason why it is fast under upstart is that with upstart the entire session is running in the logind scope/session, in particular unity-settings- daemon; and then pkexec causes
Okt 06 22:10:46 donald pkexec[9943]: pam_systemd( polkit- 1:session) : Cannot create session: Already running in a session
This is why the entire pam_systemd, systemd --user etc. for root are entirely skipped.
Under the "user session" paradigm that we get with dbus-user-session, most session processes (including gnome-terminal- server and unity-settings- daemon) run *outside* of the logind session/scope and thus not technically within a PAM session. That's why pam_systemd actually does start a new full session which makes this slow.
In conclusion: Under an upstart session we never actually had a "full" new interactive PAM session for the target user anyway, as this was *already* a PAM session. Thus changing pkexec to common- session- noninteractive is actually doing (mostly) the same as we previously did in 16.04 under an upstart session. Thus I am much more convinced now that switching to common- session- noninteractive is not only correct (and also fixing this bug), but also not actually that regression prone.