39

To update my server I use apt-get upgrade.

But when there are kernel updates I always need to do apt-get install linux-.... because apt-get update does not install them.

Is there a way I can tell it to install those too? I tried -f but it does not work.

3
  • 1
    apt-get upgrade installs new kernels for me if there is one. What Ubuntu version are you using? The only thing I have up to check right now is 10.04... Jul 28, 2010 at 23:53
  • 1
    10.04 also, it tells me "These updates are kept from being upgraded" (translated from French). and it lists the linux updates.
    – Weboide
    Jul 28, 2010 at 23:57
  • spotted this in xubuntu 13.04 safe-upgrade worked :D
    – Jim Ford
    Oct 9, 2013 at 15:51

3 Answers 3

21

you're looking for

sudo apt-get dist-upgrade
2
  • 5
    Using dist-upgrade can add or remove other packages, it's not limited to just the kernel. This can be an issue on a server if you're hosting for others. However in such a a case you probably want to use apt-pin anyways to prevent unintentional upgrades.
    – jbowtie
    Jul 29, 2010 at 1:50
  • 2
    dist-upgrade will install new packages while trying to resolve an upgrade, which is needed to get kernel updates when the kernel ABI changes (since it resolves to a different binary package name).
    – Kees Cook
    Oct 27, 2010 at 6:05
20

So, with regard to the comments: Sorry, you were right, I was completely mis-reading what apt-get was telling me (and I'm using the English version! :)).

After a little research, what you probably want to use is aptitude safe-upgrade, which does install new kernels. Really! I double checked! :)

You should probably prefer aptitude in general to apt-get anyway, unless you specifically need something in apt-get.

nknight@nkubuntu1004:~$ sudo 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-headers-2.6.32-24{a} linux-headers-2.6.32-24-generic{a} linux-image-2.6.32-24-generic{a} 
The following packages will be upgraded:
  apt apt-transport-https apt-utils base-files firefox firefox-branding firefox-gnome-support gdm google-chrome-stable 
  icedtea-6-jre-cacao linux-generic linux-headers-generic linux-image-generic linux-libc-dev openjdk-6-jre openjdk-6-jre-headless 
  openjdk-6-jre-lib software-center thunderbird ureadahead xulrunner-1.9.2 
21 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 129MB of archives. After unpacking 188MB will be used.
Do you want to continue? [Y/n/?] 
3
  • 1
    Also cite the man page: It is sometimes necessary to remove one package in order to upgrade another; this command is not able to upgrade packages in such situations. Use the full-upgrade command to upgrade as many packages as possible.
    – Weboide
    Jul 29, 2010 at 10:48
  • 4
    aptitude will be removed from the default installation of future versions of both debian and ubuntu. Apt-get is again the preferred tool for installing packages
    – Ralf
    Sep 6, 2010 at 23:08
  • Yes, I didn't find aptitude in 12.04. So I installed aptitude and ran aptitude safe-upgrade, it's also doing the same thing as apt-get upgrade. No kernel version are installed!(but I could see new kernel version available in synaptic package manager(gui)).
    – user3215
    Nov 4, 2013 at 5:49
4

if you want to install aptitude then please go ahead - but it has its dependencies and imho you can get away quite well without it - especially if you want to keep your server install lean(er).

When you run sudo apt-get upgrade it tells you about packages that weren't upgraded in the following way:

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

So, if you are connected using an ssh terminal, it's just a matter of copy+paste to enter the following command:

$ sudo apt-get upgrade linux-generic linux-headers-generic linux-image-generic

which upgrades just the packages that were kept back. Use uname -r to display the kernel version before and after the reboot (necessary to refresh the running kernel) and don't forget to run purge-old-kernels after the reboot.

You must log in to answer this question.

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