2

I already tried what is mentioned in /boot is 100% full, apt-get purge linux-image-x.x.x.x-generic won't work but it did not help.

The root cause seems to be that there are old kernels which are no longer recognised by apt / purge-old-kernels

sudo apt autoclean && sudo apt autoremove

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run ‘apt-get -f install’ to correct these.
The following packages have unmet dependencies.
 linux-image-extra-4.4.0-78-generic : Depends: linux-image-4.4.0-78-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-78-generic but it is not installed
E: Unmet dependencies. Try using -f.

uname -a

Linux host 4.4.0-75-generic #96-Ubuntu SMP Thu Apr 20 09:56:33 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

sudo purge-old-kernels

No kernels are eligible for removal

sudo apt-get purge linux-image-4.4.0-7

linux-image-4.4.0-71-generic  linux-image-4.4.0-75-generic  linux-image-4.4.0-77-generic  

sudo apt-get purge linux-image-4.4.0-71-generic

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
 linux-image-extra-4.4.0-71-generic : Depends: linux-image-4.4.0-71-generic but it is not going to be installed
 linux-image-extra-4.4.0-78-generic : Depends: linux-image-4.4.0-78-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-78-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

sudo apt-get -f purge linux-image-4.4.0-71-generic

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
 linux-image-extra-4.4.0-71-generic : Depends: linux-image-4.4.0-71-generic but it is not going to be installed
 linux-image-extra-4.4.0-78-generic : Depends: linux-image-4.4.0-78-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-78-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

But contents are still:

/boot dir
total 459M
drwxr-xr-x  4 root root 4,0K Mai 19 07:31 .
drwxr-xr-x 27 root root 4,0K Mai  8 18:34 ..
-rw-r--r--  1 root root 1,2M Jul 13  2016 abi-4.4.0-31-generic
-rw-r--r--  1 root root 1,2M Okt 27  2016 abi-4.4.0-47-generic
-rw-r--r--  1 root root 1,2M Feb  1 20:39 abi-4.4.0-63-generic
-rw-r--r--  1 root root 1,2M Mär 22 17:11 abi-4.4.0-70-generic
-rw-r--r--  1 root root 1,2M Mär 24 16:20 abi-4.4.0-71-generic
-rw-r--r--  1 root root 1,2M Apr 20 14:02 abi-4.4.0-75-generic
-rw-r--r--  1 root root 186K Jul 13  2016 config-4.4.0-31-generic
-rw-r--r--  1 root root 186K Okt 27  2016 config-4.4.0-47-generic
-rw-r--r--  1 root root 186K Feb  1 20:39 config-4.4.0-63-generic
-rw-r--r--  1 root root 186K Mär 22 17:11 config-4.4.0-70-generic
-rw-r--r--  1 root root 186K Mär 24 16:20 config-4.4.0-71-generic
-rw-r--r--  1 root root 186K Apr 20 14:02 config-4.4.0-75-generic
-rw-r--r--  1 root root  57K Dez 11 10:45 glxinfo.log
drwxr-xr-x  5 root root 1,0K Mai  8 18:35 grub
-rw-r--r--  1 root root  38M Nov 11  2016 initrd.img-4.4.0-31-generic
-rw-r--r--  1 root root  39M Dez 27 18:15 initrd.img-4.4.0-47-generic
-rw-r--r--  1 root root  39M Dez 27 18:14 initrd.img-4.4.0-53-generic
-rw-r--r--  1 root root  39M Feb 10 02:53 initrd.img-4.4.0-59-generic
-rw-r--r--  1 root root  39M Feb 12 10:17 initrd.img-4.4.0-62-generic
-rw-r--r--  1 root root  39M Feb 21 00:12 initrd.img-4.4.0-63-generic
-rw-r--r--  1 root root  39M Mär 28 06:45 initrd.img-4.4.0-70-generic
-rw-r--r--  1 root root  39M Mär 30 08:32 initrd.img-4.4.0-71-generic
-rw-r--r--  1 root root  39M Mai  8 18:35 initrd.img-4.4.0-75-generic
-rw-r--r--  1 root root  39M Mai  8 18:35 initrd.img-4.4.0-77-generic
-rw-r--r--  1 root root 4,0K Dez 11 10:48 inxi.log
drwx------  2 root root  12K Nov 11  2016 lost+found
-rw-r--r--  1 root root 179K Jän 28  2016 memtest86+.bin
-rw-r--r--  1 root root 181K Jän 28  2016 memtest86+.elf
-rw-r--r--  1 root root 181K Jän 28  2016 memtest86+_multiboot.bin
-rw-------  1 root root 3,7M Jul 13  2016 System.map-4.4.0-31-generic
-rw-------  1 root root 3,7M Okt 27  2016 System.map-4.4.0-47-generic
-rw-------  1 root root 3,8M Feb  1 20:39 System.map-4.4.0-63-generic
-rw-------  1 root root 3,8M Mär 22 17:11 System.map-4.4.0-70-generic
-rw-------  1 root root 3,8M Mär 24 16:20 System.map-4.4.0-71-generic
-rw-------  1 root root 3,8M Apr 20 14:02 System.map-4.4.0-75-generic
-rw-r--r--  1 root root 6,8M Nov 11  2016 vmlinuz-4.4.0-31-generic
-rw-------  1 root root 6,8M Okt 27  2016 vmlinuz-4.4.0-47-generic
-rw-------  1 root root 6,8M Feb  1 20:39 vmlinuz-4.4.0-63-generic
-rw-------  1 root root 6,8M Mär 22 17:11 vmlinuz-4.4.0-70-generic
-rw-------  1 root root 6,8M Mär 24 16:20 vmlinuz-4.4.0-71-generic
-rw-------  1 root root 6,8M Apr 20 14:02 vmlinuz-4.4.0-75-generic
-rw-r--r--  1 root root  54K Dez 11 10:44 Xorg.0.log

I found a pretty dirty workaround now by manually moving old kernels to another folder via "mv".

So my question is: How do I prevent such situation from happening again? How can I fix the unrecognised other kernel versions (like 4.4.0-31)?

UPDATE:

apt-cache search linux-image | cut -f 1 -d ' ' | xargs dpkg -l 2>&1 | grep ^ii

ii  linux-image-4.4.0-75-generic       4.4.0-75.96  amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-77-generic       4.4.0-77.98  amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-78-generic       4.4.0-78.99  amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-75-generic 4.4.0-75.96  amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-77-generic 4.4.0-77.98  amd64        Linux kernel extra modules for version 4.4.0 odpkg-query: no packages found matching linux-image-4.4.0-21-generic
ii  linux-image-extra-4.4.0-78-generic 4.4.0-78.99  amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-generic                4.4.0.78.84  amd64        Generic Linux kernel image

dir /boot/

total 359M
drwxr-xr-x  4 root root 4,0K Mai 19 07:50 .
drwxr-xr-x 27 root root 4,0K Mai 19 07:41 ..
-rw-r--r--  1 root root 1,2M Feb  1 20:39 abi-4.4.0-63-generic
-rw-r--r--  1 root root 1,2M Mär 22 17:11 abi-4.4.0-70-generic
-rw-r--r--  1 root root 1,2M Apr 20 14:02 abi-4.4.0-75-generic
-rw-r--r--  1 root root 1,2M Apr 27 20:24 abi-4.4.0-78-generic
-rw-r--r--  1 root root 186K Feb  1 20:39 config-4.4.0-63-generic
-rw-r--r--  1 root root 186K Mär 22 17:11 config-4.4.0-70-generic
-rw-r--r--  1 root root 186K Apr 20 14:02 config-4.4.0-75-generic
-rw-r--r--  1 root root 186K Apr 27 20:24 config-4.4.0-78-generic
-rw-r--r--  1 root root  57K Dez 11 10:45 glxinfo.log
drwxr-xr-x  5 root root 1,0K Mai 19 17:35 grub
-rw-r--r--  1 root root  39M Dez 27 18:14 initrd.img-4.4.0-53-generic
-rw-r--r--  1 root root  39M Feb 10 02:53 initrd.img-4.4.0-59-generic
-rw-r--r--  1 root root  39M Feb 12 10:17 initrd.img-4.4.0-62-generic
-rw-r--r--  1 root root  39M Feb 21 00:12 initrd.img-4.4.0-63-generic
-rw-r--r--  1 root root  39M Mär 28 06:45 initrd.img-4.4.0-70-generic
-rw-r--r--  1 root root  39M Mai 19 07:47 initrd.img-4.4.0-75-generic
-rw-r--r--  1 root root  39M Mai 19 07:47 initrd.img-4.4.0-77-generic
-rw-r--r--  1 root root  39M Mai 19 07:47 initrd.img-4.4.0-78-generic
-rw-r--r--  1 root root 4,0K Dez 11 10:48 inxi.log
drwx------  2 root root  12K Nov 11  2016 lost+found
-rw-r--r--  1 root root 179K Jän 28  2016 memtest86+.bin
-rw-r--r--  1 root root 181K Jän 28  2016 memtest86+.elf
-rw-r--r--  1 root root 181K Jän 28  2016 memtest86+_multiboot.bin
-rw-------  1 root root 3,8M Feb  1 20:39 System.map-4.4.0-63-generic
-rw-------  1 root root 3,8M Mär 22 17:11 System.map-4.4.0-70-generic
-rw-------  1 root root 3,8M Apr 20 14:02 System.map-4.4.0-75-generic
-rw-------  1 root root 3,8M Apr 27 20:24 System.map-4.4.0-78-generic
-rw-------  1 root root 6,8M Feb  1 20:39 vmlinuz-4.4.0-63-generic
-rw-------  1 root root 6,8M Mär 22 17:11 vmlinuz-4.4.0-70-generic
-rw-------  1 root root 6,8M Apr 20 14:02 vmlinuz-4.4.0-75-generic
-rw-------  1 root root 6,8M Apr 27 20:24 vmlinuz-4.4.0-78-generic
-rw-r--r--  1 root root  54K Dez 11 10:44 Xorg.0.log

Does this mean I can manually remove the versions not found by dpkg?

Thanks!

mercury
  • 193
  • 1
  • 16
  • The old kernels are not "unrecognised" but rather they were generated before the "new" behaviour of autoremove started deleting things from the /boot. I would suggest rm instead of mv as you should not need more than three kernels ("current" , "previous" and maybe "known good"). Also, It also looks like you've removed the currently running kernel package? That's usually not a good idea. You should also remove the old kernel packages from your system using apt remove (linux-headers-whatever, linux-headers-whatever-generic, linux-image-whatever and linux-image-extra-whatever-generic) – sergtech May 19 '17 at 06:26
  • Thanks for your answer: I dont think I removed the current kernel - 4.4.0-75 is still installed. One more question: How do I know which to remove and how should remove them? Just with "rm"? apt remove does not recognise them. – mercury May 19 '17 at 07:24
  • sudo apt-get autoremove removes old kernels and packages no longer needed automatically. I usually run it a few days after installing a new kernel and encountering no problems. – jarleih May 19 '17 at 07:51
  • In my case it does not (no idea why) - as you can see there are still kernels like 4.4.0-31 and they were not removed?! – mercury May 19 '17 at 08:01
  • I would remove all older kernels except 75 and 77 and then run sudo update-grub2. This will rebuild your boot menu as well. – sergtech May 19 '17 at 08:19
  • Also, this will show you which kernel images you are running (apt-cache search linux-image | cut -f 1 -d ' ' | xargs dpkg -l 2>&1 | grep ^ii) (taken from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775771). You should get only 1 or 2 results. – sergtech May 19 '17 at 08:27
  • My comment was mainly in reference to the last part of your question (...How do I prevent such situation from happening again...). I should have made that clear. Out of curiosity​, how big is your /boot partition. – jarleih May 19 '17 at 08:46
  • Thanks for all your help: sergtech - I executed the apt-cache search and got versions 75,77 and 78 as result jarleih - thanks I will keep the autoclean in mind - my /boot/ was created by Ubuntu setup and is 472M – mercury May 19 '17 at 15:31
  • Please mark, if this bug affects you. – jarno May 19 '17 at 22:07
  • It seems you have manually removed some files related to linux-image-4.4.0-77-generic which is installed according to dpkg, but e.g. vmlinuz-4.4.0-77-generic is missing at /boot. What are some log files doing there? – jarno May 20 '17 at 16:14
  • Do you have dual boot system with two linuxes or have you installed one on top of other? – jarno May 20 '17 at 16:17
  • I did not remove files regarding 4.4.0-77 and I have no clue why logfiles (eg Xorg.0.log) are there. And it is also no dual boot system - it is my homeserver which was setup with 16.04 so not even an upgrade from an older Ubuntu version. – mercury May 20 '17 at 16:39

0 Answers0