Failed instance creation (LVM / xfs)

Hello, I have a strange error on a ubuntu 16.04 host when I try to create a new container:

lxc init images:ubuntu/focal/amd64 t1
Error: Failed instance creation: Failed creating instance from image: Failed to mount LVM logical volume: Failed to mount "/dev/lxcCONTPOOL/containers_t1" on "/var/snap/lxd/common/lxd/storage-pools/default/containers/t1" using "xfs": invalid argument

In /var/snap/lxd/common/lxd/logs/lxd.log the output is:

t=2021-09-24T09:14:58+0200 lvl=dbug msg="Responding to instance create" 
t=2021-09-24T09:14:58+0200 lvl=dbug msg="Connecting to a remote simplestreams server" URL=https://cloud-images.ubuntu.com/releases
t=2021-09-24T09:14:58+0200 lvl=dbug msg="New task Operation: 0768a83a-edb7-4202-8e85-dbc2d905a51f" 
t=2021-09-24T09:14:58+0200 lvl=dbug msg="Started task operation: 0768a83a-edb7-4202-8e85-dbc2d905a51f" 
t=2021-09-24T09:14:58+0200 lvl=dbug msg="\n\t{\n\t\t\"type\": \"async\",\n\t\t\"status\": \"Operation created\",\n\t\t\"status_code\": 100,\n\t\t\"operation\": \"/1.0/operations/0768a83a-edb7-4202-8e85-dbc2d905a51f\",\n\t\t\"error_code\": 0,\n\t\t\"error\": \"\",\n\t\t\"metadata\": {\n\t\t\t\"id\": \"0768a83a-edb7-4202-8e85-dbc2d905a51f\",\n\t\t\t\"class\": \"task\",\n\t\t\t\"description\": \"Creating instance\",\n\t\t\t\"created_at\": \"2021-09-24T09:14:58.829229458+02:00\",\n\t\t\t\"updated_at\": \"2021-09-24T09:14:58.829229458+02:00\",\n\t\t\t\"status\": \"Running\",\n\t\t\t\"status_code\": 103,\n\t\t\t\"resources\": {\n\t\t\t\t\"containers\": [\n\t\t\t\t\t\"/1.0/containers/t1\"\n\t\t\t\t],\n\t\t\t\t\"instances\": [\n\t\t\t\t\t\"/1.0/instances/t1\"\n\t\t\t\t]\n\t\t\t},\n\t\t\t\"metadata\": null,\n\t\t\t\"may_cancel\": false,\n\t\t\t\"err\": \"\",\n\t\t\t\"location\": \"none\"\n\t\t}\n\t}" 
t=2021-09-24T09:14:58+0200 lvl=dbug msg="Connecting to a remote simplestreams server" URL=https://cloud-images.ubuntu.com/releases
t=2021-09-24T09:14:58+0200 lvl=dbug msg=Handling ip=@ method=GET protocol=unix url=/1.0/operations/0768a83a-edb7-4202-8e85-dbc2d905a51f username=davide
t=2021-09-24T09:14:59+0200 lvl=dbug msg="Acquiring lock for image download of \"a068e8daef0f88c667fd0f201ed0de1c48693ee383eeafbee6a51b79b0d29fea\"" 
t=2021-09-24T09:14:59+0200 lvl=dbug msg="Lock acquired for image download of \"a068e8daef0f88c667fd0f201ed0de1c48693ee383eeafbee6a51b79b0d29fea\"" 
t=2021-09-24T09:14:59+0200 lvl=dbug msg="Image already exists in the DB" fingerprint=a068e8daef0f88c667fd0f201ed0de1c48693ee383eeafbee6a51b79b0d29fea
t=2021-09-24T09:14:59+0200 lvl=info msg="Creating container" ephemeral=false instance=t1 instanceType=container project=default
t=2021-09-24T09:14:59+0200 lvl=dbug msg="FillInstanceConfig started" driver=lvm instance=t1 pool=default project=default
t=2021-09-24T09:14:59+0200 lvl=dbug msg="FillInstanceConfig finished" driver=lvm instance=t1 pool=default project=default
t=2021-09-24T09:14:59+0200 lvl=info msg="Created container" ephemeral=false instance=t1 instanceType=container project=default
t=2021-09-24T09:14:59+0200 lvl=dbug msg="CreateInstanceFromImage started" driver=lvm instance=t1 pool=default project=default
t=2021-09-24T09:15:02+0200 lvl=dbug msg="Logical volume created" driver=lvm fs=xfs lv_name=containers_t1 pool=default size=3221225472b vg_name=lxcCONTPOOL
t=2021-09-24T09:15:14+0200 lvl=dbug msg="Logical volume removed" dev=/dev/lxcCONTPOOL/containers_t1 driver=lvm pool=default
t=2021-09-24T09:15:14+0200 lvl=dbug msg="CreateInstanceFromImage finished" driver=lvm instance=t1 pool=default project=default
t=2021-09-24T09:15:14+0200 lvl=dbug msg="Failure for task operation: 0768a83a-edb7-4202-8e85-dbc2d905a51f: Failed creating instance from image: Failed to mount LVM logical volume: Failed to mount \"/dev/lxcCONTPOOL/containers_t1\" on \"/var/snap/lxd/common/lxd/storage-pools/default/containers/t1\" using \"xfs\": invalid argument" 
t=2021-09-24T09:15:14+0200 lvl=dbug msg="Event listener finished: db67a844-9a53-4139-9be4-712e36a16e38" 
t=2021-09-24T09:15:14+0200 lvl=dbug msg="Disconnected event listener: db67a844-9a53-4139-9be4-712e36a16e38" 

I have try the same command in another host and there is no error.

Any idea?

Anything interesting in dmesg?

yes…

XFS (dm-12): Superblock has unknown read-only compatible features (0x4) enabled.
XFS (dm-12): Attempted to mount read-only compatible filesystem read-write.
XFS (dm-12): Filesystem can only be safely mounted read only.
XFS (dm-12): SB validate failed with error -22.

I wonder if we’re somehow getting some incompatibility between what mkfs.xfs gets us and what the kernel supports.

Are your other systems also on 16.04?

Yes, and I have already try the same command: no error.

This looks like the same kind of problem:

https://www.humblec.com/ceph-csi-xfs-superblock-has-unknown-read-only-or-wrong-fs-type-bad-on-dev-rbd4-missing-codepage-or/