Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow addition env vars to be defined in session files #1370

Merged
merged 3 commits into from Mar 8, 2021

Conversation

davidedmundson
Copy link
Member

We have a continual problem with developers using Plasma in custom
prefixes. We need to set mulitple additional envs and it is a constant
pain point.

Setting XDG_DATA_DIRS and alike in a script in the Exec line of the
desktop file doesn't work properly, as this is after systemd and dbus
have already been started during pam_logind. It requires a lot of bodging.

Things will work much better if we can set the env before pam_logind is
run.

Using pam_env or profile.d doesn't really work correctly as that then affects all the
sessions.

This additional hint is not intended to be used for anything other than dev setups.

From a security point it should be safe, as you need root for xsession/xwayalnd files, and if you can edit them, you could just edit the Exec line.

We have a continual problem with developers using Plasma in custom
prefixes. We need to set mulitple additional envs and it is a constant
pain point.

Setting XDG_DATA_DIRS and alike in a script in the Exec line of the
desktop file doesn't work properly, as this is after systemd and dbus
have already been started during pam_logind. It is currently very bodged
with more manual steps.

Things will work much better if we can set the env before pam_logind is
run.

Using pam_env or profile.d doesn't work as that affects all the
sessions.

It is not intended to be used for anything other than dev setups.
@plfiorini plfiorini added this to the 0.20 milestone Mar 8, 2021
@plfiorini plfiorini merged commit 093e8e5 into sddm:develop Mar 8, 2021
@Vogtinator
Copy link
Contributor

This is a DM specific hack, which means that anything which uses this key in session files will be subtly broken in a non-obvious way if the session is started otherwise, be it a different DM or launching it manually somehow.

Setting XDG_DATA_DIRS and alike in a script in the Exec line of the
desktop file doesn't work properly, as this is after systemd and dbus
have already been started during pam_logind. It requires a lot of bodging.

Is updating the startup environment before doing anything with systemd or DBus not sufficient?

@davidedmundson
Copy link
Member Author

Is updating the startup environment before doing anything with systemd or DBus not sufficient?

It needs setting before systemd is launched, which is inside Pam.

That can be done before logging in, but that means it has to be always on and system wide with more manual steps for a dev setup.

@Vogtinator
Copy link
Contributor

It needs setting before systemd is launched, which is inside Pam.

I get that, but why that early? Are there certain systemd user units starting before the actual session itself? That could be worked around by changing the environment in services which run even earlier.

@davidedmundson
Copy link
Member Author

The problem isn't about the env anything that is spawned by systemd have. We have solutions for that and there aren't any ordering issues, it all works mostly great.

The problem that's left is making dbus-daemon / systemd itself able to find the right service files if those services files are installed to a prefix.

@Vogtinator
Copy link
Contributor

The problem that's left is making dbus-daemon / systemd itself able to find the right service files if those services files are installed to a prefix.

Right. I wonder how this is supposed to work if you already have a running session? Let's assume you log in using the tty, then switch to sddm and log into the Plasma developer session. systemd isn't started twice, so it would use the wrong environment? Or the other way around, log into a development session, then log out and back into a non-development session. It'll use the wrong XDG_DATA_DIRS, won't it?

peremen pushed a commit to peremen/sddm that referenced this pull request Jun 30, 2022
We have a continual problem with developers using Plasma in custom
prefixes. We need to set mulitple additional envs and it is a constant
pain point.

Setting XDG_DATA_DIRS and alike in a script in the Exec line of the
desktop file doesn't work properly, as this is after systemd and dbus
have already been started during pam_logind. It is currently very bodged
with more manual steps.

Things will work much better if we can set the env before pam_logind is
run.

Using pam_env or profile.d doesn't work as that affects all the
sessions.

It is not intended to be used for anything other than dev setups.
githubkusi pushed a commit to githubkusi/sddm that referenced this pull request Jul 6, 2023
We have a continual problem with developers using Plasma in custom
prefixes. We need to set mulitple additional envs and it is a constant
pain point.

Setting XDG_DATA_DIRS and alike in a script in the Exec line of the
desktop file doesn't work properly, as this is after systemd and dbus
have already been started during pam_logind. It is currently very bodged
with more manual steps.

Things will work much better if we can set the env before pam_logind is
run.

Using pam_env or profile.d doesn't work as that affects all the
sessions.

It is not intended to be used for anything other than dev setups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants