Is there any documentation regarding systemd which would suggest that setting the hidepid=2 mount option to the /proc procfs will cause problems?
the error message part before the failure to start a Gnome wayland session is:
systemd[330]: Started D-Bus User Message Bus.
gnome-session[339]: gnome-session-binary[339]: WARNING: Could not get session id for session. Check that logind is properly installed and pam_systemd is getting use
gnome-session-binary[339]: WARNING: Could not get session id for session. Check that logind is properly installed and pam_systemd is getting used at login.
gnome-session[339]: gnome-session-binary[339]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
gnome-session-binary[339]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
gnome-shell[346]: Can't initialize KMS backend: Could not get session ID: No such file or directory
gnome-session[339]: gnome-session-binary[339]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
gnome-session-binary[339]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
gnome-session-binary[339]: Unrecoverable failure in required component org.gnome.Shell.desktop
gdm[296]: GdmDisplay: display lasted 0.735810 seconds
I guess that the session Id is acquired somehow via the PID, which is not visisble to gnome-session.
The problem is occurring on an Arch Linux distribution. However I do think it is linked to upstream problems. It seems as discussed on Gentoo's Wiki "GNOME without systemd" that especially the wayland session of Gnome is coupled very much with systemd.
It seems to be the combination of systemd's logind, with hidepid=2 procfs mount option interplaying with Gnome wayland session, more so than Gnome Xorg session, relying on the logind.
I have also followed the advice given in @sourcejedi answer and made the
/etc/fstab exemption for logind. So my this is my entry in /etc/fstab
proc /proc proc nosuid,nodev,noexec,relatime,hidepid=2,gid=26 0 0
where 26 is the GID of the proc group to which logind, respectively polkitd group was added. However this did not resolve the problem.
As shown at https://www.freedesktop.org/wiki/Software/systemd/logind/
interface org.freedesktop.login1.Manager {
methods:
GetSession(in s session_id,
out o object_path);
GetSessionByPID(in u pid,
out o object_path);
it seems the SessionID might be queried using the PID, which naturally might create Problems once hidepid=2 option is used.
XDG_SESSION_IDwhen you log in... I guess gdm has to create its own PAM session for the login screen as well. On my system I see/etc/pam.d/gdm-launch-environment, which usespam_permitin place of any authentication. Apparently it is also possible to query the session for a given PID - but this works by sending a dbus request (GetSessionByPID) to systemd-logind, so that's the process that has to actually find the ID. The commandloginctl session-statusmust be using this dbus method.