“Packages can be updated” – How to update Ubuntu in terminal

Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-83-generic x86_64)

110 packages can be updated.
11 updates are security updates.

To install the latest versions of all packages for the current release, begin by updating the package list:

sudo apt-get update

apt-get update doesn’t actually install new versions of software. It downloads the package lists from the repositories and updates them to get information on the newest versions of packages and their dependencies.

To upgrade installed packages to their latest available versions, use apt-get upgrade. This will fetch new versions of packages existing on the machine.

sudo apt-get upgrade

You will be shown a list of upgrades. Press y for yes and then press Enter.

The apt-get upgrade command will normally only install updates or fixes to currently installed packages. It will not generally install new releases where major changes are required, like when a new Linux kernel is available.

Use the dist-upgrade command to perform upgrades involving the Linux kernel, changing dependencies, or adding and removing new packages as necessary.

sudo apt-get dist-upgrade

You will be shown a list of upgrades. Press y for yes and then press Enter.

A system restart may be required after installing updates.

sudo reboot

Detailed Explanation

apt-get update is used to resynchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and updated packages is available. An update should always be performed before an upgrade or dist-upgrade. Please be aware that the overall progress meter will be incorrect as the size of the package files cannot be known in advance.

apt-get upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. 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. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

apt-get 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.

Let me know in the comments if this helped. Follow me @DevAnswers or buy me a beer 🍺


Your email address will not be published. Required fields are marked *

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces

4 replies

I ran apt-get upgrade but I have loads of error

W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

It’s permission denied because you didn’t use sudo.

Run: sudo apt-get upgrade

I get this error when running apt-get dist-upgrade

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.