All of lore.kernel.org
 help / color / mirror / Atom feed
* Disable systemd-timesyncd.service in image
@ 2020-11-23 19:50 Damien LEFEVRE
  2020-11-23 20:21 ` [yocto] " Joel A Cohen
  0 siblings, 1 reply; 4+ messages in thread
From: Damien LEFEVRE @ 2020-11-23 19:50 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

Hi,

I would like to have systemd-timesyncd.service as part of an image but have
it disabled by default.

Right now it is enabled by default which causes some issues.

I've tried systemd_%.bbappend

do_install_append() {
    rm "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
    rm
"$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
}

but those symlinks are not part of the package.

I've tried this to remove the link during the package deployment during
do_rootfs
pkg_postinst_${PN}_append() {
    #!/bin/sh -e
    rm "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
    rm
"$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
}

But at this stage the links still don't exist.

Which package is actually responsible for enabling the default services /
creating the symlinks? How can we turn some of them off while keeping them
in the image?

Thanks,
-Damien

[-- Attachment #2: Type: text/html, Size: 1304 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [yocto] Disable systemd-timesyncd.service in image
  2020-11-23 19:50 Disable systemd-timesyncd.service in image Damien LEFEVRE
@ 2020-11-23 20:21 ` Joel A Cohen
  2020-11-23 20:42   ` Konrad Weihmann
  0 siblings, 1 reply; 4+ messages in thread
From: Joel A Cohen @ 2020-11-23 20:21 UTC (permalink / raw)
  To: Damien LEFEVRE; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 1433 bytes --]

I think you need to set SYSTEMD_AUTO_ENABLE = “disable” (actually any value
other than “enable”) in your bbappend.

(It looks like SYSTEMD_AUTO_ENABLE_${PN} is intended to work too, but I
can’t verify it at the moment and reading over systemd.bbclass I’m not sure
if it works or not)

—Aaron

On Mon, Nov 23, 2020 at 11:51 AM Damien LEFEVRE <lefevre.da@gmail.com>
wrote:

> Hi,
>
> I would like to have systemd-timesyncd.service as part of an image but
> have it disabled by default.
>
> Right now it is enabled by default which causes some issues.
>
> I've tried systemd_%.bbappend
>
> do_install_append() {
>     rm "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
>     rm
> "$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
> }
>
> but those symlinks are not part of the package.
>
> I've tried this to remove the link during the package deployment during
> do_rootfs
> pkg_postinst_${PN}_append() {
>     #!/bin/sh -e
>     rm "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
>     rm
> "$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
> }
>
> But at this stage the links still don't exist.
>
> Which package is actually responsible for enabling the default services /
> creating the symlinks? How can we turn some of them off while keeping them
> in the image?
>
> Thanks,
> -Damien
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 2371 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [yocto] Disable systemd-timesyncd.service in image
  2020-11-23 20:21 ` [yocto] " Joel A Cohen
@ 2020-11-23 20:42   ` Konrad Weihmann
  2020-11-24  8:14     ` Damien LEFEVRE
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Weihmann @ 2020-11-23 20:42 UTC (permalink / raw)
  To: yocto, lefevre.da

The service is deployed with standard systemd package, which doesn't 
have that set as far as I see it (no SYSTEMD_AUTO_ENABLE_${PN} in the 
latest recipe revision)

I think, after browsing through the code of systemd - this "autostart" 
behavior comes from [1].
So I would say you can disable it with a drop-in file at
/etc/systemd/system/systemd-timesyncd.service.d/disable.conf
[Install]
WantedBy=

which also would be charming in a way that it isn't that invasive in the 
build system

[1] 
https://github.com/systemd/systemd/blob/5b639090d0b4a49d77ba58bebe180b2a6f8da322/units/systemd-timesyncd.service.in#L55

haven't tested it though, but you might wanna give that a shot, if 
Aaron's approach doesn't work.

On 23.11.20 21:21, Joel A Cohen wrote:
> I think you need to set SYSTEMD_AUTO_ENABLE = “disable” (actually any 
> value other than “enable”) in your bbappend.
> 
> (It looks like SYSTEMD_AUTO_ENABLE_${PN} is intended to work too, but I 
> can’t verify it at the moment and reading over systemd.bbclass I’m not 
> sure if it works or not)
> 
> —Aaron
> 
> On Mon, Nov 23, 2020 at 11:51 AM Damien LEFEVRE <lefevre.da@gmail.com 
> <mailto:lefevre.da@gmail.com>> wrote:
> 
>     Hi,
> 
>     I would like to have systemd-timesyncd.service as part of an image
>     but have it disabled by default.
> 
>     Right now it is enabled by default which causes some issues.
> 
>     I've tried systemd_%.bbappend
> 
>     do_install_append() {
>          rm "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
>          rm
>     "$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
>     }
> 
>     but those symlinks are not part of the package.
> 
>     I've tried this to remove the link during the package deployment
>     during do_rootfs
>     pkg_postinst_${PN}_append() {
>          #!/bin/sh -e
>          rm "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
>          rm
>     "$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
>     }
> 
>     But at this stage the links still don't exist.
> 
>     Which package is actually responsible for enabling the default
>     services / creating the symlinks? How can we turn some of them off
>     while keeping them in the image?
> 
>     Thanks,
>     -Damien
> 
> 
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [yocto] Disable systemd-timesyncd.service in image
  2020-11-23 20:42   ` Konrad Weihmann
@ 2020-11-24  8:14     ` Damien LEFEVRE
  0 siblings, 0 replies; 4+ messages in thread
From: Damien LEFEVRE @ 2020-11-24  8:14 UTC (permalink / raw)
  To: Konrad Weihmann; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 3082 bytes --]

Yes SYSTEMD_AUTO_ENABLE_${PN} doesn't apply to systemd recipe core services
as they are not installed as separate packages.

But I got it working now.

The default enable/disable service are defined in
https://github.com/systemd/systemd/blob/master/presets/90-systemd.preset

So
do_configure_append() {
    sed -i -e "s/enable systemd-timesyncd.service/disable
systemd-timesyncd.service/g" ${S}/presets/90-systemd.preset
}

does the trick

Cheers,
-Damien

On Mon, Nov 23, 2020 at 10:42 PM Konrad Weihmann <kweihmann@outlook.com>
wrote:

> The service is deployed with standard systemd package, which doesn't
> have that set as far as I see it (no SYSTEMD_AUTO_ENABLE_${PN} in the
> latest recipe revision)
>
> I think, after browsing through the code of systemd - this "autostart"
> behavior comes from [1].
> So I would say you can disable it with a drop-in file at
> /etc/systemd/system/systemd-timesyncd.service.d/disable.conf
> [Install]
> WantedBy=
>
> which also would be charming in a way that it isn't that invasive in the
> build system
>
> [1]
>
> https://github.com/systemd/systemd/blob/5b639090d0b4a49d77ba58bebe180b2a6f8da322/units/systemd-timesyncd.service.in#L55
>
> haven't tested it though, but you might wanna give that a shot, if
> Aaron's approach doesn't work.
>
> On 23.11.20 21:21, Joel A Cohen wrote:
> > I think you need to set SYSTEMD_AUTO_ENABLE = “disable” (actually any
> > value other than “enable”) in your bbappend.
> >
> > (It looks like SYSTEMD_AUTO_ENABLE_${PN} is intended to work too, but I
> > can’t verify it at the moment and reading over systemd.bbclass I’m not
> > sure if it works or not)
> >
> > —Aaron
> >
> > On Mon, Nov 23, 2020 at 11:51 AM Damien LEFEVRE <lefevre.da@gmail.com
> > <mailto:lefevre.da@gmail.com>> wrote:
> >
> >     Hi,
> >
> >     I would like to have systemd-timesyncd.service as part of an image
> >     but have it disabled by default.
> >
> >     Right now it is enabled by default which causes some issues.
> >
> >     I've tried systemd_%.bbappend
> >
> >     do_install_append() {
> >          rm
> "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
> >          rm
> >
>  "$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
> >     }
> >
> >     but those symlinks are not part of the package.
> >
> >     I've tried this to remove the link during the package deployment
> >     during do_rootfs
> >     pkg_postinst_${PN}_append() {
> >          #!/bin/sh -e
> >          rm
> "$D/etc/systemd/system/dbus-org.freedesktop.timesync1.service"
> >          rm
> >
>  "$D/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
> >     }
> >
> >     But at this stage the links still don't exist.
> >
> >     Which package is actually responsible for enabling the default
> >     services / creating the symlinks? How can we turn some of them off
> >     while keeping them in the image?
> >
> >     Thanks,
> >     -Damien
> >
> >
> >
> >
> >
> > 
> >
>

[-- Attachment #2: Type: text/html, Size: 4430 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-24  8:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 19:50 Disable systemd-timesyncd.service in image Damien LEFEVRE
2020-11-23 20:21 ` [yocto] " Joel A Cohen
2020-11-23 20:42   ` Konrad Weihmann
2020-11-24  8:14     ` Damien LEFEVRE

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.