Unable to start containers after reinstalling the OS

Hi everyone!
I recently reinstalled the OS on my server and I followed How to reinstall LXD host OS without losing the containers? to retain the LXD data. The pool is LVM-based.
However, I find although I can list all containers with lxc list, I am unable to run any container with the error Failed to run mount hooks. I checked the VG configured for the storage pool. The LXDThinPool LV is active but all other container-specific LVs are inactive. I tried activating them using lvchange but it does not activate any more of the LVs. Nor does it report any error. May I get some suggestions on what I should do next? Thanks!

Oh I need to add that actually I do not really want to start those containers. What I really want is to mount those LVs and get the data.

This sounds similar to Restoring LXD Config on New Host

The recommend way to restore LXD using an existing storage pool is to use the lxd recover command.

See Backing up a LXD server - LXD documentation

Thank you for the reply! I tried lxc recover but it reports that No unknown volumes found. Nothing to do. Below is the full log of the failed attempt to start a container:

lxc basic 20220803131256.388 WARN     conf - conf.c:lxc_map_ids:3592 - newuidmap binary is missing
lxc basic 20220803131256.388 WARN     conf - conf.c:lxc_map_ids:3598 - newgidmap binary is missing
lxc basic 20220803131256.389 WARN     conf - conf.c:lxc_map_ids:3592 - newuidmap binary is missing
lxc basic 20220803131256.389 WARN     conf - conf.c:lxc_map_ids:3598 - newgidmap binary is missing
lxc basic 20220803131256.597 ERROR    conf - conf.c:run_buffer:321 - Script exited with status 1
lxc basic 20220803131256.597 ERROR    conf - conf.c:lxc_setup:4400 - Failed to run mount hooks
lxc basic 20220803131256.597 ERROR    start - start.c:do_start:1275 - Failed to setup container "basic"
lxc basic 20220803131256.597 ERROR    sync - sync.c:sync_wait:34 - An error occurred in another process (expected sequence number 4)
lxc basic 20220803131256.605 WARN     network - network.c:lxc_delete_network_priv:3617 - Failed to rename interface with index 0 from "eth0" to its initial name "veth7e3fa0f2"
lxc basic 20220803131256.605 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:877 - Received container state "ABORTING" instead of "RUNNING"
lxc basic 20220803131256.605 ERROR    start - start.c:__lxc_start:2074 - Failed to spawn container "basic"
lxc basic 20220803131256.605 WARN     start - start.c:lxc_abort:1039 - No such process - Failed to send SIGKILL via pidfd 17 for process 132797
lxc basic 20220803131301.698 WARN     conf - conf.c:lxc_map_ids:3592 - newuidmap binary is missing
lxc basic 20220803131301.698 WARN     conf - conf.c:lxc_map_ids:3598 - newgidmap binary is missing
lxc 20220803131301.700 ERROR    af_unix - af_unix.c:lxc_abstract_unix_recv_fds_iov:218 - Connection reset by peer - Failed to receive response
lxc 20220803131301.700 ERROR    commands - commands.c:lxc_cmd_rsp_recv_fds:127 - Failed to receive file descriptors for command "get_state"

That is because you have attempted manual recovery of the database and can now see all of your instances in lxc list, so there is nothing left for LXD recover to do.

What OS version and LXD package are you using?

Thank you so much! The problem has been solved. I kept the old /var/snap/lxd directory because the other thread suggested that it would be necessary for migration. I just tried lxd recover without that old directory, and LXD successfully recovered the containers from the LVM VG. This makes things much easier as well because /var/snap/lxd seemed to be version-specific so I would also need to install the same LXD version if I really have to rely on the old directory.

1 Like

Excellent!