我尝试使用 Synaptic 删除旧内核,但出现了严重错误。现在,如果我尝试修复它,Synaptic 中会出现此错误:
(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.
每当我尝试在终端中安装或更新时,我都会收到一串完整的错误,结尾是这样的:
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 说我需要安装该linux-headers-3.19.0-22-generic
包,但是当我在终端中尝试时,它说Package 'linux-headers-3.19.0-22-generic' has no installation candidate
。
我运行了sudo dpkg --audit
,结果如下:
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
显然,我搞砸了。Synaptic 不会修复它,也不会sudo apt-get install -f
提供sudo dpkg --configure -a
帮助。我不知道该怎么办!帮忙?!?!?
答案1
我通过以下方式手动修复了它:
步骤1:
sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.bak
gksu gedit /var/lib/dpkg/status
- 手动删除 3.19.0-21-generic 和 3.19.0-22-generic 的条目
- 节省
第2步:
sudo rm -r '/lib/modules/3.19.0-21-generic'
sudo rm -r '/lib/modules/3.19.0-22-generic'
然后我运行了sudo apt-get update
和sudo apt-get upgrade
。现在全部正常工作!