Help making grub appears on external monitor (only shows on laptop internal screen)

i use with the lid close and it stays enclosured under my desk with many cables connected, when i boot, the grub dont show on the external monitors, only on the internal laptop screen, so if i want to change OS , or rollback ostree, i need to take laptop off disconect all the cables and open the lid to choose, after that video on external monitors kicks in.
Is there any configuration that could make grub appears on external monitor ?

@john2fx for you to stay on the loop bro

Any help for where i can look to solve this ?

The source code of grub.

But I found that too cryptic to follow. The source code of grubfm (an abandoned project that easy2boot, etc. depend on) is a bit more approachable (and even helps at understanding grub source code). If the feature exists, it might be found in the source code with a lot of effort. But I expect it doesn’t exist.

It obviously could be done as a grub plugin. Grubfm makes it clear enough how such a plugin would connect to grub. I’ve never seen any decent documentation on how grub (and that hypothetical plugin) communicates to the UEFI BIOS.

i found that some Bios have this option, to choose where to display, unfortunately my dell bios dont have

You would need to set that parameter for Grub2 in order to get another device recognized at that point in the boot process. Check this solution out, might be an interim until a better one is presented to you … boot - Forcing grub menu to external monitor connected to laptop via HDMI/VGA - Ask Ubuntu

thanks,looks like a decent solution, but if i take my laptop out , i wouldnt be able to boot, what i understand is that there isnt an auto mode, to pick external display when connected

I started following those instructions to see what they would do. Before getting to the point of testing it, I realized what it was trying to do. That answer is entirely wrong. Then I noticed the explanation of why it is entirely wrong is already there in one of the comments on the wrong answer.

Long ago, I experimented directly setting the grub feature those instructions set indirectly. When/if you manage to get something like that to work, it controls the messages that Linux shows during startup (assuming you also remove rhgb and quiet from the command). That whole feature has no affect on the way grub itself displays. I’m very very sure from much testing long ago.

This is only to tell grub2 that you want colour and to quiet the boot messages as they can be overwhelming for some.

You would note from the link I sent about this particular solution, it was that the original poster used the external monitor to boot up with as primary display. If your BIOS will let you do this (which is the preferable way). If not you have to tell Grub how to find the monitor which would have to be a kernel arguement addition. If you are on Silverblue or similar you use rpm-ostree kargs <option to change/add> and do not need to use the grub2-mkconfig command as rpm-ostree will handle the menu update. Yet another reason Silverblue is better. To get the external monitor you would use the command `xrandr -q’. Then you would need to look at the grub config file to see the line


then change it by using rpm-ostree kargs like so …

rpm-ostree kargs --replace=GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"="quiet splash  video=<the name of your monitor as reported by (xrandr -q)>"

This is an example, the original karg needs to be determined by the existing configuration. You can query the existing command line with rpm-ostree kargs | grep "GRUB_CMDLINE_LINUX_DEFAULT" I think.

Yes, but it has been many years since I saw a BIOS with that feature. I don’t know why, as the room and general feature complexity of BIOSs went up, they decided to drop that simple and useful feature.

Both the current question and the question of that original thread were asking to control where grub displays its menu. A bios feature would solve that, if we had that bios feature, but we don’t.

The answer of a kernel argument to control how Linux uses the display before the GUI starts is useless. That does nothing for where grub display its menu.

You guess about what rhgb does is wildly wrong. You could easily google it rather than post incorrect information. Then you posted stuff about how one influences the grub install software to indirectly influence the files that actually control grub (/boot/grub2/grub.cfg and the contents of /boot/loaders). I never could wrap my head around all that pointless complexity (despite understanding why it exists), so I always just directly edit the files that really control grub. Yes, I have to do a manual cleanup after some major updates, that MIGHT not be needed if I did everything indirectly, but the indirection is too much pain (due to bad documentation). Anyway, direct or indirect, the grub feature asked for here doesn’t seem to exist. So the details of the indirect way of setting some irrelevant (to the current question) grub features just wastes the reader’s time.

No it isn’t , and it isn’t a guess…

Yes it does. You have to tell Grub where to display it’s output, what partition to boot from, etc…

Even GNU who makes Grub2 advises against manually adjusting grub configuration files, they have a really good tutorial, you should read it.

sorry i dont understand, with that commands i will be able to set grub to show in a external monitor when connected ? if yes, if i disconnect the monitor (like use laptop alone) it will show in the laptop screen ?
I follow the link you sent, and found some complaints about this , that work but if you disconnect monitor, grub will not show and you will not able to boot

Well it will not work if disconnected in this example. You are using the external monitor for convenience I guess. You may have to forgo convenience.

Nothing there can get you into the situation in which grub itself depends on the external monitor. If you were still worried about that (or otherwise accidentally trashing that copy of grub), you always have the fallback of booting from a USB to use chroot to undo whatever you did.

While I’m sure you WON’T actually hurt grub itself, I wouldn’t be surprised if you managed to wreck the behavior enough that grub passes something wrong enough to the kernel that the kernel won’t boot. If you know grub at all, you can just do a temporary edit to the selected command to undo the harm and boot.

I doubt there is any risk of something that in any way “works” but then doesn’t work with the external monitor disconnected. If there is some such risk, it only applies to the kernel, not the grub menu and could be overridden within grub by the temporary edit to the selected command.

im not so tech savy to mess with grub.
I guess since my bios dont have this option i will have to accept that everytime i restart would have to open the laptop to boot.

You can do much better than that.

You can easily set grub to instantly boot to Fedora on every startup, unless you hold the shift key down while it is booting. Or, you can set it to instantly boot to whichever of Windows or Fedora you chose last (unless you hold the shift key).

Then you can restart to the default OS without opening the laptop and only need to open the laptop (and hold the shift key while booting) when you want a non default choice from the grub menu.

More challenging, but certainly possible, you could set things up such that grub always defaults to boot Fedora, but inside Fedora, you have an icon you can click to do a one time reboot into Windows. With more effort, you could even put that on the login screen and not even need to login when you booted Fedora but wanted Windows. Anyway, you could switch OSs without ever opening the laptop.

thats cool bro, can you point me the direction to achieve this ?

That is patently not true. Grub can be pointed to the external monitor, it’s just not easy to have selectable monitor choices at that time since Grub doesn’t know the hardware as seen by the BIOS directly, it has to be told where and what everything is and you do that with the grub2 configuration file that the system boots with. So you can choose to boot from an external monitor, it won’t be convenient if it fails, but you only need to edit the command line at boot time to not point to the external monitor.

So you DO understand that grub’s menu and the rest of its own UI are on the monitor that the BIOS selected for default (which for most BIOSs is not user configurable).

You keep talking about the method for making grub tell the kernel which monitor to use, but the question was about what monitor grub uses for its own UI.

I don’t know whether it requires one time changes to /boot/grub2/grub.cfg to enable the feature (and assuming it does, the “correct” way is to instead make those changes to files that /boot/grub2/grub.cfg is rebuilt from on some system updates. All that is mentioned often in other threads, but I don’t remember any of it off the top of my head.

Then you would need something running as admin to modify /boot/grub2/grubenv before doing shutdown -r now or equivalent. There is a program for making valid changes to /boot/grub2/grubenv that you should invoke rather than directly code the chages in the script. All that is also mentione in many other threads

I don’t have all the details handy without research. I know I could fairly easily code it as a big chunk of extra code inside /boot/grub2/grub.cfg. I expect there are things already there to make that smaller/simpler and it would be better but likely harder to find what is there to make it small than to reinvent the wheel and have it big.

Hopefully someone who remembers such details better than I do will jump in here. I tend to need to relearn that stuff every time I do anything with it, even something I did less than a year ago.

In simpler terms, what we are talking about is using grub2-editenv to request a one time override of the default OS that will automatically revert after one time.

I know that is something commonly done, by I didn’t take the time to read all the google hits I got when I searched for that, which don’t actually do the “one time” aspect (just change the default from the Linux command line, which is very simple and frequently described).

So I guess you didn’t bother to look at GNU’s grub2 tutorial.

Because you do have to tell grub what monitor, even the default one used by BIOS. This is normally done automatically as part of install/upgrade so the user doesn’t deal with it. Whether you understand it or not makes no difference, but telling someone to manually modify the grub configuration on Fedora can lead them down a path of pain. Especially when you admit you don’t understand how it is working.

as per the OP’s post title …

Help making grub appears on external monitor (only shows on laptop internal screen)