3

Any attempt to install or remove packages with apt-get ends in error with the output as below. The error is now different from the one I had initially - the same one as in this question, but applying the proposed fix didn't help and now what I have is the error below:

$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-3.13.0-66-generic linux-image-extra-3.13.0-66-generic
0 upgraded, 0 newly installed, 2 to remove and 13 not upgraded.
2 not fully installed or removed.
After this operation, 194 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 653298 files and directories currently installed.)
Removing linux-image-extra-3.13.0-66-generic (3.13.0-66.108) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-66-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-generic
run-parts: executing /etc/kernel/postinst.d/dkms 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-66-generic
grep: /boot/config-3.13.0-66-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_VxrrWc/lib/modules/3.13.0-66-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_VxrrWc/lib/modules/3.13.0-66-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-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
dpkg: error processing package linux-image-extra-3.13.0-66-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.13.0-66-generic (3.13.0-66.108) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-66-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-66-generic /boot/vmlinuz-3.13.0-66-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.13.0-66-generic.postrm line 328.
dpkg: error processing package linux-image-3.13.0-66-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.13.0-66-generic
 linux-image-3.13.0-66-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

How can one remove forcibly this package now and reinstall it from scratch, or fix this error anyhow differently?

Tim
  • 83

1 Answers1

1

You have a syntax error in

/etc/default/grub

/usr/sbin/grub-mkconfig: 35: /etc/default/grub: Syntax error: EOF in backquote substitution

Line 35 is misleading because the problem is in some lines before.

The real problem is that you have an opening ` without a closing `.

Without /etc/default/grub it is hard to say which line is affected.

You can either find the line or you could add your /etc/default/grub to your question. Then I can give you a perfect answer. ;)

A.B.
  • 90,397
  • Right! Thank you for pointing me to that line - it was under the eyes all the time... :) Turned out I had a syntax error in my /etc/default/grub file indeed, although I have no idea how it made it there. One of the variables declared in it had a value in quotes, although the closing quote was not the " character, but the "unicode double qutation mark" (U+201D), like this - . Once fixed I'm now able to use apt-get and therefore fix the rest of issues with other packages. Thanks again! – Tim Oct 28 '15 at 09:46