Cogs and Levers A blog full of technical stuff

FreeBSD 9.0 installation on a T400

From time to time, FreeBSD has made its way onto my T400. Each time I do it, I never jot down what I did to get it to “work”. Here’s just a few thoughts and basic guide for installing FreeBSD RELEASE-9.0 on a Lenovo ThinkPad T400.

BIOS

The T400’s graphics mode needs to be switched from “Discreet” back to “Integrated”, otherwise the BSD installation process just continually reboots. The laptop will now allow a standard installation to be performed.

Post Installation

First things first. Stop the PC Speaker barking at you when you do something questionable (disable by adding this to /etc/sysctl.conf)

hw.syscons.bell=0

Some switches required for connection resilience need to be applied to the WiFi configuration (fix by commenting these lines from /etc/wpa_supplicant.conf)

# eapol_version=2  
# ap_scan=1  
# fast_reauth=1  

WiFi network entry should look as follows

network={  
	ssid="tuttle"  
	key_mgmt=WPA-PSK  
 	psk="secret-in-here"
}  

Add the full hostname to /etc/rc.conf

hostname="thor.local"  

Get the proc filesystem mounted at boot by adding the following line to /etc/fstab

proc   /proc  procfs  rw  0   0  

Organising the ports collection

In the interest of making the ports collection as “fresh” as possible, it’s best to remove the installed version and pull down the latest version over the web.

Remove the existing ports collection

cd /usr/ports
rm -Rf *  

Refresh the ports collection from an australian mirror. You can find full instructions here on this. Fetch the collection into /var/db/portsnap Extract the collection into /usr/ports

portsnap fetch
portsnap extract

From now on, to refresh ports just use the following command

portsnap update

Installation

Any port needed for installation is done with the following commands

cd /usr/ports/path/to/port  
make install clean  

bash (/usr/ports/shells/bash)

Set bash as the default shell for users by running the following

pw usermod user_name -s /path/to/bash  

sudo (/usr/ports/security/sudo)

Setup user groups who can sudo by editing the config

visudo -f /usr/local/etc/sudoers  

Uncomment the line allowing the wheel group

%wheel ALL=(ALL) ALL  

Add users who want to sudo to the wheel group

pw usermod user_name -G wheel  

Other pieces of software to make your environment feel more like home

vim (/usr/ports/editors/vim-lite)
git (/usr/ports/devel/git)
xorg (/usr/ports/x11/xorg)
xfce (/usr/ports/wm/xfce4)
gnome-keyring (/usr/ports/security/gnome-keyring)
gnome-power-manager (/usr/ports/sysutils/gnome-power-manager)
chrome (/usr/ports/www/chromium)
pidgin (/usr/ports/net-im/pidgin)
irssi (/usr/ports/irc/irssi)
evince (/usr/ports/graphics/evince)

Preferences

Set colourised output on ls by adding the following line to ~/.bash_profile

alias ls='ls -G'

Get bash_profile to execute bashrc if it exists by adding the following line towards the top to bash_profile

test -f ~/.bashrc && . ~/.bashrc  

dbus and hald need to be started at boot time if a mouse/keyboard is going to be used within X. To get these to start, add the following lines to the /etc/rc.conf file

dbus_enable="YES"
hald_enable="YES" 

Both of the above config lines can be removed if using a login manager (like gdm). All the needs to be added in this scenario is

gnome_enable="YES"  

Automatically mount any samba shares at boot by adding lines like the following to /etc/fstab </span>

>> //user@server/share  /mountpoint  smbfs  rw,-N,-Iserver  0  0  

With -N specified in the above fstab entry, any secrets needed to connect to the share need to be put into the ~/.nsmbrc file and should look as follows

[SERVER:USER]  
password=secret  

Tread with caution here: I’ve just rolled back authentication for the samba shares as FreeBSD’s mount_smbfs doesn’t contain a _netdev option which will delay mounting the remote share until the network is available. Not being able to do this makes the BSD boot fail with authentication errors.

Shutdown

sudo shutdown -h now