I need to make space in the boot but whatever I try to remove this old kernel returns an error.
-
2Please don't post screenshots of text. Copy the text here and apply code formatting, instead. – muru Mar 29 '17 at 05:07
4 Answers
Try to remove old kernels with this:
dpkg -l linux-{image,headers}-* | awk '/^ii/{print $2}' | egrep '[0-9]+\.[0-9]+\.[0-9]+' | grep -v $(uname -r) | xargs sudo apt-get -y purge
see: Don't know which kernel to remove to free up disk space
The other errors you get (couldn't lock....) is because you have several applications running who are already created the lock.
-
Thanks Carl, I tried it but the error persist:
dpkg: error processing package linux-image-extra-3.13.0-112-generic (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: linux-image-extra-3.13.0-110-generic linux-image-extra-3.13.0-112-generic N: Ignoring file '50unattended-upgrades.ucf-old' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension E: Sub-process /usr/bin/dpkg returned an error code (1)
– alfaRV Mar 29 '17 at 13:21 -
You'll need to remove files manually to hava some space in de boot dir. See: http://askubuntu.com/questions/171209/my-boot-partition-hit-100-and-now-i-cant-upgrade-cant-remove-old-kernels-to – Carl Mar 29 '17 at 14:32
You cannot execute apt-get
while synaptic is running.
Also try apt-get autoremove
before anything else. On recent Ubuntu it removes most old kernels.

- 1,958
- 1
- 14
- 11
-
Thanks Jean-Marie. I noticed that I had synaptic opened and tried again. the result is on the second screenshot. The error seems to be a broken package – alfaRV Mar 29 '17 at 13:31
I created a set of utilities to upgrade (Canonical precompiled), compile from source, and remove kernels.
Note the remove utility will remove all kernels except the current active one.
The scripts can also be called remotely through ssh.

- 1,502
-
1Thanks Mark. Tried it but error persist:
dpkg: error processing package linux-image-extra-3.13.0-112-generic (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: linux-image-extra-3.13.0-110-generic linux-image-extra-3.13.0-112-generic N: Ignoring file '50unattended-upgrades.ucf-old' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension E: Sub-process /usr/bin/dpkg returned an error code (1)
– alfaRV Mar 29 '17 at 13:34 -
I would try forcing a reinstall of that package
linux-image-extra-3.13.0-112-generic
withdpkg
, rebooting then trying again. If memory serves,dpkg --force-all
– Mark Mar 29 '17 at 14:52
You need to do the following to take care of at least two of your problems.
1) In terminal:
cd /etc/apt/apt.conf.d # change directory
ls -al # list all files
If 50unattended-upgrades
does not exist, we'll rename a file:
sudo mv 50unattended-upgrades.ucf-old 50unattended-upgrades
or if 50unattended-upgrades
does exist, we'll delete a file:
sudo rm -i 50unattended-upgrades.ucf-old
2) Your /boot
partition is full. You need to delete some older linux kernels/etc there. I personally use Synaptic to do that work for me, but there are other methods that can be used. Search here on askubuntu if you need more help with this.

- 70,711