Grub? How bad can it be?

Lo these many years I have never gone to Grub - using either BootManager with BeOS and Haiku, or lately booting the whole disk. New T480s works OK with BootManager so far (installed during the train ride home), but

  • the BIOS or whatever takes a full half minute coming to grips with it before the menu comes up, and
  • I have the impression UEFI is the way of the future, for other platforms if not Haiku

I read here some negative comments about Grub, but no details. If I put a Grub on the disk and it seems to work, then is the negative commentary unjustified, or is there some specific issue that one would encounter later?

The problem with grub is that it is very linux centric and complex to setup and debug.

As a result it is somewhat very hard to figure out why a system does mot boot. Compared to say refind which can just figure out where efi binaries are on it‘s own, has icons for it etc.

Grub usually requires you to provide a complete config from a linux host, and then different linux hosts have their own config and will sometimes overwrite the config of the other.

For efi you can use reFind, and for bios haikus bootmanager. So that is what is usually recommended for people considering a new installation with severall OS.

If you however already have grub and want to keep it that is fine too, it just is not as easy to debug. : )

6 Likes

It’s a good thread, this. I thought that GRUB was meant to boot anything, and am also somewhat curious why it is not used as our boot loader (or at least where there are multiple partitions). I imagine that it would reduce friction to Haiku adoption if it had been the main boot loader.

Pedant alert! The G in GRUB stands for GNU and I understand from its own documentation page that it is really a point of pride that it boots the HURD, and that rather than linux is GNU’s premier operating system. Linux? They have LILO (Linux loader).

GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU Hurd with the University of Utah’s Mach 4 microkernel (now known as GNU Mach).

And just to rub more salt in:

(project goals include) Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and Linux.

Grub works but… it sucks. Why I say it sucks while I admit it works? Because it is unnecessarily complicated, and good luck removing it when you have enough. Still, most GNU/Linux distributions use Grub by default (mine doesn’t and I’m glad it doesn’t). If you are stuck with Grub because of that, and you aren’t planning to tweak booting often, I’d say you should be ok.

In my opinion, the best solution for a multi-boot system is to have two disks: one dedicated to whatever else OS(es) you are using and one for Haiku (so you can boot from different disks). That way you won’t have to worry about boot loaders at all.
But the ideal setup is to use a second computer for Haiku; it doesn’t have to be top notch hardware, second-hand computers (a few years old) are usually cheap, and any of those will work more than just fine. Once I tried that setup, I never looked back.

2 Likes

When I tried to multi-boot linux and Haiku with Grub, it was a nightmare. The Haiku/BeOS boot manager has a really easy installer and interface.

Rather than mess around with grub, it would be nice if Haiku’s boot manager could do non-MBR disks, without losing the ability to do MBR disks. Also, it would be nice if it could include boot options from multiple drives, like the BeOS boot manager.

Well, mine works correctly : ( Haiku B4 and nightly, linux, freebsd ) .

Like others said, GRUB needs attention to be configured, but after that it “just works” .

Well, yes, it is meant to boot Linux and anything else.

The problem is, GRUB (like many other bootloaders) does not fit into the small space normally reserved for a bootloader at the start of the disk. There are various ways you can solve this.

For Haiku BootManager, we use a few more sectors, and tell DriveSetup to not put any partitions there. BootManager installer will check that the needed space is free, too.

For some other bootloaders, they will create their own partition and store their data there.

For EFI bootloaders, this limitation doesn’t exist. They are stored in files in the EFI partition and can be as large as you want.

But for GRUB? It usually has some files in your Linux system partition. Remove or corrupt that partition, and you now have an unbootable system that gives you only GRUB rescue mode. This problem is so bad that there is a live CD distribution dedicated entirely to fixing GRUB problems.

Is it bad? No, not really. It’s a very flexible tool, possibly more than it really needs to, and will cover all possible corner cases. But that also means it is complicated to setup, or you have to rely on additional layers of software, such as os-prober, which will try to detect what OS you have installed and add them to a bunch of scripts that eventually generate a boot menu for GRUB.

You probably don’t need all that. If you have GRUB because you use Linux anyways, yes, fine, no problem with that and your Linux install will take care of these things for you. But if you want to set it up standalone, without a companion Linux installation? Good luck.

On the other side, Haiku is going to need its own haiku_loader anyways. This one provides a friendly menu and allows to set various boot options. In order to get this friendliness, it loses some flexibility: it can only boot Haiku and nothing else. So you have to complement it with BootManager, or maybe with rEFInd for EFI systems, It’s a different approach, one with tools that are less flexible, but easier to set up.

1 Like

Hm, no, actually l did not have a Linux partition in mind here, just space reserved for one if it comes to that. So … maybe no, on that Grub.

Maybe I’ll try installing some Linux on one of the MBR partitions, to see if that’s really a problem. If there’s no real problem with that partition system, BootManager is fine with me.

The half minute delay, I think is the BIOS timing out a LAN boot, which I can presumably deconfigure.

@donn , if you are not intended to use Linux, you probably also do not need Grub (which BTW stands for GRand Unified Bootloader and is not GNU-centric).

I used Grub with no connection with Linux and I really like it. I put it on dedicated small partition and manually write grub/grub.cfg file.

However, Linux tries to configure Grub automatically and in certain use-cases it fails (almost all except Linux installation stand-alone or Linux installation after Windows). I strongly believe this is Linux fail, not Grub. Namely, all commands starting with grub-* are grub-specific and have counterparts in Grub shell, but all the commands *-grub are Linux specific and all them can be avoided.

Thank you for your correction. The Unified does indeed imply it is not specific to one OS. However its full name is GNU GRUB, it is hosted by GNU.

With the increasing popularity and recognition of Haiku, I suspect that GRUB will want to provide native support rather than simply “chainload” our own boot loader. That will obviously be another milestone in Haiku becoming credible, and give us another option of how we want to configure our computers.

Since grub has to be configured, and does not probe anything they really can‘t. On linux this is done with some autoconfig, but in the end they all seem to draw from debians os-prober.

Haiku was already detected in the oast: Getting recognition from Linux / Part Two - Recognizing Haiku | Haiku Project

However it seems to be broken since 2013 when haiku added package management.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696

I don’t think so. Our own bootloader does provide important features (the early boot menu) that GRUB doesn’t need to re-implement. And the interface between the bootloader and kernel is not documented.

Chainloading our bootloader is the proper way to boot Haiku, and GRUB shouldn’t do things otherwise. This would only result into unbootable systems whenever we add or change a kernel option, and prevent people from using our nice configuration menu.

It is unlikely and not desirable because Haiku boot loader is not just a kernel loader, but an important part of operating system. It do quite a lot of complicated Haiku-specific things:

  • Read files from HPKG packages (possibly from selected previous packages state).

  • Load boot kernel add-ons in addition to main kernel executable.

  • Load kernel configuration files.

  • Apply ELF relocations.

  • Switch to protected supervisor mode where kernel will run. Setup virtual address space for kernel.

  • Setup framebuffer for boot splash and fail-safe desktop graphics.

  • Identify and setup some devices such as UART, interrupt controllers, timer.

  • Read hardware configuration info from ACPI/FDT.

2 Likes

I use Refind (with UEFI systems), just because it looks nice :wink:

1 Like

Grub is actually quite good and feature rich, but it is complex and not easy to configure.
ProTip: have a copy of super grub disk 2 on usb stick, in case something goes wrong

1 Like

I’m a longtime user of XOSL for multiboot PCs. Since I never use UEFI and always use BIOS, I don’t know if XOSL is compatible with UEFI. But its an option.

Close to success with rEFind. Needed a Linux install to get it going (there’s a USB image, but that didn’t load for me), and I have Haiku on another partition. NetBSD is hopefully close, but there seems to be a snag somewhere. None of the operating systems seemed to be ready to make a painless install for this, as if they’re waiting to see if this stuff really catches on. For which I can hardly blame them. Elegant solution it is not.

rEFInd logic is similar to what Grub achieves with chainload +1. I heard rEFInd is able to directly load Linux kernels (+ initial ram disk), but in my home installation I use rEFInd to chainload Grub, which in turn loads Linux. Suppose the same holds also for NetBSD (Grub is able to load it natively). This is not an elegant solution, but it works.

The only downside of using rEFInd with Linux is: often when kernel is updated, the update-grub command is also run, which ruins rEFInd installation, and I need to restore it (I prepared a script for that).

That being said, on EFI systems rEFInd can load Grub and Grub can load rEFInd. So, you can play with different EFI bootloaders until you make your choice of default one.

Yep, I just redid my main machine. Haiku runs from the 250G SSD, GNUStep Desktop from the 1T HD, and FreeDOS from a USB-C SSD. Hit F12 on bootup and you just need to remember the order, because there is no way to edit labels in the BIOS.

In terms of finances and desktop space, I am at high risk of getting divorced if I bring another computer into the house!

:+1: :+1: :+1: :+1: :+1:

2 Likes

Isn’t this debate pointless in a world where UEFI is the standard for ten years? Multi-os booting is managed by either UEFI boot menu or OS by itself. There is no need for Grub for booting Haiku. In fact, it is not needed even by Linux, which is able to boot from UEFI without grub. However, I understand they use grub because it is handy for setting some kernel parameters. But that’s not the case for Haiku.

Would be great if we could manage uefi variables from Haiku user space so we can configure boot sequence.

2 Likes