lueschem / edi-cl

This repository contains an edi project configuration for Compulab embedded devices.
https://www.get-edi.io
Other
10 stars 2 forks source link

How are servicec enabled during image build? #24

Open nils-ossenbrink opened 4 days ago

nils-ossenbrink commented 4 days ago

Hello Matthias,

there is (at least) one thing left which I do not understand: How are the services which I install by copying the service unit files to /lib/systemd/system/ enabled? I recognised that the are enabled by default. How can prevent them for being enabled?

For example this ansible play:

leads to this one after first boot:

/etc/systemd/system/multi-user.target.wants/start-vpn-client.service -> /lib/systemd/system/start-vpn-client.service

How can I prevent edi from adding those links?

Thanks in advance!

Nils

lueschem commented 3 days ago

The enabling of services is done automatically on the first boot (see also systemd-firstboot. On Debian, by default services get enabled if present. Luckily you can change the default behavior by dropping a preset file such as 95-start-vpn-client.preset into the folder /lib/systemd/system-preset. The content of the file would be a single line like disable start-vpn-client.service. Like that the service would remain disabled.

nils-ossenbrink commented 3 days ago

Great. Thanks for that information, I didnt know that. First I suspected edi to do some magic in the background. But by taking a look into the lxc container I saw that there were no links present after creating the image. Now it makes absolutely sense to me :-)