LXC Crash -- how to troubleshoot?

Dear Experts,

LXC has crashed on my server and I try to retrieve at least one VM. I made many attempts without any success and I am not able anymore to diagnose if I will be able to get the VM up again.

Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal

Your help would be very appreciated to troubleshoot the situation.

lxc list
+----------------+---------+------+------+-----------------+-----------+
|      NAME      |  STATE  | IPV4 | IPV6 |      TYPE       | SNAPSHOTS |
+----------------+---------+------+------+-----------------+-----------+
| my_vm        | STOPPED |      |      | VIRTUAL-MACHINE | 0         |
+----------------+---------+------+------+-----------------+-----------+

I cannot start the VM, storage pool doesn’t exist anymore.

lxc start my_vm
Error: Storage pool "default" unavailable on this server

Everything was created using Maas that I have removed because it has crashed.

snap list
Name    Version      Rev    Tracking       Publisher   Notes
core18  20220831     2566   latest/stable  canonicalâś“  base
core20  20220923     1646   latest/stable  canonicalâś“  base
lxd     5.6-794016a  23680  latest/stable  canonicalâś“  -
snapd   2.57.2       17029  latest/stable  canonicalâś“  snapd

Please can you show output of:

lxc storage show default

And contents of /var/snap/lxd/common/lxd/logs/lxd.log

Sure.

  size: 1500GB
  source: /var/snap/lxd/common/lxd/disks/default.img
  zfs.pool_name: default
description: ""
name: default
driver: zfs
used_by:
- /1.0/images/deed74e286af957cdeb6a1020359b82c515d1e1697f31e025daba4215ee25940
- /1.0/instances/my_vm?project=maas
- /1.0/profiles/default
- /1.0/storage-pools/default/volumes/custom/maas-04469fd3-eaaf-4f89-b9bd-bd050bdfb0d8
- /1.0/storage-pools/default/volumes/custom/maas-0bf589e1-e883-4787-bd43-ea77e5705b71
...
status: Unavailable
locations:
- none
time="2022-10-05T08:34:38Z" level=error msg="Failed mounting storage pool" err="Failed to run: zpool import -f -d /var/snap/lxd/common/lxd/disks default: exit status 1 (cannot import 'default': no such pool available)" pool=default

Does /var/snap/lxd/common/lxd/disks/default.img exist?

no, it does not.

OK so there’s the problem. Any idea where its gone? Do you have backups?

What happened on the server?

No idea, probably I lost everything.
Actually, I had an issue with another VM thus I decided to remove apparmor which deleted snap.

Ah yes if you removed the snap package then it would delete any loop files which are stored within it.

Snap may have created a snapshot record on removal (if not run with --purge) see

Many thanks for your help Thomas

1 Like