Category Archives: current

FreeBSD current on Lenovo T420 Laptop (dogfood)

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:
x11/xdm
x11-servers/xorg-server

For nvidia display drivers:
x11/nvidia-driver
x11/nvidia-settings
x11/nvidia-xconfig

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

For keyboard:
x11-drivers/xf86-input-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:
x11-drivers/xf86-input-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

moused_port="/dev/psm0"
moused_enable="YES"

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:
x11-fonts/xorg-fonts
x11-fonts/webfonts

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"
EndSubSection
EndSection

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

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

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

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
#!/bin/sh

/usr/local/bin/spectrwm
/usr/local/bin/xscreensaver

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 7.2.1.2 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:
vim
screen

Alexander Leidinger

A while ago I committed the linuxulator D-Trace probes I talked about earlier. I waited a little bit for this announcement to make sure I have not broken anything. Nobody complained so far, so I assume nothing obviously bad crept in.

The >500 probes I committed do not cover the entire linuxulator, but are a good start. Adding new ones is straight forward, if someone is interested in a junior–kernel–hacker task, this would be one. Just ask me (or ask on emulation@), and I can guide you through it.

Share

Alexander Leidinger

Seems I forgot to announce that the linux_base-c6 is in the Ports Collection now. Well, it is not a replacement for the current default linux base, the linuxulator infrastructure ports are missing and we need to check if the kernel supports enough of 2.6.18 that nothing breaks.

TODO:

To my knowledge, nobody is working on anything of this. Anyone is welcome to have a look and provide patches.

Share

Alexander Leidinger

In case you have not noticed yet, KDTRACE_HOOKS is now in the GENERIC kernel in FreeBSD-current. This means you just need to load the DTrace modules and can use DTrace with the GENERIC kernel.

In case you do not know what you can do with DTrace, take the time to have a look at the DTrace blog. It is worth any minute you invest reading it.

Share

Alexander Leidinger

I just updated to a recent -current and tried the new nullfs. Sockets (e.g. the MySQL one) work now with nullfs. No need to have e.g. jails on the same FS and hardlink the socket to not need to use TCP in MySQL (or an IP at all for the jail).

Great work!

Share