Multi-user.target screen resolution

I’ve installed a simple rocky 9 without a gui, to go into a DC and be used with a simple rack monitor.
The problem is when the system boots, it displays the grub menu at 800x600, but as soon as it starts loading the kernel the screen resolution changes to 1920x1200. This is far to much for my simple rack monitor. I can get onto it using IPMI but have to scroll around the screen on my laptop to see anything.
I don’t have the xwindows system, it is just the text console showing the text login: prompt so it certainly doesn’t need to be any more than 800x600. How can I change this?

I have found articles that say to change GRUB_GFXMODE and GRUB_GFXPAYLOAD_LINUX in /etc/default/grub and then run ‘grub2-mkconfig > /boot/efi/EFI/rocky/grub.cfg’ or ‘grub2-mkconfig > /boot/grub2/grub.cfg’ or to add ‘video=800x600’ to the kernel option. And of course many thing referring to xrandr and settings in xwindows that I don’t have installed. Nothing seems to have any effect. Immediately after the grub screen the resolution changes to 1920x1200 and my poor old monitor says ‘out of range’

I would be very grateful if anyone has any insights into how to change this so that when I inevitebly need to use the console I can
Thank you
Chris

Try:

grubby --update-kernel=ALL --args="video=800x600"

or you can disable KMS which is responsible for it so:

grubby --update-kernel=ALL --args="nomodeset"

and it will set to VGA. Although it’s more recommended to use the video option.

1 Like

I’ve just done this on my EL9 system to verify the first method with video=800x600, see below screenshots before and after:

Awesome!! Thank you so much. That has worked

2 Likes

Note: Some of that does not apply to Rocky 9, i.e. will probably break something. That is the danger of dated “info”.

In principle, the grub2-mkconfig computes a new grub.cfg. It does, but it does also “update grubenv file”, and could (but does not by default) “overwrite BLS cmdline args”.

The ‘video=800x600’ and ‘nomodeset’ are “BLS cmdline args” and would be in ‘GRUB_CMDLINE_LINUX’ of the /etc/default/grub. Yes, grub2-mkconfig --update-bls-cmdline could update them like the grubby --update-kernel=ALL --args="video=800x600", but there is no need to touch the grub.cfg, if BLS cmdline args are all you need to update. Hence the ‘grubby’ is more on point.


The grub2-mkconfig has also output option as alternative for the redirection:

grub2-mkconfig > something
grub2-mkconfig -o something

That difference is subtle and usually should not matter.

What does matter is the /boot/efi/EFI/rocky/grub.cfg vs /boot/grub2/grub.cfg

Rocky 9 may have /boot/efi/EFI/rocky/grub.cfg, but that is not the grub.cfg
The grub.cfg in Rocky 9 is always (at least on x86_64) /boot/grub2/grub.cfg
Therefore, overwriting the /boot/efi/EFI/rocky/grub.cfg can cause confusion later.


I’m not expert on GRUB, but I guess that the GFXMODE and GFXPAYLOAD_LINUX affect primarily how GRUB shows its own menu and perhaps what the kernel shows initially. Hovewer, there is also a fact that kernel starts drawing messages in some mode, but at some point in boot it loads different/actual graphics driver and the mode does clearly change (with some drivers – for example Nouveau vs proprietary NVidia). It is the latter mode that you want to control and therefore the ‘video’ option (which kernel probably passes to the driver) seems more on point.

I guess to make the changes persistent across new kernel installations you also need to add the arguments to /etc/kernel/cmdline. Post install scripts of kernel packages execute kernel-install which relies on this file to create a new kernel entry (man 8 kernel-install).

I just used the command I gave in my post with the video arguments and after rebooting it was OK. That would suggest it is persistent, otherwise it wouldn’t have changed the resolution on reboot.

What I mean, the settings will not apply to the new kernel when the next kernel update is due. This is what I think.

Ah yeah gotcha, hmm maybe, I guess we’ll find out soon enough :slight_smile:

1 Like

Actually just verified that, after the grubby command, /etc/kernel/cmdline is updated:

root@rh9:~# grubby --update-kernel=ALL --args="video=800x600"

root@rh9:~# cat /etc/kernel/cmdline 
root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/root fips=1 boot=UUID=928077ae-7a36-4bfb-b37c-fe2d78f920ff video=800x600

I then change it to 640x480:

root@rh9:~# grubby --update-kernel=ALL --args="video=640x480"

root@rh9:~# cat /etc/kernel/cmdline 
root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/root fips=1 boot=UUID=928077ae-7a36-4bfb-b37c-fe2d78f920ff video=640x480

so looks like it will be persistent for new kernels and no manual edits of the file are required.

This (the “ALL”) updates three things:

  • The “options” in BLS entries (used during boot)
  • The /etc/kernel/cmdline (used by 'kernel-install to create a BLS entry)
  • The GRUB_CMDLINE_LINUX in /etc/default/grub (for consistency)
2 Likes