Grub-install fails because the installer picked the wrong disk

What type of hardware are you using: Old laptop or computer
What YunoHost version are you running: 12
How are you able to access your server: Direct access via physical keyboard/screen
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: Tweaked the USB stick detection in the BIOS

Describe your issue

When installing Yunohost on an old second-hand server I recently (as first step to migrate my existing instance to this server), the install process fails at the GRUB step. I can see in the logs that it tries to install grub on /dev/sdb, but the only “real” hard-drive and the one where Yunohost was installed is /dev/sdc.

I believe the root of the issue is from the fact that be able to boot on the USB stick, I had to pick “detect as hard-drive” instead of “detect as Auto” in the BIOS. Without that, I would get an error “missing or corrupt isolinux.bin” when trying to boot on the USB stick. So the installer “sees” 2 hard drives and tries to install GRUB on the first one, while there is only one.

I guess this is a special case that the installer is not designed for, and I need to install grub myself. But how do I do that? I saw I can open a terminal, but I’m not sure I can just run the grub-install command on the right disk. Do I need to chroot first ? where ? When I run ls /target from the shell, I see an empty dir, which worries me that Yunohost got installed on the USB stick…

Share relevant logs or error messages

Jun 13 14:37:57 grub-installer: info: initial os-prober call found the following OSes:
Jun 13 14:37:57 grub-installer: info:
Jun 13 14:37:57 grub-installer: info: Found NO other OSes, triggering question about os-prober, default false
Jun 13 14:37:57 /bin/in-target: warning: /target/etc/mtab won’t be updated since it is a symlink.
Jun 13 14:37:57 in-target: Reading package lists…
Jun 13 14:37:57 in-target:
Jun 13 14:37:57 in-target: Building dependency tree…
Jun 13 14:37:57 in-target:
Jun 13 14:37:57 in-target: Reading state information…
Jun 13 14:37:57 in-target:
Jun 13 14:37:57 in-target: grub-pc is already the newest version (2.06-13+deb12u2).
Jun 13 14:37:57 in-target: 0 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
Jun 13 14:37:58 grub-installer: info: Installing grub on ‘/dev/sdb’
Jun 13 14:37:58 grub-installer: info: grub-install does not support --no-floppy
Jun 13 14:37:58 grub-installer: info: Running chroot /target grub-install --force “/dev/sdb”
Jun 13 14:37:58 grub-installer: Installing for i386-pc platform.
Jun 13 14:38:07 grub-installer: grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..
Jun 13 14:38:07 grub-installer: grub-install: error: embedding is not possible, but this is required for cross-disk install.
Jun 13 14:38:07 grub-installer: error: Running ‘grub-install --force “/dev/sdb”’ failed.
Jun 13 14:38:07 debconf: cdebconf_gtk (process:342): Gtk - WARNING: IA__gtk_text_layout_get_line_display: we asked Pango to wrap text for width 191px but it now wants 192px. Clamping result to 191px!
Jun 13 14:38:07 debconf: cdebconf_gtk (process:342): Gtk - WARNING: IA__gtk_text_layout_get_line_display: we asked Pango to wrap text for width 191px but it now wants 192px. Clamping result to 191px!
Jun 13 14:38:11 main-menu[354]: (process:13549): dpkg-divert: warning: diverting file ‘/sbin/start-stop-daemon’ from an Essential package with rename is dangerous, use --no-rename
Jun 13 14:38:11 main-menu[354]: (process:13549): dpkg-divert: warning: diverting file ‘/sbin/start-stop-daemon’ from an Essential package with rename is dangerous, use --no-rename
Jun 13 14:38:11 main-menu[354]: (process:13549): File descriptor 3 (pipe:[404]) leaked on lvdisplay invocation. Parent PID 13707: /bin/sh
Jun 13 14:38:11 main-menu[354]: (process:13549): File descriptor 4 (/dev/tty1) leaked on lvdisplay invocation. Parent PID 13707: /bin/sh
Jun 13 14:38:11 main-menu[354]: (process:13549): File descriptor 5 (/dev/tty1) leaked on lvdisplay invocation. Parent PID 13707: /bin/sh
Jun 13 14:38:11 main-menu[354]: (process:13549): File descriptor 6 (/dev/tty1) leaked on lvdisplay invocation. Parent PID 13707: /bin/sh
Jun 13 14:38:11 main-menu[354]: (process:13549): Volume group “sdc” not found
Jun 13 14:38:11 main-menu[354]: (process:13549): Cannot process volume group sdc
Jun 13 14:38:11 main-menu[354]: (process:13549): dpkg-divert: warning: diverting file ‘/sbin/start-stop-daemon’ from an Essential package with rename is dangerous, use --no-rename
Jun 13 14:38:11 main-menu[354]: (process:13549): dpkg-divert: warning: diverting file ‘/sbin/start-stop-daemon’ from an Essential package with rename is dangerous, use --no-rename
Jun 13 14:38:11 main-menu[354]: WARNING **: Configuring ‘grub-installer’ failed with error code 1
Jun 13 14:38:11 main-menu[354]: WARNING **: Menu item ‘grub-installer’ failed.

I aborted the install and booted a live Linux, I could see that that my USB stick was not modified and Debian/Yunohost was installed on the hard-drive. So I think I just need guidance on how to install grub on the hard-drive, and resume the install ? Or do I need to re-start it if I aborted at the GRUB step ?

Is there a hard drive on sda ?
Did you try to connect the hard drive on a different connector on the motherboard ? Or in the BIOS ?

Sorry for the delay, I didn’t get a chance to come back to this earlier. No there is no hard drive on /dev/sda, it is a tape drive.

I didn’t try to connect the drive to a different connector, why would that matter ?

By the way, in case it could matter, the hard drive is a “Dell virtual disk” made of two physical disks, which I believe is their name for a hardware RAID. But since this is hardware, the installer should see it as a single disk and it shouldn’t matter, right?

So I think the solution is to install grub on the disk, picking the right device, but let me know if I misunderstand the problem. This guide seems to be what I need : Reinstall GRUB from Live USB (UEFI + LVM) - ShellHacks

Another possible solution I can think of: use the Debian installer which may not have the same problem, or install from PXE (but this is not documented for Yunohost so I guess I would also have to first install Debian).

What do you think this information do with those errors :

Attempting to install GRUB to a disk with multiple partition labels.
This is not supported yet..
Jun 13 14:38:07 grub-installer: grub-install: error: embedding is not possible, but this is required for cross-disk install.

I think you should try to investigate to saerch a solution to install a system on a RAID partition. (I have never done that).

I’ve read a post about a GRUB installation on RAID disk.
Since the disk were quite big (2 TB each), they have a GUID table in order to manage the disk.
And in order to be able to install GRUB on those disk, a small partition was created (around 1MB) in order to create the boot on it.

With my point of view, and if you have enough space left on your disk, I would suggest to make the GRUB partition a bit larger (around 100 MB).

Thank you for you help and sorry that I couldn’t come back to this earlier.

I was still not convinced, as far as I understand hardware RAID it should be completely transparent to the OS.

What I did is try to install a bare Debian bookworm, using its installer ISO. It worked like a charm : when the time came to install GRUB, it did pick the right disk (the USB stick and harddisk were assigned to sdb and sdc just like with Yunohost) AND it did let me select which disk to target in case the default pick was not correct. I think it would be nice to keep that functionality in the Yunohost installer.

Anyway, thanks again @MariusBaguepi for your help and suggestions!