Ubuntu 14.04 in an OpenVZ container: apt trying to upgrade the kernel

Solution 1:

  • fkraiem's answer has already explained why the running kernel can't be updated from the guest container.

  • To prevent kernel update, you have to uninstall its meta packages

    sudo apt-get purge linux-generic linux-image-generic linux-headers-generic
    

Solution 2:

You have some kernel image packages installed (the packages starting with linux-image), and like all other packages, the package manager wants to upgrade them when a newer version is available in the repositories.

However, in your case the kernel is provided by the host, and the installed kernel packages are completely disregarded. In such cases it is natural to uninstall them; the package manager may complain that you will be left with no kernel package installed since it is normally undesirable, but in your case it is perfectly fine.

Alternatively, keeping them installed and upgraded will do no harm (other than taking up disk space) since they are not used anyway.