FreeBSD current on Lenovo T420 Laptop (dogfood)

Posted: March 1st, 2013 | Author: | Filed under: dogfood, FreeBSD | Tags: , , , , | 5 Comments »

I used PC-BSD for about 6 months on my laptop. It is nice but it has it’s own issues. I thought of PC-BSD as a closed source project but to my ignorance, it is also an open source project. It does some serious magic foo with the wrappers around all the GUI things, though. I do not even know how it fetches/emulates FreeBSD from underneath those wrappers. Anyways, I did not feel like spending more time on it.

I recently switched to running freebsd-current on my Lenovo T420. Here is what I had to do to set it up:

1) Picked up the latest snap from here and put it on a usb stick.

2) Because T420s cannot do gpt based installs (more details here), I followed this from FreeBSD wiki to setup mbr with zfs. Setting up ZFS is a huge PIA. I am still not sure why this is not a part of the installer like regular ufs setup.

3) Checked out ports and installed devel/subversion so that I can checkout stuff (and things).

4) I checked out FreeBSD head, did buildworld/installworld and buildkernel/installkernel.

5) To setup basic Display/X setup:
For X:

For nvidia display drivers:

I also added nvidia_load="YES" to /boot/loader.conf to load nvidia driver module /dev/nvidiactl on bootup.

For keyboard:
if not installed, you may see following error in Xorg.0.log:
(EE) Failed to load module “keyboard” (module does not exist, 0)

For Mouse:
if not installed, you may see following error in Xorg.0.log:
(EE) Failed to load module “mouse” (module does not exist, 0)

For mouse, I also have following in /etc/rc.conf


Now, I am not sure why xf86-input-keyboard and xf86-input-mouse have to be explicitly installed and not as dependencies to xorg-server. Who likes an X without a keyboard or a mouse? But again, what do I know?

For fonts:

Now to get xorg.conf, do:
# Xorg -configure

For nvidia drivers, also do:
# nvidia-xconfig

Then I tinkered with xorg.conf for a bit to get it all working the way I wanted.

In particular, I had to edit “Screen” section to be:

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"

Just for reference, my “InputDevice” section looks like this:

Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5"

Xorg logs i.e /var/log/Xorg.0.log is your friend. Use is if you have trouble setting things up.

6) Window manager
I use spectrwm as my window manager. After installing it from ports, to start it automatically with X, my ~/.xinitrc looks like this:

$ cat .xinitrc


xscreensaver is obviously for screen saver functionality.

7) Browsers:
I primarily use firefox with vimperator plugin.

To make flash work on firefox, I followed instructions in section of this from freebsd handbook.

I also keep chromium around for any other sane soul who does not like browsing on my default firefox+vimperator setup.

Other needed ports: