GRUB: Boot in custom resolution

scatman75

Cadet
Joined
Jul 10, 2022
Messages
6
I would like to know where I can set a custom resolution for GRUB to start Truenas Scale. The reason for this is a "faulty" BIOS, which sets the resolution to 656x496px (overscan), which leads to screen flickering.

So can anyone tell me where I can set a parameter like GRUB_GFXMODE=640x480 that will survive a system update?

--
Version: TrueNAS-SCALE-22.02.3
 

scatman75

Cadet
Joined
Jul 10, 2022
Messages
6
Thank you for the link. I read this thread already, it deals with Freenas. And I am of the opinion, that with Scale and Debian the configuration changed. By now I identified four places, which deals with configuration options for grub:

/boot/grub.d/grub.cfg
main file

/etc/default/grub.d/
truenas.cfg: contains grub variables, but a manually added variable vanished a reboot

/etc/grub.d/
helper scripts for grub-mkconfig
Interesting seems the file 40_custom

/usr/share/grub/default/
The file grub seemed the right one and I set the variable GRUB_GFXMODE=640x480 and executed update-grub command. No errors, the variable survived the reboot, but had no effect on the cfg file in /boot/grub.d/grub.cfg.

After looking into /boot/grub.d/grub.cfg it became clear the it /usr/share/grub/default/grub will have no influence, as /boot/grub.d/grub.cfg is comprised of the content from grub-mkconfig, which is using the templates from /etc/grub.d and the settings from /etc/default/grub

So it comes down to this two places:
/etc/default/grub.d/
/etc/grub.d/

So I am looking for a solution that is working and hopefully compatible with feature updates of Truenas Scale.
 

homer27081990

Patron
Joined
Aug 9, 2022
Messages
321
Thank you for the link. I read this thread already, it deals with Freenas. And I am of the opinion, that with Scale and Debian the configuration changed. By now I identified four places, which deals with configuration options for grub:

/boot/grub.d/grub.cfg
main file

/etc/default/grub.d/
truenas.cfg: contains grub variables, but a manually added variable vanished a reboot

/etc/grub.d/
helper scripts for grub-mkconfig
Interesting seems the file 40_custom

/usr/share/grub/default/
The file grub seemed the right one and I set the variable GRUB_GFXMODE=640x480 and executed update-grub command. No errors, the variable survived the reboot, but had no effect on the cfg file in /boot/grub.d/grub.cfg.

After looking into /boot/grub.d/grub.cfg it became clear the it /usr/share/grub/default/grub will have no influence, as /boot/grub.d/grub.cfg is comprised of the content from grub-mkconfig, which is using the templates from /etc/grub.d and the settings from /etc/default/grub

So it comes down to this two places:
/etc/default/grub.d/
/etc/grub.d/

So I am looking for a solution that is working and hopefully compatible with feature updates of Truenas Scale.
Hi! I meant, maybe it would be easier to enable text-only output mode?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
For Scale, you'll need to set a kernel boot parameter via the API from shell: midclt call system.advanced.update '{ "kernel_extra_options": "video=640x480-32" }'. This gets added to the kernel's options at the next boot.
 

scatman75

Cadet
Joined
Jul 10, 2022
Messages
6
For Scale, you'll need to set a kernel boot parameter via the API from shell: midclt call system.advanced.update '{ "kernel_extra_options": "video=640x480-32" }'. This gets added to the kernel's options at the next boot.
Thank you very much, that changed the resolution of the booted system, see screenshot.
But it does not seem to have an effect on the grub menu and the output of the boot, correct?
 

Attachments

  • screenshot_2022-08-19_18.16.08.png
    screenshot_2022-08-19_18.16.08.png
    398.7 KB · Views: 380

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Grub requires modifications to /etc/default/grub to set the GRUB_GFXMODE, with running update-grub from the Shell afterwards to generate the updated grub.cfg. However, I'm not aware of any TrueNAS-specific mechanism to accomplish this. You could try doing this by hand in the shell also, but I don't know if these manual changes would be preserved between boots.
 

scatman75

Cadet
Joined
Jul 10, 2022
Messages
6
You are right, modifying /etc/default/grub would be the usual way of doing it. But this file is not present in Scale, instead most part is handled by the file truenas.cfg, which is located at /etc/default/grub.d. Changes to truenas.cfg won't survive a reboot, at least as far as I can evaluate it.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Try this: create a Shutdown task to insert "set gfxmode=640x480" at the beginning of the grub.cfg. This will be under System->Advanced->Init/Shutdown Scripts. Something like: sed -i '1i set gfxmode=640x480' /boot/grub/grub.cfg, or wherever the grub.cfg happens to be.
 

scatman75

Cadet
Joined
Jul 10, 2022
Messages
6
Thank you for your efforts and the idea of forcing the command into the boot.cfg file, but creating the script seems to have no impact on the resolution. I tried inserting the set gfxmode=640x480 at the beginning of grub.cfg manually but after a reboot the file is back to normal.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
OK, try creating a file named custom.cfg in the same directory as grub.cfg. The contents should be set gfxmode=640x480. Whenever the system rebuilds grub.cfg it should include an entry to incorporate the contents of custom.cfg. The custom.cfg file won't be molested by the grub rebuilds.

Since the shutdown script idea didn't work, please delete the shutdown script.
 

scatman75

Cadet
Joined
Jul 10, 2022
Messages
6
I did as you suggested. Unfortunately the resolution did not change from 656x496px. Must be the BIOS. But because of it is a old QNAP Bios, I do see any solution.

Thank you very much for your time. I think it is time to give up on this issue.
 
Top