Sep 12

FreeBSD on a Lenovo H430 desktop

I used to use FreeBSD a lot.  (FreeBSD is an alternative operating system, kind of like Linux.  It is the basis for OS X and many other things.)  However, ever since I stopped being a systems administrator I haven’t had a FreeBSD machine.  Well, last week our Apple Time Capsule (wireless base station + backup device) died, and I wanted to try to “roll my own” server that could be our wireless access point plus backup system and more.

The thing about FreeBSD is, you have to really learn a lot to use it.  To my knowledge, there aren’t many simple configuration tools beyond the “sysinstall” installation tool, and if you run into any problems you are on your own (to try and Google your issues and fix the problem).  In case it’s helpful for others, here is what I’ve learned about installing FreeBSD on a Lenovo H430 desktop computer.

Things I’ve learned

  • FreeBSD 9.0-RELEASE does NOT recognize the built-in wired or wireless network devices.  You have no network connectivity.
  • Use the amd64 version so you can use all 8 GB RAM.
  • FreeBSD 8.3-RELEASE recognizes the built-in wired network device (yay!) but doesn’t recognize the wireless network card (boo).
  • I scrapped the wireless network card and bought a TP-LINK TL-WN881ND wireless card.  HOWEVER, I then found this card doesn’t work with 8.3-RELEASE.  This FreeBSD forum thread recommends you  recompile your kernel to remove the 8.3-RELEASE drivers, pull the FreeBSD subversion HEAD or STABLE/9 versions, and load those modules.  This worked for STABLE/9 at the point this thread was written (April 2012) but doesn’t work today (September 2012).  John B’s solution?  Use ‘svn -r {2012-04-21}’ to pull STABLE/9 from April 21, 2012!
  • Audio does not work automatically but it is simple: the snd_hda driver
  • For my monitor, Xorg’s autoconfigure gave me a max resolution of 800×600 (yay!)  I once again had to find the horizonal sync and vertical refresh rates for my monitor.  Do you know how many times in my life I have had to search through technical specifications to find the hsync and vrefresh?  Hint: it’s a lot, and finding it is usually pretty hard because my monitor doesn’t work properly.

Current setup

For the TL-WN881ND card, I had to do a bunch:

Here’s how I built the if_ath and if_ath_pci drivers:

svn co -r {2012-04-21} {http://svn.freebsd.org/base/,}$PREFIX/sys/dev/ath
svn co -r {2012-04-21} {http://svn.freebsd.org/base/,}$PREFIX/sys/modules/ath
svn co -r {2012-04-21} {http://svn.freebsd.org/base/,}$PREFIX/sys/modules/ath_pci
( cd $PREFIX/sys/modules/ath && env CFLAGS=-I../../ make )
( cd $PREFIX/sys/modules/ath_pci && env CFLAGS=-I../../ make )

Built a custom kernel; here’s my unified diff from the GENERIC kernconf:

--- GENERIC 2012-03-03 01:15:13.000000000 -0500
+++ JOHNB-NOATH 2012-09-23 03:38:18.000000000 -0400
@@ -258,10 +258,10 @@
 device wlan_tkip # 802.11 TKIP support
 device wlan_amrr # AMRR transmit rate control algorithm
 device an # Aironet 4500/4800 802.11 wireless NICs.
-device ath # Atheros pci/cardbus NIC's
-device ath_hal # pci/cardbus chip support
+#device ath # Atheros pci/cardbus NIC's
+#device ath_hal # pci/cardbus chip support
 options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
-device ath_rate_sample # SampleRate tx rate control for ath
+#device ath_rate_sample # SampleRate tx rate control for ath
 device ral # Ralink Technology RT2500 wireless NICs.
 device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs.

I’ve done several other things to the computer since, such as setting it up as a gateway (dnsmasq is awesome!!) and AFP server, but I think these were the main showstoppers.