Hi all,
Accidentally I disconnected the power of the machine and reboot again gives me an error as in the title. And cant start the lxd daemon, as I understand correctly storage.zfs_pool_name seems default, but my zpool name is lxdpool.
NAME STATE READ WRITE CKSUM
lxdpool ONLINE 0 0 0
sdb ONLINE 0 0 0
errors: No known data errors
Here is my question, where can I find the configuration file of lxc/lxd of lxc info output and how can I overcome that error message and start lxd deamon without error.
Thanks.
@stgraber, Sorry not to mention. My lxd version is 3.0.1 therefore cant find the /var/lib/lxd/lxd.db file.
Where is the configuration file for 3.0.1?
Thanks.
sqlite3 /var/lib/lxd/database/global/db.bin 'SELECT * FROM storage_pools_config;'
Note that you wonât be able to just update that database, so based on the output above I should be able to give you a small SQL patch to put in place on the filesystem which will then correct your database on next LXD startup.
root@lxdserver01:/var/lib/lxd/database/global# sqlite3 /var/lib/lxd/database/global/db.bin âSELECT * FROM storage_pools_config;â
Error: no such table: storage_pools_config
root@lxdserver01:~# dpkg -l | grep -i lxd
ii lxd 3.0.1-0ubuntu1~18.04.1 amd64 Container hypervisor based on LXC - daemon
ii lxd-client 3.0.1-0ubuntu1~18.04.1 amd64 Container hypervisor based on LXC - client
I just stopped and try to restart the service and socket, and here is the error log.
root@lxdserver01:~# lxd --debug --group lxd
DBUG[09-11|20:55:45] Connecting to a local LXD over a Unix socket
DBUG[09-11|20:55:45] Sending request to LXD etag= method=GET url=http://unix.socket/1.0
INFO[09-11|20:56:34] LXD 3.0.1 is starting in normal mode path=/var/lib/lxd
INFO[09-11|20:56:34] Kernel uid/gid map:
INFO[09-11|20:56:34] - u 0 0 4294967295
INFO[09-11|20:56:34] - g 0 0 4294967295
INFO[09-11|20:56:34] Configured LXD uid/gid map:
INFO[09-11|20:56:34] - u 0 100000 65536
INFO[09-11|20:56:34] - g 0 100000 65536
WARN[09-11|20:56:34] CGroup memory swap accounting is disabled, swap limits will be ignored.
INFO[09-11|20:56:34] Initializing local database
EROR[09-11|20:56:34] Failed to start the daemon: Both legacy and new local database files exists
INFO[09-11|20:56:34] Starting shutdown sequence
DBUG[09-11|20:56:34] Not unmounting temporary filesystems (containers are still running)
INFO[09-11|20:56:34] Saving simplestreams cache
INFO[09-11|20:56:34] Saved simplestreams cache
Error: Both legacy and new local database files exists
Sounds like you do have a /var/lib/lxd/lxd.db file now, possibly created by trying to run the first command I gave you.
If you do, can you show sqlite3 /var/lib/lxd/lxd.db .dump? If thatâs empty, then go ahead and remove that file, then try running lxd --debug --group lxd again.
Output of the systemctl stop lxd.socket lxd.service
root@lxdserver01:~# lxd --debug --group lxd
DBUG[09-11|21:49:19] Connecting to a local LXD over a Unix socket
DBUG[09-11|21:49:19] Sending request to LXD etag= method=GET url=http://unix.socket/1.0
INFO[09-11|21:50:07] LXD 3.0.1 is starting in normal mode path=/var/lib/lxd
INFO[09-11|21:50:07] Kernel uid/gid map:
INFO[09-11|21:50:07] - u 0 0 4294967295
INFO[09-11|21:50:07] - g 0 0 4294967295
INFO[09-11|21:50:07] Configured LXD uid/gid map:
INFO[09-11|21:50:07] - u 0 100000 65536
INFO[09-11|21:50:07] - g 0 100000 65536
WARN[09-11|21:50:07] CGroup memory swap accounting is disabled, swap limits will be ignored.
INFO[09-11|21:50:07] Initializing local database
INFO[09-11|21:50:07] Initializing database gateway
INFO[09-11|21:50:07] Start database node address= id=1
INFO[09-11|21:50:07] Raft: Restored from snapshot 1-762-1536610622008
INFO[09-11|21:50:07] Raft: Initial configuration (index=1): [{Suffrage:Voter ID:1 Address:0}]
INFO[09-11|21:50:07] Raft: Node at 0 [Leader] entering Leader state
INFO[09-11|21:50:07] LXD isnât socket activated
DBUG[09-11|21:50:07] Connecting to a local LXD over a Unix socket
DBUG[09-11|21:50:07] Sending request to LXD etag= method=GET url=http://unix.socket/1.0
DBUG[09-11|21:50:07] Detected stale unix socket, deleting
INFO[09-11|21:50:07] Starting /dev/lxd handler:
INFO[09-11|21:50:07] - binding devlxd socket socket=/var/lib/lxd/devlxd/sock
INFO[09-11|21:50:07] REST API daemon:
INFO[09-11|21:50:07] - binding Unix socket socket=/var/lib/lxd/unix.socket
INFO[09-11|21:50:07] Initializing global database
INFO[09-11|21:50:07] Initializing storage pools
DBUG[09-11|21:50:07] Initializing and checking storage pool âdefaultâ.
DBUG[09-11|21:50:07] Initializing a ZFS driver.
DBUG[09-11|21:50:07] Checking ZFS storage pool âdefaultâ.
DBUG[09-11|21:50:07] ZFS storage pool âdefaultâ does not exist. Trying to import it.
EROR[09-11|21:50:07] Failed to start the daemon: ZFS storage pool âdefaultâ could not be imported: cannot import âdefaultâ: no such pool available
INFO[09-11|21:50:07] Starting shutdown sequence
INFO[09-11|21:50:07] Stopping REST API handler:
INFO[09-11|21:50:07] - closing socket socket=/var/lib/lxd/unix.socket
INFO[09-11|21:50:07] Stopping /dev/lxd handler
INFO[09-11|21:50:07] - closing socket socket=/var/lib/lxd/devlxd/sock
INFO[09-11|21:50:07] Closing the database
INFO[09-11|21:50:07] Stop database gateway
INFO[09-11|21:50:07] Stop raft instance
INFO[09-11|21:50:08] Raft: Starting snapshot up to 776
INFO[09-11|21:50:08] Raft: Compacting logs from 635 to 648
INFO[09-11|21:50:08] Raft: Snapshot to 776 complete
INFO[09-11|21:50:08] Stopping REST API handler:
INFO[09-11|21:50:08] Stopping /dev/lxd handler
INFO[09-11|21:50:08] Stopping REST API handler:
INFO[09-11|21:50:08] Stopping /dev/lxd handler
INFO[09-11|21:50:08] Unmounting temporary filesystems
INFO[09-11|21:50:08] Done unmounting temporary filesystems
INFO[09-11|21:50:08] Saving simplestreams cache
INFO[09-11|21:50:08] Saved simplestreams cache
Error: ZFS storage pool âdefaultâ could not be imported: cannot import âdefaultâ: no such pool available
But when I stop the debug, lxd sql replied that error.
root@lxdserver01:~# lxd sql global âSELECT * FROM storage_pools_config;â
Error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory
root@lxdserver01:~# systemctl status lxd.socket
â lxd.socket - LXD - unix socket
Loaded: loaded (/lib/systemd/system/lxd.socket; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-09-11 22:04:26 +03; 9min ago
Docs: man:lxd(1)
Listen: /var/lib/lxd/unix.socket (Stream)
Tasks: 0 (limit: 4504)
CGroup: /system.slice/lxd.socket
Strange, cos when I execute the lxd sql command gives socket error and checked that no unix.socket at the /var/lib/lxd directory. Anyway i restarted the lxd.socket and gives the following output.
root@lxdserver01:/var/lib/lxd# lxd sql global âSELECT * FROM storage_pools;â
±â±--------±-------±------------±------+
| id | name | driver | description | state |
±â±--------±-------±------------±------+
| 3 | default | zfs | | 1 |
| 4 | lxdpool | zfs | | 1 |
±â±--------±-------±------------±------+