Disable autostart globally without removing config on container?

I have a standby server acting as a regular backup target using copy $c --refresh

Is there any way to (temporarily) disable autostart, even when boot.autostart: "true" is configured in the container?

I want to prevent to accidentiacally starting the containers when rebooting but would like to keep the info to allow to switch this server to a temporarily production system.

Hmm, we do have that mechanism for clusters through incus cluster evacuate as a machine marked as evacuated will not start anything on boot or even on user request.

So in a cluster you could do what you want with incus cluster evacuate --action=stop NAME.

But I suspect you are not in a cluster environment which makes this a tiny bit harder.

I see two “ugly” options:

  • Make your server a cluster of one server, that will then let it use the incus cluster commands including that evacuation logic. But you need to make sure that the IP address of your server doesn’t change as this is going to be operating the database the same way it would in a real multi-server cluster.
  • Try to mark your server as evacuated even though it’s not in a cluster. You should be able to do that with incus admin sql global "UPDATE nodes SET state=2". If you ever need the machine to be able to actually start instances again, you’d then need to do the same but with state=0.

Thanks @stgraber,

that did the trick! I decided for the second option via db update not to rely on the IP and put it into a simple script not to forget in case I need to start a container manually:



# s. https://discuss.linuxcontainers.org/t/disable-autostart-globally-without-removing-config-on-container/19109/2?u=hi-ko

if [ "$1" = "true" ];then
        incus admin sql global "UPDATE nodes SET state=2"
elif [ "$1" = "false" ];then
        incus admin sql global "UPDATE nodes SET state=0"
        echo "please set parameter 'true' or 'false'"
        echo "$0 true|false"
        exit 1

ouch - in evacuated state copy --refresh to this incus instance no longer works:

Error: Failed instance creation: Cluster member is evacuated

@stgraber, do you have another idea how to get an instance in a kind of standby role not starting any container but receiving incremental copies?

As a work around I will add --config boot.autostart=false to the copy command.