How can I check if my Linode's Latest-64bit Kernel is Up to Date?

Linode Staff

I am trying to automatically detect if I am using the latest version of my kernel. Is there any easy way to do this?

1 Reply

You can do this using the Linode-CLI/API.

This command will return Linode's latest 64bit kernel version:

linode-cli kernels view linode/latest-64bit --no-headers --text | awk -F '\t' '{print $2}' | awk -F"[()]" '{print $2}'

# returns
5.17.5-x86_64-linode154

You can then compare that directly to your Linode's kernel version by running this command:

uname -r
5.16.13-x86_64-linode153

For my purposes, since the output does not match, I would then reboot my Linode.

To take this a step further, you could create a cron task to check this automatically. Please note that this would involve installing the Linode-CLI on your Linode.

The command would look something like this:

a="$(linode-cli kernels view linode/latest-64bit --no-headers --text | awk -F '\t' '{print $2}' | awk -F"[()]" '{print $2}')"
b="$(uname -r)"
if [ "$a" != "$b" ]; 
then 
  echo "kernel not up to date - you can reboot using the Linode-CLI command 'linode-cli linodes reboot \$linode_id'"
else 
  echo "kernel is up to date"; 
fi

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct