How to get Debian and WiFi/WLAN running on Lenovo ThinkPad L13 without an RJ45 port
I installed Debian on a Lenovo ThinkPad L13 a few days ago. The system is working by now but the road to "it works!" was a lot more exhausting than expected. I learned a few things along the way so it was not in vain. Maybe I can save you some time and/or headache with your own installation or help getting the WiFi to work. Let's go!
Why even get a Lenovo ThinkPad L13?
Simplified, I was looking for the cheapest ThinkPad with:
-
a less-than-14-inch matt full-HD IPS display
-
at least 16GB RAM, i5 CPU, 512 GB SSD, Intel GPU
-
support for a docking station
-
decent support for Linux
Canonical has certified Lenovo ThinkPad L13 to work well with Ubuntu 18.04 so I was in good faith that feeding Debian to it would work well. Not right away but eventually.
What's nice about the L13?
-
I like the keyboard
-
It has a shutter, a small hardware switch to close the eye of the camera
-
It looks rather elegant
What's weird about the L13?
-
It does not have an RJ45 LAN port. That's a bug in my world.
-
The battery cannot be removed. Bug!
-
It comes with two USB-A slots, only. I'm used to three or more and need them, so that's an inconvenience to me.
-
The BIOS is graphical be default (but it can be changed back to curses-like by setting
Config > Setup UI: Simple Text
) and supports mouse navigation. Except when the cursor gets stuck, happened multiple times; definitely a bug. -
By default the function keys
F1
toF12
act as if theFn
key was hold. That's not very friendly to users of Linux (thinkCtrl+Alt+F1
); the fix is settingConfig > Keyboard/Mouse > F1-F12 as Primary Function: Enabled
in the BIOS before you first need one of those keys.
What made the installation difficult?
-
The laptop itself lacks a RJ45 LAN port but the Debian installer wants wired Ethernet.
-
The WiFi chip does not work with the firmware and Linux kernel packaged in Debian buster; it needs more recent versions of these packages or a more recent release of Debian.
-
Unlike the installer of Debian buster, the installer of Debian bullseye is in alpha stage and fails with an error half-way in.
-
Upgrading a Debian buster with XFCE to bullseye produces file/package conflicts that need manual fixing and
apt install -f
to continue. -
There is EFI involved, so e.g. all your live media need to be built for booting with EFI.
The approach to installation that worked for me
The lack of a RJ45 port can be approached in at least three different ways:
-
(a) Buy a docking station with RJ45 and wait until you have it at hand
-
(b) Buy a USB-to-RJ45 external network card adapter and wait until you have it at hand
-
(c) Boot a live system shipping working WiFi drivers (e.g. Xubuntu 19.10) and use QEMU to make the Debian installer believe that the WLAN below its feet is plain LAN to them.
I didn't have a USB-to-RJ45 network adapter and no docking station handy. So it was waiting or… adventure. I decided for (c): no waiting, QEMU, adventure.
Installing Debian to the host SSD from inside QEMU
Before I continue: If you're using this as a manual I'll assume/expect that you already:
-
have set the boot order in the BIOS to boot off an external medium so we don't end up in some half-installed Windows; if you're looking for
+
and-
keys on an L13 with a German layout tryß
andShift+´
-
have
Security > Secure Boot: Disabled
in the BIOS -
have set
Config > Keyboard/Mouse > F1-F12 as Primary Function: Enabled
in the BIOS or know a way around it from within a running Linux -
have an external live medium ready that
- supports EFI (if you made something custom yourself) and
- comes with recent
iwlwifi
firmware, e.g.Xubuntu 19.10
.
Excellent — let's continue.
So you first boot that live medium with working WiFi. To install to the host SSD from within QEMU it takes:
-
Passing the SSD to QEMU
-
KVM virtualization to be fast
-
Allocating enough RAM to QEMU (for both swap size math and speed of installation)
-
An OVMF EFI image so that the installer detects an EFI environment and runs
grub-install
for platformefi-amd64
rather thanpc
, e.g. from packageovmf
on Ubuntu -
A small Debian buster network installer ISO download, e.g.
debian-10.3.0-amd64-netinst.iso
You then boot QEMU with KVM with the EFI image for a BIOS and two drives: the installer medium and the host SSD to install to. Note that the installer ISO cannot be passed as a CD-ROM drive or EFI won't boot off it. My command looked something like this:
sudo qemu-system-x86_64 \ -enable-kvm -m 12G \ -bios /usr/share/OVMF/OVMF_CODE.fd \ -drive file=debian-10.3.0-amd64-netinst.iso,format=raw,media=cdrom \ -drive file=/dev/vnme0n1,format=raw,media=disk
While in the Debian installer, when asked for the software to install,
do not enable "desktop environment" and do not enable any specific desktop
environment like XFCE, either. This allows upgrading to bullseye after the
installation without running into conflicts during upgrade.
The trick is to add the desktop environment after upgrading, not before.
You can run tasksel
from the installed system later and it will not only
install say XFCE for you but also present the very ASCII dialog
that you were presented during installation.
When the installation is done, the installer asks to reboot and remove media. Do not worry about media removal: EFI will boot of the disk because the boot order in the NVRAM of the VM (not the host) has that order set by the installer. If you run into a situation where you want to restart the installation from the beginning but cannot stop QEMU from preferring the SSD over the Debian installer live media, for a workaround consider wiping the EFI-partition of the SSD — it will be re-written during installation anyway.
Back on track: The Debian installer finished, it's the second boot in QEMU
and we need to do some finial adjustments to make the installation ready to
boot off actual hardware.
So log in as root, upgrade to bullseye using apt
,
enable package distribution non-free
next to main
to be able to install firmware-iwlwifi
and then install it,
install the meta package of the desktop environment that you want,
e.g. package xfce
or by running tasksel
as root.
Also install some WiFi management tool,
e.g. network-manager-gnome
(for command nm-applet
)
if you don't want to transfer .deb
files with a USB stick later.
Do a last boot in QEMU to ensure that everything but already WiFi works,
do a clean shutdown of the VM, run sync
on the host to flush unwritten
data to disk and boot on real hardware after.
Done.
If you cannot get it to work, feel free to get in touch.
Some closing notes:
-
Stable distributions and recent hardware are not a good match. It makes sense to me now, but I didn't expect that big of a disconnect.
-
The Debian installer makes full disk encryption with sane defaults, separate
/home
and/var
very convenient by now. Very nice. It's ahead of Ubuntu in that regard. -
Command line tool
efibootmgr
can be of great help with debugging or changing EFI boot entries and boot order from within a running system. -
If QEMU fails to boot off an installed hard disk (likely accompanied by a message like
BdsDxe: failed to start Boot0001
), then editing EFI boot entries from inside the OVMF bios may help.
Best, Sebastian