Grub doesn't always detect all hard drives

So here’s my problem: I noticed that sometimes my computer doesn’t boot, but gets stuck at seemingly random points within the boot process. Then I was tinkering with my grub boot options and found out that not all of my hard drives (/devices) are detected on every boot. I only had to go into the grub command line and run an ls -l to check whether my SSD was mounted as hd0 or hd1 (as it should be because the numbering is prioritizing the HDD first), and whenever it was hd0 (with the hard drive missing) all I had to do was to type to exit basically forcing grub to be loaded again, and with this procedure, it seems like that I’m able to boot every time. Now my problem is that it’s tedious to do this every time I want to boot up this pc. Is there a way to automate this check (almost like writing a shell script, I could do it technically if grub can run scripts like that), or is there something that I could set in grub to make it function properly? Maybe I’m able to replace grub with reFind, but I’m fully aware that most likely that could cause the same issue too. Thanks in advance for any replies!

Hi @konrad52,

I think you’ll have to repair your GRUB:

There is also, of course, the chance that it’s a hardware problem, in which case we can’t do anything from here.

However, repairing GRUB will confirm/dismiss it. So that’s your first step

In case you didn’t know:

Identifying whether your device uses BIOS/(u)EFI

Run the following in a terminal:

test -d /sys/firmware/efi && echo efi || echo bios

If the output is:

  • efi, your computer uses (u)EFI.
  • bios, your computer uses BIOS.

For more information, visit:

Thanks for the very fast reply. I already tried to reinstall grub and it doesn’t seem to change anything about this problem, so I’m suspecting a hardware problem. Most likely it has to do with the fact that the ROM chip on my motherboard had to be replaced a while ago, and my EFI seems to be much slower/unpredictable ever since. I don’t think I can necessarily fix this by any means, but if there’s is a way to add a custom startup check to grub, like run ls -l, check for a cheeky regex, and if it’s not fine then exit. If it’s not possible than I live with it as is.

All you can do is make sure you are using UUID’s in all your configs instead of (hd0)/(hd1), which will make it not care about the sequence they are detected in.

Also you didn’t mention if your drives are internal to your computer or external, which makes a huge difference when it comes to detection sequences…

Both of my devices are internal, and after I did a reinstall I replaced my device ids with uuids fixing the problem. Thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.