Install FreeBSD 10.1 or FreeBSD 11 – CURRENT on Thinkpad T420

This post is about installing FreeBSD 10.1 RC2 or FreeBSD 11 – CURRENT on a Thinkpad T420 with Intel graphics. This is for testing only up to now!

Work around the BIOS/UEFI bug:

The T420 comes with an unpatched BIOS/UEFI bug which prevents to boot from a default GPT partitioned harddisk or USB flash drive. I am not 100% sure but it looks like a bug on all T420, T520 and W520 models so not only the T420.

The bug seems to look at the first partition and if this partition is not what it expects it does not recognize it and fails to boot.To boot from USB you need to use the UEFI images. Since the first partition on a UEFI boot media is an UEFI partition if I am correct this works around the problem.

If you want to read more about the details, ask your search engine for: “T420 gpt boot problem”. The internet is full of it and there are further information what you else can do to work around this bug. There are tutorials for other systems or how to create a custom partition layout that works, too.

I will show you a way to work with the installer here. This prevents you from installing on a ZFS root with GPT, since the UEFI boot loader code doesn’t support ZFS root volumes, yet. This will change in future but lets go with ZFS and a MBR for now.

Update!

Allan Jude has committed a fix to be included with 10.2 for the gpt command to apply a workaround for this problem. If you’re using the installer, it should detect if you have an effected model and should apply the patch. Let me know if you have problems with it or if this fixed the problem for you. Thanks to Allan to make this fix happen!

Hardware support for my model:

  • Intel Graphics o.k
  • Intel Wifi o.k
  • ACPI Brightness control o.k (with -CURRENT) / not o.k (with 10.1 RC2)
  • Power support o.k

Download the installation media

For FreeBSD 11 download image available here:

ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-amd64-20140918-r271779-memstick.img.xz

For FreeBSD 10.1 RC2 download the UEFI image available here (The not UEFI image will not boot on the T420!):

ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RC2-amd64-uefi-memstick.img.xz

Prepare T420

Configure your BIOS/UEFI to boot both, UEFI and legacy boot with UEFI in first order.

Install FreeBSD minimal

Boot with default options:
FreeBSD-on-T420-1

Choose Install:

FreeBSD-on-T420-2

Select your keyboard layout. Please have in mind, if you encrypt your hard disk you have to know how you type your passphrase on the us keyboardlayout at boot time. Ping me if there is a way to change the keyboard layout at boot time.

FreeBSD-on-T420-3

Set the hostname for your machine.

FreeBSD-on-T420-4

Choose the components you want to have installed now.

FreeBSD-on-T420-5

Harddisk setup

Select ZFS while installation and change the gpt default option to mbr. If you need it choose encryption for your system and for the swap partition. You always should encrypt your hard disk on mobile devices. If you loose your laptop or it gets stolen at least your data is protected.

FreeBSD-on-T420-6

FreeBSD-on-T420-7

FreeBSD-on-T420-8

Because I have only one disk for FreeBSD in my T420 there is no redundancy and I choose stripe here.

FreeBSD-on-T420-9

Select the harddisk you want install to. Here this is a VBOX HaRDDISK because I did a replay to make the screenshots 😉

FreeBSD-on-T420-10

This is the point of no return!

FreeBSD-on-T420-11

Choose a long and strong passphrase for your disk encryption!

FreeBSD-on-T420-12

Remember the long and strong passphrase the first time 😉

FreeBSD-on-T420-13

Now the sytem will generate and initialize the filesystem with your encryption keys.

FreeBSD-on-T420-14

Now the installation process installs the selected components as usual.

FreeBSD-on-T420-15

Set a strong root password and add you user to the system.

FreeBSD-on-T420-16

Here select the services you want to have started at boot time. I use all of them here.

FreeBSD-on-T420-17

The rest is not really interesting. Exit the process and reboot the machine when done.

 

Install packages

Login in to your new system and install the first packages and make some modifications to the system.

pkg update
 pkg install xorg sudo tmux vim

Modify base configuration

Add the following lines to /etc/rc.conf

hald_enable="YES"
dbus_enable="YES"                                                      
performance_cx_lowest="Cmax"                                                                                 
economy_cx_lowest="Cmax"
moused_flags="-VH"

Hald and DBus are required to make X working correctly. The next two options are some power saving options which should improve your battery life. My T420 runs 4h+ with the standard battery and i3 as window manager. The last option enables the mid mouse button scrolling with the TrackPoint.

Add the following lines to /boot/loader.conf

kern.vty=vt                                                                                                                                                                                                          
hw.vga.textmode="1"                                                                                                                                                                                                  
acpi_ibm_load="YES"                                                                                                                                                                                                  
acpi_video_load="YES"                                                                                                                                                                                                
hint.p4tcc.0.disabled=1                                                                                                                                                                                              
hint.acpi_throttle.0.disabled=1                                                                                                                                                                                      
drm.i915.enable_rc6=7

The first options are related to the new vt. This will enable you to switch between X and your console again. Without this after starting X I was not able to switch back to console.

acpi_ibm and acpi_video enables some features like extra keys on the IBM/Lenovo notebooks. With FreeBSD 11 – CURRENT acpi_video enabled the brightness control. With the 10.1 RC2 it does not work up to now. I am not sure if this will be merged into 10.1 but stay tuned at least 11 will bring this to you.

The last three options are power tuning options again. Read more here: https://wiki.freebsd.org/TuningPowerConsumption

Configure System for Xorg installation

X -configure
cp /root/xorg.conf.new /etc/X11/xorg.conf

 Configure i3 to be your desktop environment

Install need packages or build it from ports:

pkg install i3 i3lock i3status dmenu
vi ~/.xinitrc
/usr/local/bin/i3

Install some useful software

Firefox is the quite well known browser, Thunderbird the email client and Hexchat is a XChat fork that works quite well.

pkg install firefox thunderbird hexchat

Set keyboard layout

Create the file: /usr/local/etc/hal/fdi/policy/x11-input.fdi

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
   <device>
    <match key="info.capabilities" contains="input.keyboard">
      <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
      <merge key="input.x11_options.XkbLayout" type="string">de</merge>
    </match>
   </device>
</deviceinfo>

This does not work for KDM!

In KDM this didn’t work for me. To set the keyboard layout correct in KDM you need to add the following line to: /usr/local/share/config/kdm/Xsetup

setxkbmap -model pc105 -layout de

Of course you need to replace the de with the layout you prefer. The layout in KDE itself can be modified using the system settings configuration of you input device as mentioned in this post.

Update 1

In a previous version of this Blog post I mentioned to use slim as login manager. I ran into some bugs with it and tried to find the source code and project page to get them fixed, but it looks like the project is dead and not developed further. Please stop using it if you do and choose one of the many other options around (XDM, GDM, KDM, Entrance, LXDM, MDM, Qingy).

Update 2

I added the mouse scrolling configuration option the the /etc/rc.conf file to make the scrolling working with the TrackPoint or mid mouse button.

17 thoughts on “Install FreeBSD 10.1 or FreeBSD 11 – CURRENT on Thinkpad T420

  1. Ricardo Santos

    Thanks for the tips.
    Glad to hear that i915kms driver has been updated for 10.1-RELEASE. I own a T430 and had some trouble trying to configure X properly with 10.0-RELEASE and Intel HD Graphics 4400.

    One question: did you have any trouble configuring the touchpad, trackpoint and Fn keys?
    Regards.

    Reply
    1. Dominik Zajac Post author

      Hi,

      no I had no trouble with the touchpad and trackpoint. I did no special configuration on that two components up to now. Both are working, but I will try to disable the touchpad because I don’t use it. If I have it disabled I will update the tutorial, but this should be default X configuration steps. The fn keys don’t really work up to now. I used acpi_ibm and acpi_video. The brightness control worked on FreeBSD 11 – CURRENT. The other function keys are not working beside the sound volume control and mute button.

      Reply
      1. FAndrey

        brightness control worked – WOW yes 🙂

        sound volume control, and multimedia button (pause,stop,next) – work for some software (mplayer2), may be anyone DE, not system mixer

        touchpad – works normally, but without the extra features, just like a mouse emulator and pressing buttons

        Reply
  2. Emiliano

    It’s possible to upgrade to 11 from 10.1? I have no luck running freebsd-update:

    root@hal9000:/usr/home/emi # freebsd-update -r 11.0-CURRENT upgrade
    Looking up update.FreeBSD.org mirrors… 5 mirrors found.
    Fetching metadata signature for 10.1-RELEASE from update5.freebsd.org… done.
    Fetching metadata index… done.
    Inspecting system… done.

    The following components of FreeBSD seem to be installed:
    kernel/generic world/base world/doc world/games

    The following components of FreeBSD do not seem to be installed:
    src/src

    Does this look reasonable (y/n)? y

    Fetching metadata signature for 11.0-CURRENT from update5.freebsd.org… failed.
    Fetching metadata signature for 11.0-CURRENT from update6.freebsd.org… failed.
    Fetching metadata signature for 11.0-CURRENT from update2.freebsd.org… failed.
    Fetching metadata signature for 11.0-CURRENT from update4.freebsd.org… failed.
    Fetching metadata signature for 11.0-CURRENT from update3.freebsd.org… failed.
    No mirrors remaining, giving up.

    Thanks!

    Reply
    1. Dominik Zajac Post author

      Hi,

      11 is not a stable release, yet. This is why you can’t upgrade your system that easy. If you want to use FreeBSD I than stay with 10.1 and upgrade to 10.2 if its released later. If you want to develop FreeBSD than you need to look into 11 or the CURRENT tree how it is called in general. CURRENT is always the next upcoming release (today 11.0). But there is a lot of development ongoing which sometimes can lead to a broken system. It should not happen but sometimes things go wrong in development and CURRENT is under heavy development all the time. So if you don’t develop own features or have some other reasons why you really need CURRENT you go better with stable. I run STABLE here as well on my box because I need to get things done and need a working system.

      If you’re interested in using CURRENT, just download the snapshot images and install it. You will need to check out the CURRENT source tree to your /usr/src and do your updates manually. This means you need to build your system from source each time you want to do an update. But be aware that there is not support on IRC and mailling lists because as mentioned earlier it is for developers and not for production or end users.

      Best regards,

      Dominik

      Reply
  3. dred

    This guide is to install freebsd 10.1 standard desktop on computer or virtualbox? How to install skype and flash player in FreeBSD ?.F

    Reply
    1. Dominik Zajac Post author

      Hi Dred,

      I am not in need of flash and skype so I don’t have them installed on my box. But in PC-BSD, which is based on FreeBSD they have both running. So maybe you can check there how they are installing it. I think they are using the Linux compatiblity layer to run it. Maybe check on the BSDNow Podcast and search their site for some information about flash and Skype.

      Regards,

      Dominik

      Reply
  4. lukas

    Hi Dominik,

    I have been trying to install FreeBSD both 10.1 and 11 on my T420 with SSD HDD with no luck. I have changed the suggested options in BIOS to UEFI first and used UEFI 10.1 image but system wont boot as I get Missing operating system error on start.

    I would be happy for any suggestions you might have on this.

    Thank you
    Lukas

    Reply
    1. Dominik Zajac Post author

      Hi Lukas,

      it should work. Have you tried the last 11-Current or 10.2-rc images? Allan Jude has included a auto detection routine to the installer to make the needed adjustments for the installation on a T420. I haven verified them on my hardware, yet but they should work.

      Have you installed with GPT or MBR? With UFS or ZFS?

      Regards,

      Dominik

      Reply
  5. CRS

    Hello. Did you run suspend/resume on this T420 ?
    I can’t run suspend/resume and nvidia drivers ;/ Under 10.2/11
    OS without suspend/resume is unusable for me.
    Thanks.

    Reply
  6. Tito

    Hi.
    First of all, sorry for my english (I’m from Spain). I’m have a Thinkpad T420 i7 runnig Arch.I tried to install FreeBSD, but all my attempts have been unsuccessful. Can anyone share the principal config files with me?
    Thanks in advance.

    Reply
    1. Dominik Zajac Post author

      Hi Tito,

      what problems did you face? I had no bigger problems installing the latest releases expect the bios bug. But the new installer should take care, thanks to the changes merged by Alan Jude.

      If you can be more specific maybe I can help you out with your problems.

      Regards,

      Dominik

      Reply
  7. CRS

    Hello.
    Im using Current 11 from (16.12.2015) Afrer instalation in pciconf -lv i see iwn0 , in dmesg too, but ifconfig show me only lo and em0.
    And suspend still not work 😉 Any ideas ?

    Reply
  8. mike

    how about battery threshold feature ?
    i intends install freeBSD/ghostBSD but I have been searching information about battery threshold T420 and the information I looking for sorely lacking.

    Reply
  9. Vctrsnts

    Hi.

    First, sorry for my English.

    I thought your article perfect, because I this doing the same, changing my S.O. of my laptop to FreeBSD. I looking for the exact specifications of your laptop I see you have Optimus technology. It is right?

    As you have solved this problem. I mention this because I looking information continues and the only thing I see is as clear it through a script, but if you reboot the machine, the Nvidia activated again i have to re-run the previous script so that you can disable.

    You earned every time you start FreeBSD Optimus is turned off or you have it configured from the BIOS.

    Thanks and sorry for bothering

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *