Package: autopkgtest
Version: 5.14
Severity: normal
User: de...@kali.org
Usertags: origin-kali

When a foo.new container was left over from a previous run,
autopkgtest-build-lxc fails with the following message:

  lxc-create: foo.new: tools/lxc_create.c: main: 274 Container already exists

This problem showed up for us in the context of debci daily runs, as
initiated from /etc/cron.daily/debci-worker.

The attached patch fixes this issue, without any side effect that I can
foresee.

Cheers,

-- 
Seb

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.8.0-2-amd64 (SMP w/36 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages autopkgtest depends on:
ii  apt-utils       2.1.7
ii  libdpkg-perl    1.20.5
ii  procps          2:3.3.16-5
ii  python3         3.8.2-3
ii  python3-debian  0.1.37

Versions of packages autopkgtest recommends:
ii  autodep8  0.23

Versions of packages autopkgtest suggests:
ii  lxc               1:4.0.2-1
pn  lxd               <none>
ii  ovmf              2020.05-2
ii  qemu-efi-aarch64  2020.05-2
ii  qemu-efi-arm      2020.05-2
ii  qemu-system       1:5.0-13
ii  qemu-utils        1:5.1+dfsg-4
ii  schroot           1.6.10-9+b1
ii  vmdb2             0.16-2

-- no debconf information
commit ded0cfcd394f2f756b4bb8fbdfc9bf4cfb80e53e
Author: Sébastien Delafond <sdelaf...@gmail.com>
Date:   Mon Sep 28 09:59:11 2020 +0200

    build-lxc: remove old .new container if present

diff --git a/tools/autopkgtest-build-lxc b/tools/autopkgtest-build-lxc
index 0886589..84d53f8 100755
--- a/tools/autopkgtest-build-lxc
+++ b/tools/autopkgtest-build-lxc
@@ -176,6 +176,10 @@ else
     # remove LXC rootfs caches; on btrfs this might be a subvolume, otherwise
     # rm it
     btrfs subvolume delete /var/cache/lxc/$CACHE/rootfs-* 2>/dev/null || rm 
-rf /var/cache/lxc/$CACHE/rootfs-*
+    # remove leftover .new container if present
+    if lxc-ls | grep -q ${NAME}.new ; then
+      lxc-destroy --force --name=${NAME}.new
+    fi
     # create a new rootfs in a temp container
     $LXC_CREATE_PREFIX lxc-create -B best --name=${NAME}.new $LXC_ARGS
     setup ${NAME}.new

Reply via email to