1

I get the following error when running dpkg update via the command line on my Ubuntu server and have no idea how to resolve it

2019-02-03 06:25:32 INFO: no packages to update
E:Sub-process /usr/bin/dpkg returned an error code (1)
2019-02-03 06:26:01 ERROR: installArchives() failed
2019-02-03 06:26:01 ERROR: Exited with returncode 1.

When running dpkg -l I see the following bad packages

ii  linux-image-4.15.0-42-generic      4.15.0-42.45                                amd64        Signed kernel image generic
iF  linux-image-4.15.0-43-generic      4.15.0-43.46                                amd64        Signed kernel image generic
iF  linux-image-4.15.0-44-generic      4.15.0-44.47                                amd64        Signed kernel image generic
iF  linux-image-4.15.0-45-generic      4.15.0-45.48                                amd64        Signed kernel image generic

I am running a Plesk server on Ubuntu 18.04 if this is useful


df Results

Filesystem      Size  Used Avail Use% Mounted on
udev            478M     0  478M   0% /dev
tmpfs            99M  716K   98M   1% /run
/dev/vda1        25G  7.2G   17G  30% /
tmpfs           493M  8.0K  493M   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           493M     0  493M   0% /sys/fs/cgroup
/dev/vda15      105M  3.6M  101M   4% /boot/efi
/dev/sda         25G   14G   11G  57% /mnt/volume_sfo2_01
tmpfs            99M     0   99M   0% /run/user/0

Remove Packages

dpkg: error processing package linux-image-4.15.0-45-generic (--remove):
 installed linux-image-4.15.0-45-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-43-generic
 linux-image-4.15.0-44-generic
 linux-image-4.15.0-45-generic

Audit Output

# sudo dpkg --audit linux-image-4.15.0-45-generic
The following packages are only half configured, probably due to problems
configuring them the first time.  The configuration should be retried using
dpkg --configure <package> or the configure menu option in dselect:
 linux-image-4.15.0-45-generic Signed kernel image generic

Purge Output

# sudo dpkg --purge linux-image-4.15.0-45-generic
dpkg: dependency problems prevent removal of linux-image-4.15.0-45-generic:
 linux-image-virtual depends on linux-image-4.15.0-45-generic.

dpkg: error processing package linux-image-4.15.0-45-generic (--purge):
 dependency problems - not removing
Errors were encountered while processing:
 linux-image-4.15.0-45-generic

Below is the post install script. I have checked the directories mentioned and they all exist however some of the modules listed are missing as you can see with the ls near the bottom

cat /var/lib/dpkg/info/linux-image-4.15.0-45-generic.postrm
#!/bin/sh
set -e

version=4.15.0-45-generic
image_path=/boot/vmlinuz-$version

rm -f /lib/modules/$version/.fresh-install

if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null; then
    linux-update-symlinks remove $version $image_path
fi

if [ -d /etc/kernel/postrm.d ]; then
    # We cannot trigger ourselves as at the end of this we will no longer
    # exist and can no longer respond to the trigger.  The trigger would
    # then become lost.  Therefore we clear any pending trigger and apply
    # postrm directly.
    if [ -f /usr/lib/linux/triggers/$version ]; then
    echo "$0 ... removing pending trigger"
    rm -f /usr/lib/linux/triggers/$version
    rmdir --ignore-fail-on-non-empty /usr/lib/linux/triggers
    fi
    DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
          --arg=$image_path /etc/kernel/postrm.d
fi

if [ "$1" = purge ]; then
    for extra_file in modules.dep modules.isapnpmap modules.pcimap \
                      modules.usbmap modules.parportmap \
                      modules.generic_string modules.ieee1394map \
                      modules.ieee1394map modules.pnpbiosmap \
                      modules.alias modules.ccwmap modules.inputmap \
                      modules.symbols modules.ofmap \
                      modules.seriomap modules.\*.bin \
              modules.softdep modules.devname; do
    eval rm -f /lib/modules/$version/$extra_file
    done
    rmdir /lib/modules/$version || true
fi

exit 0
root@serv1:~# cd /lib/modules/4.15.0-45-generic
root@serv1:/lib/modules/4.15.0-45-generic# ls
build          modules.alias.bin    modules.dep.bin  modules.symbols
initrd         modules.builtin      modules.devname  modules.symbols.bin
kernel         modules.builtin.bin  modules.order    vdso
modules.alias  modules.dep          modules.softdep
root@serv1:/lib/modules/4.15.0-45-generic# 

1 Answer 1

2

The "F" in the second column of the dpkg list says "Half configured". A common cause for that is "too little disk space".

Check the output of:
sudo df -h | grep -v loop
... and look for high usage percentages.

I'd also try to remove the half configured packages, in one go that is:

sudo apt-get purge linux-image-4.15.0-45-generic linux-image-4.15.0-44-generic linux-image-4.15.0-43-generic

Keep an eye open for any removal stopping errors occurs, include them above if so, then re-check with df above to see if the situation changed.

Whether anything more needs to be done depends on your findings. You need to append relevant NEW info in your original posting. Click edit and then type a <hr> at the end, and paste the new info after it.


Next step if the above doesn't help:
sudo dpkg --audit linux-image-4.15.0-45-generic
... and add the output in the same manner as above.

Based on the result, the following step might be:
sudo dpkg --purge linux-image-4.15.0-45-generic
... with the same repeated for each of the remaining troublesome packages.


As we see:
"... linux-image-virtual depends on linux-image-4.15.0-45-generic."
try:
sudo apt-get purge linux-image-virtual linux-image-4.15.0-45-generic


Same error still: Well then, try stepping up the removal attempts a bit, by using the -f (fix) flag:
sudo apt-get -f purge linux-image-virtual
sudo apt-get -f purge linux-image-4.15.0-45-generic

if that doesn't work, then try a bit harder with the "lower level" dpkg:
sudo dpkg --remove linux-image-virtual
sudo dpkg --remove linux-image-4.15.0-45-generic

Repeat for the other error-packages if any of it might give an actual cleanup.

And evidently, if one of these is in use; and actually works; that package would not be one to attempt removal on.

Additionally, by checking where the post removal scripts actually live (apparently they're not listed as part of the packages) with locate I came up with this:

cat /var/lib/dpkg/info/linux-image-4.15.0-45-generic.postrm

... read through that script and check your file system, whether there are folders mentioned in the script that are missing or if there are other odd things that might trigger a failure.


GENERAL INFO: Dealing with kernel-related packages
uname -r # this prints the currently ACTIVE kernel name; cannot be removed!

sudo apt-get purge linux-image-x.x.x.x-generic # removes a kernel

sudo update-initramfs -u # remakes boot ramdisk
sudo update-grub2 # re-creates boot menu
The last two are essential to restore the boot menu and make the entries actually work at next reboot.

7
  • Thanks for the reply I have checked with df as your suggested and I have 7.2GB left on the main drive and after running apt-get purge this did not change the situation. Commented Feb 3, 2019 at 8:30
  • I have run both your commands and updated above. I ran this for both ***.43 and ****.45 wit no difference in the output apart for the version numbers Commented Feb 3, 2019 at 12:32
  • Did you get things sorted, what did you do to achieve that? Was the above helpful in the process?
    – Hannu
    Commented Feb 9, 2019 at 14:09
  • Hi I am try trying these now. I can't run these during the week as the server is used for developing WP sites on. I will let you know if anything works Commented Feb 10, 2019 at 8:33
  • I am running kernel 44 so never tried that one but I am getting the same failed post-remove script error on both 43 and 45 with the above commands. Commented Feb 10, 2019 at 8:40

You must log in to answer this question.

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