7

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
  update-manager-core
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 Jun 23 '15 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? – 大易归真 Jun 23 '15 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 Jun 23 '15 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 – 大易归真 Jun 23 '15 at 12:38
  • well it is something that canonical tests a lot before releasing the stuff to its users - so you normally should rely on the fact that apt-get upgrade doesn't destroy something - if it does - the software you use or your server is not under your full control. if you rely on your system - you need a staging system for tests - to be sure that apt-get upgrade is not a problem... – Mr.Gosh Jun 23 '15 at 19:18
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

TL;DR!

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 Jun 23 '15 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. – 大易归真 Jun 23 '15 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? – Peter Krauss Nov 10 '16 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 Nov 10 '16 at 14:01
  • How to know when apt-get upgrade is finish? – TheCrazyProfessor Apr 3 '18 at 9:31
1

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? – Peter Krauss Nov 10 '16 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 Nov 10 '16 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. – Peter Krauss Nov 10 '16 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 Nov 10 '16 at 13:57
1

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.

-1
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 – daltonfury42 Jun 23 '15 at 7:51
  • 3
    -1 This is wrong update just updates the sources and upgrade updates the packages – Mark Kirby Jun 23 '15 at 7:58
-1

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 Jun 23 '15 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.