0

Background

I come from using Gentoo, the source based distribution. With that in mind, and 4 hard drives in my PC, I decided to experiment, and possibly switch to FreeBSD. I'm writing this question from:

OS Specs

% cat /etc/os-release 
NAME=FreeBSD
VERSION=12.2-RELEASE-p3
VERSION_ID=12.2
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 12.2-RELEASE-p3"
>snip<

Running the KDE-5 version in the ports tree, and synth as a package manager

Issue

Having installed all of the above properly, I'm in the process of fine tuning items. I'm very comfortable editing config files, as that's the main mechanism in Gentoo. I've run into an issue that I finally can't solve on my own, mainly because the FreeBSD documentation is woefully outdated. See: Bug 235040 - Lua-based loader(8) does not pick up /boot/loader.rc.local


Questions

  1. Making loader.efi point back to loader_4th.efi fixes the issue.

Is this just a symbolic link. I wanted to know before I create it, because there are no links in the list

# ls -al /boot/loader*
-r-xr-xr-x  3 root  wheel  372736 Jan  3 18:40 /boot/loader
-r-xr-xr-x  1 root  wheel  327680 Jan  3 18:40 /boot/loader_4th
-r-xr-xr-x  1 root  wheel  428032 Jan  3 18:40 /boot/loader_4th.efi
-r-xr-xr-x  1 root  wheel  327680 Nov 28 17:18 /boot/loader_4th.old
-r-xr-xr-x  3 root  wheel  372736 Jan  3 18:40 /boot/loader_lua
-r-xr-xr-x  2 root  wheel  490496 Jan  3 18:40 /boot/loader_lua.efi
-r-xr-xr-x  1 root  wheel  372736 Nov 28 17:18 /boot/loader_lua.old
-r-xr-xr-x  1 root  wheel  278528 Jan  3 18:40 /boot/loader_simp
-r-xr-xr-x  1 root  wheel  367616 Jan  3 18:40 /boot/loader_simp.efi
-r-xr-xr-x  1 root  wheel  278528 Nov 28 17:18 /boot/loader_simp.old
-r--r--r--  1 root  wheel    7492 Jan  3 18:40 /boot/loader.4th
-rw-r--r--  1 root  wheel     179 Feb 26 18:23 /boot/loader.conf
-r-xr-xr-x  2 root  wheel  490496 Jan  3 18:40 /boot/loader.efi
-r--r--r--  1 root  wheel     468 Jan  3 18:40 /boot/loader.rc
-rw-r--r--  1 root  wheel      28 Feb 27 16:18 /boot/loader.rc.local
  1. Would switching from 12.2-RELEASE to 12.2-STABLE help? I can't tell because no Google results come up, other than how to switch branches

I'm using the nvidia-driver blob from x11/nvidia-driver(There are no KMS options for this driver, due to no DRM kernel module) on a:

device     = GP107 [GeForce GTX 1050 Ti] 

Half Solution/Aggravation

If I boot to a UEFI Shell and use the mode command, the FreeBSD loader will be properly displayed. I can also choose option 3 after the loader loads (at the wrong resolution) to Escape to the loader prompt and use gop set, but I must use either option at each reboot, because my system defaults to 1024x768. Is there a way to force the UEFI to default to the new setting permanently?

1
  • @Rob Before you comment, please read the question thoroughly. 1. I CANNOT INSTALL drm-kmod because the nvidia driver has no drm module, and 2. Everything is built from source because I use Synth for FreeBSD, which compiles every package, not in buildworld from source, and saves the package in a local repo and installs the compiled packages using that local repo. I included what I just told you in the question itself, and it's OK to ask muultiple Questions in one post, as all of the questions are related to the issue
    – eyoung100
    Commented Feb 28, 2021 at 18:42

2 Answers 2

1

I actually read the question as thoroughly as I could. 3 times. And I get more confused for each read.

You spend time describing your setup. But what is your actual root issue? Why do you insist on doing it in this way? Why do you interpret the bug report like this? (I intepret it differently). The documentation is actually not that bad but I do agree that it should be much better in some crucial key places. But we seem to be chasing a different rabbit.

I do not run Gentoo so the "OS Specs" is alien to me (I would expect uname -a). There are many ways to boot a system but you seem to be quite far a long so we do not need to dive too deep there.

But FreeBSD is in the transition phase of moving from a loader based on Forth to one based on Lua. FreeBSD has been using the Forth loader for many years so many will reference it. The Lua loader was introduced in 11 and made default in 12. See LUA loader on by default

And again because it has been used for so long some Forthism has crept into /boot/loader.rc.local. This is what Kyle Evans and Warner Losh tries to explain further down in the bug report you reference.

On a modern FreeBSD system you should not tamper with /boot/loader.rc.local. It is there for legacy reasons. it will only be read by the Forth loader and not the Lua loader.

I want my Forth!

If I understand correctly you build everything from source including FreeBSD itself. In that case you can edit /etc/src.conf and set:

WITH_FORTH="yes"
WITHOUT_LUA="yes"

This then choose what loader you use.

The modern way

The proper way to change loader settings for years have been using loader.conf(5). This file is read and parsed by both loaders.

You just need to connect the dots between your "Half Solution" and Bug 235040

Edit /boot/loader.conf (which is "user defined") and add something along the lines of:

exec="gop set 0"
exec="gop set 2"

/boot/loader.conf.local work the same but is intended for machine specific settings for sites with a common loader.conf

You can write your own Lua scripts as you could Forth but it is not intended for common usage.

Default resolution

You write that your resolution defaults to 1024x768. Rather than using gop set you might be able to use efi_max_resolution (again loader.conf(5)).

Value        Resolution
480p         640x480
720p         1280x720
1080p        1920x1080
2160p        3840x2160
4k           3840x2160
5k           5120x2880
WidthxHeight WidthxHeight

So in /boot/loader.conf you could try:

efi_max_resolution="1080p"

Nvidia driver

Again it is unclear precisely what problems you have. You state you are using x11/nvidia-driver. This is only relevant for X11. During boot the vt(4) console driver should start. When doing a BIOS boot it will switch to 640x480x16 if you have no KMS driver (like you). With UEFI I would assume it keeps the resolution as it has already switched from textmode to graphics mode.

The driver will then only be used when starting X11. No config should be needed as it should be autodetected. This should either send you into a graphical login manager like Slim or directly to the desktop.

Switching between RELEASE and STABLE

If you want to live a little more frisky lifestyle then your can switch to STABLE. Or go completely wild with CURRENT. But if I have understood your issue then it would not make any difference.

24.4. Tracking a Development Branch

What's the difference between the three FreeBSD versions? (Current, Release and Stable)

1
  • Thank you for the nudge in the right direction. Please see my answer below for how I solved this finally
    – eyoung100
    Commented Mar 4, 2021 at 4:24
0

Issue

I had found most of the items @Claus Anderson referred to in old posts on the FreeBSD forums, but no matter what setting I fiddled with my efifb(VT) resolution was stuck at 1024x768. This was unacceptable to me because I prefer to use a console instead of a GUI Terminal (Alt + Fn vs. Konsole). Because this is only a personal preference, I kept digging and finally have the solution, in case it can help other readers/visitors.

Solution

My PC was custom built by an OEM and contains a MSI Z270-A PRO. When I started installing multiple OS's, I used the UEFI Setup Utility and turned off UEFI Only mode, referred to in the utility's boot settings menu as UEFI + Legacy but better known as CSM, and over time completely migrated all my installs to UEFI only.

Turns out enabling CSM disables something called Windows 8.1/10 WHQL Support, for this motherboard, which was still disabled even after I migrated all my OS'es. See photo below:

[MSI WHQL Settings

Disabling this option, even with Pure UEFI enabled in the boot settings, disables access to the bottom 2 options seen in the photo above:

  1. Internal GOP Configuration
  2. Secure Boot

While I don't use Secure Boot (personal preference), I did figure out after tinkering with multiple variations that if access to the GOP Configuration is Disabled, any OS or EFI stub that boots is stuck at the base resolution of 1024x768. In other words, without the WHQL Support turned on, the GOP Setting is marked as read-only in the NVRAM even for OS'es that aren't related to Windows. Why this is I don't know as WHQL is meant to provide driver security in Windows only by ensuring that the installed drivers are digitally signed and have undergone QC testing. Why that testing would need to be on for a resolution change for an OS that isn't Windows is unknown to me.


That meant that no matter what setting I passed the FreeBSD loader, I always got a screen size of 1024x768 on a monitor that supports a native resolution of 1920x1080/1080p @ 60Hz, unless I used the boot loader option 3, which occurs after the UEFI finishes booting into rEFInd, and the NVRAM gets marked read/write.

I now have exec mode 0 in boot/loader.conf with Windows 8.1/10 WHQL Support turned on, and have a native console resolution of 1080p. As a side effect of setting this up properly, rEFInd also boots into a native resolution.

Things I Attempted Before Finding the Above Solution

I don't recommend these, but I'll list them here for completeness sake

  1. Updated my Video Card's Firmware, same model and OEM, but a newer version.
  2. Updated my GOP Protocol, thinking my Video Card Firmware was buggy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .