cannot erase old kernels to free space in boot

Asked by Taloola on 2018-10-11

I tried to free spaceby removing old kerlnels and it says it cannot remove them because they dont exist..

Here some info:

amayzingdakini@amayzingdakini-HP-ProBook-430-G1:~$ uname -r
amayzingdakini@amayzingdakini-HP-ProBook-430-G1:~$ dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+'
ii linux-image-4.4.0-111-generic 4.4.0-111.134~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-127-generic 4.4.0-127.153~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-137-generic 4.4.0-137.163~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-97-generic 4.4.0-97.120~14.04.1 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP

*linux-image appearsin red...dont know if it's significant..

and my trials:

amayzingdakini@amayzingdakini-HP-ProBook-430-G1:~$ sudo update-initramfs -d -k 4.4.0-97-generic
[sudo] password for amayzingdakini:
update-initramfs: Deleting /boot/initrd.img-4.4.0-97-generic
amayzingdakini@amayzingdakini-HP-ProBook-430-G1:~$ sudo dpkg --purge linux-image-4.4.0-97-generic
dpkg: dependency problems prevent removal of linux-image-4.4.0-97-generic:
 linux-image-extra-4.4.0-97-generic depends on linux-image-4.4.0-97-generic.

dpkg: error processing package linux-image-4.4.0-97-generic (--purge):
 dependency problems - not removing
Errors were encountered while processing:
amayzingdakini@amayzingdakini-HP-ProBook-430-G1:~$ sudo dpkg --purge linux-image-4.4.0-97.120~14.04.1
dpkg: error: --purge needs a valid package name but 'linux-image-4.4.0-97.120~14.04.1' is not: illegal package name in specifier 'linux-image-4.4.0-97.120~14.04.1': character `~' not allowed (only letters, digits and characters `-+._')

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
amayzingdakini@amayzingdakini-HP-ProBook-430-G1:~$ sudo dpkg --purge linux-image-4.4.0-97.120
dpkg: warning: ignoring request to remove linux-image-4.4.0-97.120 which isn't installed

any advice?
Thank you!

Question information

English Edit question
Ubuntu initramfs-tools Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:

sudo apt-get --purge remove linux-image-4.4.0-111-generic
sudo apt-get --purge remove linux-image-4.4.0-97-generic
sudo apt-get --purge autoremove

Will leave you with 2 kernels:

Taloola (tali-almon) said : #2

Thanks actionparsnip, that solved my question.