graysky2/clean-chroot-manager

Nuke doesn't delete all subvolumes

inglor opened this issue · 4 comments

The ccm nuke command doesn't take care all the subvolumes. On the xample below the ID 456 is not deleted and then 455 doesn't either.

I thought the expected behaviour is to delete all chroots and leave a clean scratch area.

$ sudo btrfs subvolume list /
ID 454 gen 121253 top level 5 path scratch/chroot64/root
ID 455 gen 121265 top level 5 path scratch/chroot64/inglor
ID 456 gen 121255 top level 455 path scratch/chroot64/inglor/var/lib/machines
$ sudo ccm64 n
==> Nuking the chroot...
inglor@tiamat ~/cowerPkg/firefox-esr$ sudo btrfs subvolume list /
ID 455 gen 121266 top level 5 path scratch/chroot64/inglor
ID 456 gen 121255 top level 455 path scratch/chroot64/inglor/var/lib/machines

Works as expected for me:

% grep PATH64 ~/.config/clean-chroot-manager.conf
CHROOTPATH64="/mnt/mini"

% sudo btrfs subvolume list /mnt/mini
ID 257 gen 11 top level 5 path root
ID 259 gen 11 top level 5 path facade

% ccm n
==> Nuking the chroot...

% sudo btrfs subvolume list /mnt/mini

What is the output of the grep command on your system?

$ grep PATH64 ~/.config/clean-chroot-manager.conf
CHROOTPATH64="/scratch/chroot64"
$ ls -R /scratch
/scratch:
chroot64

/scratch/chroot64:

Ah, I see what's going on. Needs better logic. One sec.

Please try 2944b0c and reopen if it still does not behave as expected.

EDIT: It seems that one cannot build a 2nd package using a BTRFS partition and defining the CHROOTPATH64 variable to a directory under it before this change... have you found that to be true?

% ccm s
----> Attempting to build package...
==> Creating clean working copy [facade]...ERROR: cannot delete '/mnt/mini/chroot64/facade': Directory not empty
==> ERROR: Unable to delete subvolume /mnt/mini/chroot64/facade

It only works if I invoke withe S switch so as not to re-create it.

EDIT: In light of this, I am dropping btrfs support. If you or others more experienced with btrfs can help, PRs are welcomed.