Ubuntu Version: 24.04 LTS Server

Desktop Environment (if applicable): none - runs headless

Problem Description: grub upgrade failed

Relevant System Information:

Lenovo E73 small-form-factor desktop, i5 CPU, 8 GiB Ram

Screenshots or Error Messages:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.0-60-generic
Found initrd image: /boot/initrd.img-6.8.0-60-generic
Found linux image: /boot/vmlinuz-6.8.0-59-generic
Found initrd image: /boot/initrd.img-6.8.0-59-generic
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
Setting up grub-efi-amd64-signed (1.202.5+2.12-1ubuntu7.3) ...
mount: /var/lib/grub/esp: special device /dev/disk/by-id/ata-ST500DM002-1BD142_Z3T8CGF7-part1 does not exist.
       dmesg(1) may have more information after failed mount system call.
dpkg: error processing package grub-efi-amd64-signed (--configure):
 installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 32
Processing triggers for install-info (7.1-3build2) ...
Processing triggers for man-db (2.12.0-4build2) ...
Errors were encountered while processing:
 grub-efi-amd64-signed
needrestart is being skipped since dpkg has failed

The machine is used to backup user data and sage data from a Windows server. Backups are made on a rotating 28 day cycle. Trouble is, its been in use for a number of years, and the backups have grown. Due to space limitations, a bigger machine capable of taking more drives is not an option. As a result, when free space got dangerously low, it was brought back to the workshop to allow a bigger drive to be fitted. Existing backup data was saved on elsewhere to make some room, the machine was upgraded from 22.04 to 24.04, then the existing drive was backed up to image files using fsarchiver (since it wil expand partitions to fit available space), the bigger drive was fitted and the fsarchiver images restored to the new drive. Worked fine, until the recent upgrade attempted to upgrade grub.

After a bit of checking, it looks as though I need to reinstall grub to remove the reference to /dev/disk/by-id/ata-ST500DM002-1BD142_Z3T8CGF7-part1, The machine is running, so I don’t need to chroot in to do the install, but I’ve not ever encountered a reference to /var/lib/grub before and I’m uncertain whether I need to take any special precautions because of it. At present, the EFI partition is mounted as /boot/efi. Does that partition need to be unmounted beofe I run grum-install, or can I simply run grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu, which is the way I would normally install grub on an Arch machine. Any guidance appreciated…

What I’ve Tried:
Nothing yet - the machine is remote and I want to check how safe a simple reinstall of grub is before I proceed.


My /var/lib/grub/esp is empty, in /var/lib/grub/ucf I have an original copy of /etc/default/grub.
But I do not have UEFI Secure Boot on.

Is ata-ST500DM002-1BD142_Z3T8CGF7 the old drive? To see current drive & other info:

lsblk -e 7 -o MODEL,NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,uuid

If you have correct ESP mounted in fstab, this works, if everything else is ok and booted into your install. But not sure if that will update your file or not, or if you can just edit it?

sudo grub-install

If you ssh into your running machine, this should re-install grub to /boot/efi
You will need the disk identity e.g.

sudo grub-install --efi-directory=/boot/efi /dev/sda

Or for nvme disk

sudo grub-install --efi-directory=/boot/efi /dev/nvme0n1
1 Like

Same on this machine. So far as I can find, the /var/lib/grub/esp mount is only used during the upgrade. Not at all sure why, but a bit of searching suggested that it is used to store files during the update. It also seems odd that /dev/disk/by-id is used then, when fstab uses UUID. The ata-ST500DM002-1BD142_Z3T8CGF7 is the old drive, and I don’t know where the information is stored, unless it is something that Grub itself records during initial installation.

The machine doesn’t have UEFI secure boot on, so I’m not sure why grub-efi-amd64-signed is necessary either.

The server is currently on a wifi connection (the whole site is listed, so it is difficult to make changes to a lot of things). The wifi AP is old and not working very well, so I don’t dare do anything until someone is on site who can restart it for me - otherwise I risk having the connection fail while I’m trying to do the grub install. Should be able to organise that tomorrow, so I will try grub-install then. And hope it correct the call to a drive that is no longer in the machine…

Thanks for the suggestions.

Thanks. I wasn’t aware that the disk identity would be needed in that command, so I’ll have to do a bit more checking on grub-install. I’m used to doing grub installs from a chroot, not on a live system.

I was also a bit concerned that the update procedure was attempting to mount the esp partition, which was already mounted at /boot/efi. I will be trying the re-install tomorrow, once I can get someone to restart the wifi AP.

:smile: I used the fsarchiver image update in an attempt to limit downtime, looks as though I’ve just complicated my own life.

More for curiosity do these show anything? My old artful install showed my drives, just ran it in my noble install and nothing. All my installs are desktops, and I do not know if server different?
cat /boot/grub/device.map
This used to be used with BIOS grub (grub-pc) to know drive on this line: grub-pc/install_devices:
sudo debconf-show grub-pc
And drive shown in this matches:
sudo lshw -C Disk -short

But I now have this in it where it used to with BIOS show device.

  • grub-efi/install_devices: /dev/disk/by-id/nvme-eui.0025385591b07f8f-part1
    And that matches the drive in this:
    ls -l /dev/disk/by-id

I have desktop & do not maage backups well. I randomly copy to flash drives, external SSD & another PC.
Best info on server backup has been the posts by TheFu in forums. Forums are now read only.
What to backup TheFu

[ubuntu] Best way to upgrade?]
Best practice for Backups - theFu
Change to exclude line:
You and rsync - what's your backup use
[ubuntu] Backup-Drive permissions/formatting -- &
[ubuntu] best backup solution &
Full system restore using Tar backup file
He uses rsync for media or folders that do not change much.
[SOLVED] Need to backup another drive
And uses rdiff for everything else.
rdiff Here’s a simple script for backing up HOME directories: post #2 by TheFu
Ubuntu Forums
[ubuntu] Backup-Drive permissions/formatting --

Looking at this error message:

It looks like the boot option GRUB_DISABLE_OS_PROBER=true is set in the grub and that would have to be GRUB_DISABLE_OS_PROBER=false for osprober to work.

sudo nano /etc/default/grub

Uncomment GRUB_DISABLE_OS_PROBER=false or add it if doesn’t exist, then execute

sudo os-prober
sudo update-grub

Sorry for the slow reply - busy reinstalling grub, which hasn’t helped at all. cat /boot/grub/device.map shows nothing. But debconf-show grub-pc certainly does. It returns this:

* grub-efi/install_devices: /dev/disk/by-id/ata-ST500DM002-1BD142_Z3T8CGF7-part1

Which refers to the old drive. So I’m hoping I may be able to change the listing to the correct partition. Never tried modifying debconf data, so I’m keeping my fingers crossed…

The backups have run pretty much the same way for years. I wrote the backup script so long ago that I don’t remember why I designed it the way I did. It mounts the user shares from the server and pulls the data into .tar.gz files. At the end of the 28 day cycle, it deletes the oldest backup and starts again. There is another machine which does a similar thing, but monthly, not daily, on a 36 month cycle.

Thanks, but that reflects changes that were made to grub for security reasons quite a while ago. Doesn’t matter unless the machine is running more than one OS. On my laptop, which has a couple of different Linux distros installed (Arch and MX),os-prober is needed, but on a single boot machcine, it does nothing, so can stay disabled.

For old BIOS installs this was how to update
#for BIOS that uses grub-pc

sudo dpkg-reconfigure grub-pc
sudo update-initramfs -u -k

Now with UEFI having entry in it, is command the same or??

sudo dpkg-reconfigure grub-efi-amd64

1 Like

If you want to boot different kernels or transition to a different Kernel, osprober is used.

Its not really bios type, just UEFI partition boot sector vs CSM MBR first 1MB of the drive boot drive and the old process of MBR is still valid to do, but osprober does both types.

That’s a good question. Wish I knew the answer. I’ve had a look at /var/cache/debconf/config.dat. Searching it for grub references finds a whole lot of them. Some are under grub-common, some grub-efi. Can’t see anything for grub-efi-signed, No only that, but the grub-efi entry has both the old drive and the current one in it, though the old drive comes first, which seems to override the new one.

I may take the risk of editing the data file (after carefully backing it up). Either that, or I’ll need more informaiton on the structure so I can specify the correct keys. Manually ediitng would at least allow me to remove the old drive entries.

Not in my experience. My main laptop has only Arch installed, but has both the mainline kernal and the LTS kernel installed. os-probler is still disabled on it, but I get the choice of either kernel.

Gave me an error, file does not exist?

This ran, it seems to read my grub to confirm some settings, old school, tab & enter screens.
But my drive has not changed, so cannot tell if it updated it or not.


sudo dpkg-reconfigure grub-pc

If secure boot was accidentally on, I can see it installing grub-efi-amd64-signed instead. Install it manually with the apt command if its not a signed system. otherwise, you use grub-efi-amd64-signed. But both versions should be installed for UEFI boot support.