2019-11-04

How to Install FreeBSD on an NVIDIA NVS 3100M ThinkPad T410

A few years ago, I bought a Lenovo ThinkPad T410. I wanted to put a FreeBSD derivative OS called PC-BSD on it. When that didn't work, I tried pure FreeBSD, which also failed. I even wrote about that ordeal when prompted for details from a FreeBSD dev on Twitter.

Time has passed and I've explored about 4 or 5 different methods for installing Linux on my ThinkPad. I really liked Linux Mint, but it's an Ubuntu-based distro and I bristle at the idea of relying on systemd. Reluctantly, I recently updated my ZFS on root Linux system setup scripts, which I dub "linux-survival-kit", to work with Mint 19. You can disable systemd-resolved, and disable its device-naming oddity, but you can't fully disable systemd without breaking a lot of other stuff that I don't feel like fixing. Devuan ascii can't support ZFS on root due to an upstream bug, (This is fixed now to the best of my knowledge, but Devuan beowulf can't boot to an encrypted ZoL 0.8.0+ dataset... because of an upstream GRUB bug. It never ends.) but its precursor Devuan jessie can and I'm about ready to toss the whole bizarre bazaar in the bin and go screaming back to FreeDOS, TempleOS, or the first OS for which I ever felt anything resembling true love: The BeOS.

I could probably have upgraded to newer hardware by now, but the T410 is the last of the model-T ThinkPads to have the original keyboard and I like the original keyboard style almost as much as this guy does.

Then I read about Mastodon. I joined the bsd.network Mastodon instance and began reading the daily exploits of cool people doing cool things with BSD. And here I was, Linux on my laptop, standing outside the cool kids' party looking in.

So I tried installing FreeBSD on my Lenovo ThinkPad T410 again. And this time I did something I never do. I asked for help.

I got a variety of responses. Some reactively said "Try OpenBSD" or "Install NetBSD", but others were genuinely helpful in terms of troubleshooting steps. Many of those steps didn't work because they pre-supposed a successful boot, but the collected advice gave me enough knowledge to start poking at the problem with a better understanding than I had had before.

I wondered if there might be a problem with my hard disk, so I removed the Seagate Momentus and tried to boot and it worked. Must be the disk, right? I installed a Hitachi TravelStor I'd cannibalized from a dead Dell Latitude and it failed. So I yanked that and tried it again with no disk in the laptop and it failed. And failed. And failed. And succeeded. Intermittently. Over and over again. Successfully booting the install media USB stick was a 1-in-15 tries ordeal, and I took photographs of the boot sequences to compare them, looking for differences.

I was ready to buy another Lenovo ThinkPad T410 and donate it to a willing victimFreeBSD developer just to get someone with brains looking into my weird disk/no-disk booting problem. Then I tried something on a lark that saved the day.

It was a dumb old BIOS setting. One of those obscure settings that says right on the menu screen "You usually don't need to change this setting". No, Lenovo! I actually DO need to change this setting!

Here's how I install FreeBSD on a Lenovo ThinkPad T410 and not have it lock up during boot. Even if this information helps no one else but me, I'm happy to have a documented installation method that consistently gives a working laptop.

There are multiple different hardware configurations for a T410. In particular, this model of ThinkPad can contain a couple of different graphics chipsets. T410s typically have an Intel i915, but the higher end ones will have an NVIDIA NVS 3100M.

These instructions are for the NVIDIA spec T410, since it is the more complicated, less well-documented setup.


  1. Plug your Lenovo ThinkPad T410 into AC power and connect it to the Internet with an Ethernet cable.

  2. Install Windows. Yes, I'm serious. If you're buying a refurbished ThinkPad, Windows is probably already installed and you can use that. Otherwise, you can download a Windows 10 ISO from Microsoft if you hit their Windows 10 download page or use my Windows 10 LTSB tutorial.

  3. Download Rufus. I like the portable version.

  4. Download the FreeBSD memstick install image. There are multiple ways to do this, but you can just download FreeBSD-12.0-RELEASE-amd64-memstick.img and check the checksum of your downloaded file. In PowerShell:

    PS > Get-FileHash -Algorithm SHA256 -Path .\FreeBSD-12.0-RELEASE-amd64-memstick.img

  5. Using Rufus, copy the the FreeBSD .IMG file to an empty USB thumb drive using the "DD Image" method.

  6. Download the latest Lenovo BIOS executable. This is going to be on the Lenovo support page titled BIOS update utility for Windows 8 (32-bit, 64-bit), 7 (32-bit, 64-bit), Vista (32-bit, 64-bit), XP - ThinkPad. Run this executable and update the BIOS on the ThinkPad.

    Note: this isn't the only way to update your ThinkPad's BIOS. It's complicated, time-consuming, and ugly, but it's reliable and so it's how I do it. You can use this tutorial instead, but I haven't tried it personally and cannot vouch for its correctness.

  7. Reboot. Enter the BIOS Setup menu by pressing F1 during POST. Reset all settings on the BIOS to factory defaults by pressing F9 and saving the changes.

  8. Reboot again. Enter the BIOS Setup menu again by pressing F1. Go to Config > USB and find "PCI Bus Management". This is the BIOS setting that will hang your FreeBSD boot sequence 14 out of 15 times! I hate this setting. Set "PCI Bus Management" to "Disabled". Save the change. Exit the BIOS Setup menu.



  9. If you removed the USB thumb drive after using Rufus, insert it back into the ThinkPad and boot. Press F12 to choose a boot device, and select the USB thumb drive from the menu.

  10. Install FreeBSD. There are a few specific settings here you need to select. At the menu, select <Install>.

  11. Select your keymap. Enter a hostname.

  12. IMPORTANT: On the Distribution Select screen, select the ports tree ("ports") and the system source tree ("src").

  13. IMPORTANT: On the Partitioning screen, choose "Auto (ZFS)". On the ZFS Configuration screen, make sure the Partition Scheme is "GPT + Lenovo Fix (BIOS)".

  14. Continue the installation as normal. When installation is complete, reboot. Remove the FreeBSD USB thumb drive before POST.

  15. Login as root.

  16. To use X11 on this machine run:

    pkg install -y xorg

    Accept the prompt to install and run pkg.

  17. Install a desktop environment of your choice. Examples include pkg install -y lumina or pkg install -y xfce.

  18. Add some important config lines for enabling X11 to /etc/rc.conf:

    sysrc devd_enable="YES"
    sysrc moused_enable="YES"
    sysrc dbusd_enable="YES"

  19. If the Lenovo ThinkPad T410 uses an NVIDIA NVS 3100M, install the correct NVIDIA driver. (I think the NVS stands for "Not Very Stable".) This funky GPU is why you need both the ports tree and the source tree installed. There is a known problem with FreeBSD and NVIDIA drivers that explicitly requires you to install this driver from ports and NOT from packages:

    cd /usr/ports/x11/nvidia-driver-340 && make install

    The precise path to this port may change over time, so if you update the ports tree, be aware of the exact version string that the ports tree provides.

  20. Enable the NVIDIA driver kernel module and the FreeBSD Linux binary compatibility kernel module and verify they are correctly loaded:

    kldload linux
    kldload nvidia
    kldstat

    If you get an error at this step, stop and investigate what went wrong.

  21. If all has gone according to plan, you'll have output like this:

    # kldstat
    Id Refs Address                Size Name
     1   24 0xffffffff80200000  243cd00 kernel
     2    1 0xffffffff8263d000   3a9a10 zfs.ko
     3    2 0xffffffff829e7000     a4f0 opensolaris.ko
     4    2 0xffffffff82c21000      acf mac_ntpd.ko
     5    2 0xffffffff82c22000    39960 linux.ko
     6    2 0xffffffff82c5c000     2e28 linux_common.ko
     7    2 0xffffffff82c5f000   962248 nvidia.ko

    Make sure these modules are loaded automatically on system startup. Use the sysrc tool for this:

    sysrc -f /boot/loader.conf linux_load="YES"
    sysrc -f /boot/loader.conf nvidia_load="YES"

  22. Create an NVIDIA-friendly xorg.conf file. The Handbook shows you how but my laptop didn't have an /etc/X11/xorg.conf file to edit, so I found nvidia-xconfig:

    cd /usr/ports/x11/nvidia-xconfig && make install
    /usr/local/bin/nvidia-xconfig

    This will create /etc/X11/xorg.conf for you.

  23. Reboot.

At this point, you can log into your FreeBSD ThinkPad T410, add users and groups, install software, and configure your X11 environment. You should be able to run "start-lumina-desktop" or "startxfce4" or put a similar command into your ~/.xinitrc file to run "startx" and get a working desktop.

There are certainly problems with this setup. You have the ports tree still, you have the source tree still, both things that I don't particularly like to keep around when binary updates are an option.

But it's a start.

2 comments:

Austin said...

Thanks for this guide, it was quite helpful.

One thing I’d point out is even though there is newer versions of the NVidia driver available, they no longer list the NVS 3100M as supported. So I stuck with the 340 version.

Anonymous said...
This comment has been removed by a blog administrator.