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

Here's a log showing the issue:

```
autopkgtest [16:04:04]: host melpomene.kali.org; command line: 
/usr/bin/autopkgtest --no-built-binaries '--setup-commands=echo 
'"'"'pybtex-docutils kali-rolling/amd64'"'"' > /var/tmp/debci.pkg 2>&1 || true' 
--apt-upgrade --user debci --apt-upgrade --add-apt-release=kali-dev 
--pin-packages=kali-dev=src:pybtex-docutils
--output-dir 
/srv/debci/tmp/tmp.ysWjkecMC1/autopkgtest-incoming/kali-rolling/amd64/p/pybtex-docutils/3509400
 pybtex-docutils -- lxc --sudo --name ci-004-04188469 
autopkgtest-kali-rolling-amd64                                                  
                                                                            
autopkgtest-virt-lxc [16:04:39]: ERROR: WARNING: Cannot kill timed out process 
['sudo', 'lxc-attach', '--name', 'ci-004-04188469', 'runlevel']: [Errno 1] 
Operation not permitted                                                         
                                                                                
    
Unexpected error:
Traceback (most recent call last):
  File "/usr/share/autopkgtest/lib/VirtSubproc.py", line 739, in mainloop
    command()
  File "/usr/share/autopkgtest/lib/VirtSubproc.py", line 668, in command
    r = f(c, ce)
  File "/usr/share/autopkgtest/lib/VirtSubproc.py", line 258, in cmd_open
    caller.hook_open()
  File "/usr/bin/autopkgtest-virt-lxc", line 245, in hook_open
    wait_booted(lxc_container_name)
  File "/usr/bin/autopkgtest-virt-lxc", line 124, in wait_booted
    stdout=subprocess.PIPE)
  File "/usr/share/autopkgtest/lib/VirtSubproc.py", line 144, in execute_timeout
    (out, err) = sp.communicate(instr)
  File "/usr/lib/python3.7/subprocess.py", line 926, in communicate
    stdout = self.stdout.read()
  File "/usr/share/autopkgtest/lib/VirtSubproc.py", line 64, in alarm_handler
    raise Timeout()
VirtSubproc.Timeout
autopkgtest [16:06:03]: ERROR: testbed failure: cannot send to testbed: [Errno 
32] Broken pipe
```

virt-lxc uses `sudo lxc-attach --name ci-something runlevel`[0] to check
if the container is properly started and available (). In the case
above, this call timed out (this can happen when for instance the worker
is too loaded). This process however fails to get killed upon timing
out, with a "permission denied" error: `exec_timeout()` in
VirtSubProc.py simply tries to `sp.kill()`[1] it, but in this case the
`sp` subprocess was started with `sudo`, so attempting to kill it as the
user `debci` is guaranteed to fail.

More generally, `exec_timeout()` will fail to properly kill any
timed-out subprocess that was created through virt-lxc's
`sudoify()`. 

I'm not sure what a proper patch would look like, as the debci user
can't simply be given sudo privileges to `kill` just about anything.

Cheers,

-- 
Seb

[0] 
https://salsa.debian.org/ci-team/autopkgtest/-/blob/master/virt/autopkgtest-virt-lxc#L122
[1] 
https://salsa.debian.org/ci-team/autopkgtest/-/blob/master/lib/VirtSubproc.py#L151

-- 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.9.0-1-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.9.0-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.2+dfsg-3
ii  schroot           1.6.10-9+b1
ii  vmdb2             0.16-2

-- no debconf information

Reply via email to