after updating my ubuntu 18.04. installation, the lxd daemon is not starting up again and no container is being started. The log says “Error: failed to prepare loop device: no such file or directory”. Maybe it has something to do with the strorage pool “lvm” which I created during installation and tried to delete without success after the VG was deleted?!
Can someone help me fix this? Thank you very much!
lxd --debug --group lxd
INFO[11-18|23:56:30] LXD 3.0.2 is starting in normal mode path=/var/lib/lxd
INFO[11-18|23:56:30] Kernel uid/gid map:
INFO[11-18|23:56:30] - u 0 0 4294967295
INFO[11-18|23:56:30] - g 0 0 4294967295
INFO[11-18|23:56:30] Configured LXD uid/gid map:
INFO[11-18|23:56:30] - u 0 100000 65536
INFO[11-18|23:56:30] - g 0 100000 65536
WARN[11-18|23:56:30] CGroup memory swap accounting is disabled, swap limits will be ignored.
INFO[11-18|23:56:30] Initializing local database
INFO[11-18|23:56:30] Initializing database gateway
INFO[11-18|23:56:30] Start database node address= id=1
INFO[11-18|23:56:30] Raft: Restored from snapshot 1-742-1542568879099
INFO[11-18|23:56:30] Raft: Initial configuration (index=1): [{Suffrage:Voter ID:1 Address:0}]
INFO[11-18|23:56:30] Raft: Node at 0 [Leader] entering Leader state
INFO[11-18|23:56:30] Dqlite: starting event loop
DBUG[11-18|23:56:30] Dqlite: accepting connections
INFO[11-18|23:56:30] LXD isn’t socket activated
INFO[11-18|23:56:30] Starting /dev/lxd handler:
INFO[11-18|23:56:30] - binding devlxd socket socket=/var/lib/lxd/devlxd/sock
INFO[11-18|23:56:30] REST API daemon:
INFO[11-18|23:56:30] - binding Unix socket socket=/var/lib/lxd/unix.socket
INFO[11-18|23:56:30] Initializing global database
INFO[11-18|23:56:30] Dqlite: handling new connection (fd=18)
INFO[11-18|23:56:30] Dqlite: connected address=0 attempt=0
INFO[11-18|23:56:30] Initializing storage pools
DBUG[11-18|23:56:30] Initializing and checking storage pool “default”
DBUG[11-18|23:56:30] Checking BTRFS storage pool “default”
DBUG[11-18|23:56:30] Initializing and checking storage pool “fast”
DBUG[11-18|23:56:30] Checking BTRFS storage pool “fast”
DBUG[11-18|23:56:30] Initializing and checking storage pool “lvm”
DBUG[11-18|23:56:30] Checking LVM storage pool “lvm”
DBUG[11-18|23:56:30] Checked LVM storage pool “lvm”
DBUG[11-18|23:56:30] Initializing and checking storage pool “lvm2”
DBUG[11-18|23:56:30] Checking LVM storage pool “lvm2”
EROR[11-18|23:56:30] Failed to start the daemon: failed to prepare loop device: no such file or directory
INFO[11-18|23:56:30] Starting shutdown sequence
INFO[11-18|23:56:30] Stopping REST API handler:
INFO[11-18|23:56:30] - closing socket socket=/var/lib/lxd/unix.socket
INFO[11-18|23:56:30] Stopping /dev/lxd handler
INFO[11-18|23:56:30] - closing socket socket=/var/lib/lxd/devlxd/sock
INFO[11-18|23:56:30] Closing the database
INFO[11-18|23:56:30] Dqlite: closing client
INFO[11-18|23:56:30] Stop database gateway
INFO[11-18|23:56:30] Stop raft instance
INFO[11-18|23:56:30] Dqlite: stopping event loop
INFO[11-18|23:56:30] Dqlite: event loop stopped
INFO[11-18|23:56:30] Stopping REST API handler:
INFO[11-18|23:56:30] Stopping /dev/lxd handler
INFO[11-18|23:56:30] Stopping REST API handler:
INFO[11-18|23:56:30] Stopping /dev/lxd handler
INFO[11-18|23:56:30] Unmounting temporary filesystems
INFO[11-18|23:56:31] Done unmounting temporary filesystems
INFO[11-18|23:56:31] Saving simplestreams cache
INFO[11-18|23:56:31] Saved simplestreams cache
Error: failed to prepare loop device: no such file or directory
Yeah, LXD seems to be expecting a /var/lib/lxd/disks/lvm2.img file which doesn’t exist.
I suspect you may be able to get it past this error with:
truncate -s 1G /var/lib/lxd/disks/lvm2.img
pvcreate /var/lib/lxd/disks/lvm2.img
If it complains about the VG then, you can create that VG with that newly created PV, which should get LXD online, at which point you can delete that storage pool with lxc storage delete lvm2