I was trying to remove old kernels using Synaptic, and something went very wrong. Now, I get this error in Synaptic if I try to fix it:
(synaptic:11810): GLib-CRITICAL **: g_child_watch_add_full: assertion 'pid > 0' failed
dpkg: warning: files list file for package 'refind' missing; assuming package has no files currently installed
(Reading database ... 338732 files and directories currently installed.)
Removing linux-image-extra-3.19.0-21-generic (3.19.0-21.21) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-21-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-21-generic /boot/vmlinuz-3.19.0-21-generic
run-parts: executing /etc/kernel/postinst.d/dkms 3.19.0-21-generic /boot/vmlinuz-3.19.0-21-generic
Error! Your kernel headers for kernel 3.19.0-21-generic cannot be found.
Please install the linux-headers-3.19.0-21-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-21-generic /boot/vmlinuz-3.19.0-21-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-21-generic
grep: /boot/config-3.19.0-21-generic: No such file or directory
cp: cannot stat ‘/lib/modules/3.19.0-21-generic/kernel/drivers/hid/usbhid/usbhid.ko’: No such file or directory
modinfo: ERROR: Module /lib/modules/3.19.0-21-generic/kernel/drivers/hid/usbhid/usbhid.ko not found.
And whenever I try to install or update in terminal, I get a full string of errors, ending with this:
cp: cannot stat ‘/lib/modules/3.19.0-22-generic/kernel/drivers/firewire/firewire-sbp2.ko’: No such file or directory
modinfo: ERROR: Module /lib/modules/3.19.0-22-generic/kernel/drivers/firewire/firewire-sbp2.ko not found.
cp: cannot stat ‘/lib/modules/3.19.0-22-generic/kernel/ubuntu/aufs/aufs.ko’: No such file or directory
E: /usr/share/initramfs-tools/hooks/casper failed with return 1.
update-initramfs: failed for /boot/initrd.img-3.19.0-22-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.19.0-22-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.19.0-21-generic
linux-image-extra-3.19.0-22-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
Synaptic says I need to install the linux-headers-3.19.0-22-generic
package, but when I try in terminal, it says Package 'linux-headers-3.19.0-22-generic' has no installation candidate
.
I ran sudo dpkg --audit
, which gave the following:
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-extra-3.19.0-21-generic Linux kernel extra modules for version 3.1
linux-image-extra-3.19.0-22-generic Linux kernel extra modules for version 3.1
Obviously, I messed something up. Synaptic won't fix it, and neither sudo apt-get install -f
nor sudo dpkg --configure -a
help. I'm not sure what to do! Help??!?
I fixed it manually by:
STEP 1:
STEP 2:
Then I ran an
sudo apt-get update
andsudo apt-get upgrade
. All now working!