Unable to update kernel files after installation error

Asked by Jonathan Gossage

At some point a failure occurred (unfortunately unknown) and since then I am unable to remove the packages linux-image-4.4.0-22-generic or linux-image-extra-4.4.0-22-generic. The problem seems to be that when originally removing these files, Ubuntu failed after physically removing the files and before terminating the update procedure and now depmod cannot find them before trying to remove them. The diagnostic output from https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure follows and includes an attempt to remove these files. I did not do anything from step 8 as it did not seem relevant to this problem.

I am now at a loss to know how to repair my system as nothing I could find will work.

jonathan@Aristotle:~$ ubuntu-support-status
Support status summary of 'Aristotle':

You have 49 packages (2.2%) supported until enero 2017 (9m)
You have 6 packages (0.3%) supported until abril 2019 (3y)
You have 10 packages (0.5%) supported until abril 2017 (9m)
You have 1980 packages (89.5%) supported until abril 2021 (5y)

You have 167 packages (7.5%) that can not/no-longer be downloaded
You have 0 packages (0.0%) that are unsupported

Run with --show-unsupported, --show-supported or --show-all to see more details
jonathan@Aristotle:~$ cat /etc/dpkg/dpkg.cfg.d/multiarch
cat: /etc/dpkg/dpkg.cfg.d/multiarch: No such file or directory
jonathan@Aristotle:~$ dpkg --print-foreign-architectures
i386
jonathan@Aristotle:~$ sudo grep -R proxy /etc/apt/*
[sudo] password for jonathan:
jonathan@Aristotle:~$ grep proxy /etc/environment
jonathan@Aristotle:~$ echo $http_proxy

jonathan@Aristotle:~$ echo $ftp_proxy

jonathan@Aristotle:~$ grep proxy /etc/bash.bashrc
jonathan@Aristotle:~$ grep proxy ~/.bashrc
jonathan@Aristotle:~$ cat /etc/apt/apt.conf
cat: /etc/apt/apt.conf: No such file or directory
jonathan@Aristotle:~$ sudo fuser -vvv /var/lib/dpkg/lock
jonathan@Aristotle:~$ sudo fuser -vvv /var/cache/apt/archives/lock
jonathan@Aristotle:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
jonathan@Aristotle:~$ uname -a
Linux Aristotle 4.4.0-28-generic #47-Ubuntu SMP Fri Jun 24 10:09:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
jonathan@Aristotle:~$ sudo rm /var/lib/apt/lists/lock
jonathan@Aristotle:~$ sudo rm /var/cache/apt/archives/lock
jonathan@Aristotle:~$ sudo rm /var/lib/dpkg/lock
jonathan@Aristotle:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
jonathan@Aristotle:~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
jonathan@Aristotle:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/apt.extended_states.0 /var/lib/dpkg/status
jonathan@Aristotle:~$ sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
jonathan@Aristotle:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
cp: cannot stat '/var/lib/dpkg/available-old': No such file or directory
jonathan@Aristotle:~$ sudo rm -rf /var/lib/dpkg/updates/*
jonathan@Aristotle:~$ sudo rm -rf /var/lib/apt/lists
jonathan@Aristotle:~$ sudo rm /var/cache/apt/*.bin
jonathan@Aristotle:~$ sudo mkdir /var/lib/apt/lists
jonathan@Aristotle:~$ sudo mkdir /var/lib/apt/lists/partial
jonathan@Aristotle:~$ LANG=C;sudo apt-get clean
jonathan@Aristotle:~$ LANG=C;sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
jonathan@Aristotle:~$ sudo dpkg --configure -a
Setting up linux-image-extra-4.4.0-28-generic (4.4.0-28.47) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-28-generic (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-extra-4.4.0-28-generic; however:
  Package linux-image-extra-4.4.0-28-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 4.4.0.28.30); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-extra-4.4.0-28-generic
 linux-image-generic
 linux-generic
jonathan@Aristotle:~$ sudo dpkg --clear-avail
jonathan@Aristotle:~$ LANG=C;sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.4.0-22-generic linux-image-extra-4.4.0-22-generic
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 217 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 235952 files and directories currently installed.)
Removing linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-22-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic
WARNING: missing /lib/modules/4.4.0-22-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-22-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_NKwgeg/lib/modules/4.4.0-22-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_NKwgeg/lib/modules/4.4.0-22-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-22-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.4.0-22-generic (4.4.0-22.40) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-22-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-22-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-22-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-22-generic
 linux-image-4.4.0-22-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
jonathan@Aristotle:~$ LANG=C;sudo apt-get --fix-missing install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.4.0-22-generic linux-image-extra-4.4.0-22-generic
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 217 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 235952 files and directories currently installed.)
Removing linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-22-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic
WARNING: missing /lib/modules/4.4.0-22-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-22-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PAcqzE/lib/modules/4.4.0-22-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_PAcqzE/lib/modules/4.4.0-22-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-22-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.4.0-22-generic (4.4.0-22.40) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-22-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-22-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-22-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-22-generic
 linux-image-4.4.0-22-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
jonathan@Aristotle:~$ LANG=C;sudo apt-get --purge autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.4.0-22-generic linux-image-extra-4.4.0-22-generic
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 217 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 235952 files and directories currently installed.)
Removing linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-22-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found.
Please install the linux-headers-4.4.0-22-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic
WARNING: missing /lib/modules/4.4.0-22-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-22-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_wcrBsi/lib/modules/4.4.0-22-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_wcrBsi/lib/modules/4.4.0-22-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-22-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.4.0-22-generic (4.4.0-22.40) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-22-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-22-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-22-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.4.0-22-generic
 linux-image-4.4.0-22-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
jonathan@Aristotle:~$ LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [94.5 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main Sources [868 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1 201 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages [1 196 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main Translation-en [568 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 DEP-11 Metadata [733 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial/main DEP-11 64x64 Icons [409 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [87.1 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [242 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [238 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [95.5 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [186 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [155 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-backports/main Sources [752 B]
Get:18 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [676 B]
Get:19 http://archive.ubuntu.com/ubuntu xenial-backports/main i386 Packages [676 B]
Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [528 B]
Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [197 B]
Get:22 http://archive.ubuntu.com/ubuntu xenial-security/main Sources [28.5 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [114 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-security/main i386 Packages [111 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-security/main Translation-en [43.7 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [46.3 kB]
Get:27 http://archive.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [50.8 kB]
Fetched 6 903 kB in 5s (1 347 kB/s)
Reading package lists... Done
jonathan@Aristotle:~$ LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  liboxideqt-qmlplugin liboxideqtcore0 liboxideqtquick0
The following packages will be upgraded:
  libappstream-glib8 lsb-base lsb-release
3 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
5 not fully installed or removed.
Need to get 57.7 MB of archives.
After this operation, 1 024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-4.4.0-22-generic amd64 4.4.0-22.40 [18.7 MB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-extra-4.4.0-22-generic amd64 4.4.0-22.40 [38.9 MB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 lsb-base all 9.20160110ubuntu0.1 [13.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 lsb-release all 9.20160110ubuntu0.1 [11.9 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libappstream-glib8 amd64 0.5.13-1ubuntu2 [101 kB]
Fetched 57.7 MB in 33s (1 736 kB/s)
(Reading database ... 235953 files and directories currently installed.)
Preparing to unpack .../lsb-base_9.20160110ubuntu0.1_all.deb ...
Unpacking lsb-base (9.20160110ubuntu0.1) over (9.20160110) ...
Setting up lsb-base (9.20160110ubuntu0.1) ...
(Reading database ... 235953 files and directories currently installed.)
Preparing to unpack .../lsb-release_9.20160110ubuntu0.1_all.deb ...
Unpacking lsb-release (9.20160110ubuntu0.1) over (9.20160110) ...
Preparing to unpack .../libappstream-glib8_0.5.13-1ubuntu2_amd64.deb ...
Unpacking libappstream-glib8:amd64 (0.5.13-1ubuntu2) over (0.5.13-1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Setting up linux-image-extra-4.4.0-28-generic (4.4.0-28.47) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-28-generic /boot/vmlinuz-4.4.0-28-generic
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-28-generic (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-extra-4.4.0-28-generic; however:
  Package linux-image-extra-4.4.0-28-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 4.4.0.28.30); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: error processing package linux-image-4.4.0-22-generic (--configure):
 package linux-image-4.4.0-22-generic is not ready for configuration
 cannot configure (current status 'half-installed')
dpkg: error processing package linux-image-extra-4.4.0-22-generic (--configure):
 package linux-image-extra-4.4.0-22-generic is not ready for configuration
 cannot configure (current statNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                                                         No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                             No apport report written because MaxReports is reached already
     No apport report written because MaxReports is reached already
                                                                   us 'half-installed')
Setting up lsb-release (9.20160110ubuntu0.1) ...
Setting up libappstream-glib8:amd64 (0.5.13-1ubuntu2) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Errors were encountered while processing:
 linux-image-extra-4.4.0-28-generic
 linux-image-generic
 linux-generic
 linux-image-4.4.0-22-generic
 linux-image-extra-4.4.0-22-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
jonathan@Aristotle:~$ find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

/etc/apt/sources.list.d/google-chrome.list

     1 ### THIS FILE IS AUTOMATICALLY CONFIGURED ###
     2 # You may comment out this entry, but any other modifications may be lost.
     3 # deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

/etc/apt/sources.list.d/vivaldi.list

     1 ### THIS FILE IS AUTOMATICALLY CONFIGURED ###
     2 # You may comment out this entry, but any other modifications may be lost.
     3 # deb http://repo.vivaldi.com/stable/deb/ stable main

/etc/apt/sources.list.d/inameiname-ubuntu-stable-xenial.list

/etc/apt/sources.list

     1 # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
     2 deb-src http://archive.ubuntu.com/ubuntu xenial main #Added by software-properties
     3
     4 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     5 # newer versions of the distribution.
     6 deb http://archive.ubuntu.com/ubuntu xenial main
     7
     8 ## Major bug fix updates produced after the final release of the
     9 ## distribution.
    10 deb http://archive.ubuntu.com/ubuntu xenial-updates main
    11 deb-src http://archive.ubuntu.com/ubuntu xenial-updates main #Added by software-properties
    12
    13 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    14 ## team, and may not be under a free licence. Please satisfy yourself as to
    15 ## your rights to use the software. Also, please note that software in
    16 ## universe WILL NOT receive any review or updates from the Ubuntu security
    17 ## team.
    18 # deb-src http://mx.archive.ubuntu.com/ubuntu/ xenial universe
    19 # deb-src http://mx.archive.ubuntu.com/ubuntu/ xenial-updates universe
    20
    21 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    22 ## team, and may not be under a free licence. Please satisfy yourself as to
    23 ## your rights to use the software. Also, please note that software in
    24 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    25 ## security team.
    26 # deb-src http://mx.archive.ubuntu.com/ubuntu/ xenial multiverse
    27 # deb-src http://mx.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
    28
    29 ## N.B. software from this repository may not have been tested as
    30 ## extensively as that contained in the main release, although it includes
    31 ## newer versions of some applications which may provide useful features.
    32 ## Also, please note that software in backports WILL NOT receive any review
    33 ## or updates from the Ubuntu security team.
    34 deb http://archive.ubuntu.com/ubuntu xenial-backports main
    35 deb-src http://archive.ubuntu.com/ubuntu xenial-backports main #Added by software-properties
    36
    37 ## Uncomment the following two lines to add software from Canonical's
    38 ## 'partner' repository.
    39 ## This software is not part of Ubuntu, but is offered by Canonical and the
    40 ## respective vendors as a service to Ubuntu users.
    41 # deb http://archive.canonical.com/ubuntu xenial partner
    42 # deb-src http://archive.canonical.com/ubuntu xenial partner
    43
    44 deb http://archive.ubuntu.com/ubuntu xenial-security main
    45 deb-src http://archive.ubuntu.com/ubuntu xenial-security main #Added by software-properties
    46 # deb-src http://security.ubuntu.com/ubuntu xenial-security universe
    47 # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
    48 # deb http://archive.canonical.com/ xenial partner
    49 # deb-src http://archive.canonical.com/ xenial partner
jonathan@Aristotle:~$ sudo dpkg --audit
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
 linux-generic Complete Generic Linux kernel and headers
 linux-image-generic Generic Linux kernel image

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-extra-4.4.0-28-generic Linux kernel extra modules for version 4.4.

The following packages are only half installed, due to problems during
installation. The installation can probably be completed by retrying it;
the packages can be removed using dselect or dpkg --remove:
 linux-image-4.4.0-22-generic Linux kernel image for version 4.4.0 on 64 bit x8
 linux-image-extra-4.4.0-22-generic Linux kernel extra modules for version 4.4.

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

What is the output of

sudo dpkg --purge linux-image-4.4.0-22-generic linux-image-extra-4.4.0-22-generic

Remark:
The root cause might be hidden behind the lines
Generating grub configuration file ...
grub-probe: error: not a directory.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1

Revision history for this message
Jonathan Gossage (jgossage) said :
#2

Unfortunately I needed a fully working system immediately so I repaired it by reinstalling 16.04 thus I can't respond to your information request which crossed with my decision. Many thanks anyway.

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.