Skip to content

Instantly share code, notes, and snippets.

@jjmalina
Last active July 6, 2021 17:45
Show Gist options
  • Save jjmalina/5e13b2269ec97895ea5fda9df6d26751 to your computer and use it in GitHub Desktop.
Save jjmalina/5e13b2269ec97895ea5fda9df6d26751 to your computer and use it in GitHub Desktop.
Installing Debian 8.5 "jessie" on a Lenovo X1 Carbon 4th generation

Installing Debian 8.5 "jessie" on a Lenovo X1 Carbon 4th generation (20FB) - 2016

UPDATE 2018-02-24: I got a new Lenovo X1 Carbon 5th gen and tried to do the same setup with Debian 9.3.0. It was an utter failure because of some boot issues. I went with Xubuntu instead and everything works FLAWLESSLY. Xubuntu is beautiful.

I've had my mind on switching my development machine from a 13" MacBook Pro Retina to a Lenovo X1 Carbon running Linux for a while. The main reason is getting more familiar with Linux itself and also to have a more stable and minimal dev environment. So I finally got the machine and decided to install Debian 8.5 "jessie". Why Debian? Well, I tried installing Arch Linux once and couldn't get past getting wifi to work, and Ubuntu seemed like it added too much stuff. The choice was either Debian or Linux Mint. I went with Debian because it seems like it's the most stable.

Create a bootable USB stick

I followed the instructions at https://www.debian.org/releases/jessie/amd64/ch04s03.html.en which explicitly say to not use unetbootin which is a tool that makes bootable USBs for you.

  1. Download the ISO image from the downloads page: wget http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-dvd/debian-8.5.0-amd64-DVD-1.iso
  2. Write the image to a USB device, which you'll need to find first with diskutil list on a Mac (for me it was disk1). Then unmount it with diskutil unmountDisk diskX.
  3. Copy the image to the disk
cp debian-8.5.0-amd64-DVD-1.iso /dev/disk1
sync

This will wipe everything off the USB so you'll have to reformat it if you want to use it again. You'll need another USB for installing software downloaded from another machine because there won't be internet access at first. If you don't have another USB then follow the Debian instructions on how to make a multi-partitioned bootable USB. An unfortunate side-effect was that Mac OS X's Disk Utility can no longer reformat my USB sticks.

Update the BIOS

For some reason the version of the BIOS that comes installed on the 4th gen X1 Carbon won't boot from a USB. So you'll have to update the BIOS from http://support.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x1-carbon-type-20fb-20fc/downloads/DS111756
It's pretty easy just follow the wizard.

Change BIOS settings

The machine shipped with Windows 10, which doesn't fully shutdown when you "shut down" the OS so run shutdown /s /t 0 in command prompt or else you can't restart and enter the BIOS (F12). There are some BIOS settings that need to be changed in order to boot from USB. See the BIOS section of https://wiki.debian.org/InstallingDebianOn/Thinkpad/X1%20Carbon%204thGen%20PCIe_SSD/jessie

Boot USB installer and install Debian

Once you exit the BIOS and spam the F12 key you should see your USB in the list of devices to boot from. Select it, press enter, and you should get taken into the Debian installer which is nice and easy to step through. I went with GNOME for the desktop environment.

Fixing up Debian

This is where the real trouble began for me. I knew from https://wiki.debian.org/InstallingDebianOn/Thinkpad/X1%20Carbon%204thGen%20PCIe_SSD/jessie that the wifi and sound wouldn't work, and in order to get them to work I'd have to install an updated Linux kernel. So I updated the kernel and it booted but video didn't work. Luckily Debian allows you to boot different kernels so I could install the necessary drivers from Debian booted with the old kernel.

The drivers to install first (from jessie-backports):

Download the .debs and then install them with sudo dpkg -i name-of-package.deb.

Then download the linux-image-4.7.0-0.bpo.1-amd64 kernel .deb and install it the same way as the drivers.

Once everything's been installed you can restart the machine and it should boot into the latest kernel. You should now be able to connect to a wireless network from the Network Manager.

At this point I wanted to install apt packages but nothing was coming up. It turns out the apt sources config was commented out (because of no connectivity?) so I had to uncomment the sources with sudo vi /etc/apt/sources.list and then run sudo apt-get update. After this I was good to go.

Conclusion

I knew there would be some gotchas to set everything up but it was quite a frustrating process. I don't know if it's the Linux kernel, Lenovo, or the BIOS to blame but there were issues with all of these components. Maybe the software installed on the X1 Carbons will be fixed and the issues I experienced will go away, but who knows. That said, I do really like this machine because it's very light, has a nice screen, the keyboard feels great, and Debian with GNOME is quite snappy compared to Mac OS X.

A couple of things I'm still trying to figure out and get used to

  • the keyboard shortcuts which are different on Mac OS X: ctrl + left|right arrow, copy paste, the placement of the Windows button
  • apt-get vs homebrew
  • an apparent issue with gnome-terminal eating memory

I'll probably write a follow-up after getting used to doing my daily work on this machine.

UPDATE: I switched to XFCE because GNOME was slowwww. XFCE is really excellent and doesn't use many system resources.

@thetophs
Copy link

Were you able to reformat the disk on mac via the terminal and diskutil?

@jjmalina
Copy link
Author

@thetophs no I tried that and it wouldn't work. reformatting from Linux works fine though

@karatedog
Copy link

I have a Lenovo Yoga 460, and Ubuntu was at first a good choice as it has the wifi driver by default, so during the install process it is able to download updates. Is 'firmware-iwlwifi' included in the Debian install disk? Because if not, it is a bit hassle to download it without wifi and without RJ45 port :-)

@timotheemoulin
Copy link

Hi, have you ever tried to get a decent screen resolution?
I set up the gnome window scaling to 1 so all my gnome windows are nice and with small fonts but everything else is miserably big.
Any thought?

tim

@avinash-oza
Copy link

Thank you for this guide. It was really useful. In case anyone reads this in the future from the US, we do not get the Ethernet dongle. I spent a lot of time on trying to get the drivers for wifi working in the current (3.2?) kernel. I ended up using a tool called apt-offline in order to update my stable (jessie) to testing (stretch). This allowed me to pull the latest kernel which had everything in good condition.

Make sure that you are using the same version of apt-offline on both of your computers. I spent a lot of time trying to debug issues I was seeing and it came down to this.

I settled on using testing as the way of backports did not seem to be as clean.

Avi

@jjmalina
Copy link
Author

@timotheemoulin yes I have a script to change scaling when I switch to external monitors which runs xfconf-query -c xsettings -p /Xft/DPI -s 96 then when I switch back to the laptop monitor I set it back to hidpi xfconf-query -c xsettings -p /Xft/DPI -s 192

It's clunky because I have to restart apps so they get the right sizing but it works. Apparently the newer version of XFCE makes external monitor support better

@t0rqd
Copy link

t0rqd commented Feb 4, 2017

Does your system have system beeps? My old Thinkpad beeps with power connect/disconnect and I was hoping for the same on my X1. So far, no luck there.

Additionally, I've had issues getting EFI to boot by default without a hack (https://github.com/t0rqd/Lenovo_Type_20FB/blob/master/fix-reboot.sh) which makes it hard to boot Windows on that rare occasion because I then have to boot off rescue media to reset the EFI boot loader. How did you force efibootmgr to correctly force grub on to the first partition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment