Error: The 'default' profile cannot be deleted

I want to create a script to purge all lxd related configuration, so I can do a new configuration setup. After deleting all containers I am stuck at the command:

lxc profile delete default

which gives me:

Error: The 'default' profile cannot be deleted

Neither I can delete the only storage pool I have, because I get:

Error: Storage pool "srv_pool" has profiles using it:
default

Checkmate. How can I remove default profile or how can I change gedault configuration with another --preseed option?

The default profile cannot be erased.
But what you can do, is change it so that it does not specify a disk. Then you should be able to delete the storage.

1 Like

Easiest way to reset it is by pushing an empty profile in its place:

printf 'config: {}\ndevices: {}' | lxc profile edit default
2 Likes

I see. So everything else (network, storage etc) BUT the default profile could be deleted. I already (between posting the question and getting your answer) reached a workaround by removing and reinstalling lxd snap - not the most elegant solution but ensures no loose ends such are left.

I haven’t seen such information anywhere in the docs. Either I missed it or the manual should be more vocal about this, cause the defaults, at least for me, are not intuitive.

PS. I don’t want to sound too harsh - I admire your work guys, thanks for the replies!

Yeah, we have some assumptions internally that a default profile always exists.
That’s what we pick if no profile is listed, that’s also what we use when migrating containers and we can’t find a root device, …

We used to allow deleting it but it was wrecking havoc, so we’ve protected both the default profile and default project so they can’t be deleted or renamed.