yoctosystemd

Disable a standard systemd service in Yocto build


I need to start my own systemd service, let's call it custom.service. I know how to write a recipe for it to be added and enabled on boot:

SYSTEMD_SERVICE_${PN} = "custom.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"

However, it conflicts with one of the default systemd services - systemd-timesyncd.service.

Is there a nice preferred way to disable that default systemd service in my bitbake file even though the systemd_XX.bb actually enables it?

I can create a systemd_%.bbappend file to modify the systemd settings, but I can't locate the place where one service can be disabled leaving all others enabled.


The working solution I found is to remove the timesyncd altogether using

PACKAGECONFIG_remove = "timesyncd"

But I wonder if this is a appropriate way and if there is a way to just disable it, but leave in the system.


Solution

  • If the system runs fine with the other package removed, then removing the package is a preferred solution. Fewer packages means a simpler system.