Dist-Upgrade failure / old linux-image-7.0.0-12-generic package postrm maintainer script subprocess failed with exit status 1

Asked by Bogdan S

Hi DevTeam,

Keep getting this error for the last few days.

Would be great if the error message would be a bit more verbose.

And if dpkg -a would sort it ;)

I used GrubCustomizer a few days ago - did not change much, except for graphic layout

Original and Edited Grub Config - attached.

Cheers

***

sudo apt upgrade
[sudo: authenticate] Password:
The following package was automatically installed and is no longer required:
  nvidia-firmware-580-580.142
Use 'sudo apt autoremove' to remove it.

REMOVING:
  linux-image-7.0.0-12-generic

Summary:
  Upgrading: 0, Installing: 0, Removing: 1, Not Upgrading: 0
  3 not fully installed or removed.
  Freed space: 17.3 MB

Continue? [Y/n] y
(Reading database… 361247 files and directories currently installed.)
Removing linux-image-7.0.0-12-generic (7.0.0-12.12)…
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-7.0.0-12-generic
/etc/kernel/postrm.d/kdump-tools:
kdump-tools: Removing kdump tracking files for kernel version: 7.0.0-12-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-7.0.0-14-generic
Found initrd image: /boot/initrd.img-7.0.0-14-generic
Found linux image: /boot/vmlinuz-7.0.0-13-generic
Found initrd image: /boot/initrd.img-7.0.0-13-generic
Found memtest86+ 64bit EFI image: /boot/mt86+x64
Found memtest86+ 32bit EFI image: /boot/mt86+ia32
Found memtest86+ 64bit image: /boot/mt86+x64
Found memtest86+ 32bit image: /boot/mt86+ia32
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot
entries.
Found Windows Boot Manager on /dev/nvme1n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 338
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-7.0.0-12-generic (--remove):
 old linux-image-7.0.0-12-generic package postrm maintainer script subprocess fa
iled with exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-7.0.0-12-generic
Processing was halted because there were too many errors.
Error: Sub-process /usr/bin/dpkg returned an error code (1)

***

sudo dpkg --configure -a
Setting up linux-image-7.0.0-14-generic (7.0.0-14.14)…
Setting up linux-image-7.0.0-13-generic (7.0.0-13.13)…
Processing triggers for linux-image-7.0.0-14-generic (7.0.0-14.14)…
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-7.0.0-14-generic
/etc/kernel/postinst.d/kdump-tools:
kdump-tools: Generating /var/lib/kdump/initrd.img-7.0.0-14-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-7.0.0-14-generic
Found initrd image: /boot/initrd.img-7.0.0-14-generic
Found linux image: /boot/vmlinuz-7.0.0-13-generic
Found initrd image: /boot/initrd.img-7.0.0-13-generic
Found memtest86+ 64bit EFI image: /boot/mt86+x64
Found memtest86+ 32bit EFI image: /boot/mt86+ia32
Found memtest86+ 64bit image: /boot/mt86+x64
Found memtest86+ 32bit image: /boot/mt86+ia32
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme1n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 338
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-7.0.0-14-generic (--configure):
 old linux-image-7.0.0-14-generic package postinst maintainer script subprocess failed with exit status 1
Processing triggers for linux-image-7.0.0-13-generic (7.0.0-13.13)…
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-7.0.0-13-generic
/etc/kernel/postinst.d/kdump-tools:
kdump-tools: Generating /var/lib/kdump/initrd.img-7.0.0-13-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-7.0.0-14-generic
Found initrd image: /boot/initrd.img-7.0.0-14-generic
Found linux image: /boot/vmlinuz-7.0.0-13-generic
Found initrd image: /boot/initrd.img-7.0.0-13-generic
Found memtest86+ 64bit EFI image: /boot/mt86+x64
Found memtest86+ 32bit EFI image: /boot/mt86+ia32
Found memtest86+ 64bit image: /boot/mt86+x64
Found memtest86+ 32bit image: /boot/mt86+ia32
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme1n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 338
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-7.0.0-13-generic (--configure):
 old linux-image-7.0.0-13-generic package postinst maintainer script subprocess failed with exit status 1
Errors were encountered while processing:
 linux-image-7.0.0-14-generic
 linux-image-7.0.0-13-generic

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: ubuntu-release-upgrader-core 1:26.04.16
ProcVersionSignature: Ubuntu 7.0.0-13.13-generic 7.0.0-rc7
Uname: Linux 7.0.0-13-generic x86_64
ApportVersion: 2.34.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: pass
CrashDB: ubuntu
CurrentDesktop: ubuntu:GNOME
Date: Wed Apr 22 20:32:42 2026
InstallationDate: Installed on 2026-02-03 (78 days ago)
InstallationMedia: Ubuntu 24.04.3 LTS "Noble Numbat" - Release amd64 (20250805.1)
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: ubuntu-release-upgrader
Symptom: dist-upgrade
UpgradeStatus: No upgrade log present (probably fresh install)
VarLogDistupgradeTermlog:

mtime.conffile..etc.update-manager.release-upgrades: 2026-04-15T13:25:26.553685

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu grub Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Daniel Letzeisen (dtl131) said (last edit ):
#1

This looks like GrubCustomizer broke your grub config. This is not a bug in Ubuntu.
Converting to question.

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

For diagnostic purposes please add the output of the commands

cat -n /etc/default/grub
sudo update-grub

to this question document.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Was about to post that. Using a tool you found isn't a fault of the OS. The PPA for the application doesn't support Raring either. So I'm suspecting you have set the system to use the Focal packages.

Revision history for this message
Bogdan S (bogdanstefan) said :
#4

Hi,

Thank you for the quick updates to my issue - much appreciated.

The outputs are below

Thank you,

Bogdan

***

cat -n /etc/default/grub
     1 # If you change this file or any /etc/default/grub.d/*.cfg file,
     2 # run 'update-grub' afterwards to update /boot/grub/grub.cfg.
     3 # For full documentation of the options in these files, see:
     4 # info -f grub -n 'Simple configuration'
     5
     6 GRUB_DEFAULT="0"
     7 GRUB_TIMEOUT_STYLE="hidden"
     8 GRUB_TIMEOUT="0"
     9 GRUB_DISTRIBUTOR="`( . /etc/os-release && echo ${NAME} )`"
    10 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    11 GRUB_CMDLINE_LINUX=""
    12
    13 # If your computer has multiple operating systems installed, then you
    14 # probably want to run os-prober. However, if your computer is a host
    15 # for guest OSes installed via LVM or raw disk devices, running
    16 # os-prober can cause damage to those guest OSes as it mounts
    17 # filesystems to look for things.
    18 #GRUB_DISABLE_OS_PROBER="false"
    19
    20 # Uncomment to enable BadRAM filtering, modify to suit your needs
    21 # This works with Linux (no patch required) and with any kernel that obtains
    22 # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    23 #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    24
    25 # Uncomment to disable graphical terminal
    26 #GRUB_TERMINAL="console"
    27
    28 # The resolution used on graphical terminal
    29 # note that you can use only modes which your graphic card supports via VBE/GOP/UGA
    30 # you can see them in real GRUB with the command `videoinfo'
    31 #GRUB_GFXMODE="640x480"
    32
    33 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    34 #GRUB_DISABLE_LINUX_UUID="true"
    35
    36 # Uncomment to disable generation of recovery mode menu entries
    37 #GRUB_DISABLE_RECOVERY="true"
    38
    39 # Uncomment to get a beep at grub start
    40 #GRUB_INIT_TUNE="480 440 1"
    41
    42 export GRUB_COLOR_NORMAL="black/black"

***

sudo update-grub
[sudo: authenticate] Password:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-7.0.0-14-generic
Found initrd image: /boot/initrd.img-7.0.0-14-generic
Found linux image: /boot/vmlinuz-7.0.0-13-generic
Found initrd image: /boot/initrd.img-7.0.0-13-generic
Found memtest86+ 64bit EFI image: /boot/mt86+x64
Found memtest86+ 32bit EFI image: /boot/mt86+ia32
Found memtest86+ 64bit image: /boot/mt86+x64
Found memtest86+ 32bit image: /boot/mt86+ia32
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 338
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#5

The /etc/default/grub file looks sane.

Digging through the files attached to your bug report, the culprit seems to be /etc/grub.d/20_memtest86+_proxy
This is a file that is not provided by Ubuntu, but it is coming from grub-customizer, delivered in a PPA.

Please ask for help at the source where you got grub-customizer.

I can only suggest that you remove that file and reinstall the "standard" /etc/grub.d/20_memtest86+ file from Ubuntu, but I cannot predict what effects that will have.

Potential further diagnostic commands:

ls -l /etc/default/grub.d/
apt policy grub-customizer

Revision history for this message
Bogdan S (bogdanstefan) said :
#6

Thank you for pointing me in the right direction, Manfred.

sudo chmod -x /etc/grub.d/20_memtest86+_proxy
sudo update-grub

did the magic ;)

Now apt upgrade runs without glitches

Thank you all for your help.

Revision history for this message
Bogdan S (bogdanstefan) said :
#7

Thanks Manfred Hampl, that solved my question.