+++ title = "FreeBSD Tips and Tricks" date = 2025-06-12 slug = "freebsd" +++ # GPU Drivers On June 10, 2025, the new FreeBSD 14.3 was released and I decided to try it out. After installing the OS from a USB stick on my bare-metal box (very smooth installation process by the way) I was greeted with the TTY login prompt. Using the built-in `pkg` package manager, I installed my favorite window manager, sway, which unfortunately failed to launch with a cryptic error message "No displays found". After looking in the very helpful [FreeBSD Handbook](https://docs.freebsd.org/en/books/handbook/x11/), it turned out that the GPU drivers weren't preinstalled in the OS, so I had to install them manually and add the respective kernel module to automatically load during boot. ``` pkg install drm-kmods sysrc kld_list+=i915kms # replace by amdgpu if using an AMD GPU ``` Unfortunately this was not enough, the system still wasn't able to start the graphics. After looking at the logs for some time, I found out that the version of the kernel modules responsible for the GPU drivers wasn't updated for the latest kernel revision yet. Fortunately, FreeBSD developers have a separate repository called `FreeBSD-kmods` with updated drivers so that I didn't need to compile the ports (BSD lingo for source-based packages) manually. However, this repository wasn't enabled by default, so I had to force the package manager to update from it. ``` pkg upgrade -r FreeBSD-kmods ``` This was enough to make sway launch (by using `seatd-launch sway`, as the post-install message from the `seatd` package mentioned) and fully use it to the best of its abilities. # (Wired) 802.1x authentication My university uses an `802.1x` authenticated network (both wired and wireless) on campus, in order to connect to it, I had to use `wpa_supplicant` with the following configuration (`/etc/wpa_supplicant.conf`) ``` network={ key_mgmt=WPA-EAP eap=PEAP phase1="peaplabel=0" phase2="auth=MSCHAPV2" identity="user@school.edu" password="password" } ``` After that it was enough to make sure that the wired interface (in my case `em0`) used the supplicant (`/etc/rc.conf`) and restart the network configuration service `netif`: ``` sysrc ifconfig_em0="WPA SYNCDHCP" # replace em0 by your interface name service netif restart ``` TODO: In the current state of things, certificates aren't checked during the connection process. It is a good idea # `i3status` not using colors This was merely a quality-of-life issue that for some reason `i3status` fails to detect that it should format its output for `swaybar` to parse it, therefore I had to force it in the config (`~/.config/i3status/config`) ``` general { colors = true interval = 5 output_format = "i3bar" } ``` # Wireguard Since FreeBSD 14, FreeBSD has excellent support for Wireguard VPNs. I just had to install the `wireguard-tools` package (`pkg install wireguard-tools`), copy my config to `/usr/local/etc/wireguard/` and add the following two lines to `/etc/rc.conf` to automatically configure the connection at boot: ``` wireguard_enable="YES" wireguard_interfaces="wg0" ```