LXC/LXD v5.3 VolumeType Error cause 'lxc copy' command to fail

Simply splendid, Thomas!

For some reason the sqlite3 command did not work:

$ sudo sqlite3 -table /var/snap/lxd/common/lxd/database/global/db.bin 'select storage_volumes_config.id as configID, storage_volumes.name, key, value from storage_volumes left join storage_volumes_config on storage_volumes.id = storage_volumes_config.storage_volume_id where storage_volumes.type = 0 and storage_volumes_config.key = "size";'
sqlite3: Error: unknown option: -table
Use -help for a list of options.

but after some man page reading and googling, I managed this

$ sudo sqlite3 
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open /var/snap/lxd/common/lxd/database/global/db.bin
sqlite> select storage_volumes_config.id as configID, storage_volumes.name, key, value from storage_volumes left join storage_volumes_config on storage_volumes.id = storage_volumes_config.storage_volume_id where storage_volumes.type = 0 and storage_volumes_config.key = "size";
14|mythserver|size|64GB
28|local-nextcloud-server|size|21GB
32|nextcloud|size|21GB
53|roundcube|size|21GB
161|mailinabox|size|21GB
205|mailserver|size|21GB
260|ldap|size|21GB
287|myNCcontainer|size|21GB
374|nextcloud/snap0|size|21GB
376|d2ks|size|21GB
383|iredmail|size|21GB
sqlite> 

Dang, thatā€™s near all of them! I then created the patch.global.sql with the delete statement and reloaded lxd. Voila! LXD is running and lxc list now returns all my container state (plus Iā€™m able to start the containers that I rely on).

Thank you so much! I could never have figured this out on my own!

I do have some latent errors on startup:

time="2022-08-07T15:37:40-07:00" level=error msg="Failed to update image" err="context canceled" fingerprint=712a5836865525eecd8b429afa7430e8a2480aeff68804c59a0524dc8b7683ab project=default
tail: lxd.log: file truncated
time="2022-08-07T15:37:42-07:00" level=warning msg=" - Couldn't find the CGroup blkio.weight, disk priority will be ignored"
time="2022-08-07T15:37:42-07:00" level=warning msg=" - Couldn't find the CGroup memory swap accounting, swap limits will be ignored"
time="2022-08-07T15:37:45-07:00" level=warning msg="Failed to initialize fanotify, falling back on fsnotify" err="Failed to initialize fanotify: invalid argument"

Not sure if these need any attention.

Thanks again,
-brmiller

1 Like

Excellent! I guess the -table flag is for more recent versions of sqlite, dropping that flag should work and just not give the table header row.

As for the other errors, the ā€œFailed to update imageā€ error will likely be because LXD is being reloaded, and the other warnings are quite normal and shouldnā€™t affect you.