Skip to content

needrestart doesn't ignore service #353

@ErikDB87

Description

@ErikDB87

For some reason (probably a python dependance), needrestart marks openhab.service as a candidate to restart. I want that service to be ignored.

Following an answer on StackExchange (https://serverfault.com/questions/1010517/how-to-make-needrestart-not-defer-restarting-some-services), and some Ubuntu (https://discourse.ubuntu.com/t/needrestart-changes-in-ubuntu-24-04-service-restarts/44671) and Debian (https://sources.debian.org/src/needrestart/2.11-2~bpo8%2B1/ex/needrestart.conf/) sources, I implemented this in /etc/needrestart/needrestart.conf:

[...]

$nrconf{override_rc} = {
    [...]
    # don't restart openHAB
    qr(^openhab) => 0,
};

[...]

There's also the undoubtedly obsolete:

erik@MinipcLG2:~$ sudo cat /etc/needrestart/conf.d/openhab.conf
$nrconf{override_rc} = {
  qr(^openhab) => 0,
};

This worked for many months, but now:

erik@MinipcLG2:~$ sudo needrestart -v
[main] eval /etc/needrestart/needrestart.conf
[main] eval /etc/needrestart/conf.d/openhab.conf
[main] needrestart v3.6
[main] running in root mode
[Core] Using UI 'NeedRestart::UI::stdio'...
[main] systemd detected
[Core] #1339 is a NeedRestart::Interp::Python
[Python] #1339: source=/usr/bin/networkd-dispatcher
[Core] #1811 is a NeedRestart::Interp::Python
[Python] #1811: source=/usr/share/unattended-upgrades/unattended-upgrade-shutdown
[main] #2444 uses deleted /var/lib/openhab/tmp/libtmp4082853053534612679libjunixsocket-native-2.10.0.so
[main] #2444 is not a child
[main] #2444 exe => /usr/lib/jvm/java-21-openjdk-amd64/bin/java
[Core] #2444 is a NeedRestart::Interp::Java
[Core] #2444 source is UNKNOWN
[main] #2444 is openhab.service
[ucode] using NeedRestart::uCode::AMD
[ucode] using NeedRestart::uCode::Intel
[uCode/AMD] #0 cpu vendor id mismatch
[uCode/Intel] #0 current revision: 0x00f0
+ iucode_tool --scan-system
+ grep -oE [^[:space:]]+$
+ sig=0x000506e3
+ [ -r /sys/devices/system/cpu/cpu0/microcode/processor_flags ]
+ cat /sys/devices/system/cpu/cpu0/microcode/processor_flags
+ filter=-s 0x000506e3,0x2
+ test -r /etc/needrestart/iucode.sh
+ . /etc/needrestart/iucode.sh
+ type bsdtar
+ IUCODE_TOOL_EXTRA_OPTIONS=
+ test -r /etc/default/intel-microcode
+ . /etc/default/intel-microcode
+ test  = no
+ [ -r /usr/share/misc/intel-microcode* ]
+ iucode_tool -l -s 0x000506e3,0x2 --ignore-broken -tb /lib/firmware/intel-ucode
+ grep 0x000506e3
[uCode/Intel] #0 available revision: 0x00f0
[Kernel] Linux: kernel release 6.8.0-88-generic, kernel version #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025
Failed to load NeedRestart::Kernel::kFreeBSD: [Kernel/kFreeBSD] Not running on GNU/kFreeBSD!
[Kernel/Linux] /boot/vmlinuz.old => 6.8.0-87-generic (buildd@lcy02-amd64-034) #88-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 09:28:41 UTC 2025 [6.8.0-87-generic]
[Kernel/Linux] /boot/vmlinuz-6.8.0-88-generic => 6.8.0-88-generic (buildd@lcy02-amd64-004) #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 [6.8.0-88-generic]*
[Kernel/Linux] /boot/vmlinuz-6.8.0-87-generic => 6.8.0-87-generic (buildd@lcy02-amd64-034) #88-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 09:28:41 UTC 2025 [6.8.0-87-generic]
[Kernel/Linux] /boot/vmlinuz => 6.8.0-88-generic (buildd@lcy02-amd64-004) #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 [6.8.0-88-generic]*
[Kernel/Linux] Expected linux version: 6.8.0-88-generic

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

Restarting services...

Service restarts being deferred:
 systemctl restart openhab.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

Why does it list:

Service restarts being deferred:
 systemctl restart openhab.service

?

Information about my system:

erik@MinipcLG2:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description:    Linux Mint 22.2
Release:        22.2
Codename:       zara
erik@MinipcLG2:~$ uname -r
6.8.0-90-generic

I'm not trying to find out why needrestart marks openHAB as needing to be restarted. I just want to suppress that notification, and I don't understand why that isn't working... Does anyone have any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions