5

EDIT: I have appended the output of cat /etc/default/grub to the question below

This was in fact the key to solving the issue. I think it's worth noting that not having quotes around the OS assigned to GRUB_DEFAULT in /etc/default/grub didn't actually present a problem for quite some time after I had set it(months). This may be because GRUB_DEFAULT was initially set from another linux in my dual boot setup.

I have looked at other questions regarding this error, but haven't found one that helps me, so far.

I am getting the below error when I do:

sudo apt-get upgrade

or a dist-upgrade

I have tried purging the packages mentioned in the error(as per answers to other questions with the same error)

linux-image-extra-3.19.0-25-generic
linux-image-3.19.0-25-generic

with

sudo apt-get remove --purge <the packages>

and

sudo dpkg --purge <the packages>

But in both instances, I get basically the same error output as below. Can anyone help me resolve this?

Error:

yerman@DeepThought:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED
  linux-image-3.19.0-25-generic linux-image-extra-3.19.0-25-generic
0 to upgrade, 0 to newly install, 2 to remove and 0 not to upgrade.
5 not fully installed or removed.
After this operation, 209 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 529837 files and directories currently installed.)
Removing linux-image-extra-3.19.0-25-generic (3.19.0-25.26) ...
depmod: FATAL: could not load /boot/System.map-3.19.0-25-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
update-initramfs: Generating /boot/initrd.img-3.19.0-25-generic
grep: /boot/config-3.19.0-25-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_6wsANd/lib/modules/3.19.0-25-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_6wsANd/lib/modules/3.19.0-25-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: Syntax error: "(" unexpected
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
dpkg: error processing package linux-image-extra-3.19.0-25-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.19.0-25-generic (3.19.0-25.26) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
update-initramfs: Deleting /boot/initrd.img-3.19.0-25-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.19.0-25-generic /boot/vmlinuz-3.19.0-25-generic
/usr/sbin/grub-mkconfig: 6: /etc/default/grub: Syntax error: "(" unexpected
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.19.0-25-generic.postrm line 328.
dpkg: error processing package linux-image-3.19.0-25-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.19.0-25-generic
 linux-image-3.19.0-25-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Output of cat /etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=Windows 7 (loader) (on /dev/sda2)
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=30
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="acpi=noirq acpi=force apm=power_off"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
4
  • So we're on the same page, and I don't make a redundant suggestion, would you mind including links to those solutions that you had tried?
    – mheadroom
    Commented Oct 12, 2015 at 22:04
  • @mheadroom I'm afraid I'm sure of the exact links, but they would all come up top of google searches etc. I am sure. Also, the example of what I have already tried above was the advice in a lot of them.
    – Totem
    Commented Oct 13, 2015 at 12:24
  • Edit your question and add the output of cat /etc/default/grub
    – A.B.
    Commented Oct 14, 2015 at 16:26
  • @A.B. I have added the output
    – Totem
    Commented Oct 14, 2015 at 17:12

5 Answers 5

5
+100

The line

GRUB_DEFAULT=Windows 7 (loader) (on /dev/sda2)

in your /etc/default/grub is wrong, at least for the post-removal script and therefore it exits with an error.

Therefore use a numeric value or correct the entry and use double quotes. Edit the file via

sudo nano /etc/default/grub

and

GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda2)"

After that

sudo update-grub
1
  • 1
    Well, that seems to have solved it. Thanks! I admit, I thought the problem was elsewhere. Strange that this would become a problem now, after being like that for months... perhaps a recent update caused this
    – Totem
    Commented Oct 14, 2015 at 17:36
1

It looks like your file /etc/default/grub is messed up. Please try to edit the file with vi or any other editor (root privileged). Below you can see a safe sample of this file.

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
0

I suggest first working backwards and force installing the first of the packages throwing errors, like so:

sudo apt-get install -f linux-image-extra-3.19.0-25-generic

Afterwards, see if you can successfully run the following:

sudo apt-get update && sudo apt-get upgrade

If that works, try:

sudo apt-get dist-upgrade

(Note: It may be necessary to reboot after the first step before issuing the remaining commands.)

1
  • This didn't work unfortunately
    – Totem
    Commented Oct 14, 2015 at 17:26
0

Today on a fresh install of Ubuntu I got this error and my update got aborted. I did another dist-upgrade and it worked out fine.

2
  • You have enough reputation, so I'm unsure as to why you decided to put this as an answer and not a comment. Commented Oct 14, 2015 at 23:25
  • This was my observation based on my experience, its also the first time I had this happen after over thousands of Ubuntu installs and deployment. I feel there is some issue with script that makes it terminate before it can update but more investigation is needed. However this error is not permanent thankfully. Did two more installs and it worked out fine. Commented Oct 15, 2015 at 6:55
0

Go to /var/cache/apt/archives/ and copy the problematic file. Use GDebi package installer to open the problematic package, after it finished scanning the package use the option reinstall package, and let the process finish that is all.enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .