Package: debian-goodies
Version: 0.61
Severity: normal
Tags: patch
Dear Maintainer,
checkrestart does not work properly when used in an OpenVZ environment.
This is caused by an incompatibility of OpenVZ with native Linux, see [1].
As a result, checkrestart does not detect anymore that files loaded by
an application were deleted.
Of course, the actual bug here is in OpenVZ. However, it seems that there
are already programs relying on OpenVZ's behaviour, so upstream is
reluctant to change this. On the other hand, vhost-providers will probably
not do such changes without upstream support. Hence many users (including me)
are stuck with hosts in which checkrestart doesn't work unpatched.
I fixed checkrestart to work on my servers, and will attach the diff.
Kind regards
Ralf
[1]: <https://bugzilla.openvz.org/show_bug.cgi?id=2932>
-- System Information:
Debian Release: 7.5
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-042stab078.27 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages debian-goodies depends on:
ii curl 7.26.0-1+wheezy9
ii dctrl-tools [grep-dctrl] 2.22.2
ii perl 5.14.2-21+deb7u1
ii python 2.7.3-4+deb7u1
ii whiptail 0.52.14-11.1
Versions of packages debian-goodies recommends:
ii lsof 4.86+dfsg-1
Versions of packages debian-goodies suggests:
pn popularity-contest <none>
pn xdg-utils <none>
pn zenity <none>
-- no debconf information
--- /usr/sbin/checkrestart 2012-06-16 04:38:23.000000000 +0200
+++ ./checkrestart 2014-05-04 19:45:54.000000000 +0200
@@ -286,11 +286,16 @@
process.links.append(data)
elif field == 'n':
# Remove the previous entry to check if this is something we should use
- if data.startswith('/SYSV'):
+ if data.find('SYSV') >= 0:
# If we find SYSV we discard the previous descriptor
last = process.descriptors.pop()
- elif data.startswith('/'):
+ elif data.startswith('/') or data.startswith('(deleted)/') or data.startswith(' (deleted)/'):
last = process.descriptors.pop()
+ if data.startswith('(deleted)'):
+ data = data[9:] + ' (deleted)'
+ elif data.startswith(' (deleted)'):
+ data = data[10:] + ' (deleted)'
+
# Add it to the list of deleted files if the previous descriptor
# was DEL or lsof marks it as deleted
if re.compile("DEL").search(last) or re.compile("deleted").search(data) or re.compile("\(path inode=[0-9]+\)$").search(data):