"The following packages have been kept back:" Why and how do I solve it?
Solution 1
According to an article on debian-administration.org,
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".
Cautious solution 1:
Per Pablo's answer, you can run sudo apt-get --with-new-pkgs upgrade, and it will install the kept-back packages.
This has the benefit of not marking the kept-back packages as "manually installed," which could force more user intervention down the line (see comments).
If Pablo's solution works for you, please upvote it. If not, please comment what went wrong.
Cautious solution 2:
The cautious solution is to run sudo apt-get install <list of packages kept back>. In most cases this will give the kept-back packages what they need to successfully upgrade.
Aggressive solution:
A more aggressive solution is to run sudo apt-get dist-upgrade, which will force the installation of those new dependencies.
But dist-upgrade can be quite dangerous. Unlike upgrade it may remove packages to resolve complex dependency situations. Unlike you, APT isn't always smart enough to know whether these additions and removals could wreak havoc.
So if you find yourself in a place where the "cautious solution" doesn't work, dist-upgrade may work... but you're probably better off learning a bit more about APT and resolving the dependency issues "by hand" by installing and removing packages on a case-by-case basis.
Think of it like fixing a car... if you have time and are handy with a wrench, you'll get some peace of mind by reading up and doing the repair yourself. If you're feeling lucky, you can drop your car off with your cousin dist-upgrade and hope she knows her stuff.
Solution 2
Whenever you receive from the command apt-get upgrade the message
The following packages have been kept back:
then to upgrade one or all of the kept-back packages, without doing a distribution upgrade (this is what dist-upgrade does, if I remember correctly) is to issue the command:
apt-get install <list of packages kept back>
this will resolve the kept-back issues and will ask to install additional packages, etc. as was explained by other answers.
See also: Why use apt-get upgrade instead of apt-get dist-upgrade?
Solution 3
I answered a similar question here.
Try this Unix SE answer:
sudo apt-get --with-new-pkgs upgrade
This allows new packages to be installed. It will let you know what packages would be installed and prompt you before actually doing the install.
apt command (friendly alternative to apt-get) share this option.
Using apt install <pkg> instead will mark pkg as "manually installed"!! To mark it again as "automatically installed" use apt-mark auto <pkg> (see also subcommand showmanual). More info on this answer.
Solution 4
There are normally two reasons you may see this message.
If upgrading the program (via sudo apt-get upgrade) would cause packages to be added or removed, then the program will be held back. You can use sudo apt-get dist-upgrade in this case, which will then offer to add or remove the additional packages.
This is pretty common and usually not an issue. Occasionally (particularly during an Ubuntu alpha) a dist-upgrade will offer to remove a lot of other programs, in which case you probably want to cancel it.
If the package depends on packages or versions that are not available, then the program will be held back. You really can't do anything but wait in this circumstance, since the package is basically uninstallable. This can happen when packages get added to the repository out of order, when a package is renamed, or when a package stops providing a virtual package.
Solution 5
You can also try:
sudo aptitude safe-upgrade
It's safer than full-upgrade (originally named dist-upgrade) because "packages will not be removed unless they are unused".
From man aptitude:
safe-upgrade
Upgrades installed packages to their most recent version. Installed packages will not be removed unless they are unused /.../ Packages which are not currently installed may be installed to resolve dependencies unless the --no-new-installs command-line option is supplied.
Related videos on Youtube
jfoucher
Updated on September 17, 2022Comments
-
jfoucher about 1 monthI just added a PPA repository for the development version of the GIMP, but I get this error:
$ apt-get update && apt-get upgrade ... The following packages have been kept back: gimp gimp-data libgegl-0.0-0 libgimp2.0Why and how can I solve it so that I can use the latest version instead of the one I have now?
-
Admin about 1 yearWhat a garbage message. Why can't the OS just do the needful?
-
-
andol about 12 yearsWhat do you base that likelihood on, without knowing whatever he ran an apt-get upgrade or an apt-get dist-upgrade (alt. the aptitude equivalents)? -
txwikinger about 12 yearsthis is the most occurring problem in support questions and bugs -
Umang about 12 yearsAgreed. You should probably wait and check you apt_preferences. This is often caused by development archives where the and available packages dependencies are changing very quickly. Wait for them to settle down and you may not need todist-upgradeat all. If you'd still like todist-upgrade, then look at the NEW packages to be installed and the packages to be removed before going ahead. -
Postadelmaga about 10 yearsThis is my case because I get the "kept back" message using dist-upgrade -
Cas about 10 yearsAs this is an accepted answer needs, it really needs updating to warn about usingdist-upgradeon a stable system as many of the other answers below have pointed out. Personally I think there is a simpler/safer answer that needs promoted: apt-get install <list of pkgs> -
crenshaw-dev about 10 yearsCas, should I just add that it could be dangerous to run a dist-upgrade on a stable system? Why exactly is that dangerous? (I honestly don't know apt all that well.) -
Cas about 10 yearsThere is a Server Fault answer that explains dist-upgrade in a bit more detail. I think its just worth clarifying (not dangerous as such) that it may upgrade the entire system which may be beyond what the user expects/wants i.e. in the OP example they are wondering why gimp is being held back. -
Admin almost 10 yearsapt-get dist-upgradeis only dangerous if you have bad repositories in/etc/apt/sources.list*. It's good to be aware thatdist-upgradeupgrades all packages, but with the default repositories, that should be fine. Not usingdist-upgradecould be dangerous, as you might miss security updates. -
Eliah Kagan over 9 yearsPlease note thatsudo apt-get dist-upgradecan also remove packages. Consequently, it's best always to inspect the list of changes that will be made before agreeing to them, when runningsudo apt-get dist-upgrade. -
Admin over 9 yearsapt-get dist-upgradecan remove as well as add packages, but it is not really dangerous. Any package installation command can cause serious damage if you have problems in yoursources.listfile! A regularapt-get upgradecommand will install any package from any software source that is enabled;dist-upgradeis not unique in this way. Furthermore, usingaptitudeto perform any operation at all, at least on amd64, is much more dangerous than runningapt-get dist-upgrade, in a release where bug 831768 isn't fixed. -
Bibhas almost 9 yearsEvenaptitude upgradeworked for me. -
tanius over 8 yearsIn cases where this problem is due to a messup with apt preferences (pinning), I found reinstallation of the kept packages helped me:apt-get install --reinstall <packages>. -
ahmed hamdy over 7 yearsI`am usingUbuntu 14.04and I does not haveaptitudecommand line -
f.ardelian over 7 yearsapt-get dist-upgradegave me the same message, but this solved it for me. I had a package which was breaking the upgrade of another package. I didn't need the one I installed, soaptitude full-upgradegave me the option to remove it so it could upgrade everything else. -
Aaron McDaid over 7 yearsI've extended the note warning that dist-upgrade is dangerous. I'm not very satisfied with what I've written. But I want a much more emphatic warning -
Admin about 7 yearsFor me, it was easier (local machine with X running) to just open synaptic and force the package's upgrade. For some reason it didn't seem to show up at all where you described in synaptic. -
John Mee about 7 yearsUpgrades specific packages (and their dependencies) without the commitment (risks) of a dist-upgrade. -
DevZer0 about 7 yearsi had to usedist-upgradeto resume a failedrelease-upgradetherelease-upgradefailed because of a previously broken package and after fixing that problem the only way to resume the remaining package upgrade was viadist-upgrade -
syntaxerror about 7 years@EliahKagan May I add that evenapt-get upgradecan remove packages? It will always do that when there would be a version conflict otherwise. Think ofllvm3.6vs.llvm3.6v5(with the "v5" meaning that it was compiled withgcc 5). These two cannot co-exist, only either of both can be kept on the system. So yesdist-upgrademay remove some packages as well, but it's not onlydist-upgradethat would do this; under certain circumstances,upgradewould, as well. -
Admin almost 7 yearsIf you trieddist-upgradeand some packages are still "kept back", you can try diagnosing the issue withsudo apt-get install <package>; you may find that it is failing because some dependencies are unresolvable (whichdist-upgradealone apparently will not tell you) -
Admin over 6 yearsAlsosudo aptitude safe-upgrade -
Alexis Wilke over 6 yearsThe graphical tool that offers you to upgrade your computer software that appears every day there are new software available... does anapt-get dist-upgradeevery single time. It has nothing to do with upgrading to a new version of the OS (i.e. going from 12.04 to 14.04). It is more a form of distinction between kernel upgrades and other upgrades. In any event, you always want to do a dist-upgrade unless you need to keep running with some old version of software. -
Jake almost 6 yearsIs there a way to determine whether the held package needs a dependency that can't be installed or if it is being held because other packages depend on it. I have many held packages and I believe both of these cases may apply on my system. -
geekQ almost 6 yearsThere is less dangerous option, which does not need listing every package manually:sudo apt-get --with-new-pkgs upgradefrom unix.stackexchange.com/questions/38837/… -
cram2208 over 5 yearsWhen packages are kept back this way and I manuallyapt-get upgrade <list of packages>, if I redoapt-get upgrade, it will list the packages in question as no longer required and that I can useapt autoremoveto remove them, which I do, and then one lastapt-get upgradeand they are no longer listed as kept back... Very weird. Any thoughts? -
nyxee about 5 yearsI just attempted to upgrade from 14.04LTS to 16.04LTS. somehow i just got scared that i was lagging behind. so, if we can't upgrade smoothly, i wonder whats the point of keeping our systems. I wonder whether its advizeable tostay on LTS. -
dinosaur about 5 years@mac9416, you said "Think of it as upgrading from Ubuntu 12.04 to 14.04". Do you mean this literally? Willsudo apt-get dist-upgradechange which release of Ubuntu I am using? -
crenshaw-dev about 5 years@dinosaur it was a confusing analogy, so I edited it out.dist-upgradedoes not change the release, because your sources.list files do not change. This answer should help you out. -
crenshaw-dev about 5 yearsDoesapt-get installalso remove packages when necessary to resolve gnarly dependency situations, or would you have to run a separateapt-get removecommand to accomplish that part of the upgrade process? -
Alex about 5 years@cram2208 I believe that's the expected behaviour. The packages that were "automatically installed and [...] no longer required" are the previous versions of the upgraded packages, which are now no longer needed.apt autoremovethen removes these unused dependencies. -
ctrl-alt-delor about 5 yearsapt-get installwill also mark packages as manually installed, you may not want that. They wont un-install when you remove the package that depends on them. -
ctrl-alt-delor about 5 years+1 because it does not have side affect of causing packages to be marked as manually installed. -
Eliah Kagan about 5 years@syntaxerror Sorry, I just saw this. What you've described is precisely the situation where one must usedist-upgrade. Runningapt-get upgradedoes not remove packages. As theapt-getmanual page says in the description of theupgradeaction: "Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed." Sodist-upgradeis categorically more powerful thanupgrade. -
l --marc l almost 5 yearsIf the upgrade would require a new package to be installed, the package will be "kept back." First consider using:sudo apt-get --with-new-pkgs upgradewhich would not have side affect of causing packages to be marked as manually installed -
Chai T. Rex over 4 yearsPlease don't use screenshots for terminal text, since that makes it unsearchable by Google and unreadable by some people. Instead, paste the terminal text into your answer, select that text, and press the{}button in the editor to properly format it. -
Vasyl Lyashkevych over 4 years@ChaiT.Rex Thanks for remarks, I will take it in opinion for the future. -
jarno over 4 yearsYou could do it without--reinstall, too. -
jarno over 4 years@mac9416 yes it does. -
jarno over 4 yearsFunny thing is that it removes the libjpeg-turbo-progs package. -
jarno over 4 years@mac9416 see e.g. askubuntu.com/a/818101/21005 -
crenshaw-dev over 4 years@jarno this leaves me to wonder what the difference between install and dist-upgrade truly is. Thanks for the heads-up. -
jarno over 4 years@mac9416apt-get dist-upgradedecides which packages it will upgrade and may keep back packages. Withapt-get installyou have to name those packages expect maybe when using--fix-brokenoption. -
crenshaw-dev over 4 years@jarno well that's fair. I meant more in terms of how they handle un-installation of packages. Say you do an apt-get upgrade and packages foo and bar are held back. Previously I'd believed thatapt-get install foo barwould upgrade the packages, but only if it didn't have to un-install anything to resolve dependencies; whereasapt-get dist-upgradewould upgrade the packages, uninstalling anything necessary to resolve dependencies. But now it seems as if they are both willing to un-install things. -
jarno over 4 years@mac9416 Use--no-removewithapt-getif you do not want to remove packages. -
rew over 4 yearsFYI, I tried the "cautious" method, apt-get install, and because i'm explicitly teling it to install a certain package, apt feels justified to remove others... You do get a chance to say "no, lets not go that way". I got into this mess with an apt-get autoremove that removed a "no longer necessary" package and now two packages are "kept back" and upgrading either will remove 12-15 other packages. Odd. -
crenshaw-dev over 4 years@rew the plot thickens. this comment agrees apt-get install removes packages. I'm honestly stumped now which is the "safer" solution. -
ctrl-alt-delor over 4 yearsThe first “cautious” option, will also mark packages as manually installed. This may have a detrimental affect when installing another package that depends on them. E.g. You didapt install gamesthen one daypingusis held back, so you do the fix, then next week you doapt remove games. Butpinguswill not be removed, as it was manually installed. -
ctrl-alt-delor over 4 yearsNote to who ever reads my comment above: not having the side effect of marking as manually installed is a good thing. I like this answer. -
crenshaw-dev over 4 years@ctrl-alt-delor is there a scenario where that "sticky" package will cause other (truly damaging) package management issues? Or does it just add the inconvenience of having to run an additionalapt remove pingusto force the removal of that package? -
jlh over 4 yearsThanks, the second reason was the issue for me. Evenapt-get dist-upgraderefused to install it. Inspecting the package with aptitude showed that it depends on a package that isn't available. I guess I'll have to wait. -
ctrl-alt-delor over 4 years@mac9416 Probably not. Let me have a go at a scinario. What if it was a library, then it caused you to remove some library by mistake. -
Markus Zeller over 4 yearsInstalling the kept package helped me also with open-vm-tools. Thank you for the solution and explanation. -
crenshaw-dev over 4 years@ctrl-alt-delor I feel like that's solved by just keeping an eye on the list of packages to be removed when you manually uninstall (for example) pingus. -
ctrl-alt-delor over 4 years@mac9416 if you want to do the job of apt, then you can do this. However I am not a computer, so I let apt manage my dependencies. -
crenshaw-dev over 4 years@ctrl-alt-delor if you're upgrading "kept-back" packages, you're already dabbling in the role of "human package manager" by altering its default behavior. -
ctrl-alt-delor over 4 years@mac9416 this answer askubuntu.com/a/862799/10473 is better. Dabble as little as possible. The argument that I dabbled a little, so I dabble a lot, is not valid. If you are just trying to legitimise your own dabbling, by telling others to do like wise, then please realise that you are legitimate and loved. You can do what ever you want on your own system. -
crenshaw-dev over 4 years@ctrl-alt-delor, that does look like a better solution. I'll edit to point folks further down the page. -
crenshaw-dev over 4 yearsSo if you usesudo apt-get --with-new-pkgs upgradewithout runningapt-mark auto <pkg>, will everything be fine? Is the second command only necessary if you do choose to manually install held-back packages? -
Pablo Bianchi over 4 yearsYes.apt-mark auto <pkg>should only be necessary to mark a package as being automatically installed (here the man page). -
Franklin Yu almost 4 yearsFor some reasonsudo apt-get --with-new-pkgs upgradestill shows the packages as "kept back". No error message. -
Julius almost 4 yearsJust want to add that for many up to date debian 9.6 server instances this was the absolute safest solution without breaking things. Thank you for this, Pablo, as I had luckily tested other options on staging environments beforehand, and could admin many servers up to security standards thanks to the --with-new-pkgs inclusion with much cleaner results for general future package management. Really, this UNIX SE answer should be upvoted! -
drevicko over 3 years@MichaelCrenshaw yes, that's the point here.apt-mark auto <pkg>' is for when youapt-get install <pkg>` for a pkg that was previously marked auto. -
Andrew over 3 yearsYou can also add the --simulate switch to see what this command would do, without it actually doing it. -
Admin over 2 years@msanford Thank you! Your solution fixed it for me wheresudo apt-get --with-new-pkgs upgradedid not. -
Arun Panneerselvam over 2 yearsAfter this operation, 2,548 MB disk space will be freed. You are about to do something potentially harmful. To continue type in the phrase 'Yes, do as I say!' -
yucer about 2 yearsI wonder if some of those actions in ubuntu LTS would break the LTS guaranty. -
bernie over 1 yearfull-upgradedoes the same thing asdist-upgrade! This answer is wrong! See here askubuntu.com/questions/770135/… -
l --marc l over 1 year@bernie Answer updated per your observation. -
sovemp over 1 yearFirst solution doesn't work at all, it just does nothing then says again "following packages have been kept back..." -
DaVince over 1 yearI think something might have changed about the mechanism, because for me, dist-upgrade actually did nothing and it was the regular install command that asked me to remove the :i386 version of a package. Luckily, apt reports in detail what packages it affects and so I could successfully update the package that was being held back. -
iRaS over 1 yearI have a strong opinion that it should be possible to force the release upgrade anyway. For example I have installed conky 1.11.3 because in 1.11.4 they introduced reparsing of lua-conky-parse expressions what makes it unusable. It seems they don't want to fix it: github.com/brndnmtthws/conky/issues/967 And I defenetly don't want to upgrade it - I set it to kept back manually. -
Andrew Koster about 1 yearThis solution doesn't have the side effect of causing packages to be marked as "manually installed". It also doesn't have the side effect of "actually installing the dang packages". -
Andrew Koster about 1 yearThis is the only answer that works and doesn't require a full distro upgrade. -
Andrew Koster about 1 yearThe package manager doesn't want to manage packages "without my permission" even though I manually typedsudo apt upgrade. Lol. -
Andyc about 1 yearIn my case evendist-upgradedidn't do anything (at least it didn't do any damage). I had to use both "Cautious solution #1" and "Cautious solution #2" in that sequence. -
geneorama 11 months"Unlike you, APT isn't always smart enough to know whether these additions and removals could wreak havoc." I've been using Ubuntu for 10+ years and I still don't know what 90% of the packages do when I update/upgrade, which is why I rely on the package manger. I have no idea what's usinglibsmbclientorlibfreerdp-client2-2:amd64orbamfdaemonis doing. I've come to this answer many times and been frustrated by the warning ofdist-upgrade, which I always considered to be safe. -
crenshaw-dev 11 months@geneorama very fair criticism. 12+ years after writing this answer, I'm so far removed from APT internals that I'm not super confident in what's written there. Unless an APT developer can hop in and make authoritative edits (or someone w/ good references), I'm inclined to leave the answer as-is, especially since the "warn aboutdist-upgradecomment has 208 upvotes. But I share your frustration with the aggressive warning having so little to support it. -
geneorama 11 months@MichaelCrenshaw For the records, I appreciate your wonderful answer and follow up comments. Your first suggestion of installing the packages solved my "kept back" issue this time, but I know it hasn't in the past. I've installed R a dozen different ways, and I get this kept back thing often. I've also run dist-upgrade without obvious issue for about 10 years now. I still feel like a Linux Noob and I try to keep my important files in the cloud where they're safe from me. -
UpTheCreek 7 monthsThis had no effect for me - packages still kept back. -
Admin 7 monthsdist-upgradewill not update/upgrade the whole distribution (likedo-release-upgrade). It is a misnomer. Usefull-upgradeequivalent.