Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purging LXD snap doesn't remove LVM storage backed by loop device #15013

Open
simondeziel opened this issue Feb 17, 2025 · 1 comment
Open

Purging LXD snap doesn't remove LVM storage backed by loop device #15013

simondeziel opened this issue Feb 17, 2025 · 1 comment

Comments

@simondeziel
Copy link
Member

simondeziel commented Feb 17, 2025

# snap install lxd --channel latest/candidate
lxd (candidate) 6.2-7a6ecda from Canonical✓ installed
# lxd init --auto --storage-backend=lvm
# snap remove --purge lxd
2025-02-03T22:22:40Z INFO Waiting for "snap.lxd.daemon.service" to stop.
lxd removed
# snap install lxd --channel latest/candidate
lxd (candidate) 6.2-7a6ecda from Canonical✓ installed
# lxd init --auto --storage-backend=lvm
Error: Failed to create storage pool "default": A volume group already exists called "default"

This behavior goes back to a long time as even 4.0/stable is affected:

root@v1:~# snap install lxd --channel 4.0/stable
2025-02-17T20:15:09Z INFO Waiting for automatic snapd restart...
lxd (4.0/stable) 4.0.10-e664786 from Canonical✓ installed
root@v1:~# lxd init --auto --storage-backend=lvm
root@v1:~# LD_LIBRARY_PATH=/snap/lxd/current/lib/:/snap/lxd/current/lib/x86_64-linux-gnu/:/snap/lxd/current/lib/x86_64-linux-gnu/ceph:/snap/lxd/current/zfs-2.2/lib PATH=/snap/lxd/current/zfs-2.2/bin:/snap/lxd/current/bin:$PATH nsenter --mount=/run/snapd/ns/lxd.mnt -- lvs
  LV          VG      Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  LXDThinPool default twi-a-tz-- 2.65g             0.00   1.57                            
root@v1:~# LD_LIBRARY_PATH=/snap/lxd/current/lib/:/snap/lxd/current/lib/x86_64-linux-gnu/:/snap/lxd/current/lib/x86_64-linux-gnu/ceph:/snap/lxd/current/zfs-2.2/lib PATH=/snap/lxd/current/zfs-2.2/bin:/snap/lxd/current/bin:$PATH nsenter --mount=/run/snapd/ns/lxd.mnt -- vgs
  VG      #PV #LV #SN Attr   VSize VFree
  default   1   1   0 wz--n- 4.65g    0 
root@v1:~# snap remove --purge lxd
2025-02-17T20:19:22Z INFO Waiting for "snap.lxd.daemon.service" to stop.
lxd removed
root@v1:~# snap install lxd --channel 4.0/stable
lxd (4.0/stable) 4.0.10-e664786 from Canonical✓ installed
root@v1:~# LD_LIBRARY_PATH=/snap/lxd/current/lib/:/snap/lxd/current/lib/x86_64-linux-gnu/:/snap/lxd/current/lib/x86_64-linux-gnu/ceph:/snap/lxd/current/zfs-2.2/lib PATH=/snap/lxd/current/zfs-2.2/bin:/snap/lxd/current/bin:$PATH nsenter --mount=/run/snapd/ns/lxd.mnt -- lvs
  LV          VG      Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  LXDThinPool default twi-a-tz-- 2.65g             0.00   1.57                            
root@v1:~# LD_LIBRARY_PATH=/snap/lxd/current/lib/:/snap/lxd/current/lib/x86_64-linux-gnu/:/snap/lxd/current/lib/x86_64-linux-gnu/ceph:/snap/lxd/current/zfs-2.2/lib PATH=/snap/lxd/current/zfs-2.2/bin:/snap/lxd/current/bin:$PATH nsenter --mount=/run/snapd/ns/lxd.mnt -- vgs
  VG      #PV #LV #SN Attr   VSize VFree
  default   1   1   0 wz--n- 4.65g    0 
root@v1:~# lxd init --auto --storage-backend=lvm
Error: Failed to create storage pool 'default': Volume group "default" is already used by LXD

Note: this was initially lumped with #14918 but the LVM case is much older and different due to the interaction between PV, VG and LV in LVM.

@tomponline
Copy link
Member

Could be related to #9278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants