|
Linux Kernel Upgrade Introduction
In this KB, we will see how to upgrade the kernel on Ubuntu based Linux systems. We will show you how to perform automated upgrades of the kernel using the built-in package management tool, aptitude, on Ubuntu desktop and server editions.
Before continuing on, a word of caution. I recommend avoiding kernel updates unless absolutely necessary. Generally speaking, if it's not broke, don't try and fix it. So unless there is a vulnerability or lack of hardware/driver support in the currently installed kernel on the system, I would recommend against the installation of a new/updated kernel. Installing a new kernel could have wide spread and unknown consequences to your system and/or might not be supported by your hardware/installed software. Now that I got that off my chest, I'll get off my soapbox so we can get to work!
Kernel Upgrade/Update on Ubuntu
Ubuntu's package management tool, aptitude, is your best friend when it comes to updating not only packages, but the kernel. We will configure aptitude to use external package repositories on the Internet to retrieve and install updated packages for our system (which will also include the kernel.)
- Let's begin by adding the external package repositories to aptitude's sources list. By default, aptitude's sources list will reference your source installation media (typically your CDROM). I prefer to comment out the CDROM line and always pull my updates from Ubuntu Internet repositories. Edit the /etc/apt/sources.list file commenting and un-commenting the sources you desire.
Edit /etc/apt/sources.list:
root@ubuntu:/# vi /etc/apt/sources.list
|
Add / Remove the sources you desire:
#deb cdrom:[Ubuntu-Server 8.10 _Intrepid Ibex_ - Release amd64 (20081028.1)]/ intrepid main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution.
## Major bug fix updates produced after the final release of the ## distribution. deb http://us.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted #deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. #deb http://us.archive.ubuntu.com/ubuntu/ intrepid universe #deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid universe #deb http://us.archive.ubuntu.com/ubuntu/ intrepid-updates universe #deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. #deb http://us.archive.ubuntu.com/ubuntu/ intrepid multiverse #deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid multiverse #deb http://us.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse #deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse
## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://us.archive.ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. This software is not part of Ubuntu, but is ## offered by Canonical and the respective vendors as a service to Ubuntu ## users. # deb http://archive.canonical.com/ubuntu intrepid partner # deb-src http://archive.canonical.com/ubuntu intrepid partner
deb http://security.ubuntu.com/ubuntu intrepid-security main restricted #deb-src http://security.ubuntu.com/ubuntu intrepid-security main restricted deb http://security.ubuntu.com/ubuntu intrepid-security universe #deb-src http://security.ubuntu.com/ubuntu intrepid-security universe deb http://security.ubuntu.com/ubuntu intrepid-security multiverse #deb-src http://security.ubuntu.com/ubuntu intrepid-security multiverse
|
Note: Depending on your distribution of Ubuntu, your sources.list file may differ (the above is from a v.8.10 system.) In the above, we have enabled Ubuntu's security and major fixes repositories.
- Update repository packages list
root@ubuntu:~# aptitude update Get:1 http://us.archive.ubuntu.com intrepid-updates Release.gpg [189B] Ign http://us.archive.ubuntu.com intrepid-updates/main Translation-en_US Get:2 http://security.ubuntu.com intrepid-security Release.gpg [189B] Ign http://security.ubuntu.com intrepid-security/main Translation-en_US Ign http://us.archive.ubuntu.com intrepid-updates/restricted Translation-en_US Get:3 http://us.archive.ubuntu.com intrepid-updates Release [51.2kB] Ign http://security.ubuntu.com intrepid-security/restricted Translation-en_US Ign http://security.ubuntu.com intrepid-security/universe Translation-en_US Ign http://security.ubuntu.com intrepid-security/multiverse Translation-en_US Get:4 http://security.ubuntu.com intrepid-security Release [51.2kB] Get:5 http://us.archive.ubuntu.com intrepid-updates/main Packages [340kB] Get:6 http://security.ubuntu.com intrepid-security/main Packages [122kB] Get:7 http://security.ubuntu.com intrepid-security/restricted Packages [3523B] Get:8 http://security.ubuntu.com intrepid-security/universe Packages [51.6kB] Get:9 http://security.ubuntu.com intrepid-security/multiverse Packages [6772B] Get:10 http://us.archive.ubuntu.com intrepid-updates/restricted Packages [8430B] Fetched 635kB in 1s (421kB/s) Reading package lists... Done
Current status: 85 updates [+85], 29 new [+29]. root@ubuntu:~#
|
- A quick check of the system reveals we are running on v2.6.27-9 of the Linux kernel
root@ubuntu:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 8.10 Release: 8.10 Codename: intrepid root@ubuntu:~# uname -a Linux ubuntu 2.6.27-9-server #1 SMP Thu Nov 20 22:56:07 UTC 2008 x86_64 GNU/Linux root@ubuntu:~# aptitude
|
- Search repository to see if there are available kernel updates.
| root@ubuntu:~# aptitude search linux-image |
p
|
linux-image |
- Generic Linux kernel image. |
| v |
linux-image-2.6 |
- |
| p |
linux-image-2.6.27-11-generic |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-11-server |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-11-virtual |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-14-generic |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-14-server |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-14-virtual |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-7-generic |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| i |
linux-image-2.6.27-7-server |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-7-virtual |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-9-generic |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| i A |
linux-image-2.6.27-9-server |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-2.6.27-9-virtual |
- Linux kernel image for version 2.6.27 on x86/x86_64 |
| p |
linux-image-generic |
- Generic Linux kernel image |
| i |
linux-image-server |
- Linux kernel image on Server Equipment. |
| p |
linux-image-virtual |
- Linux kernel image for virtual machines |
| root@ubuntu:~# |
|
Note: We can see this system already has 2 kernel images installed, v2.6.27-7 and v2.6.27-9 with a new version available: v2.6.27-14
- Install the new kernel with the safe-upgrade command line switch
root@ubuntu:~# aptitude safe-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Resolving dependencies... Resolving dependencies... The following NEW packages will be installed: linux-image-2.6.27-14-server{a} linux-restricted-modules-2.6.27-14-server{a} linux-restricted-modules-common{a} linux-restricted-modules-server{a} The following packages will be upgraded: linux-image-server linux-libc-dev linux-server 3 packages upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 24.5MB of archives. After unpacking 114MB will be used. Do you want to continue? [Y/n/?] y
|
Note: There may also be other available packages that need updating on the system. Aptitude's safe-upgrade should take care of the kernel as well as any other packages and associated dependencies on the system.
After answering yes to the continue question, aptitude will pull all the new packages and their dependencies from the source repositories. It will then configure them, and update your boot loader for the new kernel (requires a reboot).
- Once safe-upgrade has completed, the new kernel will be ready for use. Reboot the system to boot into the new kernel image
- Once the system has come back up, login and verify your running from the new kernel image
root@ubuntu:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 8.10 Release: 8.10 Codename: intrepid root@ubuntu:~# uname -a Linux ubuntu 2.6.27-14-server #1 SMP Wed Apr 15 20:14:25 UTC 2009 x86_64 GNU/Linux root@ubuntu:~# aptitude
|
In case you run into trouble with your new kernel, you can always boot to the previously installed version. Aptitude will preserve the old kernel allowing you to interrupt the boot sequence selecting the kernel version you would like to boot from. If you need to select a different kernel version interrupt the GRUB boot loader:
- Press the escape key from the GRUB boot loader menu
GRUB loading stage1.5.
GRUB loading, please wait... Press 'ESC' to enter the menu.... 5
|
- From the list of available kernels, select the last known good kernel

Best of luck updating your kernel!
Add this page to your favorite website
|