/usr/sbin/whmapi1 system_needs_reboot shows wrong running kernel

Michael-Inet

Well-Known Member
Feb 20, 2014
134
20
68
Nashville, TN, USA
cPanel Access Level
Root Administrator
Very weird. The box (SolosVM, QEMU) seems okay, but one of my daily checks keeps showing the box needs to be rebooted because of a needed kernel update. I’ve rebooted through the VNC console and the shown running kernel doesn’t seem to even be on the box? ‘MCpanel::Kernel::Status’ shows the correct running kernel.

What is used to resync whatever ‘system_needs_reboot’ pulls it’s data from?

Is there something else I should be looking at?

Outputs below.

Thanks,
Michael

cat /etc/redhat-release
AlmaLinux

uname a
Linux srv10.srv10-inet-design.com 4.18.0-372.9.1.el8.x86_64 #1 SMP Tue May 10 08:57:35 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux

[email protected] [~]# /usr/sbin/whmapi1 system_needs_reboot
---
data:
details:
kernel:
boot_version: 4.18.0-372.9.1.el8.x86_64
running_version: 3.10.0-1160.el7.x86_64
needs_reboot: 1
metadata:
command: system_needs_reboot
reason: OK
result: 1
version: 1

[email protected] [~]# /usr/local/cpanel/3rdparty/bin/perl -MData::Dumper -MCpanel::Kernel::Status -le 'print Dumper( Cpanel::Kernel::Status::kernel_status(updates => 1));'
$VAR1 = {
'reboot_required' => '',
'running_version' => '4.18.0-372.9.1.el8.x86_64',
'update_available' => undef,
'running_latest' => 1,
'has_kernelcare' => 0,
'boot_version' => '4.18.0-372.9.1.el8.x86_64'
};

Ref: Check the GRUB boot configuration message
PS: Code tag pulls up a forum list? No code tags for you!


Well outputs got borked, all I get is the below when trying to add copy/paste commands...
"Oops! We ran into some problems.
Oops! We ran into some problems. Please try again later. More error details may be in the browser console."

1) Can't add "dash a" to uname. How bizarre that breaks cPanel forums?
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,220
2,420
363
cPanel Access Level
Root Administrator
Hey there! This is actually expected behavior when the system is running inside a Linux container of some sort. At Return whether system needs reboot we have this documentation:

"This function cannot detect whether your system needs a reboot if you use cPanel & WHM inside of a Linux Container (LXC)."

so there isn't a way to keep that message from showing up.
 

Michael-Inet

Well-Known Member
Feb 20, 2014
134
20
68
Nashville, TN, USA
cPanel Access Level
Root Administrator
Ah Ha!

"Warning:
We have not tested LXC on AlmaLinux OS 8 or CloudLinux 8 servers."

Well there you go, crap on toast...

My first Alma box is a fail! Well, probably not, but having to add a bit more code to the needs reboot notification logic is ...

So, question 1?

The "MCpanel::Kernel::Status stuff": Does that do roughly the same thing? In my last post it was showing the correct kernel and what seems to indicate the system does not need a reboot:

$VAR1 = {
'reboot_required' => '',

Question 2?

I saw that by chance in the Ref:, are there docs similar to the API1 docs somewhere? Can you share?

Thanks cPRex

Best,
Michael
 

Michael-Inet

Well-Known Member
Feb 20, 2014
134
20
68
Nashville, TN, USA
cPanel Access Level
Root Administrator
"MCpanel::Kernel::Status" is a local perl module, and tries to determine the same information as the API call.
Ah, okay, not that I know it very well, but perl works.

The only API docs I have available are the ones at Return whether system needs reboot. Is there a specific call you were looking for?
Nope. system_needs_reboot is what I'm using now, I'll test adding the perl call for triggering my email alert.

I also added a Feature Request (although the interface ate the code blocks) at:


Thanks Rex,
Michael