all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH kernel-helper v2] kernel hooks: flag pending reboot after installing a new kernel
@ 2026-10-14 10:41 Jonas Theisen
  2026-10-28 20:15 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Theisen @ 2026-10-14 10:41 UTC (permalink / raw)
  To: pve-devel

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 update-notifier or monitoring checks
can then notice that the newly installed kernel is not running yet
by checking the existance of this file.
See f.ex.: https://github.com/mvo5/unattended-upgrades/blob/master/unattended-upgrade#L867
and: https://git.launchpad.net/ubuntu/+source/update-notifier/tree/data/update-motd-reboot-required

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..c645914
--- /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 update-notifier 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}"
+
+printf "*** System restart required ***\n" > /run/reboot-required
+if ! grep -qxF "$pkg" /run/reboot-required.pkgs 2>/dev/null; then
+	printf "%s\n" "$pkg" >> /run/reboot-required.pkgs
+fi
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* applied: [PATCH kernel-helper v2] kernel hooks: flag pending reboot after installing a new kernel
  2026-10-14 10:41 [PATCH kernel-helper v2] kernel hooks: flag pending reboot after installing a new kernel Jonas Theisen
@ 2026-10-28 20:15 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-10-28 20:15 UTC (permalink / raw)
  To: pve-devel, Jonas Theisen

On Wed, 14 Oct 2026 12:41:29 +0200, Jonas Theisen wrote:
> 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 update-notifier or monitoring checks
> can then notice that the newly installed kernel is not running yet
> by checking the existance of this file.
> See f.ex.: https://github.com/mvo5/unattended-upgrades/blob/master/unattended-upgrade#L867
> and: https://git.launchpad.net/ubuntu/+source/update-notifier/tree/data/update-motd-reboot-required
> 
> [...]

Applied, thanks!

[1/1] kernel hooks: flag pending reboot after installing a new kernel
      commit: 3b801dcd7bcc2b61f86f19b3b94679e26a07df7b




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-28 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 10:41 [PATCH kernel-helper v2] kernel hooks: flag pending reboot after installing a new kernel Jonas Theisen
2026-10-28 20:15 ` applied: " Thomas Lamprecht

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal