0

I need to make space in the boot but whatever I try to remove this old kernel returns an error.

Tried to show results from synaptic and apt-get purge

enter image description here

Kaz Wolfe
  • 34,122
  • 21
  • 114
  • 172
alfaRV
  • 1
  • 3
  • 2
    Please don't post screenshots of text. Copy the text here and apply code formatting, instead. – muru Mar 29 '17 at 05:07

4 Answers4

2

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.

Carl
  • 724
  • 3
  • 5
  • 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
1

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.

Jean-Marie
  • 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
0

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.

https://github.com/mtompkins/linux-kernel-utilities

Mark
  • 1,502
  • 1
    Thanks 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 with dpkg, rebooting then trying again. If memory serves, dpkg --force-all – Mark Mar 29 '17 at 14:52
0

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.

heynnema
  • 70,711