michal-sapka-me

Codebase for my homepage.
git clone git://vcs.sapka.me/michal-sapka-me
Log | Files | Refs

commit 6f61947ffc15209ff8c27b15f318caf4ae6b3df5
parent 9cace0982a14f4c8a83371c7edf2b2acfa3843cb
Author: Michał M. Sapka <michal@sapka.me>
Date:   Sat,  4 Mar 2023 00:33:43 +0100

feat: article for 2023-03-04

Diffstat:
Acontent/2023/freebsd-configuring-nvidia-and-xorg-on-thinkpad-x1-extreme-g2.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcontent/2023/freebsd-on-thinkpad-x1-extreme-g2.md | 3++-
2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/content/2023/freebsd-configuring-nvidia-and-xorg-on-thinkpad-x1-extreme-g2.md b/content/2023/freebsd-configuring-nvidia-and-xorg-on-thinkpad-x1-extreme-g2.md @@ -0,0 +1,73 @@ +--- +title: "FreeBSD: configuring NVIDIA and Xorg on Thinkpad X1 Extreme G2" +category: "software" +abstract: A tutorial for making Nvidia work on FreeBSD +date: 2023-03-04T04:40:17+01:00 +year: 2023 +draft: false +tags: +- FreeBSD +- NVIDIA +- XOrg +- tutorial +--- +First, the bad news: I could not make FreeBSD work with Hybrid Graphics, so I use only the discrete one. To ensure this, open BIOS and + +Configuration +Display +Graphics Device +select `Discrete Graphics` + +Then, log in as root and install the drivers: + +``` +# pkg install nvidia-driver nvidia-xconfig +``` + +The next step is to enable the drivers. + +``` +# sysrc kld_list+=nvidia +# sysrc kld_list+=nvidia-modeset +``` + +Some people advise adding Linux (`# sysrc kld_list+=linux`) to kld_list, but I got my GPU working without that. + +After that, either load the drivers manually or give the computer an old, good reboot. + +Login as root again and use the NVIDIA configurator to get Xorg configured. + +``` +# nvidia-xconfig +``` + +Then try starting your desktop environment, windows manager, or startx. You may be done, but I got an error about `Screen not found`. Tell Xorg where the NVIDIA GPU is if you have the same problem. Try probing the system for GPUs + +``` +# pciconf -l | grep vga +``` + +You will see one on more elements on the list. The critical part is in the first column, for example: + +``` +vgapci0@pci0:1:0:0 +``` + +Our GPU is available under BUS 1:0:0 (we skip the first 0). You may need to try different elements from the list. + +> For PCI/AGP cards, the bus−id string has the form PCI:bus:device:function (e.g., “PCI:1:0:0” might be appropriate for an AGP card). +> +> [xorg documentation](https://www.x.org/releases/X11R7.7/doc/man/man5/xorg.conf.5.xhtml#heading10) + +Open `/etc/X11/xorg.conf`, look for `Section "Device"` and add: + +``` +BusID "PCI:1:0:0" +``` + +For me everything worked fine after that. + +References: + +[Nude Systems](https://nudesystems.com/how-to-fix-no-screen-found-xorg-error-on-freebsd/) + diff --git a/content/2023/freebsd-on-thinkpad-x1-extreme-g2.md b/content/2023/freebsd-on-thinkpad-x1-extreme-g2.md @@ -26,7 +26,7 @@ Many things worked out of the box, but not all of them. ### Hardware -Setting X-Org was a breeze. Nvidia drivers are [available and ready to go](https://docs.freebsd.org/en/books/handbook/x11/#x-configuration-nvidia); no additional configuration is necessary. +Setting X-Org was a breeze. Nvidia drivers are [available and ready to go](https://docs.freebsd.org/en/books/handbook/x11/#x-configuration-nvidia); no additional configuration is necessary. (*[update: I was wrong, but it is fixed now](#updates)*) Sound, of all things, work out of the box. Unfortunately, it doesn't auto-switch to headphone output, but there is [a known way to do this](https://freebsdfoundation.org/freebsd-project/resourcesold/audio-on-freebsd/) via device hints. @@ -58,3 +58,4 @@ For personal servers, however, I see no way of abandoning BSD. ### Updates - 2023-02-27: [Fixing resume](/2023/fixing-resume-on-thinkpad-x1-extreme-g2-on-freebsd/) +- 2023-02-04: [Configuring NVIDIA](/2023/freebsd-configuring-nvidia-and-xorg-on-thinkpad-x1-extreme-g2/)