Linux headers generic kept back

apt says packages have been kept back, what to do?

I have had the same issue, several times. Do NOT do sudo apt-get dist-upgrade first.Very important. It can make your system very unstable, programs can crash and you can lose a lot of functionality in your OS. NOTE: This solution is for Debian based machines but will not work on KDE Neon. To update KDE Neon, you must use sudo pkcon update .

You MUST install each package individually, HOWEVER, during that process, other dependencies will also be installed automatically and your issue will be solved in just a few minutes. Please see this blog post to understand why this happens.

I have had no issues with the following solution. It’s fairly quick and easy.

First, do this:

Next, do this:

sudo apt-get install package-name-here

After that process completes, do this:

  • This will again show which packages can be upgraded. Your list of packages should now be decreasing. Follow the list of packages and type apt list —upgradable after each package install. This should only take a couple of minutes to complete.

Finally:

sudo apt-get update && sudo apt-get dist-upgrade

If this solution worked for you, please don’t forget to upvote it so that the correct solution is available for others and is at the top of the list of answers.

If for some reason this solution does not work for you, please see user GAD3R’s answer below. It is also a good solution.

Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.

Used for Ubuntu 22.04.1. Can’t see: «The following packages have been kept back: gnome-remote-desktop grub-common grub-pc grub-pc-bin grub2-common gstreamer1.0-pipewire libpipewire-0.3-0 libpipewire-0.3-common libspa-0.2-modules open-vm-tools open-vm-tools-desktop openssh-client. » anymore. Before that OS became very slow unexpectedly

In most cases dist-upgrade is better that this solution because it will calculate the correct decisions about which packages to remove and upgrade but this solution gives you more control.

The following packages have been kept back: 

This means that there are new versions of these packages which will not be installed for some reason. Possible reasons are broken dependencies (a package on which it depends doesn’t have a version available for download) or new dependencies (the package has come to depend on new packages since the last version).

Should I take action?

Читайте также:  What is angstrom linux

You need to use dist-upgrade in order to install the new dependencies and upgrade the packages:

The problem can be solved by runing dist-upgrade if not you need to:

Remove some packages that are no longer installed on your system:

Put the desired package on hold:

echo " hold" | dpkg --set-selections 

Reconfigure the named package:

It seems to me that «for some reason» is kind of a bug. Apt should tell the user why a package was held back, IMHO. For what it’s worth, it seems that one reason this can happen is something called «Phased Updates» — see wiki.ubuntu.com/PhasedUpdates — basically, that it’s trying to keep everyone from updating all at once, in case there’s a regression or whatever. How much time would be saved if the software would tell us this, and to just try again later, or give an option to force it or something? Anyway.

This article nicely summarizes why this happens:

If the dependencies have changed on one of the packages you have installed so that a new package must be installed to perform the upgrade then that will be listed as «kept-back».

The solution to this is to install them explicitly with

sudo apt install [packages] 

You probably want to mark these packages as automatically installed, unless you care about them yourself and not just to satisfy dependencies.

sudo apt-mark auto [packages] 

To prevent this from happening in the first place, I recommend to use

sudo apt --with-new-pkgs upgrade 

to upgrade packages in the future, which allows installation of new packages to satisfy changes in dependencies.

Two thumbs up for —with-new-pkgs ! And let me stress just again that, «DO NOT dist-upgrade any production system! While dist-upgrading will «solve» kept back packages it is definitely not the solution to this issue and will quite likely cause you more grief than good if you run it without knowing the implications on your system.»

Firstly as mentioned above please DO NOT dist-upgrade any production system! While dist-upgrading will «solve» kept back packages it is definitely not the solution to this issue and will quite likely cause you more grief than good if you run it without knowing the implications on your system.

If upgrading a package requires installing additional packages it will be «kept back» when running sudo apt-get upgrade .

As mentioned above you can install these «kept back» packages manually by explicitly running sudo apt-get install but this will mark these packages as «manually installed» which is often not what we want.

Читайте также:  Astra linux офисные приложения

To automatically install any additional packages needed to upgrade the «kept back» packages while not marking the «kept back» packages as manually installed just run sudo apt-get —with-new-pkgs upgrade .

I included this answer in my blog. If you want to see that you can go there from this link.

The above error is very common in Ubuntu terminal when you try to upgrade ( apt-get upgrade ). This usually happens because dependencies of one package you install has changed. In order to upgrade you need to upgrade those as well first. So it is very straightforward to solve that. You will be able to see those packages that kept back below this error message. as an example I can see following packages in the list:

gnome-software gnome-software-common linux-generic linux-headers-generic linux-image-generic snapd ubuntu-core-launcher ubuntu-software

Don’t just type sudo apt-get dist-upgrade It is very dangerous since it installs all pending updates. This could take your working environment to a highly unstable state.

Therefore my opinion is to use famous

sudo apt-get install [package]

You can replace [package] with whatever package is in the error message. Also you can put them as it is as a list (just copy and paste it). As an example in my case I can enter

sudo apt-get install gnome-software gnome-software-common linux-generic linux-headers-generic linux-image-generic snapd ubuntu-core-launcher ubuntu-software

for some reason, just make sure to inspect the list of packages by using the simulate option -s ( sudo apt-get -s dist-upgrade ), or without the -s option you can terminate execution before accepting. (you can always choose the option no )

Источник

How To: Upgrade Packages that Were Kept Back

Now and then you may notice that apt-get upgrade command keeps a few packages back, meaning they don’t get upgraded. This quick post shows what you can do about it and how to get all the packages upgraded.

How apt-get Keeps Packages Back

[email protected]:~ $ sudo apt-get upgrade Reading package lists. Done Building dependency tree Reading state information. Done Calculating upgrade. Done The following packages have been kept back: linux-generic linux-headers-generic linux-image-generic 0 to upgrade, 0 to newly install, 0 to remove and 3 not to upgrade.

Why Packages Are Kept Back by apt-get

Most likely reason for keeping packages back is that upgrading them means installing new packages or removing existing ones. apt-get upgrade strictly upgrades existing packages, without removing or installing anything. Since the command you’re giving to apt-get is upgrade and not to install new packages, packages that require some old packages removed or new packages installed are kept back.

How To Upgrade Packages That Were Kept Back

Simply use the dist-upgrade option of apt-get, which will resolve dependencies and install/remove dependent package as needed:

[email protected]:~ $ sudo apt-get dist-upgrade Reading package lists. Done Building dependency tree Reading state information. Done Calculating upgrade. Done The following NEW packages will be installed linux-headers-5.0.0-20 linux-headers-5.0.0-20-generic linux-image-5.0.0-20-generic linux-modules-5.0.0-20-generic linux-modules-extra-5.0.0-20-generic The following packages will be upgraded: linux-generic linux-headers-generic linux-image-generic 3 to upgrade, 5 to newly install, 0 to remove and 0 not to upgrade. Need to get 67.0 MB of archives. After this operation, 334 MB of additional disk space will be used. Do you want to continue? [Y/n] y

See Also

Источник

Читайте также:  Чем хороша операционная система линукс

How to force installation of kernel updates when using apt-get upgrade?

To update my server I use apt-get upgrade . But when there are kernel updates I always need to do apt-get install linux-. because apt-get update does not install them. Is there a way I can tell it to install those too? I tried -f but it does not work.

apt-get upgrade installs new kernels for me if there is one. What Ubuntu version are you using? The only thing I have up to check right now is 10.04.

10.04 also, it tells me «These updates are kept from being upgraded» (translated from French). and it lists the linux updates.

3 Answers 3

Using dist-upgrade can add or remove other packages, it’s not limited to just the kernel. This can be an issue on a server if you’re hosting for others. However in such a a case you probably want to use apt-pin anyways to prevent unintentional upgrades.

dist-upgrade will install new packages while trying to resolve an upgrade, which is needed to get kernel updates when the kernel ABI changes (since it resolves to a different binary package name).

So, with regard to the comments: Sorry, you were right, I was completely mis-reading what apt-get was telling me (and I’m using the English version! :)).

After a little research, what you probably want to use is aptitude safe-upgrade , which does install new kernels. Really! I double checked! 🙂

You should probably prefer aptitude in general to apt-get anyway, unless you specifically need something in apt-get .

nknight@nkubuntu1004:~$ sudo aptitude safe-upgrade Reading package lists. Done Building dependency tree Reading state information. Done Reading extended state information Initializing package states. Done Resolving dependencies. Resolving dependencies. The following NEW packages will be installed: linux-headers-2.6.32-24 linux-headers-2.6.32-24-generic linux-image-2.6.32-24-generic The following packages will be upgraded: apt apt-transport-https apt-utils base-files firefox firefox-branding firefox-gnome-support gdm google-chrome-stable icedtea-6-jre-cacao linux-generic linux-headers-generic linux-image-generic linux-libc-dev openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib software-center thunderbird ureadahead xulrunner-1.9.2 21 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 129MB of archives. After unpacking 188MB will be used. Do you want to continue? [Y/n/?] 

Источник

Оцените статью
Adblock
detector