Score:1

How to disable "Pending kernel upgrade" message?

ht flag

Since I upgraded to Ubuntu 21.04 hirsute, I get this very annoying message whenever I perform some upgrades.

Pending kernel upgrade

How to disable it? It's breaking my upgrade scripts.


System information :

OS: Ubuntu 21.04 x86_64
Host: HP G62 Notebook PC 0598120000202710010020100
Kernel: 5.11.0-24-generic
Uptime: 17 mins
Packages: 1289 (dpkg), 11 (snap)
Shell: bash 5.1.4
Resolution: 1366x768
Terminal: /dev/pts/0
CPU: Intel i3 M 370 (4) @ 2.399GHz
GPU: Intel Core Processor
Memory: 424MiB / 3726MiB

Upgrade script :

sudo apt update
sudo apt full-upgrade -y --auto-remove
sudo reboot now
Nmath avatar
ng flag
What upgrades and how are you performing them? Please edit your question with the output of `sudo apt update`. What happens when you reboot?
ht flag
I'm performing the upgrades available via `sudo apt full-upgrade -y --auto-remove` and performing them via `sudo apt full-upgrade -y --auto-remove`. When I reboot, the computer reboots. The results of `sudo apt update` depends on the upgrades available at the time. Example : *1 package can be upgraded. Run `apt list --upgradable` to see it.*
Nmath avatar
ng flag
when you run apt commands with the `-y` flag you might be missing important information that could help explain the error. Can you add the entire output of `sudo apt update` and `sudo apt upgrade` into the body of your question. If you put three backticks (`) before and after each block, it will retain monospace formatting and line breaks.
ht flag
I think it would be better if you directly tell me what you're getting at. This is the normal upgrade process of Ubuntu Server and I would've included anything out of the ordinary to help you help me. Regardless, here's the logs of these commands : https://pastebin.com/BYsKWdr7 I would've put it in the question but `<details><summary>` doesn't seem to be supported here.
Nmath avatar
ng flag
*"what you're getting at"* - problem solving which requires information gathering. The error suggests that there is a problem somewhere with the package management and `apt` will usually throw errors or messages giving you more information. I'm asking questions that might shed light on the problem, which could reveal a solution. Have you already rebooted the system? Also, do you generally, or have you ever manually installed kernel versions outside of the typical updates from the package manager or `apt`?
Nmath avatar
ng flag
Also, why do you use a *script* for updates, and is there any reason you are using `sudo apt full-upgrade -y --auto-remove` instead of `sudo apt upgrade`?
user535733 avatar
cn flag
Your output shows that you have the `-proposed` pocket of the Ubuntu Repositories enabled. That's generally a bad idea, and is one possible cause of your problem. Disable `-proposed`, run apt updates again, and see if the problem goes away over the next week or two.
ht flag
Aight. I don't see any errors right now. The way I see it, it really looks like an intended notification suggesting that I reboot after the upgrade. I've dismissed this notification during many different upgrades before and I've already rebooted. This notification will likely appear during the next upgrade when a new kernel version will be available. I've never installed another kernel outside of what's available via upgrades. I also have this message on my Raspberry Pi running Ubuntu Server.
ht flag
I've disabled `hirsute-proposed`, I'll see what happens next week. While it's nice if that solves it, it would be better to know how to disable only the prompt so it doesn't happen even if I use `-proposed` in the future, at least to actually answer the question.
JohnC avatar
cn flag
To those that are pointlessly questioning the need for this rather than just answering the question it's not uncommon to need to create servers in an automated process such as virtual private servers and use a standard initializing script for each new server and the script will automatically restart anyway.
Score:0
ng flag

A workaround is to remove needrestart:

sudo apt -y remove needrestart
Kevin Cooper avatar
br flag
While this may work, it also removes a useful program and is likely not what most users want. Benny's answer below is less invasive.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.