samedi 7 octobre 2017

Debian on my new ThinkPad T470p

As I started my new activity as a contractor, I bought a new laptop: a Lenovo Thinkpad T470p. Not that I fell in love with Windows, but to install Debian on it. Here is the description of the journey. I leave the reason of my choice in another post.

Hardware

The hardware is made of:

  • A i7 processor
  • 8 GB Ram
  • 256 GB Samsung SSD
  • A Nvidia GeForce 940 mx graphic card
  • Intel 8265 wifi component

I'm quite happy with this.

What you'll need

Prepare this stuff or it won't work:

  • Your laptop
  • An USB key (not a big one, I used a 1 GB old key I had)
  • An Internet connection through ethernet cable, since what I describe won't work by wifi.

Installation

I have several installation of Linux behind me, but only on BIOS based systems and raspberry PI. So I learned about UEFI, not without some difficulties!

I want to install Debian testing, because Debian stable usually contains old stuff. So at the time I write these lines, its little name is Buster and it might be Debian 10th release.

First thing to do is to download an ISO. Do yourself a favour and don't chose a Debian testing installer. It's an alpha version and will simply not work (I used netinst ISO and it doesn't contains the mandatory packages). Go on with stable distribution. I chose netinst, because I did not have a big bootable USB stick at home and I want a minimal installation. I chose an amd64 architecture (though you have an Intel CPU… I know, I know…).

Now you have to make an UEFI bootable USB key. To do so, from Windows 10, I used Rufus. I first made the mistake of choosing to make it BIOS bootable. The thing is that depending the type you choose (UEFI or BIOS), the installer will now if it has to install on UEFI or BIOS. I made the bad choice at first and the laptop did not boot at the end of the installation. So, choose to format the key as a UEFI boot device.

Remember to shrink your disk to have some room for your Linux system. I used the disk management tool provided with Windows 10. I did not gain lot of disk space, but I guess it is the most secure way to do so.

Now reboot having the key plugged and go into the BIOS by pressing Return while booting. In there, disable Secure Boot in security options (I guess). You can also change boot order to make it boot directly from the disk, instead of Windows bootloader. Exit the BIOS and press F12 to access the list of devices to boot from. Choose the USB stick. You now enter the installer.

From here, you won't face a lot of trouble, do whatever you want. Just notice:

  • I prefer the simple ncursed based installer instead of the graphical one. I know I'm a nerd but believe me, it's easier to use.
  • The wifi chip needs a non free firmware that is not provided by the ISO. The installer propose you to get it from another support. Say no.
  • I advise you to keep the installation to its minimum, without a graphical desktop since you will upgrade to testing right after the process.
  • I chose not to use Swap partition. Come on, I have 8GB RAM! It's controversial though, and I could create a swap file later on if things goes wrong.

At the end of the installation, remove the USB key and let the installer reboot the machine for you. You should then see Grub to boot on your Debian.

Post installation

First thing I did was to switch to testing repositories and activate contrib and non-free repo. To do so, replace the content of /etc/apt/sources.list with:

deb http://ftp.fr.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.fr.debian.org/debian/ testing main contrib non-free

deb http://security.debian.org/debian-security testing/updates main contrib non-free
deb-src http://security.debian.org/debian-security testing/updates main contrib non-free

deb http://ftp.fr.debian.org/debian/ testing-updates main contrib non-free
deb-src http://ftp.fr.debian.org/debian/ testing-updates main contrib non-free

Then, as root, launch the upgrade:

apt-get dist-upgrade

Remember to install the wifi firmware with:

apt-get install firmware-iwlwifi

And voilà, you can install whatever you want.

Troubleshooting

I faced a few caveats after the installation, partly because I chose to use XFCE as my desktop environment and lightdm as a display manager (because I like to try different desktop).

The main problem was the inability to log back to my session after locking it. After spending a looong time on Google, I found that it is due to an incompatibility between XFCE4 power management and lightdm-locker, the locking frontend for lightdm. The no brainer here is to install and configure the (ugly) xscreensaver, as XFCE tries to use it before light-locker while locking the session. Its done in a simple shell script (/usr/bin/xflock4), so feel free to check and hack it if you want.

I also found some error messages related to firmware in the syslog, which made me install firmware-misc-nonfree package. I thought at first it was related to the locking problem, but actually I do not know the effect of this fix.

Conclusion

I'm really happy with this system. It's amazingly fast. I took time to install Node and Python 3.6 from sources and I'm ready to hack!

If everything works well in near future, I may drop Windows partition and reinstall the system to use the whole disk and encrypt the partitions. The journey is far from being over!