I have an Ubuntu Server 22.04 install running from a VDI image booted using Ventoy which I'm trying to apt-get upgrade.
When it comes to reinstalling GRUB, I get the following message:
The GRUB boot loader was previously installed to a disk that
is no longer present, or whose unique identifier has changed
for some reason. It is important to make sure that the
installed GRUB core image stays in sync with GRUB modules and
grub.cfg. Please check again to make sure that GRUB is
written to the appropriate boot devices.
- /dev/sda2 (33 MB; ) on 32017 MB TS32GSSD420K
- none of the above
(Enter the items or ranges you want to select, separated by
spaces.)
GRUB install devices:
/dev/sda2 is Ventoy's EFI partition, rather than the one inside the VDI. Attempting to enter /dev/mapper/ventoy as the device results in the same prompt, so I finished the upgrade without reinstalling GRUB and am now trying to fix it.
I did sudo grub-mkdevicemap, which gave me a /boot/grub/device.map with physical disks as follows:
(hd0) /dev/disk/by-id/ata-TS32GSSD420K_D964580002
(hd1) /dev/disk/by-id/ata-WDC_WD10EZEX-22MFCA0_WD-WCC6Y5ZE6VAL
(hd2) /dev/disk/by-id/ata-WDC_WD10EZEX-60WN4A0_WD-WCC6Y1VULY52
(hd3) /dev/disk/by-id/ata-Samsung_SSD_860_QVO_4TB_S4CXNF0M423112D
Changing the contents to
(hd0) /dev/mapper/ventoy
results in an error about one of the individual partitions (/dev/mapper/ventoy1), and previous errors in the output of sudo apt-get upgrade reference /dev/mapper/ventoy2 (which is /boot) with the same error.
ansel@enya:~$ sudo grub-install /dev/mapper/ventoy
Installing for x86_64-efi platform.
grub-install: error: cannot find a GRUB drive for /dev/mapper/ventoy1. Check your device.map.
ansel@enya:~$
Relevant fdisk -l output is as follows:
Disk /dev/sda: 29.82 GiB, 32017047552 bytes, 62533296 sectors
Disk model: TS32GSSD420K
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D0FA3E5E-2C2A-5658-FABE-84A0C9AE6291
Device Start End Sectors Size Type
/dev/sda1 2048 62467719 62465672 29.8G Linux filesystem
/dev/sda2 62467720 62533255 65536 32M EFI System
Disk /dev/mapper/ventoy: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2820B8E5-E365-41C4-94D9-B1DC8E03B3F2
Device Start End Sectors Size Type
/dev/mapper/ventoy1 2048 1103871 1101824 538M EFI Syste
/dev/mapper/ventoy2 1103872 4773887 3670016 1.8G Linux fil
/dev/mapper/ventoy3 4773888 33552383 28778496 13.7G Linux fil
Disk /dev/mapper/ventoy1: 538 MiB, 564133888 bytes, 1101824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Disk /dev/mapper/ventoy2: 1.75 GiB, 1879048192 bytes, 3670016 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/ventoy3: 13.72 GiB, 14734589952 bytes, 28778496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Adding lines for the individual partitions to /boot/grub/device.map results in GRUB saying those lines are invalid and being ignored:
ansel@enya:~$ cat /boot/grub/device.map
(hd0) /dev/mapper/ventoy
(hd0,1) /dev/mapper/ventoy1
(hd0,2) /dev/mapper/ventoy2
(hd0,3) /dev/mapper/ventoy3
ansel@enya:~$ sudo grub-install /dev/mapper/ventoy
Installing for x86_64-efi platform.
grub-install: warning: the device.map entry `hd0,1' is invalid. Ignoring it. Please correct or delete your device.map.
grub-install: warning: the device.map entry `hd0,2' is invalid. Ignoring it. Please correct or delete your device.map.
grub-install: warning: the device.map entry `hd0,3' is invalid. Ignoring it. Please correct or delete your device.map.
grub-install: error: cannot find a GRUB drive for /dev/mapper/ventoy1. Check your device.map.
ansel@enya:~$
How can I get GRUB to recognise the individual partitions?
Thanks.