5

I m running Ubuntu 16.04. After a prompt by software update, that I discarded, as I booted I opened a terminal and run my update alias:

alias maintain='set -x; sudo apt-get update && sudo apt-get upgrade && sudo apt autoremove && sudo apt autoclean; set +x'

Weirdly no package got upgraded but i did get the following message:

The following packages have been kept back:

There were 3 packages with names linux,image,headers don't remember the exact names.

After checking here I run

sudo apt-get install [3 packages names here]

and the packages installed without errors or warnings. Thinking that the kernel can't be completely updated while running I also rebooted my laptop. Wanting to check if the update was completed I run the following commands [that I found here while checking for the previous warning] on my terminal:

$ uname -r
4.4.0-21-generic
$ dpkg -l | grep linux-image
ii  linux-image-4.4.0-21-generic 4.4.0-21.37 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-22-generic 4.4.0-22.40 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-24-generic 4.4.0-24.43 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-21-generic 4.4.0-21.37 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-22-generic 4.4.0-22.40 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-24-generic 4.4.0-24.43 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-generic 4.4.0.24.25 amd64 Generic Linux kernel image

Apart from the fact that I have three instead of 2 images from the kernel the question is:

Why do I have multiple images of the kernel installed? Since my alias runs autoremove/autoclean [and I rebooted once more and rerun the alias to err on the safe side] shouldn't they be deleted? Also shouldn't, after reboot, Ubuntu be using the latest kernel version?

update1: ls /boot results:

$ ls /boot
abi-4.4.0-21-generic     config-4.4.0-22-generic      initrd.img-4.4.0-22-generic  memtest86+_multiboot.bin     vmlinuz-4.4.0-21-generic
abi-4.4.0-22-generic     config-4.4.0-24-generic      initrd.img-4.4.0-24-generic  System.map-4.4.0-21-generic  vmlinuz-4.4.0-22-generic
abi-4.4.0-24-generic     grub                         memtest86+.bin               System.map-4.4.0-22-generic  vmlinuz-4.4.0-24-generic
config-4.4.0-21-generic  initrd.img-4.4.0-21-generic  memtest86+.elf               System.map-4.4.0-24-generic

update2: After running sudo update-grub and rebooting I still get:

$ uname -r
4.4.0-21-generic

I also remember seeing the grub being updated from terminal output when the new kernel packages were being installed.

update3: I tried booting into kernel 4.4.0-24 from grub2 advanced boot options and then running sudo update-grub again. But after another reboot uname -r still shows 4.4.0-21 :(

update4: I am thinking of other angles to approach the problem. I considered manually setting grub to load on the new kernel but that is a workaround not a fix since I d need to do it again every time I download a new kernel. During this I remembered that I have used grub-customizer to do some minor tweaks (because I m dual booting with win7). I am pasting the relevant entries from /boot/grub/grub.cfg if people can spot what's wrong and how it could be fixed. It's the menu entry from ubuntu and 2 (out of 9) submenu entries from advanced boot options:

# # BEGIN /etc/grub.d/40_custom_proxy ###
menuentry "Ubuntu 16" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-4e2b96c0-04a0-4750-bd14-479f684bf3be' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  4e2b96c0-04a0-4750-bd14-479f684bf3be
else
  search --no-floppy --fs-uuid --set=root 4e2b96c0-04a0-4750-bd14-479f684bf3be
fi
linux   /boot/vmlinuz-4.4.0-21-generic root=UUID=4e2b96c0-04a0-4750-bd14-479f684bf3be ro  quiet splash $vt_handoff
initrd  /boot/initrd.img-4.4.0-21-generic
}
# ## END /etc/grub.d/40_custom_proxy ###

menuentry "Ubuntu, with Linux 4.4.0-21-generic" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-21-generic-advanced-4e2b96c0-04a0-4750-bd14-479f684bf3be' {
    recordfail
    load_video
    gfxmode $linux_gfx_mode
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos5'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  4e2b96c0-04a0-4750-bd14-479f684bf3be
    else
      search --no-floppy --fs-uuid --set=root 4e2b96c0-04a0-4750-bd14-479f684bf3be
    fi
    echo    'Loading Linux 4.4.0-21-generic ...'
    linux   /boot/vmlinuz-4.4.0-21-generic root=UUID=4e2b96c0-04a0-4750-bd14-479f684bf3be ro  quiet splash $vt_handoff
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-4.4.0-21-generic
}

menuentry "Ubuntu, with Linux 4.4.0-24-generic" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-24-generic-advanced-4e2b96c0-04a0-4750-bd14-479f684bf3be' {
    recordfail
    load_video
    gfxmode $linux_gfx_mode
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos5'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  4e2b96c0-04a0-4750-bd14-479f684bf3be
    else
      search --no-floppy --fs-uuid --set=root 4e2b96c0-04a0-4750-bd14-479f684bf3be
    fi
    echo    'Loading Linux 4.4.0-24-generic ...'
    linux   /boot/vmlinuz-4.4.0-24-generic root=UUID=4e2b96c0-04a0-4750-bd14-479f684bf3be ro  quiet splash $vt_handoff
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-4.4.0-24-generic
}

I 'm not sure how relevant that is - and that file is supposed to not be changed. But I m guessing that whatever the problem is it can create a footprint in that file to be identified. (Hopefully.)

6
  • 1
    "Why do I have multiple images of the kernel installed?" - because apt-get does not automatically remove the old version(s), so if you want to remove it, you need to do so manually. Jun 11, 2016 at 18:07
  • By looking arround it appears that there's this question explaining how to remove old kernels. But I m still wandering why ubuntu keeps booting with 4.4.0-21 instead of 22 or 24 still. There may be an underlined problem but I can't think of anything to search for it.
    – Karsus
    Jun 11, 2016 at 18:29
  • 1
    apt should update grub when installing the new kernel, but just to be sure, run sudo update-grub and reboot again and uname -r
    – Zanna
    Jun 11, 2016 at 19:03
  • @Zanna Thanks for the suggestion. Tried it but no fix unfortunately. It still loads the old kernel.
    – Karsus
    Jun 11, 2016 at 19:12
  • 1
    Please provide the output of mount | grep /boot. Jun 11, 2016 at 19:24

1 Answer 1

2

After looking around in /boot/grub/grub.cfg wondering if I should change stuff I remembered that I had used grub-customiser when I set up my system. I opened it to see what I would find there.

There were removed entries from both Ubuntu and Windows 7. Somehow the removed Ubuntu entry had ver 4.4.0-24 at it's details (maybe update-grub auto updated it?). I am not sure. I removed my entry and restored that one as the first option. Now Ubuntu loads at newest installed kernel:

$ uname -r
4.4.0-24-generic

and I hope everything will work fine. (At least until next kernel update.)

From some entries in grub-customizer I suspect that if an entry is labelled as custom it doesn't get updated when a newer kernel is installed? Not sure.

Anyway, thank you to everyone who commented and helped me figure it out. Couldn't have done without you.

0

You must log in to answer this question.

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