The default profile no longer used for creating new instances?

I have a problem with creating new instances with the latest lxd (clustering):

$ snap info lxd
...
installed:          4.6                    (17597) 71MB -

When creating new instances suddenly I get the following error:

$ lxc launch ubuntu:focal ubuntu
Creating ubuntu
Error: Failed instance creation: Create instance: Create instance: Invalid devices: Failed detecting root disk device: No root device could be found

Looking at the debug output, it looks like no profile has been included upon creation:

$ lxc launch ubuntu:focal ubuntu --debug
...
Creating ubuntu
DBUG[10-07|12:37:57] Connecting to a remote simplestreams server 
DBUG[10-07|12:37:57] Connected to the websocket: ws://unix.socket/1.0/events 
DBUG[10-07|12:37:57] Sending request to LXD                   method=POST url=http://unix.socket/1.0/instances etag=
DBUG[10-07|12:37:57] 
	{
		"architecture": "",
		"config": {},
		"devices": {},
		"ephemeral": false,
		"profiles": null,
		"stateful": false,
		"description": "",
		"name": "ubuntu",
		"source": {
			"type": "image",
			"certificate": "",
			"alias": "focal",
			"server": "https://cloud-images.ubuntu.com/releases",
			"protocol": "simplestreams",
			"mode": "pull"
		},
		"instance_type": "",
		"type": "container"
	} 
...

When I manually include the default profile, the instance is created successfully:

$ lxc launch ubuntu:focal ubuntu -p default
Creating ubuntu
Starting ubuntu  

Here is my default profile:

~$ lxc profile show default
config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    network: lxdfan0
    type: nic
  root:
    path: /
    pool: local
    type: disk
name: default

Has this behaviour been changed and the default profile is not included by default anymore?

Yeah, that’s an issue we’ve seen a few times, effectively the image is getting detached from the default profile during a refresh. I have logs showing it happening but haven’t yet found the right way to fix this consistently.

If you do lxc query /1.0/images?recursion=1 | less then look for images that show "profiles": [] those are the problematic ones.

You can fix them with lxc image edit FINGERPRINT and then adding default back to the profiles list on the image.

My current suspicion is that this happens when two cluster members refresh the exact same image at the exact same time and hit a DB issue.

We have plans to overhaul the way this works over the next few months by not actually having this kind of image refresh happen, instead having a single cluster member handle the entire refresh process for an image, then pushing to the other members that have it rather than all of them doing it on their own.

Indeed, looks like a few images have the empty list of profiles:

...
        {
                "aliases": [],
                "architecture": "x86_64",
                "auto_update": true,
                "cached": true,
                "created_at": "2020-09-21T00:00:00Z",
                "expires_at": "2025-04-23T00:00:00Z",
                "filename": "ubuntu-20.04-server-cloudimg-amd64-lxd.tar.xz",
                "fingerprint": "4746a4889a31e449e6c5e2764eb733a60e85131be3165c91d5f5a8346f0ba43c",
                "last_used_at": "2020-10-07T12:50:54.104858977Z",
                "profiles": [],
                "properties": {
                        "architecture": "amd64",
                        "description": "ubuntu 20.04 LTS amd64 (release) (20200921.1)",
                        "label": "release",
                        "os": "ubuntu",
                        "release": "focal",
                        "serial": "20200921.1",
                        "type": "squashfs",
                        "version": "20.04"
                },
                "public": false,
                "size": 372441888,
                "type": "container",
                "update_source": {
                        "alias": "focal",
                        "certificate": "",
                        "image_type": "",
                        "protocol": "simplestreams",
                        "server": "https://cloud-images.ubuntu.com/releases"
                },
                "uploaded_at": "2020-10-07T02:07:09.904160629Z"
        },
...

I did not know that profiles are stored with images.

Does it mean that deleting this image should solve the problem, at least temporarily?

Adding the profile manually did the trick. Thanks!

Correct, images are tied to profiles, normally all images are tied to the default profile unless it’s changed by the user.

That feature lets you alter some images to have them default to using a different set of profiles when none are specified by the user.