At what point lxd started instances?

Hi,

I’d like to know at what point those autostart instance got started? is it after

snap.lxd.daemon.service
?
Thanks,

Yeah, it’s done as part of the daemon starting up, so usually a few seconds after snap.lxd.daemon.service is marked as started.

thanks, following your other post:

I come out with a service to be run before the lxd.daemon:

[Unit]
Description=Setup foo
Before=snap.lxd.daemon.service

[Service]
Type=oneshot
ExecStart=/opt/foo/setup-foo.sh
RemainAfterExit=true
ExecStop=/opt/foo/teardown-foo.sh
StandardOutput=journal

[Install]
WantedBy=multi-user.target

if setup-foo.sh succeeded , snap.lxd.daemon.service got started, good, but if setup-foo.sh failed , snap.lxd.daemon.service got started as well, is this how ‘Before’ directive works? thanks

Apr 28 13:27:37 backup systemd[1]: foo.service: Main process exited, code=exited, status=1/FAILURE
Apr 28 13:27:37 backup systemd[1]: foo.service: Failed with result 'exit-code'.
Apr 28 13:27:37 backup systemd[1]: Failed to start Setup foo.

That’s indeed how a Before stanza works, it guarantees order, it doesn’t block on failure.
For that you’d need an override on snap.lxd.daemon with a Requires I believe.

Thanks, that’s exactly what I need.