Linux on a Lenovo Thinkpad W541

[Edit April 25, 2016]

I just updated my system to Ubuntu 16.04 and ran into a login loop.  It seems to be bumblebee that was causing the issue as it seems to have been deprecated in 16.04 due to lack of support in favor of Nvidia Prime[10].  Removing bumblebee fixed the issue for me (I also reinstalled Mesa following the procedure in this article but I am not sure if that helped or not).  I am still using nvidia-current (nvidia-304).

The new 16.04 Live CD seems to resolve my initial issues with installing off of a Linux Live CD as I was able to boot it up with no modifications.

[Original Article]

As a programmer, I have need for Linux at my fingertips.  Windows is great for browsing and gaming, but, unless I am specifically creating a Windows application, I want to be using Linux for any kind of development.  The Lenovo W541 comes pre-loaded with Windows 8.1 and so it is obviously compatible with Windows but Linux distributions seem to give the system some trouble.

On my last laptop, I dual-booted Windows 7 and Fedora Workstation.  I constantly use Ubuntu at work and so I like to have a little bit of variety and use Fedora for my schoolwork and personal development and so I thought I would run Fedora on my new laptop as well.  Little did I know the issues I would run into.

Apparently there are commonly issues with installing Linux distributions on newer systems with Live CDs as the developers of the OSes and the Linux kernel need to work towards integrating new hardware setups.  The support wasn’t quite there yet when I received my W541 but I found some threads relating to the same issues I saw that helped me get Linux installed.

Trying Fedora

So when I first tried booting from a Fedora Workstation Live CD I got a whole lot of nothing.  More specifically, I got the following error messages and never reached the wonderful installation GUI:

"mmc0 unknown controller version(3), You may experience problems"

This was with the default BIOS settings.  I tried changing the UEFI boot settings to Legacy Only which got me to the Fedora Live desktop and I was able to start installation but then Fedora would totally freeze and I would have to hard shutdown the laptop with the power button.  This would occur every time I tried even after further tweaking BIOS settings and even updating the BIOS.

Researching this issue, I did not find anything specific to Fedora but I did find others having issues installing Linux distributions on the Lenovo W541.  The most relevant posts I found were a post on the Ubuntu forums which also linked to a bug ticket on Launchpad.  The issue described seemed to have the same root cause as mine but with Ubuntu.  One reply to the bug ticket laid out a procedure which the poster claimed got the system to work with an Ubuntu installation.  Since I am familiar with Ubuntu and I hold no particular loyalty to Fedora, I decided to try out this procedure to see if I could get any Linux distribution running.[1][2]

Moving to Ubuntu

I normally stick to the Ubuntu LTS versions but some people said they were having better luck with Ubuntu 15.04 so I decided to just go with that.  I had previously installed 15.04 on a VM on my desktop machine and didn’t have any problems so I figured it would be fine.

Using the Live CD

The first issue that people usually see when they try to boot with the Ubuntu Live CD on the W541 is a black screen right when it looks like the Desktop environment is going to load.  This can be circumvented by changing the Linux boot parameters in grub.  This can be accessed on the screen that says “Try Ubuntu without Installing” (i.e. the grub menu).  With the first menu entry highlighted, press the ‘e’ key.  This will bring up a text editor with the grub configuration for that menu entry.  Scroll down to the line which starts with linux and, at the end of the line but before the $vt_handoff parameter, add the nomodeset parameter.  The end of the line should then read quiet splash nomodeset $vt_handoff.  Then press Ctrl+x to boot with those settings.

The nomodeset parameter “instructs the kernel to not load video drivers and use BIOS modes instead until X is loaded.”  This removes the black screen issue which is common for NVIDIA cards which use the nouveau driver by default.[3] You will need to perform this procedure every time Ubuntu is booted until the nouveau driver is blacklisted in a subsequent step.

Now that you have access to the Ubuntu Live Desktop you can install Ubuntu normally with the installation tool.

Initial Setup

Once Ubuntu is installed on the system, we want to blacklist the nouveau driver so that it is not loaded by the kernel on boot and we also want to setup the NVIDIA drivers with bumblebee/primus.  Bumblebee allows for the switching between the integrated Intel graphics cards and the NVIDIA card.

To blacklist nouveau so that we don’t need to set the nomodeset parameter, we need to modify the /etc/modprobe.d/blacklist.conf file by adding the following line:[4]

blacklist nouveau

With that taken care of, we can install bumblebee.  With older versions of Ubuntu, bumblebee had to be installed via a PPA, but it is now integrated into the standard software repositories.  Run the following command to install bumblebee:[5]

sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic

Next we want to install the NVIDIA reference drivers.  This can be done with the following commands:[6]

sudo apt-get remove --purge nvidia*
sudo apt-get install nvidia-current

Next we want to remove the xserver-xorg-video-intel package with the following command:[2]

sudo apt-get remove xserver-xorg-video-intel

Now we want to setup the bumblebee configuration to use our NVIDIA drivers.  The bumblebee configuration file is located in the /etc/bumblebee/bumblebee.conf file.[5]  In the [bumblebeed] section, we want to set the Driver parameter to nvidia.  Then, in the [nvidia] section, we want to set the KernelDriver parameter to nvidia-current[2] and the LibraryPath and XorgModulePath parameters should have their nvidia-current versions of their paths.[6] For example, these are my two versions of these parameters:

LibraryPath=/usr/lib/nvidia-current:/usr/lib32/nvidia-current
XorgModulePath=/usr/lib/nvidia-current/xorg,/usr/lib/xorg/modules

Next we will setup our Linux boot parameters. This is done by modifying the /etc/default/grub file by making the GRUB_CMDLINE_LINUX_DEFAULT parameter read like the following:[2]

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=\"!Windows 2013\""

The acpi_osi parameter is supposed to help with backlight and fan control issues.[3] After modifying this file, run the sudo update-grub command and then reboot.

The final step in setting up the graphics is to compile the Mesa driver from source and install it over the mesa drivers which should have already been installed via the package manager. Doing this turns out to have quite a few steps so I decided it should have its own section…

Compiling and Installing Mesa

Follow the following procedure in order to compile and install the Mesa driver from source:

  1. Download the Mesa source with the command:[7]
    git clone git://anongit.freedesktop.org/mesa/mesa mesa.git
  2. Install Mesa dependencies with the following commands:[7]
    sudo apt-get build-dep mesa
    sudo apt-get install llvm
  3. In the mesa.git directory you just downloaded, run the command:[7]
    autoreconf -vfi
  4. Run the command:[7]
    ./configure --prefix=/usr \
                --enable-driglx-direct \
                --enable-gles1 \
                --enable-gles2 \
                --enable-glx-tls \
                --with-dri-driverdir=/usr/lib/dri \
                --with-egl-platforms='drm x11' \
                --with-dri-drivers=i915
    1. If this command complains about your libdrm version then you will need to also compile and install libdrm from source using the following procedure.  Otherwise, continue with the next step.
      1. Download the latest version of libdrm from the download page.
      2. Extract the downloaded archive using the command
        tar -zxvf libdrm-x.y.z.tar
      3. Install libdrm build dependencies with the following commands:
        sudo apt-get install valgrind
        sudo apt-get install libpciaccess0 libpciaccess-dev
      4. In the libdrm directory which was extracted, run the following commands to compile and install libdrm:[8]
        ./configure
        make
        sudo make install
      5. Check for the /usr/local/lib/pkgconfig/libdrm_intel.pc file. If it does not exist, copy the file from the libdrm source package. It is typically in the intel directory.[8]
      6. Add the /usr/local/lib/pkgconfig/ directory to the PKG_CONFIG_PATH environment variable. This can be done with the following command:[8]
        export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

        or, for a more permanent solution, add that command to your .bashrc file. You can confirm that this is setup properly by running the command:[8]

        pkg-config --modversion libdrm_intel
      7. After libdrm is installed correctly, re-run the configure command for Mesa above.
  5. Run the following commands to finish compiling and install Mesa:
    make
    sudo make install

After installing Mesa, your graphics should be totally setup and therefore your Linux installation on your Thinkpad W541.

Additional Configurations

Trackpad Setup

Synaptics for Linux apparently does not currently support the trackpad on the W541. You should therefore not use Synaptics in your Linux installation but instead use the imps protocol. This can be set up by modifying the /etc/modprobe.d/psmouse.conf file (or creating it if it does not exist) by adding the following line:[2]

options psmouse proto=imps

[Edit September 1, 2015]

The above trackpad setup provided me with a functional trackpad but it did not have trackpad scrolling.  After doing some digging, I removed the above configuration and reinstalled synaptics and the trackpad is working with scrolling so it appears that there is now support for the trackpad in synaptics.  You can reinstall synaptics with the following command:

sudo apt-get install --reinstall xserver-xorg-input-synaptics

You should reboot afterwards.  There are further settings in the System Settings -> Mouse & Trackpad menu.  You can verify that synaptics is running by running the synclient command from a terminal window.  If it outputs a bunch of property values then it is running.

Resizing

When I first started using Windows with the 3K display of my W541 I didn’t really notice much difference from the 1080p displays which I was used to. As soon as you get to the Ubuntu desktop you see a huge difference. Everything will look super miniature. In a way this is a good thing since it gives you a sense of having much more monitor space for having a million terminals and code editors open for development but it also makes it a bit difficult to see and isn’t totally usable as is.  My best guess as to why there is such a difference in appearance between Ubuntu and Windows is that Windows has “better” built-in scaling for larger resolutions.

The easiest solution is to adjust the system font sizes. This can be done by installing the unity-tweak-tool via sudo apt-get install unity-tweak-tool. Then run the utility either via the command line or through unity. Navigate to the Fonts section and then you can adjust several system font sizes to your liking.[9]

Sources

  1. Ubuntu Forums: “Problem booting Lenovo Thinkpad W541” by manadi
  2. Ubuntu Launchpad Bug #1437386 by manadi
  3. Ubuntu Forums: “How to set NOMODESET and other kernel boot options in grub2” by P4man
  4. Ask Ubuntu: “install nvidia driver instead nouveau” by Dor Zohar
  5. Ubuntu Wiki: “Bumblebee”
  6. Ask Ubuntu: “bumblee on Ubuntu 15.04” by Dima
  7. Debian: “How to build mesa”
  8. Surfing Troves: “Defeating the MesaLib installation issues”
  9. How-to-Geek: “Resizing Unity Launcher Icons”
  10. Ask Ubuntu: “Does Ubuntu 16.04 support hybrid grafics cards (bumblebee)” by JOnathanJOnes

23 thoughts on “Linux on a Lenovo Thinkpad W541”

  1. On linux mint:

    $ sudo apt-get build-dep mesa
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: You must put some ‘source’ URIs in your sources.list

    Mesa is a debian-only package it looks like.

  2. Hi,
    I have beside me a brand new w541 I got today.
    It spits out strange messages and screens but eventually boots into the graphical GUI using the mint 17.2 live DVD.
    The machine was configured to have Windows 7 in legacy mode per my request.

    In your opinion, can I safely install mint and let it partition the HD? I am terrified of bricking this expensive machine (16GB, 500SSD).

    Thanks, Jo

    1. I’ve never used mint so I am not sure if you will run into the same problems I had with Fedora and Ubuntu. In my quest to get Linux on my w541 I attempted to install Fedora several times. Each time the GUI installer completely froze and I had to hard boot the machine but it did not break anything. If you are trying to install to the same drive as your Windows installation and you want to keep the Windows installation then the worst thing that could likely happen if your installation fails is losing your Windows partition if it messes up your partition table (I installed to a different disk so I’m not sure how likely this is). Then you would just have to reinstall it so make sure that everything is backed up and you have access to a Windows 7 installer.

  3. Hi, thanks for sharing all this info.
    I am looking for a linux laptop and that w541 seems ok, but first i am doi
    ng some linux related research to avoid some later disapointments…
    In the past i’ve managed to install diferent kind of distros in really old machines(12 yrs old +), but i confess that i am a bit afraid with brand new hardware… So, i have a few questions: do you have any regrets about your choice (w541)? And is the 3K display worthy? Specially if not doing any specialized graphic design… Also, how is the behavior on external monitors(1920×1080 and/or 2560×1440) and with virtual box?
    Thanks, Nelson B.

    1. The only thing I would bring up to someone considering the w541 is the that it may be hard to setup due to the issues I ran into. However, now that I have it setup I don’t really have any complaints. I mainly got the w541 as a work station for development and not as a media center but I got the upgraded graphics card anyway in case I wanted to do something graphics related. I have seen the integrated Intel card struggle on certain web video players but the NVIDIA card powers through it. The keyboard is pretty good for typing and the numpad is an added benefit. I think the arrow keys could be a little bigger but they are at least easy to find by touch. The trackpad is also quite good. I don’t really use the nub (trackpoint) but I can say it functions much better than other ones I have encountered on older laptops.

      The 3K display looks nice but I don’t think there is enough explicit support for >1080p displays yet. The Windows UI is sized appropriately but certain programs open all squished and the default zoom on browsers makes text too small to read comfortably (though the zoom can obviously be adjusted). Also, the Ubuntu UI is not as well sized as the Windows UI so hopefully you have good eyesight if you go that route. If you want to be an early adopter to help push developers to add explicit support for high resolution displays then you can get by fine but otherwise I don’t think the world is ready for 3K+ yet.

      I have used an external 1920×1080 display with it with no problems though note that you will need lightning adapters to hook up with anything other than VGA. I have used VMware with Windows Host and Guest and it seems to work quite well though I am using it on a non-stock SSD which I feel is necessary to get any kind of usability out of a VM. I would recommend getting the cheapest storage and RAM options when ordering the w541 and then buy your own replacements as they never tell you the brands of their different component options and I am particular about the computer component brands I stick in my machines.

  4. Hi all,
    I installed mint 17.2 on my brand new w541, and while it shows
    “mmc0 unknown controller version(3), You may experience problems”
    The installation went quickly and without a hitch. Apart from not being able to use the nvidia things seemed ok, BUT::

    The VGA port is broken (washed out colours), and I hope this signals there is something wrong with the whole unit, but I suspect some of it is broken Linux support.

    It can’t shut off from the GUI. (I can go CTRL-ALT-F1 and do ‘/sbin/shutdown -h now’ after it ‘hangs’). Worse, it can’t boot, not even into windows, when the mouse+keyboard USB is plugged in. it just hangs.
    perhaps it thinks it is some kind of harddrive and tries to boot from there LOL, but I can’t even see a ‘boot order’ in the BIOS. One time it went into “Lenovo fixing mode” when booting windows after I had to shut off a hanging machine with the power button.

    Even worse, if I log out (session) my dual monitor is gone (until a reboot). it either hangs or will only go with mirroring the same display on both screens. I assume this is the nouveau driver.

    This is terrible.

    Unless the unit is faulty, I will not recommend this machine or Lenovo for any Linux user.

    -Jo

  5. HI

    How do i go about installing the NVIDIA reference drivers on a Pure Debian Jessie System as “sudo apt-get install nvidia-current” doesn’t find any installation candidates using this command.

    Thanks.

  6. Thank you for writing this up. I took me sometime however to realise that somehow GRUB_CMDLINE_LINUX=”nomodeset” was in my grub configuration, giving me problems with my external display.

    After commenting this out it worked fine.

  7. Hi there,

    Great guide, I followed it and it all went through, sadly, after I finished the guide, the one problem I was trying to solve, is still there 😦 . On the login screen I enter the password and if the password is correct the screens just flicks and sends me back again to the login screen. Have you seen this problem?

    thanks

    1. I actually ran into this same problem during my install. Sadly it seems to be the only thing that I didn’t write down from the whole experience so I don’t remember exactly how I solved it but I think I had to reinstall the Nvidia drivers and it went away. If you google “Ubuntu Login Loop” you will get a lot of results. I remember trying a bunch of solutions but none of them worked for me. Many of them say to remove the ~/.Xauthority file and reboot and that has worked for a lot of people.

  8. This post is a life-saver. Many thanks for these detailed steps, this was tremendously helpful — I couldn’t have installed Ubuntu on my W541 without this!

  9. Thank you very much for this posting, saved me some lifetime.
    One hint for non unity users (in my case xfce) you can “fix” the scaling within font settings, setting the DPI from 91 to 182 gave me a good looking fontsize and still keeping the resolution up.

  10. Hello,

    Thanks for the information, it was very useful.

    Some additional comments on installing Ubuntu using the netboot mini.iso image from a CD or USB stick: the mini.iso image does not include the Intel 7260 wireless chip driver and firmware. I had to unpack the initrd.gz file and add the following two files:
    https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7260-ucode-15.227938.0.tgz -> contents of this go into the /lib/firmware/ directory in initrd
    – I had to take the iwlmvm kernel module from the corresponding kernel modules deb package: http://packages.ubuntu.com/wily/amd64/linux-image-extra-4.2.0-16-generic/download, and add it to the relevant kernel module directory.

    After the boot the installer still did not recognise the wifi card, I had to go to the console and manually load the mac80211.ko and iwlmvm.ko kernel modules. After that the installer could recognise the wifi card and the network installation went ahead smoothly.

    I simply can’t believe that the Ubuntu netboot image does not have all network-related kernel modules included, ah….

    Zoltan

  11. Thank you for the instructions!
    I have a brand new W451 and I really want Linux on it — but so far the installation is giving me a challenge. I tried following your initial instructions, but when I press e in the grub menu, the viewed file doesn’t have a ‘$vt_handoff’ at the end of the linux line.

    Is it safe to add the text ‘ quiet splash nomodeset $vt_handoff’ anyway?

    Cheers!

    1. It is a little strange that $vt_handoff isn’t there by default on your system but you technically don’t need it. So it should be safe to keep it out or you can add it in if you want. The $vt_handoff variable is basically there to improve appearance during boot by displaying a colored background instead of just a black screen before the boot logo appears so if you don’t care about that or if you are getting this even without $vt_handoff being used then feel free to keep it out.

      If you do add it back in and experience any difficulties, I would try following the directions on this page: kubuntuforums.

      Information Source

  12. Hi,

    did anyone try to install ubuntu after switching off the the GPU or IGP in the BIOS, so exclusively one is used? Sounds very simple, but may work. Can’t actually try by myself because use the w541 at work…

    every note appreciated…

Leave a comment