Author Topic: "You have broken packages installed, fix them before upgrading" message  (Read 1990 times)

cartmanrules

  • Zen Apprentice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Hi,

A few days ago, I see this message when logging into the Zentyal administration system:

Code: [Select]
You have broken packages installed, fix them before upgrading

I tried to run sudo apt-get update and sudo apt-get upgrade but I receive an error telling me to run apt-get -f install. When I run it, the following error appears:

Code: [Select]
After this operation, 47.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 99245 files and directories currently installed.)
Preparing to unpack .../linux-image-3.19.0-80-generic_3.19.0-80.88~14.04.1_amd64.deb ...
Done.
Unpacking linux-image-3.19.0-80-generic (3.19.0-80.88~14.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-3.19.0-80-generic_3.19.0-80.88~14.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/abi-3.19.0-80-generic' to '/boot/abi-3.19.0-80-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.19.0-80-generic /boot/vmlinuz-3.19.0-80-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.19.0-80-generic /boot/vmlinuz-3.19.0-80-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-3.19.0-80-generic_3.19.0-80.88~14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I can read a line complaining about the space on the hard drive, telling that it's full (/boot folder). When I run df -h I get:

Code: [Select]
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G  4.0K  3.9G   1% /dev
tmpfs           799M  2.5M  796M   1% /run
/dev/dm-0       1.8T  104G  1.6T   6% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none             50M     0   50M   0% /run/lock
none            3.9G   21M  3.9G   1% /run/shm
none            100M  4.0K  100M   1% /run/user
/dev/sda1       236M  225M     0 100% /boot

How could I solve this problem? Any help welcome, thanks.

talkinggoat

  • Zen Apprentice
  • *
  • Posts: 20
  • Karma: +3/-0
    • View Profile
For anyone trying to find an answer to this, here is what you can do You are going to be replacing the kernel values and versions with your own system. Don't attempt to use mine, exactly...

First, determine your current kernel version.
Code: [Select]
uname -rThat will be the kernel you want to make sure you don't delete.

List the kernel packages installed.
Code: [Select]
sudo dpkg --get-selections | grep linux-image
linux-image-3.13.0-106-generic install
linux-image-3.13.0-117-generic install
linux-image-3.13.0-45-generic deinstall
linux-image-3.13.0-61-generic install
linux-image-3.13.0-91-generic install
linux-image-3.13.0-98-generic install
linux-image-3.19.0-64-generic install
linux-image-3.19.0-71-generic install
linux-image-3.19.0-78-generic install
linux-image-extra-3.13.0-106-generic install
linux-image-extra-3.13.0-117-generic install
linux-image-extra-3.13.0-45-generic deinstall
linux-image-extra-3.13.0-61-generic install
linux-image-extra-3.13.0-91-generic install
linux-image-extra-3.13.0-98-generic install
linux-image-extra-3.19.0-64-generic install
linux-image-extra-3.19.0-71-generic install
linux-image-extra-3.19.0-78-generic install
linux-image-extra-3.19.0-80-generic install
linux-image-generic install
linux-image-generic-lts-vivid install

In my case, apt was trying to install 3.19.0-80, but could not, because /boot was full.

Get a list of all the kernel image files in the /boot directory.
Code: [Select]
christopher@sbs-server:/boot$ ls
abi-3.13.0-106-generic         initrd.img-3.19.0-64-generic
abi-3.13.0-117-generic         initrd.img-3.19.0-71-generic
abi-3.13.0-61-generic          initrd.img-3.19.0-78-generic
abi-3.13.0-91-generic          lost+found
abi-3.13.0-98-generic          System.map-3.13.0-106-generic
abi-3.19.0-64-generic          System.map-3.13.0-117-generic
abi-3.19.0-71-generic          System.map-3.13.0-61-generic
abi-3.19.0-78-generic          System.map-3.13.0-91-generic
config-3.13.0-106-generic      System.map-3.13.0-98-generic
config-3.13.0-117-generic      System.map-3.19.0-64-generic
config-3.13.0-61-generic       System.map-3.19.0-71-generic
config-3.13.0-91-generic       System.map-3.19.0-78-generic
config-3.13.0-98-generic       vmlinuz-3.13.0-106-generic
config-3.19.0-64-generic       vmlinuz-3.13.0-117-generic
config-3.19.0-71-generic       vmlinuz-3.13.0-61-generic
config-3.19.0-78-generic       vmlinuz-3.13.0-91-generic
grub                           vmlinuz-3.13.0-98-generic
initrd.img-3.13.0-106-generic  vmlinuz-3.19.0-64-generic
initrd.img-3.13.0-61-generic   vmlinuz-3.19.0-71-generic
initrd.img-3.13.0-91-generic   vmlinuz-3.19.0-78-generic
initrd.img-3.13.0-98-generic

Create a folder
Code: [Select]
christopher@sbs-server:/boot$ mkdir ~/old-kernel-imagesMove all the old kernels to the above folder.
Code: [Select]
christopher@sbs-server:/boot$ sudo mv ./*-3.13.0-* ~/old-kernel-images
Now, you should have space in /boot, but apt will complain about missing files, when you install the latest kernel version. We'll handle this, later.

Code: [Select]
update-initramfs: Generating /boot/initrd.img-3.13.0-106-generic
grep: /boot/config-3.13.0-106-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.13.0-98-generic
grep: /boot/config-3.13.0-98-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.13.0-91-generic
grep: /boot/config-3.13.0-91-generic: No such file or directory
update-initramfs: Generating /boot/initrd.img-3.13.0-61-generic
grep: /boot/config-3.13.0-61-generic: No such file or directory

Once it is finished, purge all the missing kernel packages. This, also, will give errors, but it is necessary to tell apt they are no longer installed.

Code: [Select]
christopher@sbs-server:/boot$ sudo apt-get purge linux-image-3.13.0-91-generic linux-image-3.13.0-61-generic linux-image-3.13.0-45-generic linux-image-3.13.0-117-generic linux-image-3.13.0-106-generic
Once everything is purged out, you should no longer have any issues.

Code: [Select]
christopher@sbs-server:/boot$ dpkg --get-selections | grep "linux-image"linux-image-3.19.0-64-generic install
linux-image-3.19.0-71-generic install
linux-image-3.19.0-78-generic install
linux-image-3.19.0-80-generic install
linux-image-extra-3.13.0-45-generic deinstall
linux-image-extra-3.19.0-64-generic install
linux-image-extra-3.19.0-71-generic install
linux-image-extra-3.19.0-78-generic install
linux-image-extra-3.19.0-80-generic install
linux-image-generic-lts-vivid install

Now install your latest kernel. There should be no errors.

Code: [Select]
christopher@sbs-server:/boot$ sudo apt-get install --reinstall linux-image-3.19.0-80-generic
Clean up any straggling packages, using autoremove. There should be no errors.

Code: [Select]
christopher@sbs-server:/boot$ sudo apt-get autoremove
« Last Edit: April 27, 2017, 07:40:52 pm by talkinggoat »