<div dir="auto">Hi Marc,<div dir="auto"><br></div><div dir="auto">it has been a while since working with generators but I think the correct solution is to ensure that the system-presets are configured such that you generated units are enabled by default. Debian for example has a fallback which applies a default preset of disabled for all units unless specifically listed as enabled-by-default</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Nils</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sun, Jun 22, 2025, 23:45 Marc Haber <<a href="mailto:mh%2Bsystemd-devel@zugschlus.de">mh+systemd-devel@zugschlus.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
the following works, but I doubt that it is a nice way to do it. I have <br>
a generator that generates a number of service, and I want all of those <br>
services automatically started at boot. I have:<br>
<br>
$ sudo systemctl cat console-log-8.service<br>
[sudo] password for mh on hover:<br>
# /run/systemd/generator/console-log-8.service<br>
# generated by console-log.generator<br>
<br>
[Unit]<br>
Description=page tty8<br>
After=console-log.target<br>
<br>
[Service]<br>
...<br>
<br>
[Install]<br>
WantedBy=console-log.target<br>
$ sudo systemctl cat console-log-9.service<br>
# /run/systemd/generator/console-log-9.service<br>
# generated by console-log.generator<br>
<br>
[Unit]<br>
Description=page tty9<br>
After=console-log.target<br>
<br>
[Service]<br>
...<br>
<br>
[Install]<br>
WantedBy=console-log.target<br>
$ sudo systemctl cat console-log.target<br>
# /run/systemd/generator/console-log.target<br>
# generated by console-log.generator<br>
<br>
[Unit]<br>
Description=Pull in all console-log units<br>
After=multi-user.target<br>
Wants=console-log-9-var-log-syslog-syslog.service<br>
Wants=console-log-8-var-log-exim4-mainlog.service<br>
<br>
[Install]<br>
WantedBy=multi-user.target<br>
$ sudo systemctl cat console-log-starter.service<br>
# /etc/systemd/system/console-log-starter.service<br>
[Unit]<br>
Description=Start console-log.target at boot<br>
After=multi-user.target<br>
<br>
[Service]<br>
Type=oneshot<br>
ExecStart=/bin/systemctl start console-log.target<br>
RemainAfterExit=yes<br>
<br>
[Install]<br>
WantedBy=multi-user.target<br>
<br>
$<br>
<br>
The console-log-starter.service is the only persistent thing, all others <br>
are generated (including the target since the target lists all generated <br>
services). So I cannot enable them. The console-log-starter.service is <br>
the first unit that I can actually enable.<br>
<br>
When I search on the Internet I read that the generator should generate <br>
"the Wanted" Symlinks itself, but the docs also say that the generator <br>
can't write outside its target directories. And I don't have a clue <br>
which symlinks I am supposed to generate in the generator. And in the <br>
running system I don't see any symlinks regarding my units other than <br>
the <br>
/etc/systemd/system/multi-user.target.wants/console-log-starter.service <br>
-> /etc/systemd/system/console-log-starter.service one that was <br>
generated when I enabled the start service.<br>
<br>
Am I supposed to<br>
ln -s /etc/systemd/system/console-log-8.service /etc/systemd/system/multi-user.target.wants/console-log-8.service and<br>
ln -s /etc/systemd/system/console-log-9.service /etc/systemd/system/multi-user.target.wants/console-log-9.service?<br>
<br>
How am I supposed to do this correctly? Or is my entire approach wrong?<br>
<br>
Greetings<br>
Marc<br>
<br>
<br>
-- <br>
-----------------------------------------------------------------------------<br>
Marc Haber | "I don't trust Computers. They | Mailadresse im Header<br>
Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402<br>
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421<br>
</blockquote></div>