Editing Grub bootloader

There's a lot of information out there for different ways of editing a grub bootloader, so much so it makes me a little anxious about doing so.

Hopefully someone here can tell me the proper way with 22.04 installed, and hopefully this also applies to newer MATE releases too.

Once I'm there I know how to make settings. I can read :slight_smile:

Any help would be appreciated.

Also, and I don't know why this happens, I can do an install and the bootloader will show. I like this because it's a dual boot system and I want it that way. What will happen is after either updates or booting between the different OSs (currently 22.04 and Win11) is the bootloader stops showing. Is this a typical thing? I can always press a hot key to override the default boot device but I'd rather use grub if it doesn't give me issues.

2 Likes

Hi Dave,

The Official Way:

The official way is to edit the grub default file:

sudo pluma /etc/default/grub

You will see something like this:

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

The only thing we are interested in is:

GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0

Change this to:

GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10

After you save and close, just issue this command:

sudo update-grub

And you have your grub bootmenu back.


Alternative method (GUI):

The other method is using a GUI: The Grub Customizer by Daniel Richter is as close as official you can get.

You have to add his PPA (=custom repository) first:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update

and then install grub-customizer

sudo apt-get install grub-customizer

and that is it :slight_smile:

6 Likes

HI!

THANKS! I'll be giving it a try later today, but sure it will work.

Any ideas about that last part? Why is it that the boot menu shows after doing an install but later disappears?

And a little bit more about the system:
AMD X570, Zen 3 5800X3D, 3 NVMe ports. Port 1 off the CPU is Win11, port 2 is a games disk, and then port 3 is Ubuntu MATE. In BIOS the default boot disk is Ubuntu MATE. So, the system after POST SHOULD point to the Ubuntu disk and that certainly seems correct and I can tell grub is there, just blank and a few seconds later Ubuntu MATE loads.

I know this isn't board related because I've seen this same issue with more than one X570 MB and it wouldn't make sense anyway. It just seems like for some reason the grub file gets changed once again after either using both OSs or after updates are installed, and I don't know which.

And I'll go with method 1 and skip loading software just to do this. Pluma is already there :slight_smile:

1 Like

After every kernel-update, Grub scans the disk for multiple operatingsystems.
If it finds more than one, it enables the menu.

Maybe Grub is not configured to scan more than one harddisk and doesn't enable the menu because your operatingsystems reside on different harddisks, I don't know, never encountered that.

But in this case you can always use the above described manual override to always show the menu.

That is exactly what happens. BIOS -> GRUB -> Ubuntu-MATE.
The only thing is that GRUB hides its output so it seems like it isn't there.

After a kernel update seems to be the most logical conclusion.

By the way, I also have an X570 board ("MSI mpg X570 gaming plus" with a Ryzen 5 3600 ) but I couldn't tell if that plays any role in this. I have a different dual boot configuration. I have a tiny Win10 partition on my Ubuntu NVMe. Just enough OS for playing games that are stored on another disk.

Cool, let me know if it worked for you, okay ? :slight_smile:

2 Likes

I'll be dealing with it this evening. I'll let you know the outcome.

Yes, the OS's are on different disks and even the loaders are on different disks because when I do the install I install Win 11 first, then remove those drives so MATE doesn't want to put itself (a loader) on the Win11 disk or any other disk it sees. I feel compelled to do this because in the past when installing dual boot systems, MATE wanted to put the loader on the Win11 disk and I don't like that. It gives me issues if I have to remove disks to clone the Win11 disks onto NVMe, which though is a little pain, I'd rather clone that way because the software that makes the clone plays better when the disk types are the same, and since MATE is on port 3 it's easy to get to anyway. On top of that I want the clone disk of Win11 to ONLY be Win11 without a MATE loader. This is just a personal preference. I like having a clone that I can just drop into the system and it works.

I just read up about grub with two seperate OS disks:

When it comes down to other disks, the os-prober, which is a part of grub's update sequence, only probes mounted partitions for bootloaders.

So to keep a windows boot option in grub, you might want to mount the EFI partition of your windows-disk before invoking sudo update-grub

If you don't want to do it by hand every time after a kernel-update, you might consider mounting the EFI partition of your windows-disk automatically on every MATE boot.
This way you can be sure that the windows boot will be discovered by the os-prober every time and automatically when there is a kernel update.

I did not try this myself, but several sources claim this same method of OS discovery.

2 Likes

Ahhh, I'll give that a try. I'm on that system now but doing a few thing before editing Grub and restarting to test. That certainly makes sense. And no it's not mounted because I disable any Windows partition from being mounted so this info probably helps. :slight_smile:

I'm going to assume that I only have to mount it when you update Grub and then it can be unmounted.

But that brings up another point. If the issue is some Ubuntu update that causes Grub to get changed in the first place, then another update could possibly do the same thing. This is now something I can pay attention to, to see what happens with future updates and if Grub gets hidden again, and then also I can see what happens if the EFI partition on the Win11 disk is enabled or disabled.

So, this could be a good learning experience. Thanks again for the info.

1 Like

I followed what you said and that works. Thanks!

There is still one alternative:

Use a EFI bootloader:

https://refit.sourceforge.net/
https://www.rodsbooks.com/refind/

2 Likes

I'll give this a read. Thanks