5

I am unable to install or update any software on my machine.

Using my incredible powers of inference I deduced that /boot was full and was causing all my heartache.

notlinus@NS0:/boot$ df -h

Filesystem                Size  Used Avail Use% Mounted on
udev                      2.0G  4.0K  2.0G   1% /dev
tmpfs                     396M  656K  395M   1% /run
/dev/mapper/NS0--vg-root   36G  3.6G   30G  11% /
none                      4.0K     0  4.0K   0% /sys/fs/cgroup
none                      5.0M     0  5.0M   0% /run/lock
none                      2.0G     0  2.0G   0% /run/shm
none                      100M     0  100M   0% /run/user
/dev/sda1                 236M  234M     0 100% /boot

notlinus@NS0:/boot$ ls -l

total 229780
-rw-r--r-- 1 root root  1270654 Aug 12  2015 abi-3.19.0-26-generic
-rw-r--r-- 1 root root  1271100 Sep  1  2015 abi-3.19.0-28-generic
-rw-r--r-- 1 root root  1271518 Oct  3 00:54 abi-3.19.0-30-generic
-rw-r--r-- 1 root root  1271689 Oct  8 13:01 abi-3.19.0-31-generic
-rw-r--r-- 1 root root  1271689 Oct 22 13:14 abi-3.19.0-32-generic
-rw-r--r-- 1 root root  1271689 Nov  6 20:39 abi-3.19.0-33-generic
-rw-r--r-- 1 root root  1271691 Nov 23 16:57 abi-3.19.0-37-generic
-rw-r--r-- 1 root root   177632 Aug 12  2015 config-3.19.0-26-generic
-rw-r--r-- 1 root root   177651 Sep  1  2015 config-3.19.0-28-generic
-rw-r--r-- 1 root root   177730 Oct  3 00:54 config-3.19.0-30-generic
-rw-r--r-- 1 root root   177790 Oct  8 13:01 config-3.19.0-31-generic
-rw-r--r-- 1 root root   177790 Oct 22 13:14 config-3.19.0-32-generic
-rw-r--r-- 1 root root   177790 Nov  6 20:39 config-3.19.0-33-generic
-rw-r--r-- 1 root root   177790 Nov 23 16:57 config-3.19.0-37-generic
drwxr-xr-x 5 root root     1024 Feb 17 13:47 grub
-rw-r--r-- 1 root root 20754747 Aug 27  2015 initrd.img-3.19.0-26-generic
-rw-r--r-- 1 root root 20753554 Sep  9 06:29 initrd.img-3.19.0-28-generic
-rw-r--r-- 1 root root 20756217 Oct  6 07:03 initrd.img-3.19.0-30-generic
-rw-r--r-- 1 root root 20758684 Oct 22 13:04 initrd.img-3.19.0-31-generic
-rw-r--r-- 1 root root 20757000 Nov  5 06:55 initrd.img-3.19.0-32-generic
-rw-r--r-- 1 root root 20758873 Nov 10 07:17 initrd.img-3.19.0-33-generic
-rw-r--r-- 1 root root 20757964 Dec  2 06:54 initrd.img-3.19.0-37-generic
-rw-r--r-- 1 root root  3463561 Feb 17 13:46 initrd.img-3.19.0-39-generic
-rw-r--r-- 1 root root  3463563 Feb 17 13:47 initrd.img-3.19.0-42-generic
drwx------ 2 root root    12288 Aug 27  2015 lost+found
-rw-r--r-- 1 root root   176500 Mar 12  2014 memtest86+.bin
-rw-r--r-- 1 root root   178176 Mar 12  2014 memtest86+.elf
-rw-r--r-- 1 root root   178680 Mar 12  2014 memtest86+_multiboot.bin
-rw------- 1 root root  3626965 Aug 12  2015 System.map-3.19.0-26-generic
-rw------- 1 root root  3626779 Sep  1  2015 System.map-3.19.0-28-generic
-rw------- 1 root root  3627906 Oct  3 00:54 System.map-3.19.0-30-generic
-rw------- 1 root root  3628177 Oct  8 13:01 System.map-3.19.0-31-generic
-rw------- 1 root root  3628149 Oct 22 13:14 System.map-3.19.0-32-generic
-rw------- 1 root root  3628149 Nov  6 20:39 System.map-3.19.0-33-generic
-rw------- 1 root root  3628776 Nov 23 16:57 System.map-3.19.0-37-generic
-rw------- 1 root root  6570192 Aug 12  2015 vmlinuz-3.19.0-26-generic
-rw------- 1 root root  6568848 Sep  1  2015 vmlinuz-3.19.0-28-generic
-rw------- 1 root root  6572496 Oct  3 00:54 vmlinuz-3.19.0-30-generic
-rw------- 1 root root  6572336 Oct  8 13:01 vmlinuz-3.19.0-31-generic
-rw------- 1 root root  6572944 Oct 22 13:14 vmlinuz-3.19.0-32-generic
-rw------- 1 root root  6572432 Nov  6 20:39 vmlinuz-3.19.0-33-generic
-rw------- 1 root root  6571920 Nov 23 16:57 vmlinuz-3.19.0-37-generic

notlinus@NS0:/boot$ uname -r

3.19.0-37-generic

notlinus@NS0:~$ sudo apt-get clean

notlinus@NS0:/boot$ sudo apt-get autoremove

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-3.19.0-49-generic : Depends: linux-image-3.19.0-49-generic but it is not installed
 linux-image-generic-lts-vivid : Depends: linux-image-3.19.0-49-generic but it is not installed
                                 Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.

notlinus@NS0:/boot$ sudo dpkg --list '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-3.0                     <none>                 <none>                 (no description available)
rc  linux-image-3.19.0-25-generic       3.19.0-25.26~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-26-generic       3.19.0-26.28~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-28-generic       3.19.0-28.30~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-30-generic       3.19.0-30.34~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-31-generic       3.19.0-31.36~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-32-generic       3.19.0-32.37~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-33-generic       3.19.0-33.38~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-3.19.0-37-generic       3.19.0-37.42~14.04.1   amd64                  Linux kernel image for version 3.19.0 on 64 bit x86 SMP
in  linux-image-3.19.0-39-generic       <none>                 amd64                  (no description available)
in  linux-image-3.19.0-42-generic       <none>                 amd64                  (no description available)
in  linux-image-3.19.0-49-generic       <none>                 amd64                  (no description available)
rc  linux-image-extra-3.19.0-25-generic 3.19.0-25.26~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-extra-3.19.0-26-generic 3.19.0-26.28~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-extra-3.19.0-28-generic 3.19.0-28.30~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-extra-3.19.0-30-generic 3.19.0-30.34~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-extra-3.19.0-31-generic 3.19.0-31.36~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-extra-3.19.0-32-generic 3.19.0-32.37~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
ii  linux-image-extra-3.19.0-33-generic 3.19.0-33.38~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
iF  linux-image-extra-3.19.0-37-generic 3.19.0-37.42~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
iU  linux-image-extra-3.19.0-49-generic 3.19.0-49.55~14.04.1   amd64                  Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
iU  linux-image-generic-lts-vivid       3.19.0.49.34           amd64                  Generic Linux kernel image

notlinus@NS0:/boot$ sudo apt-get remove linux-image-3.19.0-26-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-3.19.0-26-generic : Depends: linux-image-3.19.0-26-generic but it is not going to be installed
 linux-image-extra-3.19.0-49-generic : Depends: linux-image-3.19.0-49-generic but it is not going to be installed
 linux-image-generic-lts-vivid : Depends: linux-image-3.19.0-49-generic but it is not going to be installed
                                 Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Im sure this must be a duplicate question but after searching around the solutions to similar questions did not aleviate my predicament.

Lastly, I am a RHEL admin so please excuse my apt ignorance - our BIND servers have to be on Ubuntu as a condition of some free colo space by our sister company. What am I doing wrong that caused this issue and how can I avoid it happening in future?

When I try similar solutions on this site such as How do I free up more space in /boot? I get:

notlinus@NS0:/boot$ sudo dpkg -fl linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs sudo apt-get -y purge
You might want to run ‘apt-get -f install’ to correct these.
The following packages have unmet dependencies.
 linux-image-extra-3.19.0-26-generic : Depends: linux-image-3.19.0-26-generic but it is not installed
 linux-image-extra-3.19.0-28-generic : Depends: linux-image-3.19.0-28-generic but it is not installed
 linux-image-extra-3.19.0-30-generic : Depends: linux-image-3.19.0-30-generic but it is not installed
 linux-image-extra-3.19.0-31-generic : Depends: linux-image-3.19.0-31-generic but it is not installed
 linux-image-extra-3.19.0-32-generic : Depends: linux-image-3.19.0-32-generic but it is not installed
 linux-image-extra-3.19.0-33-generic : Depends: linux-image-3.19.0-33-generic but it is not installed
 linux-image-extra-3.19.0-49-generic : Depends: linux-image-3.19.0-49-generic but it is not installed
 linux-image-generic-lts-vivid : Depends: linux-image-3.19.0-49-generic but it is not installed
                                 Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.
3
  • 1
    Possible duplicate of Can't clean a full /boot because of unmet dependencies. I'd also recommend upgrading, as Vivid is no longer supported. Mar 4, 2016 at 11:24
  • Please see my update
    – ZZ9
    Mar 4, 2016 at 12:29
  • This answer provides a way of removing packages with unmet dependencies, if nothing else works. Namely, you need to use sudo dpkg --force-all -P pkgname. Script it if you want to, but it looks like that's the way to go. Mar 4, 2016 at 12:51

3 Answers 3

5

Thanks @mikewhatever,

sudo dpkg --force-all -P pkgname was the answer

So: sudo dpkg --force-all -P linux-image-extra-3.19.0-26-generic did it for me

1
  • 1
    borrowing from another answer, the command echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'$(uname -r)'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo dpkg --force-all -P worked beautifully for me to pass all but the active kernel for removal.
    – b_laoshi
    Oct 8, 2019 at 7:55
1

The problem is because you ran out of space on the /boot partition.

Easily create some free space via sudo truncate -s 0 /boot/initrd.img-oldest-version

NOTE: do not truncate the highest 2 initrd versions!

After this sudo apt autoremove -f will succeed but it will take nearly forever to complete because it will rebuild initrd for all images and reinstall grub twice every time it removes one old kernel image. With 20 old kernel images it will rebuild the initrds nearly 400 times!

You can work around that ridiculous rebuilding by disabling the initrd generation tool:

sudo mv /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postinst.d/initramfs-tools.real
sudo ln -s /bin/true /etc/kernel/postinst.d/initramfs-tools

Then issue sudo apt autoremove -f and when you're done...

sudo rm /etc/kernel/postinst.d/initramfs-tools
sudo mv /etc/kernel/postinst.d/initramfs-tools.real /etc/kernel/postinst.d/initramfs-tools
sudo /etc/kernel/postinst.d/initramfs-tools $( uname -r )

NOTE: If the running kernel isn't in /boot any more then you may need to supply the kernel version manually in place of uname -r

After you're done, consider manually installing a specific kernel such as the current one, and then enabling apt-autoremove. This will ensure you always have the chosen image to boot from, plus whatever the latest is.

1
  • Why not sudo rm -f /boot/*3.19.0-25.26* and get more than one file (initrd.img-3.19.0-26-generic) at once? May 16, 2019 at 1:53
0

If your issue is because of lack of space, then you might have a way out. If you look closely, then you can see:

 Filesystem                Size  Used Avail Use% Mounted on
 /dev/sda1                 236M  234M     0 100% /boot

You will see that the size of the partition is 236M, while used is 234M. System has reserved 2 MB for such emergencies. Free it up for your use by issuing the command:

 sudo tune2fs -m 0 /dev/sda1

You will have 2M of free space which might help you out of your situation.

Another way out will be to abandon that partition as boot entirely and use change the fstab (remove /boot ) and create a /boot on the root partition.

Copy everything over from the (now) old boot to new boot and then complete the commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .