From: Jonas Theisen <j.theisen@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH kernel-helper] kernel hooks: flag pending reboot after installing a new kernel
Date: Tue, 13 Oct 2026 13:46:16 +0200 [thread overview]
Message-ID: <20261013114721.198258-1-j.theisen@proxmox.com> (raw)
Ship a postinst.d hook that writes /run/reboot-required and records
the kernel package in /run/reboot-required.pkgs, similar to
the hooks shipped by unattended-upgrades on Debian and
update-notifier on Ubuntu. Tools like needrestart or monitoring checks
can then notice that the newly installed kernel is not running yet,
without requiring one of those packages to be installed.
Skip this when configuring the currently running kernel, as no reboot
is needed then.
Came up in https://forum.proxmox.com/threads/156352/
Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
src/proxmox-boot/Makefile | 2 ++
src/proxmox-boot/proxmox-reboot-required | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
create mode 100755 src/proxmox-boot/proxmox-reboot-required
diff --git a/src/proxmox-boot/Makefile b/src/proxmox-boot/Makefile
index 044a024..d9e1c3d 100644
--- a/src/proxmox-boot/Makefile
+++ b/src/proxmox-boot/Makefile
@@ -1,4 +1,5 @@
KERNEL_HOOKSCRIPTS = proxmox-auto-removal zz-proxmox-boot
+KERNEL_POSTINST_HOOKSCRIPTS = proxmox-reboot-required
INITRAMFS_HOOKSCRIPTS = proxmox-boot-sync
SHARE_FILES = functions
GRUB_CFG_SNIPPET = 000_proxmox_boot_header
@@ -17,6 +18,7 @@ all:
install:
install -d $(POSTINSTHOOKDIR)
install -m 0755 $(KERNEL_HOOKSCRIPTS) $(POSTINSTHOOKDIR)
+ install -m 0755 $(KERNEL_POSTINST_HOOKSCRIPTS) $(POSTINSTHOOKDIR)
install -d $(POSTRMHOOKDIR)
install -m 0755 $(KERNEL_HOOKSCRIPTS) $(POSTRMHOOKDIR)
install -d $(POSTINITRAMFSHOOKDIR)
diff --git a/src/proxmox-boot/proxmox-reboot-required b/src/proxmox-boot/proxmox-reboot-required
new file mode 100755
index 0000000..ccb01cd
--- /dev/null
+++ b/src/proxmox-boot/proxmox-reboot-required
@@ -0,0 +1,19 @@
+#! /bin/sh
+set -e
+
+# Flag that a reboot is needed to boot the newly installed kernel, following the convention used by
+# update-notifier and unattended-upgrades, so that tools like needrestart or monitoring checks
+# notice it. Reconfiguring the currently running kernel does not require a reboot.
+
+version="$1"
+
+[ -n "$version" ] || exit 0
+[ "$version" != "$(uname -r)" ] || exit 0
+[ -d /run ] || exit 0
+
+pkg="${DPKG_MAINTSCRIPT_PACKAGE:-proxmox-kernel-$version}"
+
+echo "*** System restart required ***" > /run/reboot-required
+if ! grep -qxF "$pkg" /run/reboot-required.pkgs 2>/dev/null; then
+ echo "$pkg" >> /run/reboot-required.pkgs
+fi
--
2.47.3
reply other threads:[~2026-10-13 11:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261013114721.198258-1-j.theisen@proxmox.com \
--to=j.theisen@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.