Installing & Using FreeBSD On A Laptop

Posted on

Note to self: this is more like my personal install notes and stuff rather that an actual guide.

Hey everyone! Archie here! So I recently upgraded my wifi card to the intel ax210, and i've been wanting to use FreeBSD since like forever, but oh god i have had some trashy laptops, ughhh!!!!!!!! and then, the damn MediaTek MT7902 didn't let me, but now i finally upgraded my wifi and installed FreeBSD!!!! and yeah.

In The Beginning...

As you might know, I now use FreeBSD. Why? I don't know, maybe to tinker with it and stuff. But if there's one thing I'm sure of, it's that i've been wanting to install and use FreeBSD since sooo damnnnnnnnnn longgggggg aaaaaaaaaaaa!!!!!

Now i have the hardware and stuff, and ughhhhhhh let's start before zfs decides to go berzerk, eat all my RAM and trip over itself!!!!!!!

Obtaining FreeBSD

First you want to grab the iso file for whatever version of FreeBSD you wanna install from its official website.

in my particular case i chose the latest version (15.0-RELEASE at the time of writing this). Then, on my Arch Linux install (yea i used to use arch btw), i backed my data to google drive (i don't like corporations but i trust google enough, so), and wrote the iso with dd. Your standard/usual sudo dd command and stuff.

Then, with the USB drive still plugged in, I restarted my laptop, and i had to enter its UEFI menu, that was done with F2. Then i put the USB drive at the top of boot priority and clicked "exit saving changes" (guardar y salir). Then I was presented with the FreeBSD installer boot menu.

The Installation (lmao why does it sound like Quake's E2M1????????)

The install process for FreeBSD is fairly easy to say the least, it's just a menu that guides you on hostname, root password, users, firmware files (if any), wifi connection and stuff like that. I chose to install the distribution sets so i can upgrade freebsd with the freebsd-update command. Then, drive partitioning, and other choices. For my hostname i chose "archie-laptop" as it's my laptop, lol. Then i installed the firmware and stuff, connected to my Wi-Fi access point, and i chose ZFS as the default file system for my NVMe drive, which is called /dev/nda0, because I love tinkering with snapshots and datasets and all kinds of cool stuff. One quirk i noticed is that if i were to choose UFS (Unix File System), the loader(8) config file, which is located at /boot/loader.conf was gonna be empty, and I like to have some stuff added, like efi_max_resolution="1920x1080x32" for the EFI framebuffer's screen resolution, for example. The main (and only) issue with ZFS as main filesystem is that it consumes a lot of battery and RAM </3.

That process was easier than the windows eleven installer, lmao

Initial System Configuration

Once i rebooted my laptop, i unplugged my USB drive, and i let loader(8) load my kernel, and i logged in as root on the system console.

I tested the network with ping, and I was already connected.

Now there's two ways of installing stuff here in FreeBSD: the ports collection and pkg. The ports collection is managed with git, and it consists on some makefiles and patches and stuff put together to compile programs from their source code, but the thingg here is, i don't wanna wait nineteen hours waiting for stuff to compile, soooooooooooo i obviouslyy chose pkg, though ports are cool af!!!!!!!!!!!

pkg is a tool that fetches and installs pre-compiled packages from the official FreeBSD repositories.

Well, we're not done here, there's a bit of stuff i needed to do.

First, I installed sudo from the official FreeBSD repositories:

pkg install sudo

then edited /usr/local/etc/sudoers, and I configured what commands my user can run (all commands), and that it always asks me for a password (yea i am that paranoid lmao)

Wireless Networking On FreeBSD

My intel ax210ngw wifi card is supported via the iwlwifi(4) kernel driver which in itself is ported from the linux kernel source tree, but the speeds that it supports are all from ancient standards, 802.11a/g, both from 1999 and 2003...

Now let's get the wifi to persist across reboots. I logged in as my user, opened /etc/rc.conf and put this line in it:

wlans_iwlwifi0="wlan0"

to create the wlan0 interface, and:

ifconfig_wlan0="WPA SYNCDHCP"

to configure wlan0 to use WPA and DHCP.

And this last line, to enable the IPv6 autoconfiguration, though i probably don't need it, but idk, just in case...

ifconfig_wlan0_ipv6="inet6 accept_rtadv"

But the state of the Wi-Fi in FreeBSD is a mess!!!!!!!!! For instance, i'm using 802.11a, and that predates my birth!!!!! For reference, i was born on late 2005 (i'm 20yo) and 802.11a is from 1999, and the download speeds are soooo damnnn slowwwww!!!!!! i'm getting 3.4mb/s (27.2mbps) while downloading a 1 gb iso file on the 5GHz band. actually quite not, i somewhat improved the speeds by changing the regdomain to ETSI/UY. But, ohh myyyy!!!!!

Well, enough of Archie bitching about the state of the wifi. Let's get FreeBSD to actually render some graphics!!!!!

My iGPU Kernel Driver

The resolution and stuff were a little ugly, so to fix that, I installed my iGPU kernel driver. My iGPU is called Intel UHD graphics, from the 13th gen intel core i3-1315u processor.

So the package i needed to install was drm-kmod, and then go into rc.conf again to load the correct kernel driver.

sudo pkg install drm-kmod

Then, i edited /etc/rc.conf, to include the line that loads my iGPU kernel driver.

kld_list="i915kms"

Then, I added myself to the video group and did a reboot. The screen flashed off and then back on during boot which means I had correctly installed my iGPU kernel driver!!!!!!!!! Yaaaayyyyy!!!!!! Now we have working graphics!!

Xorg, i3 And Stuff

I can do stuff from the tty, it's great and all, but I rather have some usable graphical environment.

I chose to install X11 along with the i3 window manager and some other programs that I use.

sudo pkg install xorg i3 i3status picom alacritty rofi firefox dbus

Then, I added this to /etc/rc.conf.

dbus_enable="YES"

to enable D-Bus (because some programs require it).

Once I restarted, I created the .xinitrc file, containing this.


setxkbmap es
exec dbus-run-session /usr/local/bin/i3

Then, I configured the default shell (tcsh) to run startx automatically on ttyv0 (the first system console).


if ($tty == ttyv0) then
    exec startx
endif

The exec command replaces whatever your shell process is (in my case, tcsh) with the process you specify it.

And then, I configured the missing pieces: status bar, compositor, wallpaper, creating a nice theme... and there you have it: FreeBSD on a laptop. It works well, but ughhhhhhhhhhhhhhhhhhhhhhhhh I'm currently having some issues with bhyve (the BSD hypervisor) regarding networking and stuff, but I'm gonna get it fixed by myself!!!!!!!!!! Actuallyyyy that's no moreeeee!!!!!!! I solved it by installing and configuring dnsmasq by myself.

Actually Using FreeBSD

Now that I have FreeBSD installed, let's get to actually using it. Using it isn't really that hard and I encourage you to use it if you can (and have compatible hardware), so...

Underlying Graphical System

I don't really care, nor I don't understand the hype around the "trend" involving wayland, for me it's basically the sameeeee!!!!!!!!!!!!!! plus wayland is so glitchy i swear!!!! Soooooo????? I will use X11!!!!! It's not insecure, I don't really know of anyone that had been hacked while using X11, that's straight up ridiculous.

Window Manager

I use i3 as my main window manager. I'm used to it, it's simple, I already have it customized to my liking and i love how it looks.

Terminal Emulator

FreeBSD is Unix-based, which means that the majority of the standard commands (chown, chmod, ls, mv, rm, and so) are available. It can (and should at the very least, for admin and such) be used via the terminal. Now, my laptop doesn't have an rj45 (ethernet) port, anddddd i have the sshd service disabled!!!!!!!! So i can't really use sshd to access it remotely. And another thing: i'm using a tiling window manager, so i can't really do much even if i managed to get remote desktop working via my phone. For command line access and stuff, I use Alacritty. Plus it's actively using my iGPU kernel driver to render stuff, which makes it incredibly fast.

Program Launcher & Web

For a program launcher i usually use rofi as it's extremely popular among i3 users, and for web browsing I use firefox. I installed it just fine, logged into my accounts (Mozilla acc and google and stuff) and it just works. It's a web browser at the end, soo? I have a black and red theme on it, and an ad blocker to keep the slop off my laptop. It works great for me, and idk.

Note Taking & School Stuff

Now i needed a program for note taking, and what better program for that than the vim text editor? it gets the job done really quick, and i can do normal txt files, markdown, groff (i use groff a lot for school) and all kinds of text, including configs (vim gets really handy for configs).

Music

For music i just use mpd (musicpd package on FreeBSD), the ncmpcpp ncurses frontend and stuff.

Virtualization

I use VM's a lot, and i used to use virtualbox, but it breaks a lot with updates and custom kernels (and i have my custom kernel running, too). Thankfully, FreeBSD includes a native hypervisor called bhyve (pronounced as "beehive" in English), and it's simple to use. It supports Windows, GNU/Linux, FreeBSD, and other operating systems as guests.

I have to create the VM directories, define them on rc.conf, load the vmm (virtual machine monitor) kernel driver and install bhyve, the vm-bhyve console frontend, the edk2 uefi firmware, configure the vm via a text file and stuff. I connect to my VM's either with "vm console" or via VNC (though it's painful to use it due to the llvmpipe renderer).

Networking on a bhyve VM can be challenging due to bhyve not having a DHCP server, but you can install and configure dnsmasq to give your VM's an IP address on a NAT, as bridging a vm to your wifi interface is not supported. Then you have to enable IP forwarding and configure the pf firewall to allow traffic to pass to the VM's NAT interface.

Mail

For mail i use the aerc terminal client with my gmail acc using an app password. It's simple to configure it, it even has a guided menu for that.

Games & Misc

There has been some reports of Grand Theft Auto: San Andreas working on FreeBSD, but I haven't tried it. What I tried (and it works) is compiling re3 (a native port of Grand Theft Auto 3) and it works flawlessly. I have yet to try and get The Ultimate Doom and Quake 1, 2 and 3 up and running.

Once you get past the initial system configuration it just works, and it feels like using any other open source unix-like operating system. It has everything that I use daily, so it works for me. And everything I installed was just the programs that I used on GNU/Linux like terminals, shells and stuff. I use only open source software, so I don't have any problems whatsoever.

I've had a great experience using FreeBSD, but bhyve doesn't have 3d acceleration, requiring GPU passthrough. And i only have my UHD graphics. but yeah, it's just another free operating system!!!!!!

Hope it has been useful (though this is kinda like idk, install notes for myself), but yea, see ya next time, take care, much luv!

Go back to the blog's main index.