# Unable to modify the screen resolution for console



## Pardub (Jan 25, 2021)

Hi,

I’m trying to decrease the screen resolution for the console on my laptop which has a default resolution 1920x1080 ( 12.5 ‘’) booting in UEFI.

At the end of the boot, I got a nice console very bright and clear but with it's very very small and makes the reading very complicated

After adding in the /boot/loader.conf the line `kern.vt.fb.default_mode="1280x720"` and proceeded a reboot, the fonts become bigger in the middle  of the booting stage,  with the “1280x720” screen resolution apparently set up. That console is not as bright as the one with the default settings.

But I have to press `Enter`many times to reach the end of the console as the automatic scrolling down doesn't go lower ( normally, at the end of the boot process ,we reach automatically the line with the login) .

I have to switch with `ALT F2` as I can’t see the login and password on this default console.

By toggling to the other terminals with `ALT F2,F3..F8`,I got the expected result  with the correct font size but why is it not the case with the default console we got during the boot process?

Also, following this link http://www.codenicer.com/content/configuring-default-resolution-freebsd-11-uefi , I added `mode 1` in the file I created /boot/loader.rc.local but it didn't change anything. 

If during the boot process I press `Escape`and enter `mode 1`, then `exit` to continue the boot process,I got the correct resolution for a few seconds but in the middle of the booting process, the screen is flashing and revert back to the original screen resolution 1980 x1080

How can I set up a lower screen resolution?

Some config files below:
pciconf   https://dpaste.com/CNRSX67XG
uname  https://dpaste.com/CLYCA86Q4
dmesg before modifying /boot/loader.conf https://dpaste.com/7LDSDHB3M 
/boot/loader.conf  before modification https://dpaste.com/G8LZRKCBY 

 dmesg after modifying /boot/loader.conf https://dpaste.com/2Z6V3842A
/boot/loader.conf after  modification https://dpaste.com/2DGGBHYUM 
kldstat before /boot/loader.conf modification  https://dpaste.com/BYW4NWSDB
kldstat after /boot/loader.conf modification https://dpaste.com/GHPE5CVA2



Thank you for your help!


----------



## chrbr (Jan 25, 2021)

You can do that by setting efi_max_resolution in /boot/loader.conf. Please see loader.conf(5) for details.


----------



## Pardub (Jan 25, 2021)

if I comment out the line #efi_max_resolution="1280x720" in /boot/loader.conf, the screen has the resolution 800x600 at the beginning.

in `dmesg`,when appears the line "loading kernel module", the screen resolution reverts back to 1980x1020 at this stage.


----------



## memreflect (Jan 26, 2021)

Pardub said:


> in `dmesg`,when appears the line "loading kernel module", the screen resolution reverts back to 1980x1020 at this stage.


efi_max_resolution is for the UEFI framebuffer (before display driver modules are loaded).
kern.vt.fb.default_mode is what gets used once the UEFI framebuffer is not active (e.g. when a new display driver module is loaded).

Below are the first two lines in my loader.conf(5), so my console resolution boots at 1024x768 and my console resolution remains 1024x768 when the i915kms.ko module for my display driver is loaded.  Otherwise, one or the other will default to 1920x1080, and I'll have a console with tiny text:

```
efi_max_resolution="1024x768"
kern.vt.fb.default_mode="1024x768"
```


----------



## Pardub (Jan 26, 2021)

Thank you!
It seems it’s working in that way with /boot/loader.conf containing the lines:


```
efi_max_resolution="1280x720"
kern.vt.fb.default_mode="1280x720"
```
I noticed with those settings, once the boot reached the prompt with the FreeBSD menu and the logo,if I press `Escape` and “`?`” ,I’m now unable to visualize the different options .

I just got the line “available commands” but there is no display below that last line and I have to perform a hard reboot to restart the laptop as the keyboard is unresponsive.

I still can get access to the single user mode if I press “2” during the boot menu in case if I need.


----------



## memreflect (Jan 26, 2021)

Pardub said:


> I noticed with those settings, once the boot reached the prompt with the FreeBSD menu and the logo,if I press `Escape` and “`?`” ,I’m now unable to visualize the different options .
> 
> I just got the line “available commands” but there is no display below that last line and I have to perform a hard reboot to restart the laptop as the keyboard is unresponsive.
> 
> I still can get access to the single user mode if I press “2” during the boot menu in case if I need.


I think I have noticed the same problem you encountered.  Pressing `Escape` will allow you to enter bootloader commands, which is expected.  However, maybe the output goes beyond the end of the screen, or you can't even see any output.

There are a few commands you might be interested in:

`gop list` - list graphical modes
`gop set N` - set the graphical mode to _N_
`mode` - list text modes
`mode N` - set the text mode to _N_
`efi-autoresizecons` - automatically resize the EFI framebuffer console; will reset screen mode to `efi_max_resolution`, but that sometimes fixes my problem?
The information in vt(4) regarding `hw.vga.textmode` explains that some features are not available in text mode like loadable fonts, which is why I listed the graphical commands first.


----------



## Pardub (Jan 26, 2021)

Thank you for the information!

If I do `gop set 0` or `gop set 01` then the laptop freeze .I cannot entered any command. No action can be made from the keyboad. I have to make a hard reboot.

Adding `exec="gop set 1"` in boot/loader.conf as per information in https://forums.freebsd.org/threads/...t-loader-rc-local-at-boot-manual-works.71225/ reset the first part of the booting to the screen resolution 800x600 with the same problem by not being capable to visualize the bootloader commands.

`hw.vga.textmode="1"` in /boot/loader.conf keeps the resolution 1920x1080 up to the bootloader commands  which would be acceptable as I can have access to the bootloader commands even if it's very small but then the second part of the boot process which has a nice  resolution 1280x720 but I cannot see the output at the end of the boot process.

With that setup 

```
efi_max_resolution="1280x720"
kern.vt.fb.default_mode="1280x720"
```
I cannot see the bootloader commands during the first stage of the boot process but the last line of the boot process with the login can be displayed.

With that  other setup 

```
efi_max_resolution="1920x1080"
kern.vt.fb.default_mode="1280x720"
```
I can see the commands during the first stage of the boot process but the output at the bottom of the final stage of the boot process with the login cannot be displayed...

I decided to keep the settings below  at the moment as I need to find a compromise.


```
efi_max_resolution="1280x720"
kern.vt.fb.default_mode="1280x720"
```

I hope it wasn't too confusing....

FreeBSD is time consuming actually  ))



Thank you for the help!


----------



## Mjölnir (Jan 26, 2021)

Be patient, it takes some time to complete that puzzle.  The advantage is that you gain a fairly good understanding of how the pieces fit together.

Tricks like `exec="dont do this"` in loader.conf(5) are only needed in rare circumstances.
`efi_max_resolution="720p"` or `efi_max_resolution="480p"` set
1280x720 or 640x480, resp., so the boot menu is reasonably large and readable.
Now the following applies when the vt(4) console/terminal driver takes over after the loader(8): `kern.vt.fb.default_mode="XxY"` in loader.conf(5) is the *fallback* resolution.  It applies to all devices, internal & external, that are not set explicitely.  You should set it to a resolution that works for all display devices you might connect, or not set it at all.  It's much safer to fetch the connector names from the boot messages, and set the desired resolution for the specific connector: `fgrep kern.vt.fb.modes /var/run/dmesg.boot`.  eDP-1 or LVDS is the laptop internal screen.  So please instead set `kern.vt.fb.modes.eDP-1` or `kern.vt.fb.modes.LVDS` to the desired resolution for the console.  Then you can safely remove `hw.vga.textmode="1"` or set it to `"0"`, which is the default anyway.
You can scroll the console text back & forth by activating SCROLL LOCK (on newer Lenovo Laptops: Fn+K, for other brands: consult the manual) and then use the PgUp & PgDown or arrow keys.  Press SCRLK again to deactivate scrolling mode.
`kern.consmsgbuf_size="16384" # default: 8192` increases the console's text buffer.  All the above were settings in loader.conf(5).
On modern high resolution displays, you may want to use a large font: e.g. `sysrc allscreens_flags="-f gallant"` will add that to rc.conf(5).
Standard disclaimer:

install the docs:`pkg install {de,en}-freebsd-doc`, replace `de` with your native tongue, and point your favorite browser to /usr/local/share/doc/freebsd.
You may want to add `message: "query '[%C/%n] %M'",` to the `ALIAS` section of /usr/local/etc/pkg.conf, then read through all `pkg message|less` and *apply the requested settings*.
Instead of less(1), you may find sysutils/most more user-friendly.  Beginners will prefer edit(1) (ee(1)), editors/aee or editors/nano instead of the old-school, UNIX'ish vi(1).
The utilities sysutils/psearch or sysutils/portfind will help you to find available software in the ports(7) tree.
ports-mgmt/octopkg is a user-friendly graphical frontend to the pkg(8) package manager.  It uses the Qt toolkit and runs on every DE.  AFAIK there is no Gtk-based counterpart.
Use sysrc(8) to safely edit system rc(8) files instead of editing rc.conf(5).  It does some checks to prevent typos, and allows for advanced tricks like `sysrc moused_flags+=" -l 2"` (note the space).


----------



## Pardub (Jan 27, 2021)

Thank you so  so much for all these valuable information and tips!I really do appreciate.
I will study all that this evening ans trying to apply them as much as I can.


----------

