[SOLVED] LXD on Centos 8: lxd init fails after installing from source [Error: Failed to connect to local LXD]

Hello,

I used to have LXD 3.0.4 via snap (on Centos 8), and then I deleted all of it using @stgraber reply here and then installed LXD 3.18 from source.

Now, when I run lxd init , I get this error:

$ lxd init
Error: Failed to connect to local LXD: Get "http://unix.socket/1.0": dial unix /var/lib/lxd/unix.socket: connect: no such file or directory

$ lxd --debug init
DBUG[07-13|20:21:46] Connecting to a local LXD over a Unix socket
DBUG[07-13|20:21:46] Sending request to LXD                   method=GET url=http://unix.socket/1.0 etag=
Error: Failed to connect to local LXD: Get "http://unix.socket/1.0": dial unix /var/lib/lxd/unix.socket: connect: no such file or directory

However, on running (as root) the following command, it works fine:
# lxd --debug --group lxd

INFO[07-13|21:11:51] LXD 3.18 is starting in normal mode      path=/var/lib/lxd
INFO[07-13|21:11:51] Kernel uid/gid map:
INFO[07-13|21:11:51]  - u 0 0 4294967295
INFO[07-13|21:11:51]  - g 0 0 4294967295
INFO[07-13|21:11:51] Configured LXD uid/gid map:
INFO[07-13|21:11:51]  - u 0 1000000 65536
INFO[07-13|21:11:51]  - g 0 1000000 65536
WARN[07-13|21:11:51] AppArmor support has been disabled because of lack of kernel support
WARN[07-13|21:11:51] Couldn't find the CGroup blkio.weight, I/O weight limits will be ignored.
INFO[07-13|21:11:51] Kernel features:
INFO[07-13|21:11:51]  - netnsid-based network retrieval: yes
INFO[07-13|21:11:51]  - uevent injection: yes
INFO[07-13|21:11:51]  - seccomp listener: yes
INFO[07-13|21:11:51]  - unprivileged file capabilities: yes
INFO[07-13|21:11:51]  - shiftfs support: no
INFO[07-13|21:11:51] Initializing local database
DBUG[07-13|21:11:51] Initializing database gateway
DBUG[07-13|21:11:51] Start database node                      id=1 address=
INFO[07-13|21:11:51] Starting /dev/lxd handler:
INFO[07-13|21:11:51]  - binding devlxd socket                 socket=/var/lib/lxd/devlxd/sock
INFO[07-13|21:11:51] REST API daemon:
INFO[07-13|21:11:51]  - binding Unix socket                   socket=/var/lib/lxd/unix.socket
INFO[07-13|21:11:51] Initializing global database
DBUG[07-13|21:11:51] Dqlite: connected address=1 attempt=0
INFO[07-13|21:11:51] Initializing storage pools
DBUG[07-13|21:11:51] No existing storage pools detected
INFO[07-13|21:11:51] Initializing networks
DBUG[07-13|21:11:51] New task Operation: 49d42503-d3cc-4a15-ba35-dbc2ed41536c
INFO[07-13|21:11:51] Pruning leftover image files
DBUG[07-13|21:11:51] Started task operation: 49d42503-d3cc-4a15-ba35-dbc2ed41536c
INFO[07-13|21:11:51] Done pruning leftover image files
INFO[07-13|21:11:51] Loading daemon configuration
DBUG[07-13|21:11:51] Initialized inotify with file descriptor 28
DBUG[07-13|21:11:51] Success for task operation: 49d42503-d3cc-4a15-ba35-dbc2ed41536c
INFO[07-13|21:11:51] Started seccomp handler                  path=/var/lib/lxd/seccomp.socket
DBUG[07-13|21:11:51] New task Operation: 2604fdd2-7fd1-4ab3-b82e-ee2f0abb9175
INFO[07-13|21:11:51] Pruning expired images
DBUG[07-13|21:11:51] Started task operation: 2604fdd2-7fd1-4ab3-b82e-ee2f0abb9175
INFO[07-13|21:11:51] Done pruning expired images
DBUG[07-13|21:11:51] New task Operation: 0efebffc-c3fa-4b33-9e16-f50241502f7a
DBUG[07-13|21:11:51] Success for task operation: 2604fdd2-7fd1-4ab3-b82e-ee2f0abb9175
INFO[07-13|21:11:51] Pruning expired container backups
DBUG[07-13|21:11:51] Started task operation: 0efebffc-c3fa-4b33-9e16-f50241502f7a
INFO[07-13|21:11:51] Done pruning expired container backups
DBUG[07-13|21:11:51] Success for task operation: 0efebffc-c3fa-4b33-9e16-f50241502f7a
DBUG[07-13|21:11:51] New task Operation: 3815fc16-972a-4d3f-9250-c5f5fcd818ef
DBUG[07-13|21:11:51] New task Operation: aba00a1b-2e15-41e2-9ef0-d7aa4e93e2c2
INFO[07-13|21:11:51] Updating instance types
DBUG[07-13|21:11:51] Started task operation: 3815fc16-972a-4d3f-9250-c5f5fcd818ef
INFO[07-13|21:11:51] Done updating instance types
INFO[07-13|21:11:51] Updating images
DBUG[07-13|21:11:51] Started task operation: aba00a1b-2e15-41e2-9ef0-d7aa4e93e2c2
INFO[07-13|21:11:51] Done updating images
DBUG[07-13|21:11:51] New task Operation: a7f8e526-8cb0-4a78-87d7-e5a4572617cf
INFO[07-13|21:11:51] Expiring log files
DBUG[07-13|21:11:51] Started task operation: a7f8e526-8cb0-4a78-87d7-e5a4572617cf
INFO[07-13|21:11:51] Done expiring log files
DBUG[07-13|21:11:51] Success for task operation: aba00a1b-2e15-41e2-9ef0-d7aa4e93e2c2
DBUG[07-13|21:11:51] Success for task operation: a7f8e526-8cb0-4a78-87d7-e5a4572617cf
DBUG[07-13|21:11:56] Success for task operation: 3815fc16-972a-4d3f-9250-c5f5fcd818ef
DBUG[07-13|21:12:03] Handling                                 url=/1.0 ip=@ user= method=GET

.
.
.
.
^CINFO[07-13|21:16:27] Received 'interrupt signal', exiting
INFO[07-13|21:16:27] Starting shutdown sequence
INFO[07-13|21:16:27] Stopping REST API handler:
INFO[07-13|21:16:27]  - closing socket                        socket=/var/lib/lxd/unix.socket
INFO[07-13|21:16:27] Stopping /dev/lxd handler:
INFO[07-13|21:16:27]  - closing socket                        socket=/var/lib/lxd/devlxd/sock
INFO[07-13|21:16:27] Closing the database
DBUG[07-13|21:16:27] Stop database gateway
INFO[07-13|21:16:27] Unmounting temporary filesystems
INFO[07-13|21:16:27] Done unmounting temporary filesystems

Would appreciate any help on fixing this!

~

Never mind. It was a silly mistake :slight_smile:
It works fine! I did not realize I was not spawning the daemon properly!

I face the exact same scenario as you described in your initial post (on a Manjaro host. Version : 4.3-1, installed from the standard repositories)

would be great whether you can get a bit into detail on which practical steps are required to "spawn the daemon properly "

nevermind. I found a solution on the manjaro forum

(running: sudo systemctl restart lxd.socket on the LXD host)