Package: needrestart
Version: 2.11-3
Severity: important
Tags: patch upstream

Dear Maintainer,
needrestart does not work properly on some OpenVZ containers - it always claims 
that everything needs to be restarted. There was a bug report about that in the 
upstream:
https://github.com/liske/needrestart/issues/28
but the solution given there (already included in Debian) does not cover all 
cases. As written in the kernel docs 
(https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/devices.txt),
 unnamed device major number is not always 0, it can also be 144, 145 and 146. 
I've made a simple patch to handle that.

Regards,
Piotr


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

Kernel: Linux 2.6.32.bsd54g54 (SMP w/24 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages needrestart depends on:
ii  dpkg                       1.18.24
ii  gettext-base               0.19.8.1-2
ii  libintl-perl               1.26-2
ii  libmodule-find-perl        0.13-1
ii  libmodule-scandeps-perl    1.23-1
ii  libproc-processtable-perl  0.53-2
ii  libsort-naturally-perl     1.03-1
ii  libterm-readkey-perl       2.37-1
ii  perl                       5.24.1-3+deb9u1
ii  xz-utils                   5.2.2-1.2+b1

Versions of packages needrestart recommends:
ii  sysvinit-core  2.88dsf-59.9

Versions of packages needrestart suggests:
pn  needrestart-session | libnotify-bin  <none>

-- no debconf information
--- needrestart-2.11.orig/needrestart
+++ needrestart-2.11/needrestart
@@ -472,9 +472,9 @@ if(defined($opt_l)) {
 
                        # Don't compare device numbers on anon filesystems
                        # w/o a backing device (like OpenVZ's simfs).
+                       my $major = (($sdev >> 8) & 0xfff) | (($sdev >> 32) & 
~0xfff);
                        $mdev = "00:00"
-                           if (((($sdev >> 8) & 0xfff) |
-                                (($sdev >> 32) & ~0xfff)) == 0);
+                           if ($major == 0 || $major == 144 || $major == 145 
|| $major == 146);
 
                        # compare maps content vs. on-disk
                        unless($minode eq $sinode && ((grep {$mdev eq $_} 
@sdevs) ||

Reply via email to