Page tree
Skip to end of metadata
Go to start of metadata

This article requires more details with links to the other upgrade options. Maybe even have a general intro page on updates. Also, the same steps to record the Ubuntu version information before running the update.

In a server environment there are different levels of updates,

  • upgrade - Package Update without removing packages
  • dist-upgrade - Package Update using conflict resolution to remove outdated packages
  • do-release-update - Release Updates

This is to allow the administer fine grained control. The more higher level of updates, the more risk to a system.

upgrade

Package Update using upgrade is the safest and covered in Setup Ubuntu Linux Base Server. The command to upgrade is,

sudo apt-get upgrade

A reboot is almost never required, but you can verify that the reboot file does NOT exist,

cat /var/run/reboot-required
cat: /var/run/reboot-required: No such file or directory

From the man pages,

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.

Once the system actually is in production you will want to review what will be upgraded before actually performing the upgrade. This can be performed using --simulate,

sudo apt-get upgrade --simulate

dist-upgrade

You may notice with apt-get upgrade that even though there are some updates not yet installed, they get "kept back". That is because these are considered more intrusive updates and will only be installed through a dist-upgrade.

This type of upgrade often updates the the Linux kernel in which case reboot is required to change to the new kernel.

From the man pages,

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.

There are some additional considerations when performing a dist-upgrade when a kernel upgrade is on the list,

  1. Have console access - in some rare cases, on boot-up you will want to choose to go back to your previous kernel.
  2. Be prepared to reboot - for the kernel to take effect you will need to reboot your machine.

Check to see if kernel upgrade is available,

sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  linux-image-virtual linux-virtual
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Notice line 5 indicates that kernel upgrade is required because of the keyword image.

Gather Information

Record the current kernel information. In this example, the current kernel version is 2.6.32-33,

uname -a
Linux krypton 2.6.32-33-server #72-Ubuntu SMP Fri Jul 29 21:21:55 UTC 2011 x86_64 GNU/Linux
cat /proc/version_signature
Ubuntu 2.6.32-33.72-server 2.6.32.41+drm33.18

Perform Upgrade

Run the upgrade,

sudo apt-get dist-upgrade

Pay attention to the kernel information. For example,

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-image-2.6.32-40-virtual
The following packages will be upgraded:
  linux-image-virtual linux-virtual
2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.2 MB of archives.
After this operation, 33.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? 

In the above response, we can see that the new kernel version will be 2.6.32-40.

Check for Reboot

First, check if a program requires a reboot by looking for the reboot-required file. If the file does not exist you will not need to reboot.

cat /var/run/reboot-required
*** System restart required ***

However, that's not the end of it. Sometimes this file will not populate even though it should. For example, if you run the kernel version commands you might find, as in the below example, the updated kernel has not yet taken effect. In this case, a reboot would be required to use the updated kernel.

uname -a
Linux krypton 2.6.32-33-server #72-Ubuntu SMP Fri Jul 29 21:21:55 UTC 2011 x86_64 GNU/Linux
cat /proc/version_signature
Ubuntu 2.6.32-33.72-server 2.6.32.41+drm33.18

Reboot

If all goes well you will get back in. If not, get console access, reboot the system and select the previous kernel during the initial boot.

sudo reboot

Optionally, verify the new kernel is running. For example,

uname -a
Linux krypton 2.6.32-40-server #87-Ubuntu SMP Tue Mar 6 02:10:02 UTC 2012 x86_64 GNU/Linux
cat /proc/version_signature
Ubuntu 2.6.32-40.87-server 2.6.32.57+drm33.23

do-release-update

Release updates are the most disruptive. The almost always require a reboot. The process is quite involved and it is recommended to turn off all services.

  • No labels