Fixing "idmaps of container and storage volume are not identical"

By chimo on (updated on )

If, for whatever reason, you’re in a situation where a volume cannot be added to a container with an error message similar to: “idmaps of container <container-name> and storage volume <volume-name> are not identical”, you might need to run the following:

# Temporarily make the container privileged
chimo@xps:~$ incus config set <container-name> security.privileged true # Undo the previous operation
chimo@xps:~$ incus config set <container-name> security.privileged false # Restart the container
chimo@xps:~$ incus restart <container-name>

Repeat as necessary if the error complains about a different container.