Re: Request for a check 'relinking in progress' before a reboot

2024-03-24 Thread Dan


Thanks for the reply, I will give it a try.
I'm still with the /etc/bsd.re-config without effect..


Stuart Henderson :

>> Eg. actually I was testing changes to my /etc/bsd.re-config ( as per 
>> different thread ), it needs two reboots to apply changes..
>
> Run /usr/libexec/reorder_kernel after your edit.

-Dan



Re: Request for a check 'relinking in progress' before a reboot

2024-03-24 Thread Stuart Henderson
On 2024-03-23, Dan  wrote:
> Eg. actually I was testing changes to my /etc/bsd.re-config ( as per 
> different thread ), it needs two reboots to apply changes..

Run /usr/libexec/reorder_kernel after your edit.



Re: Request for a check 'relinking in progress' before a reboot

2024-03-24 Thread Stuart Henderson
On 2024-03-23, Florian Obser  wrote:
>
> 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 ))

Don't forget upd(4)! Maybe it could also time an md5 -ttt run and demand
more available battery if the machine is slow.

> +# Disable halt(8) & reboot(8) to prevent interuption of the kernel relink.
> +/bin/chmod 000 /sbin/{halt, reboot}

Also hw.allowpowerdown=0 and shutdown. And what about the watchdog?

> We should also disable panic(9) in the kernel while reorder_kernel is
> running. Maybe a sysctl?

Disabling panic, that's genius, it would solve so many problems!




Re: Request for a check 'relinking in progress' before a reboot

2024-03-23 Thread Dan


Brian Conway :

>> 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!
>>
>> -Dan
>
> I have frequently rebooted or shut down shortly after boot, for example when 
> booting the wrong VM by accident, and it has never caused a problem on 
> subsequent reboots. What problem are you actually experiencing, just the 
> message being printed to the console?

Eg. actually I was testing changes to my /etc/bsd.re-config ( as per different 
thread ), it needs two reboots to apply changes..
and as unexpected I failed to wait the in prograss relinking just after the 
first saving of the file, and I launched the reboot.

Actually Im not involved directly in the development stuff and I neither want 
to touch one aspect of it with these words,
and I mean it could be certainly stuff complicated to fix.
But like an user experience after the n time you fail in the same situation
you can just think it is matter of a check and I said so..
Honestly speaking..



Re: Request for a check 'relinking in progress' before a reboot

2024-03-23 Thread Brian Conway
On Fri, Mar 22, 2024, at 6:10 PM, Dan 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!
>
> -Dan

I have frequently rebooted or shut down shortly after boot, for example when 
booting the wrong VM by accident, and it has never caused a problem on 
subsequent reboots. What problem are you actually experiencing, just the 
message being printed to the console?

My concern with the proposed patch is for my painfully slow system (embedded, 
i386, whatever) that may be locked out of reboot/halt for 3-5 minutes after 
booting.

Brian



Re: Request for a check 'relinking in progress' before a reboot

2024-03-23 Thread Florian Obser
On 2024-03-23 08:47 +01, Dan  wrote:
> Florian, thanks a lot for your effort, really appreciable..
>
>> Could you give this a spin please an report back? See release(8) for
>> details.
>
> Unfortunately I'm still on 7.4 stable and I cant screw down any patch for you.
> Maybe having a storagy with current on it I can be more helpful.. in
> the near future.. thinking.

No worries, take your time, we are not in a hurry.

>
> However, I hope anyoneelse can try the patch here.
>
>
>> 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?
>
>
> -Dan
>

-- 
In my defence, I have been left unsupervised.



Re: Request for a check 'relinking in progress' before a reboot

2024-03-23 Thread Dan


Florian, thanks a lot for your effort, really appreciable..

> Could you give this a spin please an report back? See release(8) for
> details.

Unfortunately I'm still on 7.4 stable and I cant screw down any patch for you.
Maybe having a storagy with current on it I can be more helpful.. in the near 
future.. thinking.

However, I hope anyoneelse can try the patch here.


> 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?


-Dan



Re: Request for a check 'relinking in progress' before a reboot

2024-03-23 Thread Florian Obser
On 2024-03-23 00:10 +01, Dan  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.



Request for a check 'relinking in progress' before a reboot

2024-03-22 Thread Dan
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!

-Dan