Package: schroot

Invoking /bin/kill on processes fails if the process already
quit by itself while the schroot shutdown runs. Because of "set -e"
this causes the whole shutdown to fail.

I have seen this occasionally in a nightly testing setup involving
a D-Bus session: when the D-Bus daemon stops, all other processes
depending on it also shut down automatically, with or without being
killed.

Attached a patch which wraps kill in a function which merely logs
the problem instead of aborting.

-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-xen-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set
to POSIX)
Shell: /bin/sh linked to /bin/dash

Versions of packages schroot depends on:
ii  libboost-filesystem1.4 1.42.0-4          filesystem operations
(portable pa
ii  libboost-program-optio 1.42.0-4          program options library for
C++
ii  libboost-regex1.42.0   1.42.0-4          regular expression library
for C++
ii  libboost-system1.42.0  1.42.0-4          Operating system (e.g.
diagnostics
ii  libc6                  2.11.2-10         Embedded GNU C Library:
Shared lib
ii  libgcc1                1:4.4.5-8         GCC support library
ii  liblockdev1            1.0.3-1.4         Run-time shared library for
lockin
ii  libpam0g               1.1.1-6.1         Pluggable Authentication
Modules l
ii  libstdc++6             4.4.5-8           The GNU Standard C++
Library v3
ii  libuuid1               2.17.2-9          Universally Unique ID
library
ii  schroot-common         1.4.19-1+squeeze1 common files for schroot

schroot recommends no packages.

Versions of packages schroot suggests:
pn  aufs-modules | unionfs-module <none>     (no description available)
pn  btrfs-tools                   <none>     (no description available)
pn  debootstrap                   <none>     (no description available)
pn  lvm2                          <none>     (no description available)
pn  unzip                         <none>     (no description available)

-- Configuration Files:
/etc/schroot/default/fstab changed [not included]
/etc/schroot/schroot.conf changed [not included]
/etc/schroot/setup.d/15killprocs changed [not included]

-- no debconf information


*** 15killprocs.dpkg	Sun Aug 28 13:24:38 2011
--- setup.d/15killprocs	Sun Aug 28 13:27:27 2011
***************
*** 29,34 ****
--- 29,45 ----
      fatal "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist"
  fi
  
+ # Wrapper around kill command. Turns errors into
+ # warnings when running in verbose mode, otherwise
+ # it ignores them.
+ # args: parameters for kill
+ kill_proc()
+ {
+     if ! kill "$@" 2>/dev/null; then
+         info "kill $@ failed: process already gone?"
+     fi
+ }
+ 
  # Kill all processes that were run from within the chroot environment
  # $1: mount base location
  do_kill_all()
***************
*** 51,57 ****
  		info "Killing left-over pid $pid (${exe##$1})"
  		info "  Sending SIGTERM to pid $pid"
  
! 		/bin/kill -TERM "$pid" 2>/dev/null
  
  		count=0
  		max=5
--- 62,68 ----
  		info "Killing left-over pid $pid (${exe##$1})"
  		info "  Sending SIGTERM to pid $pid"
  
! 		kill_proc -TERM "$pid"
  
  		count=0
  		max=5
***************
*** 62,68 ****
                  # Wait for $max seconds for process to die before -9'ing it
                      if [ "$count" -eq "$max" ]; then
  			info "  Sending SIGKILL to pid $pid"
! 			/bin/kill -KILL "$pid" 2>/dev/null
  			sleep 1
  			break
                      fi
--- 73,79 ----
                  # Wait for $max seconds for process to die before -9'ing it
                      if [ "$count" -eq "$max" ]; then
  			info "  Sending SIGKILL to pid $pid"
! 			kill_proc -KILL "$pid"
  			sleep 1
  			break
                      fi

Reply via email to