FreeBSD

Introduction

I had been using PC-BSD to stay somewhat familiar with BSDs. They are now no more. So off to FreeBSD land I go. :-)

BTW, if you are thinking of making a go of FreeBSD, either make sure your wired/wireless NIC is supported or get a supported USB dongle (wired or wireless).

Quick Reference

  • CTRL-ALT-F# works in BSD, CTRL-ALT-F9 is the GUI (at least with XDM, ttyv8)

  • sudo pkg update && sudo pkg upgrade

  • sudo portsnap fetch update (link)

  • pkg version -l "<" (to list outdated ports)

  • pkg info --pkg-message <portname> (messages after install are important in FreeBSD!!!)

Installation Notes

FreeBSD expects you to do a lot on your own. They do a good job of coaching folks through the base installation in their Handbook. One will probably want to do some research for things they do not understand extremely well. For instance, I initially choose the "sh" shell, but changed it to "csh" because it is used by root and (I think) the more common shell on FreeBSD. I'd also do research for supported hardware and save yourself some time.

Another thing I want to stress is reading the information after each install. Those comments are not in the FreeBSD book and often not other websites (e.g. https://www.freshports.org/, https://wiki.freebsd.org/).

For those continuing below, follow the links, there is additional information beyond just running the command.

Not Yet Everything

After the base install there are a few more things I consider installation steps to get a "usual" desktop environment. Be careful what is run as root; many commands are, but not the .xsession. Also, don't reboot until the end. This all assumes a working NIC.

  • Setup portsnap, that is at least what I've been using. And wow, the extract takes a long time on older machines (single/dual core, no ssd).

  • pw group mod operator -m <username> (This lets the user run shutdown -r now or shutdown -p now.)

  • pkg install git nano sudo (No flame wars please. For sudo, many folks use the wheel group or the operator group is used below.)

  • nano -w /usr/local/etc/sudoers (Uncomment which ever line you are most comfortable with, note that the pkg does not create the sudo group.)

  • pkg install xorg (link)

  • pkg install urwfonts (link)

  • pkg install xdm (link, This login manager gets you going, I actually settled on slim.)

  • pkg install xfce (link)

  • pkg install xfce4-power-manager xfce4-battery-plugin (Especially for laptops.)

  • pkg install xfce4-pulseaudio-plugin (To get an icon for sound in the panel.)

  • pkg install networkmgr (For both wifi and wired.)

  • pkg info -D xfce4-session (Copy which ever rule is more appropriate. For those who have tiny screens on laptops, look below.)

  • nano -w /usr/local/etc/polkit-1/rules.d/shutdown.rules

  • Paste in what you copied above, just don't forget to change PUTYOURGROUPHERE to be operator (unless you want wheel or something different).

  • pciconf -lv (This can be used to find your graphics card. If you have nvidia, I prefer to finish the setup with the nv driver. Then do the proprietary driver later, see below.)

  • Now reboot (Really, don't do this until now. If you did, CTRL-ALT-F# works in BSD)

  • I like working in a GUI, so that is why I left video drivers until now. Look below for NVIDIA, it can be a bear depending on your card. For other cards, check out the graphics wiki section; it has lots more information then the FreeBSD Handbook.

Below are your (as of 4/19/2020) options for xfce4-session. The first is generic rules:

polkit.addRule(function(action, subject) {

if ((action.id == "org.freedesktop.consolekit.system.restart" ||

action.id == "org.freedesktop.consolekit.system.stop")

&& subject.isInGroup("operator")) {

return polkit.Result.YES;

}

});

and for those who have working suspend/resume add in addition to the above:

polkit.addRule(function(action, subject) {

if (action.id == "org.freedesktop.consolekit.system.suspend" ||

&& subject.isInGroup("operator")) {

return polkit.Result.YES;

}

});

Troubleshooting

Stuff doesn't always go as planned. I've done this on a few laptops, and found some of the below useful:

  • If you have troubles with wifi, check out /boot/loader.conf and /etc/rc.conf for the proper entries. Finding out what is appropriate is sometimes hard to find. ;-) BTW I have 2 laptops with Broadcom wireless cards. I just gave up on them, and moved some cards around for the one laptop I'm keeping FreeBSD.

  • My sounds cards have all been found automatically, but check here. You can also create something like blah.txt file with garbage in it and then cat blah.txt > /dev/dsp to test the sound card.

NVIDIA Drivers

Depending on what your "regular" use is, FreeBSD might be fine without NVIDIA drivers. I've seriously considered that on an old laptop that has an old GeForce G72M; which is listed as "Quadro NVS 110M/GeForce Go 7300" via the pciconf -lv command. And I've scoured posts, but I could never get any driver to load. But I have accumulated a bit of information. That is all below.

First, how do you clean up packages?

  • pkg delete <packagename> (This is not so useful as most NVIDIA packages are ports, not packages.)

  • cd /usr/ports/<path to port>/ && make deinstall (This will remove the port that you installed.)

  • rm -f /etc/X11/xorg.conf /usr/local/etc/X11/xorg.conf (Switching between driver versions might require clearing out old stuff.)

In /usr/ports/, there are a few packages; there are no pkg because of licensing issues. Some folks have said to go to NVIDIA's website to see what driver they suggest. Two observations. First, that page doesn't list FreeBSD. Second, if I choose Linux, look at number and "round down" to version supported for FreeBSD, that driver doesn't always work. It's a good place to start, but you may need to keep downgrading or adjust options.

The places of configuration are below. The first is the one that enables the use of the driver. Remove/move the file to disable using it. Also, the path is mixed up in some tutorials; it is correct in that it has(?) worked for me.

  • /usr/local/etc/X11/xorg.conf.d/10-nvidia.conf (Enter the information below, but use the BusID from the pciconf -lv command.)

Section "Device"

Identifier "NVIDIA Card"

VendorName "NVIDIA Corporation"

BusID "PCI:1:0:0"

Driver "nvidia"

EndSection

  • /boot/loader.conf (This file needs a line with nvidia_load="YES".)

  • /etc/rc.conf (This file will probably need a line with linux_enable="YES".)

If the NVIDIA driver for your card is still not working, there is a lot of other information around. But I honestly gave up. I'm not that reliant on the laptop nor FreeBSD. I can say I got a lot of information on BSD's configuration files. :-)