Hi Marc, 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
Cheers, Nils On Sun, Jun 22, 2025, 23:45 Marc Haber <mh+systemd-de...@zugschlus.de> wrote: > Hi, > > the following works, but I doubt that it is a nice way to do it. I have > a generator that generates a number of service, and I want all of those > services automatically started at boot. I have: > > $ sudo systemctl cat console-log-8.service > [sudo] password for mh on hover: > # /run/systemd/generator/console-log-8.service > # generated by console-log.generator > > [Unit] > Description=page tty8 > After=console-log.target > > [Service] > ... > > [Install] > WantedBy=console-log.target > $ sudo systemctl cat console-log-9.service > # /run/systemd/generator/console-log-9.service > # generated by console-log.generator > > [Unit] > Description=page tty9 > After=console-log.target > > [Service] > ... > > [Install] > WantedBy=console-log.target > $ sudo systemctl cat console-log.target > # /run/systemd/generator/console-log.target > # generated by console-log.generator > > [Unit] > Description=Pull in all console-log units > After=multi-user.target > Wants=console-log-9-var-log-syslog-syslog.service > Wants=console-log-8-var-log-exim4-mainlog.service > > [Install] > WantedBy=multi-user.target > $ sudo systemctl cat console-log-starter.service > # /etc/systemd/system/console-log-starter.service > [Unit] > Description=Start console-log.target at boot > After=multi-user.target > > [Service] > Type=oneshot > ExecStart=/bin/systemctl start console-log.target > RemainAfterExit=yes > > [Install] > WantedBy=multi-user.target > > $ > > The console-log-starter.service is the only persistent thing, all others > are generated (including the target since the target lists all generated > services). So I cannot enable them. The console-log-starter.service is > the first unit that I can actually enable. > > When I search on the Internet I read that the generator should generate > "the Wanted" Symlinks itself, but the docs also say that the generator > can't write outside its target directories. And I don't have a clue > which symlinks I am supposed to generate in the generator. And in the > running system I don't see any symlinks regarding my units other than > the > /etc/systemd/system/multi-user.target.wants/console-log-starter.service > -> /etc/systemd/system/console-log-starter.service one that was > generated when I enabled the start service. > > Am I supposed to > ln -s /etc/systemd/system/console-log-8.service > /etc/systemd/system/multi-user.target.wants/console-log-8.service and > ln -s /etc/systemd/system/console-log-9.service > /etc/systemd/system/multi-user.target.wants/console-log-9.service? > > How am I supposed to do this correctly? Or is my entire approach wrong? > > Greetings > Marc > > > -- > > ----------------------------------------------------------------------------- > Marc Haber | "I don't trust Computers. They | Mailadresse im Header > Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 > Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421 >