On 2024-03-23 00:10 +01, Dan <d...@nnnne-o-o-o.com> wrote: > Hello, > > To avoid prbs with the relinking of the kernel happening in background > I propose to set a little check during the shutdown to avoid to interrup it.. > > Thnx!
Could you give this a spin please an report back? See release(8) for details. It's not perfect. We still need to disable the ddb.console sysctl if it has been activated. But we can't reenable it because of secure level, so this needs some readjustment of the whole boot process. We should also disable panic(9) in the kernel while reorder_kernel is running. Maybe a sysctl? diff --git libexec/reorder_kernel/reorder_kernel.sh libexec/reorder_kernel/reorder_kernel.sh index fb1d151f42a..809d1e18e55 100644 --- libexec/reorder_kernel/reorder_kernel.sh +++ libexec/reorder_kernel/reorder_kernel.sh @@ -30,6 +30,14 @@ SHA256=/var/db/kernel.SHA256 # Silently skip if on a NFS mounted filesystem. df -t nonfs $KERNEL_DIR >/dev/null 2>&1 +# Silently skip if battery is less than 50% remaining. +# We know nothing of the quality of the powergrid and we do not +# want the relink to fail halfway through because of power outage. +(( $(/usr/sbin/apm -l) < 50 )) + +# Disable halt(8) & reboot(8) to prevent interuption of the kernel relink. +/bin/chmod 000 /sbin/{halt, reboot} + # Install trap handlers to inform about success or failure via syslog. ERRMSG='failed' trap 'trap - EXIT; logger -st $PROGNAME "$ERRMSG" >/dev/console 2>&1' ERR @@ -70,5 +78,9 @@ make newbsd make newinstall sync +# Enable halt(8) & reboot(8) again. In case of a relink error we leave them +# disabled to give the operator time to investigate. +/bin/chmod 555 /sbin/{halt,reboot} + echo "\nKernel has been relinked and is active on next reboot.\n" cat $SHA256 > > -Dan > -- In my defence, I have been left unsupervised.