Closed bitranox closed 3 years ago
The systemd error seems to be coming from the fact that your script is being triggered through a stop action on the same systemd target as what snapd uses for the transient units created whenever a lxc
command is run. This then causes systemd to fail with that error telling you that you're trying to run a start
action as part of a stop
operation and fail.
You may have some luck by moving dependencies or targets around to ensure your service triggers separately from what causes the LXD shutdown. Or you could have your python script use pylxd to bypass that systemd wrapper on the lxc
tool (though you may still hit some issues as systemd manages connections on the unix socket and may still block that).
I'm also a bit confused as to what your service is doing. You say it's looking at lxc info
and then doing lxc stop
on reboot and shutdown. That's exactly what LXD itself does out of the box, so I'm not sure why any of this is needed in the first place :)
Closing as not a LXD issue, this would probably have been better handled as a support question on our forum, https://discuss.linuxcontainers.org. But happy to keep chatting about it here.
Thanks Stephane - I opened the same issue on https://discuss.linuxcontainers.org. to discuss it there further ... thanks a lot Robert, Vienna
Required information
Distribution: Ubuntu Hirsute
The output of "lxc info":
Issue description
I can not stop LXC Containers with a service - always some errors like :
Steps to reproduce
just any service description does not work - nothing seem to work. I tried a lot of different Targets and Services, there seems to be always a conflict like described above.
The question is, how to configure such a service so that
lxc info <name>
andlxc stop <name>
can work on reboot/shutdown ?