2

Using Ubuntu 16.04 ... I just upgraded my kernel from 4.4 to 4.9 which runs fine yet when I issue

apt-get upgrade

it suggests I install

The following packages have been kept back:
linux-generic linux-headers-generic linux-image-generic

so naturally I tried to install above yet I see it points to 4.4 and not 4.9 :

sudo apt-get install linux-generic linux-headers-generic linux-image-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  linux-headers-4.4.0-62 linux-headers-4.4.0-62-generic linux-image-4.4.0-62-generic linux-image-extra-4.4.0-62-generic
Suggested packages:
  fdutils linux-tools
The following NEW packages will be installed:
  linux-headers-4.4.0-62 linux-headers-4.4.0-62-generic linux-image-4.4.0-62-generic linux-image-extra-4.4.0-62-generic
The following packages will be upgraded:
  linux-generic linux-headers-generic linux-image-generic

Interestingly when I ask to install 4.9 headers package I discover they're already installed

sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-4.9.0-040900-generic is already the newest version (4.9.0-040900.201612111631).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

How to I convince my system that package linux-generic should point to 4.9 and not 4.4 ? ... I see upcoming Ubuntu Zesty 17.04 will use 4.9 ... If I want 4.9 is there anything I can do now to install 4.9 versions of above or just install 17.04 now ?


Here is how I upgraded my Ubuntu 16.04 from kernel 4.4 to 4.9

cd /tmp/

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900_4.9.0-040900.201612111631_all.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-headers-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-image-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb

sudo dpkg -i *.deb
sudo reboot now 

uname -r
4.9.0-040900-generic

UPDATE After manually upgrading kernel from v4.4 to v4.9 box was fine for weeks until docker wanted an update ... it failed with

systemctl restart docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.



journalctl -xe
Feb 05 17:01:06 bodhisattva polkitd(authority=local)[1767]: Registered Authentication Agent for unix-process:8451:61106220 (system bus name :1.347 [/usr/bi
Feb 05 17:01:06 bodhisattva gnome-session[3383]: Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Feb 05 17:01:11 bodhisattva polkitd(authority=local)[1767]: Operator of unix-session:c2 successfully authenticated as unix-user:stens to gain TEMPORARY aut
Feb 05 17:01:11 bodhisattva systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has finished shutting down.
Feb 05 17:01:11 bodhisattva systemd[1]: Starting Docker Socket for the API.
-- Subject: Unit docker.socket has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has begun starting up.
Feb 05 17:01:11 bodhisattva systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.socket has finished starting up.
-- 
-- The start-up result is done.
Feb 05 17:01:11 bodhisattva systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has begun starting up.
Feb 05 17:01:11 bodhisattva dockerd[8461]: time="2017-02-05T17:01:11.687485266-05:00" level=info msg="libcontainerd: new containerd process, pid: 8467"
Feb 05 17:01:12 bodhisattva dockerd[8461]: time="2017-02-05T17:01:12.692845664-05:00" level=error msg="[graphdriver] prior storage driver aufs failed: driv
Feb 05 17:01:12 bodhisattva dockerd[8461]: Error starting daemon: error initializing graphdriver: driver not supported
Feb 05 17:01:12 bodhisattva systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Feb 05 17:01:12 bodhisattva systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Feb 05 17:01:12 bodhisattva systemd[1]: docker.service: Unit entered failed state.
Feb 05 17:01:12 bodhisattva systemd[1]: docker.service: Failed with result 'exit-code'.
Feb 05 17:01:12 bodhisattva polkitd(authority=local)[1767]: Unregistered Authentication Agent for unix-process:8451:61106220 (system bus name :1.347, object

so I reverted kernel back to original and it fixed the docker upgrade issue ... here is how I backed out kernel from v4.9 back to v4.4 ... first reboot while holding down Shift key then at GRUB menu pick Advanced options and boot into that prior release v4.4 ... then once booted up I listed kernels

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)
rc  linux-image-4.4.0-47-generic                4.4.0-47.68                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-49-generic                4.4.0-49.70                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-51-generic                4.4.0-51.72                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-52-generic                4.4.0-52.73                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-53-generic                4.4.0-53.74                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-57-generic                4.4.0-57.78                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-58-generic                4.4.0-58.79                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.9.0-040900-generic            4.9.0-040900.201612111631                            amd64        Linux kernel image for version 4.9.0 on 64 bit x86 SMP

then issued

sudo dpkg --purge  linux-image-4.9.0-040900-generic  

and now this successfully ran

sudo apt-get install   linux-generic linux-headers-generic linux-image-generic
2
  • Headers are usually installed for all kernel versions present.
    – user589808
    Jan 22, 2017 at 21:24
  • 3
    If you want to use a non-standard kernel, then by all means do. However, the regular update stuff will not know about it, nor should it. I always boot to the stock kernel, and then run update stuff. Bumping to kernel 4.4.0-62 will not mess up your kernel 4.9.0. Jan 22, 2017 at 21:49

2 Answers 2

2

The first message you are receiving

The following packages have been kept back:
 linux-generic linux-headers-generic linux-image-generic

Is discussed here: (digitalocean.com - Packages have been kept back new Ubuntu 14 image) and the solution is to perform:

sudo apt-get dist-upgrade

The second message you are receiving

The following NEW packages will be installed:
  linux-headers-4.4.0-62 linux-headers-4.4.0-62-generic linux-image-4.4.0-62-generic linux-image-extra-4.4.0-62-generic

Is perfectly normal and not a cause for concern. When you do regular Ubuntu 16.04 updates the kernel 4.4.0-xx is automatically updated. It has nothing to do with your Kernel 4.9.4 or Kernel 4.9.5 which is the first option on your Grub menu.

The 4.4.0-xxx kernels are available for booting if necessary on Grub's Advanced Options menu.

When you look on your system you will see linux headers for all kernel versions on your drive:

$ ls /lib/modules
3.13.0-92-generic      4.7.1-040701-generic   4.8.12-040812-generic
3.2.0-113-generic      4.7.2-040702-generic   4.8.4-040804-generic
4.4.0-53-generic       4.7.3-040703-generic   4.8.5-040805-generic
4.4.0-57-generic       4.7.5-040705-generic   4.9.0-040900-generic
4.4.0-59-generic       4.8.10-040810-generic  4.9.1-040901-generic
4.4.33-040433-generic  4.8.1-040801-generic   4.9.4-040904-generic
4.6.3-040603-generic   4.8.11-040811-generic

To see your header files for 4.4.0-xxx:

$ ls /lib/modules/4.4.0-59-generic/build/include/linux
8250_pci.h                i2c-smbus.h              phy_fixed.h
acct.h                    i2c-xiic.h               phy.h
acpi_dma.h                i7300_idle.h             pid.h
  (... hundreds of files ....)
i2c-pnx.h                 phonet.h                 zsmalloc.h
i2c-pxa.h                 phy                      zutil.h

To see your header files for 4.9.4:

$ ls /lib/modules/4.9.4-040904-generic/build/include/linux
8250_pci.h                i2c-ocores.h             phy_fixed.h
acct.h                    i2c-omap.h               phy.h
acpi_dma.h                i2c-pca-platform.h       pid.h
  (... hundreds of files ....)
i2c-mux-gpio.h            pfn_t.h                  zutil.h
i2c-mux.h                 phonet.h
i2c-mux-pinctrl.h         phy

Removing older kernels

You should run sudo apt-get autoremove periodically to clean out old versions of 4.4.0-xxx kernels. This will keep the most recent version plus the next oldest.

Older kernel versions for 4.6, 4.7, 4.8 and 4.9 must be manually removed using:

sudo apt-get purge linux-image-x.x.x.x-generic

followed by:

sudo update-grub

As each kernel version is > 100 MB you can save a lot of storage space. A full write up for deleting older kernels you manually installed can be found here: How do I remove old kernel versions to clean up the boot menu?

Recommended packages

apt-get has a message for you:

Suggested packages:
  fdutils linux-tools

This doesn't happen on my system and might be of interest to research further.

Easiest way to install newest kernel

I used to use wget as you did because those are popular / common instructions on the internet. It requires a little bit of typing and joining of strings though. An easier way is just to navigate to:

http://kernel.ubuntu.com/~kernel-ppa/mainline/

Press the End key and click on 4.9.5 or the newest kernel you want. Then this screen appears:

kernel 4.9.5

Assuming yoyu want 64-bit generic version click on:

  • linux-headers-4.9.5-040905_4.9.5-040905.201701200532_all.deb
  • linux-headers-4.9.5-040905-generic_4.9.5-040905.201701200532_amd64.deb
  • linux-image-4.9.5-040905-generic_4.9.5-040905.201701200532_amd64.deb

All three downloads will easily start for you without complicated typing.

When done open terminal with Ctrl+Alt+T and type:

cd Downloads
sudo dpkg -i *.deb
rm *4.9.5*

I think everyone will find this method much easier than methods commonly published on the internet.

Ubuntu 17.04 Zesty will be using Kernel 4.10

Although your statement Zesty will be using kernel version 4.9 was true yesterday it's not true today. As per this story released an hour ago: (softpedia.com - Ubuntu developers now tracking Linux Kernel 4.10 for Ubuntu 17.04 Zesty Zapus) they are using Kernel 4.10 rc4.

That said I would stick to Kernel 4.9.5 which is stable and has improvements for i915 and AMD Southern Islands which might interest many here.

1

The answer is simple: you can't.

Ubuntu releases support specific kernels that are not identical to the Linux mainline ones.

Canonical Kernel Team maintains Ubuntu kernels based on the Linux mainline kernel versions. In many cases bug fixing and support of some hardware is backported from newer mainline kernels.

Ubuntu 16.04 supports the 4.4 kernel and soon will also support the 4.8 HWE. Ubuntu 16.10 supports the 4.8. Only these kernels get updates from Ubuntu repositories.

You can install mainline kernels at your own risk, but they will not get updates. You will have to update them manually. Also problems with unsupported kernels are off-topic at this site.

Grub will always boot with the highest kernel version installed no matter how it was installed. So having the 4.4 Ubuntu kernels will not affect any other kernels with higher version numbers.

If you are sure that you rally want to use only mainline kernels that you plan to manually install and update, you can remove the kernel meta-packages. After that you will stop getting updates of the supported Ubuntu kernels.

It can be done by

sudo apt remove linux-image-generic linux-headers-generic

command.

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