# CT Deletion with Stale RBD Config — 2026-07-14

## Problem

`pct destroy <CTID> --purge` fails with exit 255 when the RBD disk image
was already deleted by a prior operation:

```
rbd error: rbd: error opening image vm-112-disk-0: (2) No such file or directory
```

The CT config file remains in pmxcfs (`/etc/pve/lxc/NNN.conf`), so
`pct list` still shows the CT as `stopped`.

## Fix

```bash
# On the PVE node hosting the CT:
rm -f /etc/pve/lxc/NNN.conf
# Verify:
pct list | grep NNN  # Should return nothing
```

## Reliable CT Deletion Sequence

1. `pct stop NNN` (ensure stopped)
2. `pct destroy NNN --purge --destroy-unreferenced-disks`
3. If it fails with RBD error but config remains:
   `rm -f /etc/pve/lxc/NNN.conf`
4. Verify: `pct list | grep NNN` → empty

## Pitfall

`--destroy-unreferenced-disks` helps clean up orphaned RBD images not
referenced in the CT config, but if the RBD image is already gone, the
flag doesn't suppress the error — it just tries and fails on the missing
image. The config file is the leftover that needs manual cleanup.

## Session Context

CT112 (Authelia) was stopped and then deleted with `pct destroy 112
--purge`. The RBD image was apparently already removed (possibly during
a prior storage migration or manual cleanup), so the destroy command
failed on the missing image. The config was manually removed with
`rm -f /etc/pve/lxc/112.conf`.
