Systemd service gets automatically started on Raspberry Pi / Debian Trixie

I have a weird behavior that I cannot understand. I am running on a Raspberry Pi OS (Debian Trixie).

If I create a simple file /lib/systemd/system/foo.service without enabling it.

[Unit]
Description=Foo

[Service]
Type=oneshot
ExecStart=/bin/echo FOO

[Install]
WantedBy=multi-user.target

It somehow gets started after I reboot even though I did not enable it and ends up as a symlink in /etc/systemd/system/multi-user.target.wants/foo.service.
If I disable it the symlink disappears but reappears after a reboot.

I checked the presets in /lib/systemd/system-preset/*.preset but there is no wildcard.

What else could I check and is this an expected behavior? I have an Arch Linux machine as well as an Ubuntu one on my PC and I do not see this behavior.

Read more here: Source link