Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How are servicec enabled during image build? #24

Open
nils-ossenbrink opened this issue Jun 26, 2024 · 2 comments
Open

How are servicec enabled during image build? #24

nils-ossenbrink opened this issue Jun 26, 2024 · 2 comments

Comments

@nils-ossenbrink
Copy link

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:

  • name: Copy start-vpn-client service file.
    copy:
    src: start-vpn-client.service
    dest: /lib/systemd/system/
    mode: 0644
    owner: root
    group: root

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
Copy link
Owner

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
Copy link
Author

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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants