[systemd-devel] A way to pass runtime-defined XDG_CONFIG_DIRS to xdg-autostart-generators

2022-10-20 Thread Slava Aseev

Hello!

I recently ran into some problem with systemd booted KDE: the autostart 
from KDE related paths doesn't work.
Compounding the problem, there is no way to properly fix that with 
environment generators (or configs for systemd-environment-d-generator), 
because the required XDG_CONFIG_DIRS is set by the startkde application. 
Of course, we can create a config with variables in /lib/environment.d/, 
but this will work for all DEs (not only for KDE) and will also mean 
duplicating variables (which can already be set by the startkde app).


It is also worth noting that the startkde app passes all set XDG_* 
environment variables to systemd (by calling the 
org.freedesktop.systemd1.Manager.UnsetAndSetEnvironment), but systemd 
does not pass them to xdg-autostart-generator (after 
org.freedesktop.systemd1.Manager.Reload). This is because variables 
passed to systemd end up in client_environment (which remain intact 
after Reload), but generators take transient_environment only (which are 
generated on every Reload by environment generators).


So the questions are: Is there a way to pass variables from 
client_environment to transient_environment on Reload? And if not, 
should it exist? (maybe the startkde is doing something wrong and should 
not set variables itself?)


Thanks.

--
Best regards,
Slava Aseev



Re: [systemd-devel] systemd-container: Trying to use a bookworm chroot with a buster host fails / Failed to create /init.scope control group

2022-10-20 Thread Lennart Poettering
On Mo, 17.10.22 01:38, Michael Biebl (mbi...@gmail.com) wrote:

> What are you Missing?

Come on, you have the original email:

https://lists.freedesktop.org/archives/systemd-devel/2022-October/048453.html

"What is mounted to /sys/fs/cgroup and below?"

"if you force container into cgroupsv1 mode as the host (by adding
systemd.unified_cgroup_hierarchy=no to the nspawn cmdline, does that
work?"

Also, please provide the relevant output from "strace -f -s 500 -y -o
/tmp/log.strace" (put on some pastebin)

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] systemd.mount - How to disable the auto-creation of the directory (directories)

2022-10-20 Thread Lennart Poettering
On Do, 20.10.22 09:18, kAja Ziegler (ziegl...@gmail.com) wrote:

> Hello,
>
> Is there any way to turn off the automatic directory (directories) creation
> during mount unit start/run? To make the [auto-generated] mount unit behave
> the same as the mount command - to end with an error?

Add a .mount drop-in for your unit that sets AssertPathExists= to your
path in the [Unit] section.

i.e. create /etc/systemd/system/mnt-x.mount.d/50-myassert.conf, and
add:

[Unit]
AsserPathExists=/mnt/x

into it.

Lennart

--
Lennart Poettering, Berlin


[systemd-devel] systemd.mount - How to disable the auto-creation of the directory (directories)

2022-10-20 Thread kAja Ziegler
Hello,

Is there any way to turn off the automatic directory (directories) creation
during mount unit start/run? To make the [auto-generated] mount unit behave
the same as the mount command - to end with an error?

- from the systemd.mount man page:

What=
Takes an absolute path of a device node, file or other resource to mount.
See mount(8) for details. If this refers to a device node, a dependency on
the respective device unit is automatically created. (See systemd.device(5)
for more information.)
This option is mandatory.

Where=
Takes an absolute path of a directory of the mount point. If the mount
point does not exist at the time of mounting, it is created. This string
must be reflected in the unit filename. (See above.) This option is
mandatory.

- example:
 - fstab:
/mnt/x/mnt/ynonebind0 0

  - commands:
# systemctl daemon-reload
# systemctl --version
systemd 250 (v250.8-1.fc36)
# ls -1 /mnt
# mount /mnt/y
mount: /mnt/y: mount point does not exist.
dmesg(1) may have more information after failed mount system call.
# ls -1 /mnt
# systemctl cat mnt-y.mount
# /run/systemd/generator/mnt-y.mount
# Automatically generated by systemd-fstab-generator

[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target

[Mount]
What=/mnt/x
Where=/mnt/y
Type=none
Options=bind
# systemctl start mnt-y.mount
# systemctl status mnt-y.mount
● mnt-y.mount - /mnt/y
Loaded: loaded (/etc/fstab; generated)
Active: active (mounted) since Thu 2022-10-20 09:01:05 CEST; 13s ago
Until: Thu 2022-10-20 09:01:05 CEST; 13s ago
Where: /mnt/y
What: /dev/mapper/vg_sys-lv_root
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Tasks: 0 (limit: 9333)
Memory: 16.0K
CPU: 6ms
CGroup: /system.slice/mnt-y.mount

Oct 20 09:01:05 demo-lab systemd[1]: Mounting mnt-y.mount - /mnt/y...
Oct 20 09:01:05 demo-lab systemd[1]: Mounted mnt-y.mount - /mnt/y.
# mount | fgrep /mnt/y
/dev/mapper/vg_sys-lv_root on /mnt/y type ext4
(rw,relatime,seclabel,errors=remount-ro)
# findmnt
TARGET SOURCE
FSTYPE  OPTIONS
...
├─/mnt/y   /dev/mapper/vg_sys-lv_root[/mnt/x] ext4
   rw,relatime,seclabel,errors=remount-ro
...
# ls -1 /mnt
x
y

The systemd.mount unit created both directories - the destination directory
/mnt/y (Where=) and also the source directory /mnt/x (What=). Additionally,
this behavior for What= is not mentioned in the man page.


Thank you and with best regards,
-- 
Karel Ziegler

 e-mail:ziegl...@gmail.com