0

After runing de comand sudo apt autoremove it try to delete linux-image-6.11.0-26-generic, but after that returns the terminal return the following text:

(Reading database… 196228 files and directories currently installed.)
Uninstalling linux-image-6.11.0-26-generic (6.11.0-26.26)…
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-6.11.0-26-generic
/etc/kernel/postrm.d/kdump-tools:
kdump-tools: Removing kdump tracking files for kernel version: 6.11.0-26-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 ...
The script `/boot/grub/grub.cfg.new' does not contain commands and it will do nothing
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: An error occurred while processing package linux-image-6.11.0-26-generic (--remove): subprocess "installing script linux-image-6.11.0-26-generic from package post-remove oval" returned error exit code 1 dpkg: Too many errors, stopping Errors were encountered while processing: linux-image-6.11.0-26-generic Process stopped due to too many errors. Error: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried to:

  • Reinstalling grub-common and grub-pc
  • Force purge of linux-image-6.11.0-26-generic

After looking for syntax errors with ´grub-script-check´ and using ´sudo update-grub´, the terminal return:

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file...
The script "/boot/grub/grub.cfg.new" contains no commands and will do nothing
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.
Thomas Ward
  • 78,878
Aleix
  • 1
  • 1

2 Answers2

0

The issue is due to a syntax error in the generated GRUB config.

Check /etc/default/grub and scripts in /etc/grub.d/ for invalid entries or broken syntax.

Fix any issues, then regenerate GRUB config manually using sudo update-grub. After that, retry sudo apt autoremove to clean up the kernel properly

0

Finally I solved, I deleted all grub from my ubuntu, next I entered in a bootable USB from ubuntu, and reinstalled. Mounting the linux partition externally and entering with chroot.

Aleix
  • 1
  • 1