You are not logged in.

#1 2023-05-08 06:46:56

qu@rk
Member
Registered: 2021-07-28
Posts: 53

boot stages change resolution. how do I force the native one?

I always had this issue that I wasn't able to fix. I'm using an encrypted setup and when I first start the computer I get good resolution first screen from mobo, then it drops to a low one for the efi part with /boot password, then it moves into GRUB where I managed to set it to native, then immediately after loading the ramdisk when it asks for / password that screen is also low res, keeps it low res until sddm is on, at which point the resolution is again native.
I've noticed that in Ubuntu it's consistent all the way with native resolution. Any way I can tweak Arch so it behaves the same?

in /etc/default/grub I have added:

GRUB_CMDLINE_LINUX_DEFAULT="...video=2560x1440..."
GRUB_GFXMODE=2560x1440x32
GRUB_GFXPAYLOAD_LINUX="keep"

in /etc/mkinitcpio.conf I have added:

MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
FILES=(/lib/firmware/edid/edid.bin)
HOOKS=(...kms...)

edid.bin is the edid file for my monitor. These all seem to affect only the GRUB menu. before and after it (immediately after ramdisk load) it's low res.
The efi binary was made with this script:

#!/bin/bash

CONFIG=$(mktemp /tmp/grub-config.XXXXX)
cat >"$CONFIG" <<EOF
cryptomount -u boot-partition-UUID
set prefix=(cryptouuid/boot-partition-UUID)/grub
set root=cryptouuid/boot-partiton-UUID
insmod normal
normal
EOF

grub-mkimage \
    -p '(cryptouuid/boot-partiton-UUID)/grub' \
    -O x86_64-efi \
    -c "$CONFIG" \
    -o /tmp/image \
    luks2 part_gpt ext2 cryptodisk gcry_rijndael gzio luks gcry_sha512

rm "$CONFIG"

Anything I could add to it to keep native resolution on first password?

edit: also forgot to mention that this behavior is present in the virtualised version of Arch. at least the resolution drop between GRUB menu and fully loaded, when I have to input the / password. I can't seem to make that screen higher resolution on neither native nor virtual Arch.

Last edited by qu@rk (2023-05-08 07:01:12)

Offline

#2 2023-05-08 10:37:14

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 10,982

Re: boot stages change resolution. how do I force the native one?

It's not an edid issue, but a nvidia driver issue because nvidia didn't implement the fbdev drvier that allows the kernel to use native res before graphical environment is started.


Try removing the video= from grub default as that is likely overriding the GRUB_GFX settings as soon as grub transfers control to the kernel .

Last edited by Lone_Wolf (2023-05-08 10:38:50)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2023-05-08 14:18:34

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

I removed it but it made no difference. And for / password the same thing happens with Arch in VM. Which uses QXL for video.

Offline

#4 2023-05-08 14:33:49

seth
Member
Registered: 2012-09-03
Posts: 38,710

Re: boot stages change resolution. how do I force the native one?

I've noticed that in Ubuntu it's consistent all the way with native resolution.

it drops to a low one for the efi part with /boot password, then it moves into GRUB

The EFI is pre-OS, so how and why would ubuntu not be affected by that?
Does ubuntu use nvidia or nouveau?
Which GPU and nvidia version do you use on arch?
https://wiki.archlinux.org/title/GRUB/T … resolution

Try to force a mode, https://www.kernel.org/doc/Documentation/fb/modedb.rst

Online

#5 2023-05-08 16:01:10

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

I have a gtx1080 and using nvidia-dkms 530.41.03-1. I didn't test Ubuntu with encryption but I did notice it runs native resolution when loading it up. I'll give it a closer look tomorrow to see what they use.

I did try before posting with video=DP-1:2560x1440@60 (and @144) but no change.

Offline

#6 2023-05-09 16:11:30

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

I installed Ubuntu 22.04 today, server version, chose nvidia drivers at install, and I also used LVM + encryption just to add that extra auth step.
It starts into GRUB which is native res, just like Arch does with GRUB_GFXMODE and GRUB_GFXPAYLOAD_LINUX. After choosing the boot option it drops resolution just like Arch does, but it loads some stuff and goes native res when asking for the encryption password. from that point on it's native resolution all the way. Once loaded there's no nouveau when checking with lsmod, only nvidia stuff, just like Arch.
Only that Arch never really goes native res after / password. I disabled sddm and I'm left with low res in tty. Same thing, nvidia stuff loaded with no nouveau.
So Ubuntu does something different. There's a step right before asking for encryption password where loader does some "loading essential drivers" or something like that, when it switches to native res before asking for password. It might temporarily load the nouveau driver at that point, I don't think I get all the info on what's going on in the background. In the end it's in tty with native resolution with nvidia drivers, unlike Arch which doesn't do it.

Offline

#7 2023-05-09 18:47:59

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

I've done some more testing in Arch and there doesn't seem to be any difference between any settings in /etc/default/grub or /etc/mkinitcpio.conf, with regular nvidia driver or nvidia-dkms. Neither between adding (nvidia nvidia_modeset etc...) in mkinitcpio.conf (modules), or having nvidia_drm.modeset=1 or not in cmdline. In all configurations with sddm service disabled I'm left in a low res tty.
lsmod | ack nvidia shows:

nvidia_drm             94208  47
nvidia_uvm           3211264  0
nvidia_modeset       1519616  19 nvidia_drm
nvidia              61693952  2053 nvidia_uvm,nvidia_modeset
video                  77824  1 nvidia_modeset

In all configurations I tried, in Ubuntu server as well, yet there I have a native res after OS load finished.

Offline

#8 2023-05-09 20:15:37

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

Ok so I managed to fix the "low res" state by adding

FONT=eurlatgr
FONT_MAP=8859-2

in /etc/vconsole.conf
There was only the KEYMAP part in it. Adding a font makes it look normal, like Ubuntu looks once it's finished loading. Dmesg messages also have the correct size.
Now, I'm not sure if what I was seeing before this mod was a low res screen or a native screen with huge fonts. Looking closely the "low res" screen fonts do look sharp, only very big compared to what I would expect for 2560x1440.
Now, after native screen GRUB there's that "loading ramdisk" screen which has "high res" screen then it drops low res when starting to load kernel, but immediately go "high res" as /etc/vconsole.conf get applied. And / password screen is "high res". But if I add "quiet" to cmdline then /etc/vconsole.conf fonts don't get applied before asking for / password, and I have this error showing up just above the password enter line:

setfont: KDFONTOP: Function not implemented

Once I input the password the /etc/vconsole.conf fonts get applied and boot continues "high res".
I'm looking to make a cleaner boot visual, trying to hide messages and have consistent native res throughout the boot process from start to end. Apart from the startup efi password low res, it seems like it should be possible. Although I do have like 5-6 screen flickers along the whole boot process.
Is it possible to get a more consistent experience using an AMD card? I might consider getting the cheapest that would support 2560x1440@144Hz (are RX400/RX500 series capable of that? I think DP1.4 is required for 144Hz@2K)

Offline

#9 2023-05-09 20:26:46

seth
Member
Registered: 2012-09-03
Posts: 38,710

Re: boot stages change resolution. how do I force the native one?

fbset -i

https://wiki.archlinux.org/title/Silent_boot

Rebuild the initramfs w/ the altered vconsole.conf to apply it early.

Online

#10 2023-05-09 21:11:28

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

Aparently there is a bug related to vconsole.conf not being applied with "quiet" in cmdline.
https://bugs.archlinux.org/task/78052

Offline

#11 2023-05-09 23:03:23

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

Using the solution in the comments which is replacing 'consolefont' and 'keymap' hooks with the 'sd-vconsole' hook seems to resolve that setfont: KDFONTOP: Function not implemented error.
Now I am able to use plymouth and the experience is way nicer. The full cmdline parameters I used:

"quiet splash loglevel=3 systemd.show_status=auto rd.udev.log_level=3 nvidia_drm.modeset=1 vga=current"

I was wondering, any way of going from GRUB menu straight to plymouth splash/password screen? There still seems to be a visible step with:

Loading Linux linux ...
Loading initial ramdisk ..."

And it stays there for a few seconds. Would be great to have a clean transition between GRUB menu and plymouth password screen.

Offline

#12 2023-05-10 05:41:05

seth
Member
Registered: 2012-09-03
Posts: 38,710

Re: boot stages change resolution. how do I force the native one?

Those messages are from grub and pre-loading plymouth.

grep -r Loading /etc/grub.d

Online

#13 2023-05-11 04:15:19

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

Good info seth, thank you!
Indeed there's an echo line in 10_linux that can be commented out:

echo   '$(echo "$message" | grub_quote)'

I think there's one line for each kernel in the list. I suppose this file gets overwritten at each GRUB update?

Now the boot sequence is very clean apart from the first /boot password from efi binary. I don't suppose there's any options relating to graphics for grub-mkimage?

Offline

#14 2023-05-11 06:37:44

seth
Member
Registered: 2012-09-03
Posts: 38,710

Re: boot stages change resolution. how do I force the native one?

I suppose this file gets overwritten at each GRUB update?

Yes.

I don't suppose there's any options relating to graphics for grub-mkimage?

https://wiki.archlinux.org/title/GRUB/T … figuration
https://wiki.archlinux.org/title/GRUB/T … early_boot
No idea whether you can make the theme show up at that stage, sorry.

Online

#15 2023-05-11 14:19:11

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

I did manage to force native resolution for the very first password screen, by making the grub image with this script:

#!/bin/bash

CONFIG=$(mktemp /tmp/grub-config.XXXXX)
cat >"$CONFIG" <<EOF

insmod all_video
set gfxmode=2560x1440x32
load_video
insmod gfxterm
terminal_output gfxterm
loadfont /EFI/Arch/unicode.pf2
insmod gfxterm_background
insmod png
background_image -m stretch /EFI/Arch/splash.png

cryptomount -u boot_drive_UUID
set prefix=(cryptouuid/boot_drive_UUID)/grub
set root=cryptouuid/boot_drive_UUID
insmod normal
normal
EOF

grub-mkimage \
    -p '(cryptouuid/boot_drive_UUID)/grub' \
    -O x86_64-efi \
    -c "$CONFIG" \
    -o /tmp/image \
    all_video terminal video_fb video gfxterm gfxterm_background png luks2 part_gpt ext2 cryptodisk gcry_rijndael gzio luks gcry_sha512

rm "$CONFIG"

It's not yet done as I'm trying to add a background image, and it throws two errors about not recognizing the UUID of the bootdrive, but it works if I input the password, it goes to GRUB menu next. I suspect those two identical errors are actually it not finding the two files I referenced, the font file and the splash png.
I'm not sure how I should link them in the script. With loaded OS they are in /efi/EFI/Arch/ next to grubx64.efi.
Anyone who knows their GRUB can chime in. Maybe more modules need to be loaded, maybe not all that I added need to be loaded.
At least I have native res but I'd love to force a splashscreen as well, maybe even center the input as plymouth does it (if possible).

edit: for images made with the above script you have to type your first password very slow, like one char per two seconds. similar to the grub menu, might have to do with the gfx stuff and memory.

Last edited by qu@rk (2023-05-11 14:31:50)

Offline

#16 2023-05-11 20:13:21

qu@rk
Member
Registered: 2021-07-28
Posts: 53

Re: boot stages change resolution. how do I force the native one?

I managed to set a background image as well but it seems GRUB does not do very well with high resolutions. With 2560x1440 it's input speed is seriously limited. And it's not lagging behind, it just drops the keyboard inputs.
So I managed to find a happy medium at about 1280x720 but setting it makes for the following GRUB menu to also be at 1280x720. The native resolution I set in /etc/default/grub does not seem to apply in GRUB menu.
I'd settle for the lower resolution but with custom background but if I'd be able to get the GRUB menu at native res. Moving around in it at native res is slow but I don't mind it. Text input is another matter.

The script I used to create the grub image is this:

#!/bin/bash
CONFIG=$(mktemp /tmp/grub-config.XXXXX)
cat >"$CONFIG" <<EOF

insmod efi_gop
set gfxmode=1280x720x32
insmod gfxterm
terminal_output gfxterm
insmod gfxterm_background
insmod png
insmod part_gpt
insmod part_msdos
insmod fat
background_image -m stretch (hd0,gpt1)/EFI/Arch/splash.png
loadfont (hd0,gpt1)/EFI/Arch/unicode.pf2

cryptomount -u boot_partition_UUID
set prefix=(cryptouuid/boot_partition_UUID)/grub
set root=cryptouuid/boot_partition_UUID
insmod normal
normal
EOF

grub-mkimage \
    -p '(cryptouuid/boot_partition_UUID)/grub' \
    -O x86_64-efi \
    -c "$CONFIG" \
    -o /tmp/image \
    fat part_msdos efi_gop terminal gfxterm gfxterm_background png luks2 part_gpt ext2 cryptodisk gcry_rijndael gzio luks gcry_sha512

rm "$CONFIG"

A few mentions, you need to copy the font file and splash.png to the efi partition where it can be accessed by GRUB pre-auth. Your (hd0,gpt1) partion name might vary depending on your partition/storage setup.
I only loaded the efi_gop driver which is the one that supports the video modes for me. If in doubt use all_video module instead.
So, any way of forcing the GRUB menu to native res?

Last edited by qu@rk (2023-05-11 20:14:43)

Offline

Board footer

Powered by FluxBB