When I use apt-get update and apt-get upgrade,there are some packages should installed in newest version,like below:

The following packages will be upgraded:
  accountsservice apparmor apport apt apt-transport-https apt-utils binutils
  cloud-init cpp-4.8 dpkg fuse g++-4.8 gcc-4.8 gcc-4.8-base gdisk gnupg gpgv
  grub-common grub-legacy-ec2 grub-pc grub-pc-bin grub2-common initscripts
  isc-dhcp-client isc-dhcp-common libaccountsservice0 libapparmor-perl
  libapparmor1 libapt-inst1.5 libapt-pkg4.12 libasan0 libatomic1 libbsd0
  libcurl3-gnutls libdrm2 libedit2 libfuse2 libgcc-4.8-dev libgd3 libgomp1
  libitm1 libjson-c2 libjson0 libnuma1 libpam-systemd libpolkit-agent-1-0
  libpolkit-backend-1-0 libpolkit-gobject-1-0 libquadmath0 libstdc++-4.8-dev
  libstdc++6 libsystemd-daemon0 libsystemd-login0 libtsan0 libudev1 libxext6
  linux-libc-dev ntpdate openssl overlayroot patch policykit-1 ppp
  python-urllib3 python3-apport python3-problem-report python3-update-manager
  rsyslog systemd-services sysv-rc sysvinit-utils tcpdump tzdata udev
75 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

If I didn't know every one of there packages what will happen if there update in newest version.I shouldn't execute this command(apt-get upgrade).

For example:

This php version is before I upgrade

yzxu@ubuntu:/tmp/git-2.1.2$ php --version
PHP 5.6.6-1+deb.sury.org~precise+1 (cli) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

and after I upgrade:

yzxu@ubuntu:/tmp/git-2.1.2$ php --version
PHP 5.6.10-1+deb.sury.org~precise+1 (cli) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

The php version is changed.And if I didn't what what was change in two version,should I upgrade it?Is it will influence product?

  • well that depends on the package version numbering scheme
    – Mr.Gosh
    Commented Jun 23, 2015 at 9:46
  • @Mr.Gosh So if I want use upgrade,I should notice every packages version numbering scheme and make sure every update didn't influence product? Commented Jun 23, 2015 at 11:16
  • no not necessarily- if you are not sure if a package that you depend on is breaking something - you have to research. In php the version numbereing scheme is x.y.z where x = main version number (change this and it breaks things) x = feature number (here will things change too - but it is all well documented and should be no problem thorugh dependency checks of ubuntu) z = bugfix release (these wont normally break things and should allways be isntalled fast)
    – Mr.Gosh
    Commented Jun 23, 2015 at 11:36
  • @Mr.Gosh I have see apt-get upgrade in many documents on github or other website.It looks like author didn't care what will happen if user use apt-get upgrade to update they system. It seems they just regard apt-get upgrade as a normal command instead of dangerous command like rm -rf Commented Jun 23, 2015 at 12:38
  • 1
    It's only dangerous if you don't use it.
    – mchid
    Commented Jun 3, 2016 at 14:04

7 Answers 7

apt-get update

Refreshes the repositories and fetches information about packages that are available online.

apt-get upgrade

Downloads and installs updates for all installed packages - as long as it doesn't bother dependencies (install new packages, remove old ones or crosses a repo source (switch a package from one repo to another)).

apt-get dist-upgrade

Does the same as "upgrade" but upgrades a package also when dependencies or sources are changed (something you want to avoid on servers without further testing).

To conclude - an update can break things but it is necessary! So if you are on a desktop you should normally do a:

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

Without destroying something.

On a server most of the times a:

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

should be enough AND security updates should be installed automatically (on servers and desktops)

Update to 16.04

Meanwhile the "apt" wrapper is the standard way in Ubuntu, so the commands are now:

sudo apt update        #to update the repo-information

sudo apt upgrade       #to install all security fixes and changes that doesn't harm the system or change the behaviour

sudo apt full-upgrade  #the new "dist-upgrade" that installs newer versions that can break backwards-compatibility


Yes, you should update PHP in this example because it is a security fix (this can be seen through the versioning scheme of PHP; it also wouldn't have been pushed into the "upgrade" channel of Ubuntu.)

  • Good advice on the dist-upgrade option for servers, as it can often do away with your config files! +1
    – Arronical
    Commented Jun 23, 2015 at 8:53
  • I'm understand diff between upgrade and dist-upgrade.My puzzled is if I didn't know what actually change between two version,should I upgrade it?Maybe it will influence product. Commented Jun 23, 2015 at 9:12
  • hum.. But it is dangerous? I have a good 16.04 LTS , with the apt-get upgrade command I will lose the LTS warranty? Commented Nov 10, 2016 at 3:12
  • no - you won't - LTS means that you get new updates in the "upgrade" channel for a longer time than in the non-LTS version...
    – Mr.Gosh
    Commented Nov 10, 2016 at 14:01
  • How to know when apt-get upgrade is finish? Commented Apr 3, 2018 at 9:31

I have 3 years experience of using Ubuntu, from 16.04 LTS 18.04 LTS to 20.04 LTS.

I used to do upgrade before, like doing

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

or when System Updater pops up, click install as most of people suggested online and I trusted them. I think that upgrade would make the system more stable, more better and more secure, but actually it made more problems... These behaviours had caused many many bugs so that I had spent lots of time debugging or reinstalling my system. For examples, broken grub, broken wifi driver, broken nvidia driver, broken DNS resolver... etc.

And recently, I have figured it out.

My opinion is not never doing upgrade. The reason why I always got lots of bugs is that apt-get upgrade will upgrade a lots of packages you do not know. If one of these packages do something wrong, there would cause some bugs. The more packages you upgrade, the more risk your system would encounter. So my solution would be always upgrade specific packages you want to upgrade by doing so:

sudo apt-get update

sudo apt-get --only-upgrade install <packages name>

And when you want to do sudo apt-get upgrade, it takes risks. If the system go well, lucky. If not, debug or reinstall.

But how about security update, is it still safe?

In the Software & Updates, Updates section, if you choose security updates as the options "Download and install automatically", /usr/bin/unattended-upgrade would handle the security update automatically.

You can check by

less /var/log/apt/history.log


When you run apt-get upgradeit updates all installed packages on your system. It is perfectly safe (unless you cut it off before it finishes) as all packages are from the repos (you should only install one's you trust) and are (probably) well tested before uploading.

The only small risk is a risk of bugs within the packages there self, but this could happen to any thing on any OS that was upgraded as bugs are common in any software and come and go based on version.

Should you upgrade ? Well thats up to you, I would say yes, if you don't like upgrade use the application-updater app, same thing no output to make you worried.

Here is some documentation for apt so you can find out more

  • hum... But it is "LTS dangerous"? I have a good 16.04 LTS , with the apt-get upgrade command I will lose the LTS warranty? Commented Nov 10, 2016 at 3:24
  • @PeterKrauss I don't know what you mean, all upgrade does is update the current system, it will not change your Ubuntu version, just update current packages.
    – Mark Kirby
    Commented Nov 10, 2016 at 9:17
  • 1
    thanks your reply. Example: if apt-get upgrade command changes from 16.04 LTS to 17 (or any other 16.X non-LTS), I will lost "LTS warranty". If no confusion and upgrade stay in the LTS subversion, ok. Commented Nov 10, 2016 at 13:32
  • 1
    that wont do that, it upgrades packages, not the OS, the command you use for that is do-release-upgrade
    – Mark Kirby
    Commented Nov 10, 2016 at 13:57

Maybe. But you should regularly update your system. Updates can have risk, yes. This risk also depends on things I do not know such as what PPAs you may or may not have added or other sources. But again in general it's a good idea to keep you system up to date. When you update, you get stability fixes and security updates. So I will say that it is even more dangerous not to update(upgrade) your system.


As a supplement to other more complete answers, here is a corner case in which apt-get upgrade can be dangerous (I got caught in this myself):

When running Docker containers, apt-get upgrade will shut down all of them down.

This could cause:

  • service disruption
  • loss of data (if you have --rm in your docker run command for example, and have some data you value in the container itself and not mounted somewhere properly).

Sometimes you may have a broken system, when you add third party PPA on your repository , after updating it sudo apt-get update. It is not dangerous and actually you should do this to keep your system up-to-date. One suggestion from me though, just uncheck proposed and backports repository from software sources.

  • 1
    -1 Don't see how this addresses the question about upgrade
    – Mark Kirby
    Commented Jun 23, 2015 at 7:59
sudo apt-get update
  • This only updates all your Installed Softwares.
  • This is Also Necessary when you Installed OS for the first time.. As it firstly needs Update, then only Enables you to use the Installed Softwares..

Edit: And Upgrade is Used to Upgrade the packages which were not installed correctly..

  • 1
    I thought that update is for updating the package lists, and upgrade to update the packages. And dist-upgrade to update installed packages + install new packages Commented Jun 23, 2015 at 7:51
  • 4
    -1 This is wrong update just updates the sources and upgrade updates the packages
    – Mark Kirby
    Commented Jun 23, 2015 at 7:58

You must log in to answer this question.

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