57

Possible Duplicate:
updates in amazon-ec2 ubuntu 10.04 server

When I log into an Ubuntu 10.04.2 LTS server, I see the message:

42 packages can be updated.
18 updates are security updates.

But when I try to update this, nothing gets upgraded as would be expected:

$ sudo apt-get update
....snip....
Reading package lists... Done
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  linux-generic-pae linux-headers-generic-pae linux-image-generic-pae
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

Any ideas why either nothing was updated, or why the count of 3 (from apt-get) is different than 42? What software says 42 if not apt?

(Other details: This is the server edition, no GUI; I haven't touched the apt configuration files; when I installed the software, I declined to allow automatic updates)

2
  • 3
    @Chopper3: Though is true that this answer is really closed to the one spotted as duplicate, I cannot see how the OP may know that the command aptitude is related to this question. Aptitude is not installed by default in latest ubuntu servers so the answer should focused in how to solve it using apt-get not aptitude (which is the tool proposed in the other post and have to be installed previously in order to solve this issue) lists.ubuntu.com/archives/maverick-changes/2010-June/… -> aptitude removed from standard
    – hmontoliu
    May 2, 2011 at 11:00
  • A number of people asked for it to be closed as duplicate, I have no particular opinion on the question. SF is a democracy if enough people want a question closed then it is, same for if enough people want it reopened.
    – Chopper3
    May 2, 2011 at 11:20

2 Answers 2

55

In order to install packages kept back you have to run:

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

Trying to run just sudo apt-get update && sudo apt-get upgrade wont install packages kept back because apt-get upgrade by default does not try to install new packages (such as new kernel versions); from the man page: under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed.

However apt-get dist-upgrade allows you to install new packages when needed (ie, a new kernel version); From the man page:

  dist-upgrade
       dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new
       versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important
       packages at the expense of less important ones if necessary. So, dist-upgrade command may remove some packages. The
       /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also
       apt_preferences(5) for a mechanism for overriding the general settings for individual packages.
2
  • 4
    This did update the three packages, but it did not change the MOTD message which read exactly the same as before ("42 packages can be updated..."). I had to manually reset this message via sudo rm /etc/motd.tail, and now I correctly see "0 packages can be updated".
    – Mike T
    May 2, 2011 at 18:50
  • This worked for me to clear the packages that were left after a sudo apt-get upgrade May 21, 2018 at 22:52
21

This message is coming from the MOTD (message of the day) system. Details of how to fix the incongruity between this message and the package manager were covered recently in this answer.

6
  • sudo rm /etc/motd.tail did the trick
    – Mike T
    May 2, 2011 at 10:57
  • but that doesn't upgrade your system :-)
    – hmontoliu
    May 2, 2011 at 11:05
  • The above was preceded by sudo apt-get update && sudo apt-get dist-upgrade, however that didn't change the message text. I had to delete the tail file and restart, and now I correctly see "0 packages can be updated"
    – Mike T
    May 2, 2011 at 18:46
  • There is a delay between the last upgrades and the MOTD. What I notice with Ubuntu 14, is that if you run sudo /etc/update-motd.d/90-updates-available after doing update, dist-upgrade and autoremove (optional but good to do), it will show you nothing. But if you immediately start a new session, the MOTD will show the old message still. Wait a minute and then start a new session, now the MOTD is updated to show nothing. PS: Remember to sudo reboot.
    – ADTC
    Jun 19, 2016 at 8:02
  • 2
    And reboot? I cannot believe that we must reboot just to refresh a system message. And this bug has been around for 7+ years without being fixed? Amazing. May 7, 2018 at 11:13

Not the answer you're looking for? Browse other questions tagged .