Getting Fedora 21 Running Well on the ThinkPad X1 Carbon (2015)

It works! It really does.

So after several days, I finally have this all set up and running optimally.  Well, about 98% optimally.  There is only one nagging issue I’m having, but it’s really not a big deal…certainly not enough for me to really care about.  But when I turn the keyboard backlighting on, it turns off after reboot or suspend.  It would really be nice if I could make it persistent.  But that’s small potatoes.

But if you’re interested in how to get this all set up, read on.

One note: this notebook features a “fn-lock.”  If the lock is not on, the F keys are mapped to their intended uses, i.e. volume changing, brightness, etc.  Press fn + esc to lock them to regular F-keys.  In Linux you will likely use them much more than their other purpose.  This means you have to now press fn along with the key to do something like change the volume, whereas before you would have to press fn just to get the regular use of the f-key.

Backing Up the Pre-Installed Image

I didn’t want to mess with having to be on the phone with Microsoft or Lenovo in the event that I wanted to put Windows back on this machine, trying to get a product key or God forbid having to pay for installation media.  Luckily, Windows 8 has a nice feature that allows you to build your own USB restore media.  All you need is a USB drive that is 16GB or larger.  Move your mouse to the top or bottom of the right side of the screen, and “charms” will appear.  Go to settings, and type “restore” in the search box.  You’ll find an option to create bootable recovery media.  It takes about 8-10 minutes.  Now you have a backup if you want to go back to Windows.

Booting from the Fedora USB Key

This turned out to be trickier than I first thought, and I spent about 2 very aggravated hours on this before I figured it out.  I used Fedora’s USB utility, as well as a tool for Windows called Rufus, but every time I would boot from the USB, it would get about 85% of the way done before dumping me in an emergency command line environment.  I tried other spins, too…Fedora KDE, Fedora XFCE, etc.  I even tried Fedora 22 Alpha to see if something had been updated.  I also went into the BIOS and disabled USB 3, forcing the ports to defer to USB 2.  It kept happening.  Finally, I tried a different tool to write the ISO to the USB drive…I used win32 Disk Imager.  Worked like a charm.  Apparently the “universal” image writers actually change syslinux, so it has problems booting.  Using the disk imager fixed the problem.  If you were using a Linux or Mac machine to write the USB, you could also use the dd command to write the image bit-for-bit to the USB drive.

Fedora 21 Installation and Partitioning

The partitioning tool in the Fedora installer is a little weird to me.  The automatic partition option only looks at free space, so you have to use an option that says “free up additional space.”  This allows you to blow away the partitions.  But you will probably want to then use the “partition myself” option, as the automatic partitioning for me (128GB SSD) sets a HUGE root partition of 50GB, leaving much less space (after swap and EFI partitions) for mount point /home.  So what you can do is either do the automatic option, free up space, then use the custom partitioning to adjust the root partition down to 20GB, then use more space for /home, or you can exit the installer, use gparted to blow away all the partitions, and start the installer again.  Alternatively, you could put everything on the root partition.  I chose to not do this, as I could keep my entire home directory (and associated settings) and try a different distribution if I wanted to, by simply overwriting the root partition.  I used 500GB for EFI/boot, 8GB swap, 20GB root, and all the rest of the space went to /home.

Updating Fedora to the Latest Packages and Stable Kernel

Run this to update everything, then reboot:

sudo yum update

Depending on your connection speed, this could take 5 minutes or much longer.  Mine went pretty quickly.  Reboot to make sure everything installed correctly, and verify you are running a new kernel (3.18 at time of writing) by running the following in the terminal:

uname -a

Installing Guake, a Drop-Down Terminal

I think Guake is one of the best Linux apps out there.  It is mapped to your F12 key, is quick, looks good, and is customizeable.  We are going to install it and then set it up to run at login, so it will always be available.  To install:

sudo yum install guake

Now add it as a startup application in gnome-tweak-tool.  The command is simply “guake” and you can put in any additional comment you want.  Once you add it to startup applications you can access a terminal at any time just by pressing F12.

Desktop Scaling in Gnome Desktop

Gnome by default seems to recognize that this is a high-DPI screen and uses it’s limited scaling capabilities.  Basically it just doubles everything.  I find that this is too much…you lose out on a lot of the screen real-estate that you have.  In order to fix this, you need to do 2 things…set the scaling factor to one, and change the text scaling to 1.1.  The scaling factor being set to 1 makes everything small, and I found that setting the font scaling to 1.1 is a happy medium…the text is still small enough that it fits within all of the UI elements, but is a bit larger and easier to read.  To accomplish this, you need to install 2 tools.  Gnome-tweak-tool and gconf-editor.

sudo yum install gnome-tweak-tool gconf-editor

Open the tweak tool first.  There you can go under windows, set the scaling to 1.0, and set the font scaling (under fonts) to 1.1.  This takes care of most of the scaling, but there is still some persistent scaling issue with the activities pane and some elements of the UI will still be mismatched.  To fix the rest of it, open gconf-editor (press alt-F2 to bring up the run dialog, then type in gconf-editor) and find org.gnome.desktop.interface and the scaling-factor setting, and change it to 1.  Sadly, there are no options except 1 or 2, I think if it were able to accept 1.5 it would be perfect.  Reboot or log out/back in for the settings to go into effect completely.

Further Tweaks with Gnome-Tweak-Tool

There are a lot of helpful things under “extensions.”  I used the extensions that give me back the normal applications and places menus, as well as an extension that moves the tray icons to the top (legacy icons) and one that fixes the “favorite applications” as a dock on the desktop.  Click “get more extensions” and they can be installed with one click in Firefox.  Due to how they manage plugins differently, this doesn’t work in Chrome, which we will install next.

Installing Fedy and Extra Software

If you go here you will see a fantastic tweak tool that someone wrote that really helps the post-install process.  You can use it to add custom (restricted) repositories, install Google Chrome, and a ton of other useful things.  Run this command to install it (all on one line):

su -c "curl https://satya164.github.io/fedy/fedy-installer -o fedy-installer && chmod +x fedy-installer && ./fedy-installer"

This tool has several categories of options, but the ones that are most important are installing Google Chrome and setting up the rpmfusion repositories.  You can also install other software (Sublime Text is a great text editor/coding environment) and multimedia codecs.

“Fixing” the Wifi Card Connectivity Issues

This is a fairly new Intel card, and you will notice that the connection drops repeatedly, even with good signal strength.  I found a few bug reports and it’s being worked on, but likely won’t be affecting Fedora users until F22 or at the very least a later kernel for F21.  In the meantime, this can be worked around by disabling the wireless-n feature.  Even after disabling, you will still pull pretty good download speeds, and suddenly the wifi always works.  To disable the wireless-n:

 sudo sh -c 'modprobe -r iwlwifi && modprobe iwlwifi 11n_disable=1'

Enabling the Brightness Adjustment Keys

After several hours of banging my head against the wall a combination of reading documentation and a message from another reddiror got this squared away.

I looked up a little more about modules, but had a little trouble finding out how to load them initially. A lot of the documentation I found via google was outdated, and the ways that things like this have been done have changed a number of times…looks like at one point you actually had to write a script. The first hints I got were when I gave up googling and actually searched for terms in the official fedora documentation. (Why does it never show up in my google results?!)

Anywho, the command ‘modprobe’ (ran as root via sudo or su) is what actually loads a module, but just for the time being. Loading a module via the CLI will go away once you reboot. So I tried

  modprobe thinkpad_acpi

and got an error that it could not load, the device didn’t exist.

From what I’ve read this happens from time to time, but there’s another statement you can add – ‘force_load’ – which does exactly that. So, type this:

   modprobe thinkpad_acpi force_load

and it works like a charm. You can use the brightness keys right then and there…in fact, the little gear pulls up system settings (I’ve switched back to gnome, long story) and the other keys pull up home folder, etc. Fantastic!

But, gone after reboot.

Figuring out how to make this change persistent was a little more tricky. The way to persistently load modules in f21 is to add a conf file to the directory /etc/modules-loaded.d/.

The conf file should just have the name of the module you want to load (with a comment if you want) and it is supposed to load. So I tried first the name of the module and nothing else. Then I tried it with the ‘force_load’ statement, neither of which worked. That’s when I got a reply from another redditor that fixed it.

Run the following (as root):

echo thinkpad_acpi > /etc/modules-load.d/thinkpad_acpi.conf
echo "options thinkpad_acpi force_load=1" > /etc/modprobe.d/thinkpad_acpi.conf
reboot

The two echo statements add a string to a file…for instance the first one adds “thinkpad_acpi” to a file it creates, “thinkpad_acpi.conf” which is in the indicated path. The second adds the qualifying option to modprobe. (The third of course reboots.)

This got everything working perfectly after reboot.  Now you should be good to go!  Let me know in the comments if you have anything to add or experienced any of this differently.