几天前,我尝试通过终端安装游戏 0ad。安装完成之前我不小心关闭了终端,现在我无法在计算机上安装或更新任何程序。我运行的是 13.10。
我尝试搜索并发现许多有关此错误的文章、帖子和讨论,但我还没有找到可以修复它的方法。
我试过跑步
sudo apt-get clean && sudo apt-get autoremove
输出
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-3.11.0-12 linux-headers-3.11.0-12-generic linux-image-3.11.0-12-generic linux-image-extra-3.11.0-12-generic
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
7 not fully installed or removed.
After this operation, 210 MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 315931 files and directories currently installed.)
Removing linux-headers-3.11.0-12-generic ...
Removing linux-headers-3.11.0-12 ...
Removing linux-image-extra-3.11.0-12-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
update-initramfs: Deleting /boot/initrd.img-3.11.0-12-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-extra-3.11.0-12-generic.postrm line 328.
dpkg: error processing linux-image-extra-3.11.0-12-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.11.0-12-generic ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
dkms: removing: bbswitch 0.7 (3.11.0-12-generic) (i686)
-------- Uninstall Beginning --------
Module: bbswitch
Version: 0.7
Kernel: 3.11.0-12-generic (i686)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
bbswitch.ko:
- Uninstallation
- Deleting from: /lib/modules/3.11.0-12-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod.....
DKMS: uninstall completed.
dkms: removing: nvidia-319-updates 319.60 (3.11.0-12-generic) (i686)
-------- Uninstall Beginning --------
Module: nvidia-319-updates
Version: 319.60
Kernel: 3.11.0-12-generic (i686)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
nvidia_319_updates.ko:
- Uninstallation
- Deleting from: /lib/modules/3.11.0-12-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod....
DKMS: uninstall completed.
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
update-initramfs: Deleting /boot/initrd.img-3.11.0-12-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.11.0-12-generic.postrm line 328.
dpkg: error processing linux-image-3.11.0-12-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.11.0-12-generic
linux-image-3.11.0-12-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
然后我也尝试跑步
sudo dpkg --configure -a
输出
dpkg: dependency problems prevent configuration of linux-image-extra-3.11.0-15-generic:
linux-image-extra-3.11.0-15-generic depends on linux-image-3.11.0-15-generic; however:
Package linux-image-3.11.0-15-generic is not configured yet.
dpkg: error processing linux-image-extra-3.11.0-15-generic (--configure):
dependency problems - leaving unconfigured
Setting up linux-image-3.11.0-17-generic (3.11.0-17.31) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
run-parts: executing /etc/kernel/postinst.d/dkms 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
update-initramfs: Generating /boot/initrd.img-3.11.0-17-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.11.0-17-generic.postinst line 1010.
dpkg: error processing linux-image-3.11.0-17-generic (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-3.11.0-17-generic:
linux-image-extra-3.11.0-17-generic depends on linux-image-3.11.0-17-generic; however:
Package linux-image-3.11.0-17-generic is not configured yet.
dpkg: error processing linux-image-extra-3.11.0-17-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-3.11.0-17-generic; however:
Package linux-image-3.11.0-17-generic is not configured yet.
linux-image-generic depends on linux-image-extra-3.11.0-17-generic; however:
Package linux-image-extra-3.11.0-17-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 3.11.0.17.18); however:
Package linux-image-generic is not configured yet.
dpkg: error processing linux-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-pae:
linux-generic-pae depends on linux-generic (= 3.11.0.17.18); however:
Package linux-generic is not configured yet.
dpkg: error processing linux-generic-pae (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-image-extra-3.11.0-15-generic
linux-image-3.11.0-17-generic
linux-image-extra-3.11.0-17-generic
linux-image-generic
linux-generic
linux-generic-pae
我很茫然,不知道下一步该去哪儿。
如您提供任何帮助,我们将不胜感激。
输出
uname -r
是
3.11.0-15-generic
编辑
我跑了
sudo dpkg -P linux-image-3.11.0-12-generic
并得到输出
(Reading database ... 286111 files and directories currently installed.)
Removing linux-image-3.11.0-12-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
update-initramfs: Deleting /boot/initrd.img-3.11.0-12-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.11.0-12-generic.postrm line 328.
dpkg: error processing linux-image-3.11.0-12-generic (--purge):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-3.11.0-12-generic
然后我跑了
sudo apt-get install -f
并得到输出
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-3.11.0-12-generic linux-image-extra-3.11.0-12-generic
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
9 not fully installed or removed.
After this operation, 136 MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 286111 files and directories currently installed.)
Removing linux-image-extra-3.11.0-12-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
update-initramfs: Deleting /boot/initrd.img-3.11.0-12-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-extra-3.11.0-12-generic.postrm line 328.
dpkg: error processing linux-image-extra-3.11.0-12-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.11.0-12-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
update-initramfs: Deleting /boot/initrd.img-3.11.0-12-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.11.0-12-generic.postrm line 328.
dpkg: error processing linux-image-3.11.0-12-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-3.11.0-12-generic
linux-image-3.11.0-12-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
错误信息非常容易解释:
/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution
您的 中有一个错误/etc/default/grub
。
答案2
您的问题可能与 debconf 数据库损坏有关。
运行以下命令:
sudo /usr/share/debconf/fix_db.pl
您可能已经修复了这个问题。
运行以下 bash 命令检查这些模板是否受到影响:
diff -u /var/cache/debconf/config.dat{-old,} | grep ^[+-]Name
diff -u /var/cache/debconf/templates.dat{-old,} | grep ^[+-]Name
您可能仍想对引起问题的包运行以下命令:
dpkg-reconfigure <your package>