I need to enable systemd services before I'm actually booting the system (for unattended install purposes). Therefore I can't use systemctl. I could use systemd-nspawn, but I think it not that well suited for scripting.
I know that systemctl creates a symlink, but is that all I have to do and can I do it without 'disturbing' systemd?
This seems to work, but can you confirm it?
ln -s /usr/lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service
Best Answer
How to use
systemd-nspawn
to enable a service or perform changes onsystemd
:Warning: Just using a symlink may cause issues as systemd processes the
[Install]
section of the unit file and the symlink may cause corruption. Improvements thanks to @神秘德里克.