PDA

View Full Version : [ubuntu] 16.04 Kernel Konfusion what kernels are installed?



rsteinmetz70112
February 15th, 2018, 02:35 AM
I'm working on cleaning up a server and I noticed something odd. The server works fine and I have no problems with it

The GRUB menu lists kernels

4.4.0-103
4.4.0-109
4.4-0-112
2.6.32-31
/boot contains files for

4.4.0-103
4.4.0-109
4.4.0-112
2.6.32-31
So far So good.
However during an upgrade I ran I saw messages related to initram running updates of

4.4.0-92
4.4.0-93
I looked in Synaption and can't find any on the server. I can't find installed packages for

4.4.0-92
4.4.0-93
2.6.32-32

I did find some postrm files for a number of older kernels and files related to -112.

Then it gets weird.

Synaptic doesn't show any packages for

4.4.0-112
even available for installation.

uname -a says kernel 4.4.0.112 is running.

I assume that I can simply delete the 2.6.32-31 stuff in /boot and grub will clean it's menus up on the next update.
but why does initram-tools think 4.4.0-92 and 4.4.0-93 are still installed and how do I convince it they aren't?

QIII
February 15th, 2018, 02:47 AM
Hello!

If you start just deleting those files you're going the right way for a significant negative emotional event.

You should let the package management system deal with it to keep things straight.


sudo apt autoremove

Is probably what would be best. If it doesn't remove all of them, then it is probably best that they aren't removed.

In general, don't ever just delete system files.

Impavidus
February 15th, 2018, 10:49 AM
Deleting system files usually leads to unpleasant experiences, but we could investigate a bit. 4.4.0-112 is the kernel you should be running and indeed you are running it, but synaptic should show it clearly as installed. 2.6.32 is ancient. I don't remember what was the last release of Ubuntu using a 2.6 kernel, but it must be about 7 years ago. Maybe it wasn't properly removed after a release upgrade.

Maybe this gives some hints:
# What's present in /boot?
ls /boot

# What's in the grub menu?
grep initrd /boot/grub/grub.cfg | uniq

# What's installed according to the package manager?
dpkg -l linux-image*

# Which kernels is initramfs-tools aware of?
ls /var/lib/initramfs-tools
All of that after the autoremove (which will probably uninstall 4.4.0-103).

rsteinmetz70112
February 15th, 2018, 10:43 PM
Hello!

If you start just deleting those files you're going the right way for a significant negative emotional event.

You should let the package management system deal with it to keep things straight.
Except the package management system doesn't know they're there.





sudo apt autoremove

Is probably what would be best. If it doesn't remove all of them, then it is probably best that they aren't removed.

In general, don't ever just delete system files.

Already did that as well a clean and autoclean
atp-get usually indicates those packages which can be removed but it doesn't make any suggestions.

rsteinmetz70112
February 15th, 2018, 10:57 PM
Deleting system files usually leads to unpleasant experiences, but we could investigate a bit. 4.4.0-112 is the kernel you should be running and indeed you are running it, but synaptic should show it clearly as installed. 2.6.32 is ancient. I don't remember what was the last release of Ubuntu using a 2.6 kernel, but it must be about 7 years ago. Maybe it wasn't properly removed after a release upgrade.

Maybe this gives some hints:
# What's present in /boot?
ls /boot


# ls
abi-2.6.32-31-generic initrd.img-4.4.0-112-generic
abi-4.4.0-103-generic memtest86+.bin
abi-4.4.0-109-generic memtest86+.elf
abi-4.4.0-112-generic memtest86+_multiboot.bin
boot System.map-2.6.32-31-generic
config-2.6.32-31-generic System.map-4.4.0-103-generic
config-4.4.0-103-generic System.map-4.4.0-109-generic
config-4.4.0-109-generic System.map-4.4.0-112-generic
config-4.4.0-112-generic vmcoreinfo-2.6.32-31-generic
debian.bmp vmlinuz-2.6.32-31-generic
grub vmlinuz-4.4.0-103-generic
initrd.img-2.6.32-31-generic vmlinuz-4.4.0-109-generic
initrd.img-4.4.0-103-generic vmlinuz-4.4.0-112-generic
initrd.img-4.4.0-109-generic
that looks correct




# What's in the grub menu?

grep initrd /boot/grub/grub.cfg | uniq


# cd grub
# ls
default fat_stage1_5 jfs_stage1_5 minix_stage1_5 stage2
device.map grubenv menu.lst reiserfs_stage1_5 xfs_stage1_5
e2fs_stage1_5 installed-version menu.lst~ stage1
# grep initrd /boot/grub/menu.lst | uniq
initrd /initrd.img-4.4.0-112-generic
initrd /initrd.img-4.4.0-109-generic
initrd /initrd.img-4.4.0-103-generic
initrd /initrd.img-2.6.32-31-generic

Looks like it's running grub-legacy, but that looks correct.


# What's installed according to the package manager?
[core]dpkg -l linux-image*[/code]

# dpkg -l linux-image*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
un linux-image <none> <none> (no description available)
un linux-image-2. <none> <none> (no description available)
rc linux-image-2. 2.6.17.1-10. amd64 Linux kernel image for version 2.
un linux-image-2. <none> <none> (no description available)
rc linux-image-2. 2.6.20-16.35 amd64 Linux kernel image for version 2.
un linux-image-2. <none> <none> (no description available)
un linux-image-2. <none> <none> (no description available)
rc linux-image-2. 2.6.24-19.41 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.24-21.43 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.24-22.45 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.24-23.52 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.24-24.61 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.24-25.63 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.24-26.64 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.24-28.71 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-24.43 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-25.45 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-26.48 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-27.49 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-28.55 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-30.59 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-32.62 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-33.72 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-34.77 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-35.78 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-36.79 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-38.83 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-41.94 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-42.96 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-45.10 amd64 Linux kernel image for version 2.
rc linux-image-2. 2.6.32-46.10 amd64 Linux kernel image for version 2.
un linux-image-3. <none> <none> (no description available)
rc linux-image-3. 3.13.0-49.83 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.13.0-62.10 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-41.66 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-45.70 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-48.74 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-49.75 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-51.77 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-57.87 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-58.88 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-59.90 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-65.99 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-67.101 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-69.103 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-75.110 amd64 Linux kernel image for version 3.
rc linux-image-3. 3.2.0-80.116 amd64 Linux kernel image for version 3.
hi linux-image-4. 4.4.0-103.12 amd64 Linux kernel image for version 4.
rc linux-image-4. 4.4.0-104.12 amd64 Linux kernel image for version 4.
ii linux-image-4. 4.4.0-109.13 amd64 Linux kernel image for version 4.
ii linux-image-4. 4.4.0-112.13 amd64 Linux kernel image for version 4.
rc linux-image-4. 4.4.0-64.85 amd64 Linux kernel image for version 4.
rc linux-image-4. 4.4.0-66.87 amd64 Linux kernel image for version 4.
rc linux-image-4. 4.4.0-77.98 amd64 Linux kernel image for version 4.
rc linux-image-4. 4.4.0-79.100 amd64 Linux kernel image for version 4.
rc linux-image-4. 4.4.0-83.106 amd64 Linux kernel image for version 4.
rc linux-image-4. 4.4.0-98.121 amd64 Linux kernel image for version 4.
rc linux-image-ex 3.13.0-49.83 amd64 Linux kernel extra modules for ve
rc linux-image-ex 3.13.0-62.10 amd64 Linux kernel extra modules for ve
hi linux-image-ex 4.4.0-103.12 amd64 Linux kernel extra modules for ve
rc linux-image-ex 4.4.0-104.12 amd64 Linux kernel extra modules for ve
ii linux-image-ex 4.4.0-109.13 amd64 Linux kernel extra modules for ve
ii linux-image-ex 4.4.0-112.13 amd64 Linux kernel extra modules for ve
rc linux-image-ex 4.4.0-64.85 amd64 Linux kernel extra modules for ve
rc linux-image-ex 4.4.0-66.87 amd64 Linux kernel extra modules for ve
rc linux-image-ex 4.4.0-77.98 amd64 Linux kernel extra modules for ve
rc linux-image-ex 4.4.0-79.100 amd64 Linux kernel extra modules for ve
rc linux-image-ex 4.4.0-83.106 amd64 Linux kernel extra modules for ve
rc linux-image-ex 4.4.0-98.121 amd64 Linux kernel extra modules for ve
ii linux-image-ge 4.4.0.112.11 amd64 Generic Linux kernel image



# Which kernels is initramfs-tools aware of?

ls /var/lib/initramfs-tools
[/code][/quote]

# ls /var/lib/initramfs-tools
4.4.0-103-generic 4.4.0-109-generic 4.4.0-112-generic

All of that after the autoremove (which will probably uninstall 4.4.0-103).
Actually -103 didn't get autoremoved, probably because its using grub-legacy.
Since it's running grub-legacy I can probably edit menu.lst, and delete the 2.6.32 files from boot with little effect.
I don't know how to get rid of the old kernel versions. According to synaptic they aren't installed.

Impavidus
February 16th, 2018, 11:37 AM
Next time make your terminal a bit larger before running dpkg -l, so that the output doesn't get truncated.

-103 wasn't uninstalled because it's put on hold. I assume that was because of the broken upgrade to -104 or or something like that. You should be able to remove the hold or uninstall it manually:
sudo apt-get purge linux-image-{,extra-}4.4.0-104-genericOr use synaptic.

I've got one computer that used grub legacy. Some time after a release upgrade I noticed it wasn't properly updating the grub menu anymore. Switching to grub2 fixed that. I don't know if it would be wise to get grub2.

initramfs-tools seems unaware of your 2.6.32-31 kernel, as is the package manager, which is convinced it has been purged. I'm not sure about the clean way to uninstall it. Maybe you can simply remove the files. I expect some in /boot, /lib/firmware, /lib/modules and /usr/share/doc. Maybe you can't simply do that. You can also try and grab the 2.6.32-31 deb package files from the old release server, reinstall that kernel and then cleanly uninstall it. Or you can just leave it alone until some day you decide to wipe the entire hard drive. As it is, that old kernel only takes some hard drive space.

Synaptic should definitely list 4.4.0-112, as it is installed. It should of course be listed under installed packages, not available for installation.

There are many kernel packages marked as removed, config files remaining. These kernel packages don't actually have config files, but still have an entry in the package manager's database. You can use apt, dpkg or synaptic to purge them. That will do little more than removing some clutter. You may also have a lot of old kernel header packages. Same story, you can purge them if you like to remove some clutter.

Doug S
February 16th, 2018, 05:15 PM
There are two very very good kernel removal type scripts available.
One, with both a desktop and server version (I use the server version), can be found on askubuntu.com (https://askubuntu.com/questions/892076/how-to-selectively-purge-old-kernels-all-at-once/892077#892077). The other is available via git via launchpad (https://launchpad.net/linux-purge)

rsteinmetz70112
February 16th, 2018, 09:18 PM
Thanks for the help. For now I'm embroiled in other issues. I'm also a little nervous about upgrading to grub2 because I've had issues with it in the past. I think I'll wait until I have a little time to work on it.


Next time make your terminal a bit larger before running dpkg -l, so that the output doesn't get truncated.
The output is all there you just have to scroll down to see it.

I'm still mystified why Synaptic didn't show some of the kernels as even available for installation. After reinstalling Synaptic they are showing up now.

deadflowr
February 16th, 2018, 09:25 PM
The output is all there you just have to scroll down to see it.
No, Impavidus means expand the terminal to the right.
It cut the output halfway.
(Run the command with a terminal in full screen and you'll understand)