LXD's dqlite server fails to start

When LXD 4.5 rolled out it caused my GUI containers to fail, so since then I froze my LXD version on 4.4. Everything worked fine for several months until tonight. When I started the computer the following error appeared:

$ lxc list
Error: Get "http://unix.socket/1.0": dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused

In a related post from April’18 I found the suggestion to have a look at debug output, so here is the error:

$ systemctl stop snap.lxd.daemon
$ lxd --debug --group lxd
DBUG[12-06|00:13:56] Connecting to a local LXD over a Unix socket 
DBUG[12-06|00:13:56] Sending request to LXD                   method=GET url=http://unix.socket/1.0 etag=
INFO[12-06|00:13:56] LXD 4.4 is starting in normal mode       path=/var/snap/lxd/common/lxd
INFO[12-06|00:13:56] Kernel uid/gid map: 
INFO[12-06|00:13:56]  - u 0 0 4294967295 
INFO[12-06|00:13:56]  - g 0 0 4294967295 
INFO[12-06|00:13:56] Configured LXD uid/gid map: 
INFO[12-06|00:13:56]  - u 0 1000000 1000000000 
INFO[12-06|00:13:56]  - g 0 1000000 1000000000 
INFO[12-06|00:13:56] Kernel features: 
INFO[12-06|00:13:56]  - closing multiple file descriptros efficiently: no 
INFO[12-06|00:13:56]  - netnsid-based network retrieval: no 
INFO[12-06|00:13:56]  - pidfds: no 
INFO[12-06|00:13:56]  - uevent injection: no 
INFO[12-06|00:13:56]  - seccomp listener: no 
INFO[12-06|00:13:56]  - seccomp listener continue syscalls: no 
INFO[12-06|00:13:56]  - seccomp listener add file descriptors: no 
INFO[12-06|00:13:56]  - safe native terminal allocation : no 
INFO[12-06|00:13:56]  - unprivileged file capabilities: yes 
INFO[12-06|00:13:56]  - cgroup layout: hybrid 
WARN[12-06|00:13:56]  - Couldn't find the CGroup memory swap accounting, swap limits will be ignored 
DBUG[12-06|00:13:56] no such device - Failed to mount shiftfs 
INFO[12-06|00:13:56]  - shiftfs support: no 
INFO[12-06|00:13:56] Initializing local database 
DBUG[12-06|00:13:56] Initializing database gateway 
DBUG[12-06|00:13:56] Start database node                      role=voter id=1 address=

EROR[12-06|00:13:57] Failed to start the daemon: Failed to start dqlite server: raft_start(): io: load closed segment 0000000000011160-0000000000011253: found 93 entries (expected 94) 
INFO[12-06|00:13:57] Starting shutdown sequence 
DBUG[12-06|00:13:57] Not unmounting temporary filesystems (containers are still running) 

It looks like there is some issue with the database. I didn’t notice any sign of a disk corruption or any other problems neither during the last shut down nor during the startup. Can someone please help me to fix that and get my containers back running?

Try moving aside the problematic segment in /var/snap/lxd/common/lxd/database/global after making a full backup of that directory.

Thank you, at least I can start the LXD now and backup my containers. However, the GUI enabled containers won’t start (update: resolved, works fine now).

Error: Common start logic: Load go-lxc struct: The NVIDIA LXC hook couldn't be found

UPDATE: Never mind, after I left the debug mode it runs perfectly again. Thank you!