Re: [systemd-devel] How to have systemd --user instance share the same environment variables as the X server?

2017-02-27 Thread Lennart Poettering
On Sun, 26.02.17 21:10, Patrick Schleizer (patrick-mailingli...@whonix.org) 
wrote:

> Being on Debian stretch (Qubes). The display manager there does not yet
> get started by systemd --user.
> 
> I find it useful to convert /etc/xdg/autostart/app.desktop files to
> systemd --user unit files.
> 
> Therefore the environment variables have to be sorted out. On any Linux
> we would have to set at least DISPLAY as well as XAUTHORITY.
> 
> On Qubes however, we need a few more environment variables. We need also
> QT_X11_NO_MITSHM=1 and may need a few others ones.
> 
> Now, before I go through them manually and then have this break in
> future when more/different environment variables are needed...
> 
> Is there a way to have the systemd --user session share the same
> variables as the X server? Writing a parser for /etc/X11/Xsession.d/
> seems wrong. Am I missing some tool to do that?
> 
> Would I add something like this?
> 
> ExecStartPre=dbus-update-activation-environment --systemd --all

I am not sure I follow what you are trying to do, and I'd strongly
recommend to avoid pushing env vars from privileged code into
unprivileged code, but do note that there's "systemctl
import-environment" for importing env vars set for you.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to have systemd --user instance share the same environment variables as the X server?

2017-02-26 Thread Mantas Mikulėnas
On Sun, Feb 26, 2017 at 11:10 PM, Patrick Schleizer <
patrick-mailingli...@whonix.org> wrote:

> Being on Debian stretch (Qubes). The display manager there does not yet
> get started by systemd --user.
>
> I find it useful to convert /etc/xdg/autostart/app.desktop files to
> systemd --user unit files.
>
> Therefore the environment variables have to be sorted out. On any Linux
> we would have to set at least DISPLAY as well as XAUTHORITY.
>
> On Qubes however, we need a few more environment variables. We need also
> QT_X11_NO_MITSHM=1 and may need a few others ones.
>
> Now, before I go through them manually and then have this break in
> future when more/different environment variables are needed...
>
> Is there a way to have the systemd --user session share the same
> variables as the X server? Writing a parser for /etc/X11/Xsession.d/
> seems wrong. Am I missing some tool to do that?
>
> Would I add something like this?
>
> ExecStartPre=dbus-update-activation-environment --systemd --all
>

Those don't sound like X server variables – they're X *client* variables,
aren't they?

If you're in charge of the distro, and if the variables are fairly static,
a) set them via the pam_env PAM module (i.e. /etc/environment),
or b) set them with Environment= in "user@.service".

That said, in many distributions Xsession already calls
`dbus-update-activation-environment…` right after having sourced all the
Xsession.d scripts.

-- 
Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] How to have systemd --user instance share the same environment variables as the X server?

2017-02-26 Thread Patrick Schleizer
Being on Debian stretch (Qubes). The display manager there does not yet
get started by systemd --user.

I find it useful to convert /etc/xdg/autostart/app.desktop files to
systemd --user unit files.

Therefore the environment variables have to be sorted out. On any Linux
we would have to set at least DISPLAY as well as XAUTHORITY.

On Qubes however, we need a few more environment variables. We need also
QT_X11_NO_MITSHM=1 and may need a few others ones.

Now, before I go through them manually and then have this break in
future when more/different environment variables are needed...

Is there a way to have the systemd --user session share the same
variables as the X server? Writing a parser for /etc/X11/Xsession.d/
seems wrong. Am I missing some tool to do that?

Would I add something like this?

ExecStartPre=dbus-update-activation-environment --systemd --all

Best regards,
Patrick

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel