It should be possible to set session default environment variables via a systemd environment generator: https://www.freedesktop.org/software/systemd/man/latest/systemd.environment-generator.html And example would be setting XDG_CACHE_HOME to a value that is not inside a read-only root filesystem, which is not done by the existing read-only rootfs support. An executable script is placed in the appropriate directory to generate a variable: > yocto:~$ ls -l /usr/lib/systemd/user-environment-generators/99-test > -rwxr-xr-x 1 root root 41 Feb 21 19:39 /usr/lib/systemd/user-environment-generators/99-test > > yocto:~$ cat /usr/lib/systemd/user-environment-generators/99-test > #!/bin/sh > > echo "TESTENV=from-generator" It appears that doing this should add the variable the systemd default environment: > yocto:~$ systemctl --user show-environment | grep TESTENV > TESTENV=from-generator And yet the variable is not set in the environment: > yocto:~$ env | grep TESTENV > yocto:~$ I've tested logins via ssh, the virtual console, and the default weston session. For both the weston user as well as root. None of them gain environment variables set by systemd environement generators. Adding the same generator to a Fedora system works as expected.
Do you need to enable 'pam' as a DISTRO_FEATURE ?
It is enabled: DISTRO_FEATURES="debuginfod ext4 ipv4 ipv6 usbhost wifi pci 3g vfat wifi pam efi opengl multiarch wayland vulkan systemd-resolved rauc systemd usrmerge gobject-introspection-data ldconfig"
Hi Trent, Thanks for showing that your DISTRO_FEATURES include pam. Are you able to dig through the systemd configuration and add what's needed to enable this feature and send a patch to master? I only have a kirkstone build at hand but in: tmp/work/core2-64-poky-linux/systemd/1_250.5-r0/temp/log.do_configure I see: Message: Skipping systemd-xdg-autostart-generator.8 because ENABLE_XDG_AUTOSTART is false You seem to be using 5.0.7 aka scarthgap, is that right? ../Randy
Yes, using scarthgap. systemd-xdg-autostart-generator is a service generator. Similar to the one that automatically adds the getty@ttyS0.service serial console unit if the kernel command line references a serial console. But its for desktop app auto start files. Totally unrelated to environment generators.
Thanks for explaining what systemd-xdg-autostart-generator is. Are you able to dig through the systemd configuration and add what's needed to enable this feature and send a patch to master? If so, please put the bug in ACCEPTED and assign it to yourself. Otherwise, I'll set the owner to unassigned and someone might get to this eventually.
I don't know what needs to be done to fix it. I don't think there is a systemd feature that needs to be enabled. I didn't see anything optional in the systemd code related to this. And systemd is running the environment generator and it is adding the output to the environment shown with systemctl show-environment. I think it's something with how user sessions are started, maybe related to systemd-logind, but I've not dug into how all that works now.
"I don't know what needs to be done to fix it." -> unassigned. I thought about suggesting that you strace the various systemd processes on Yocto and Fedora but the logs would be huge! ;-) If you come up with a plan, please let us know here. Thanks Trent.
Bulk move of all unassigned 5.2 medium importance bugs to 5.3.
We don't have anyone to work on this issue, parking in 6.99. If you can check master or wrynose when it's released, that would be good.