Hi,
Originally Posted by
CelticWarrior
Please elaborate. How exactly did you update grub2?
Grub updates are served alongside all the other updates and typically users don't even notice it. The "just update grub2" part of your sentence is what bothers me now (and surely Impavidus is curious too).
I just ran "sudo update-grub"
Originally Posted by
Impavidus
I don't know if there's no /boot/grub/grub.cfg and I didn't ask. I guess it's actually there and correct, or the system would be unbootable. I think update-grub creates a /boot/grub/grub.cfg.new and only if that's successful (so not in this case), it deletes the old grub.cfg and renames grub.cgf.new to grub.cfg.
In any case, what's wrong here is that the scripts run by update-grub in /etc/grub.d/ are missing. I wonder what could have caused that. Reinstalling grub-common may fix it. On most Ubuntu systems there's also a memtest in that directory, which has to reinstalled too (package is called memtest86+), but reinstalling grub-common is vital before the package manager can be fixed. Let's see if apt can reinstall it:
Code:
sudo apt install --reinstall grub-common
I wouldn't be surprised if this fails, but there are more low-level ways to do this.
It may be good to know more about the status of some vital packages. If above command doesn't allow you to fix it, can you show the output of
Code:
dpkg --list linux-* grub*
dpkg --list | grep -v '^ii \|^rc '
The re-installation was failed as you suspected:
Code:
viet@viet-Vostro-15-3568:~$ sudo apt install --reinstall grub-common[sudo] password for viet:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-5.4.0-42-generic
0 upgraded, 0 newly installed, 1 reinstalled, 1 to remove and 6 not upgraded.
3 not fully installed or removed.
Need to get 1,873 kB of archives.
After this operation, 11.7 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://ca.archive.ubuntu.com/ubuntu focal-updates/main amd64 grub-common amd64 2.04-1ubuntu26.4 [1,873 kB]
Fetched 1,873 kB in 4s (484 kB/s)
Preconfiguring packages ...
(Reading database ... 221558 files and directories currently installed.)
Removing linux-image-5.4.0-42-generic (5.4.0-42.46) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-42-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
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.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-5.4.0-42-generic (--remove):
installed linux-image-5.4.0-42-generic package post-removal script subprocess r
eturned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
linux-image-5.4.0-42-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
viet@viet-Vostro-15-3568:~$
And this is the result of command you gave me:
Code:
viet@viet-Vostro-15-3568:~$ dpkg --list linux-* grub*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================================-====================-============-==============================================================
un grub <none> <none> (no description available)
un grub-cloud-amd64 <none> <none> (no description available)
ii grub-common 2.04-1ubuntu26.4 amd64 GRand Unified Bootloader (common files)
un grub-coreboot <none> <none> (no description available)
un grub-doc <none> <none> (no description available)
un grub-efi <none> <none> (no description available)
rc grub-efi-amd64 2.04-1ubuntu26.3 amd64 GRand Unified Bootloader, version 2 (EFI-AMD64 version)
ii grub-efi-amd64-bin 2.04-1ubuntu26.4 amd64 GRand Unified Bootloader, version 2 (EFI-AMD64 modules)
un grub-efi-amd64-signed <none> <none> (no description available)
un grub-efi-arm <none> <none> (no description available)
un grub-efi-arm64 <none> <none> (no description available)
un grub-efi-arm64-signed <none> <none> (no description available)
un grub-efi-ia32 <none> <none> (no description available)
un grub-efi-ia64 <none> <none> (no description available)
un grub-emu <none> <none> (no description available)
ii grub-gfxpayload-lists 0.7 amd64 GRUB gfxpayload blacklist
un grub-ieee1275 <none> <none> (no description available)
un grub-legacy <none> <none> (no description available)
un grub-legacy-doc <none> <none> (no description available)
un grub-linuxbios <none> <none> (no description available)
iF grub-pc 2.04-1ubuntu26.4 amd64 GRand Unified Bootloader, version 2 (PC/BIOS version)
ii grub-pc-bin 2.04-1ubuntu26.4 amd64 GRand Unified Bootloader, version 2 (PC/BIOS modules)
un grub-uboot <none> <none> (no description available)
un grub-xen <none> <none> (no description available)
un grub-yeeloong <none> <none> (no description available)
un grub2 <none> <none> (no description available)
ii grub2-common 2.04-1ubuntu26.4 amd64 GRand Unified Bootloader (common files for version 2)
ii linux-base 4.5ubuntu3.1 all Linux image base package
un linux-doc <none> <none> (no description available)
ii linux-firmware 1.187.3 all Firmware for Linux kernel drivers
un linux-firmware-raspi2 <none> <none> (no description available)
un linux-firmware-snapdragon <none> <none> (no description available)
ii linux-generic-hwe-20.04 5.4.0.48.51 amd64 Complete Generic Linux kernel and headers
un linux-headers <none> <none> (no description available)
un linux-headers-3.0 <none> <none> (no description available)
ii linux-headers-5.4.0-42 5.4.0-42.46 all Header files related to Linux kernel version 5.4.0
ii linux-headers-5.4.0-42-generic 5.4.0-42.46 amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii linux-headers-5.4.0-45 5.4.0-45.49 all Header files related to Linux kernel version 5.4.0
ii linux-headers-5.4.0-45-generic 5.4.0-45.49 amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii linux-headers-5.4.0-48 5.4.0-48.52 all Header files related to Linux kernel version 5.4.0
ii linux-headers-5.4.0-48-generic 5.4.0-48.52 amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii linux-headers-generic-hwe-20.04 5.4.0.48.51 amd64 Generic Linux kernel headers
un linux-image <none> <none> (no description available)
rH linux-image-5.4.0-42-generic 5.4.0-42.46 amd64 Signed kernel image generic
ii linux-image-5.4.0-45-generic 5.4.0-45.49 amd64 Signed kernel image generic
iF linux-image-5.4.0-48-generic 5.4.0-48.52 amd64 Signed kernel image generic
ii linux-image-generic-hwe-20.04 5.4.0.48.51 amd64 Generic Linux kernel image
un linux-image-unsigned-5.4.0-42-generic <none> <none> (no description available)
un linux-image-unsigned-5.4.0-45-generic <none> <none> (no description available)
un linux-image-unsigned-5.4.0-48-generic <none> <none> (no description available)
un linux-initramfs-tool <none> <none> (no description available)
un linux-kernel-headers <none> <none> (no description available)
un linux-kernel-log-daemon <none> <none> (no description available)
ii linux-libc-dev:amd64 5.4.0-48.52 amd64 Linux Kernel Headers for development
ii linux-modules-5.4.0-42-generic 5.4.0-42.46 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii linux-modules-5.4.0-45-generic 5.4.0-45.49 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii linux-modules-5.4.0-48-generic 5.4.0-48.52 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc linux-modules-extra-5.4.0-42-generic 5.4.0-42.46 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii linux-modules-extra-5.4.0-45-generic 5.4.0-45.49 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii linux-modules-extra-5.4.0-48-generic 5.4.0-48.52 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
un linux-restricted-common <none> <none> (no description available)
ii linux-sound-base 1.0.25+dfsg-0ubuntu5 all base package for ALSA and OSS sound systems
un linux-source-5.4.0 <none> <none> (no description available)
un linux-tools <none> <none> (no description available)
Bookmarks