{"id":5532,"date":"2023-10-23T18:06:00","date_gmt":"2023-10-23T23:06:00","guid":{"rendered":"https:\/\/www.incredigeek.com\/home\/?p=5532"},"modified":"2023-12-05T15:55:54","modified_gmt":"2023-12-05T21:55:54","slug":"how-to-check-if-rhel-almalinux-need-a-reboot-after-an-update","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/how-to-check-if-rhel-almalinux-need-a-reboot-after-an-update\/","title":{"rendered":"How To Check if RHEL\/AlmaLinux needs a reboot after an update"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>Typically you&#8217;ll need to reboot a server after an update if the Linux Kernel was updated.  It is possible that services need to be restarted.  <\/p>\n\n\n\n<p>There is some good information here https:\/\/serverfault.com\/questions\/122178\/how-can-i-check-from-the-command-line-if-a-reboot-is-required-on-rhel-or-centos<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Yum Utilities needs-restarting<\/h2>\n\n\n\n<p>Install the needs-restarting utility<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo dnf install -y yum-utils<\/pre>\n\n\n\n<p>Once installed, we can check if we need to reboot with<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo needs-restarting -r<\/pre>\n\n\n\n<p>The -r option only reports if a reboot is required.<\/p>\n\n\n\n<p>If we wanted to automatically check and reboot, we could do<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo needs-restarting -r || sudo shutdown -r<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Alternative way<\/h2>\n\n\n\n<p>We could alternatively just check the kernel version and if it is different, manually reboot the machine.  Note that there could be a couple cases where the kernel didn&#8217;t update, but you still need a reboot, or services needed to be restarted  View links below for more information.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">LAST_KERNEL=$(rpm -q --last kernel | perl -pe 's\/^kernel-(\\S+).*\/$1\/' | head -1)\nCURRENT_KERNEL=$(uname -r)\n\ntest $LAST_KERNEL = $CURRENT_KERNEL || shutdown -r<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Typically you&#8217;ll need to reboot a server after an update if the Linux Kernel was updated. It is possible that services need to be restarted. There is some good information here https:\/\/serverfault.com\/questions\/122178\/how-can-i-check-from-the-command-line-if-a-reboot-is-required-on-rhel-or-centos Using Yum Utilities needs-restarting Install the needs-restarting utility &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/how-to-check-if-rhel-almalinux-need-a-reboot-after-an-update\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,22],"tags":[1389,491,7,1599,681,538,248,441],"class_list":["post-5532","post","type-post","status-publish","format-standard","hentry","category-linux","category-redhat-linux","tag-almalinux","tag-dnf","tag-linux-2","tag-needs-restarting","tag-reboot","tag-rhel","tag-update","tag-yum"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/5532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=5532"}],"version-history":[{"count":2,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/5532\/revisions"}],"predecessor-version":[{"id":5539,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/5532\/revisions\/5539"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=5532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=5532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=5532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}