Search interesting materials

Tuesday, July 25, 2023

A conservative path to get to a fully working Linux computer

by Ajay Shah.

Linux has long been a great operating system, but there is a bottleneck on getting it properly installed and working. It is hard to get it to work with all the hardware such as the wifi, USB devices, audio, suspend/hibernate, etc. This is because this hardware tends to evolve rapidly. The device vendors frequently do not release source code, or even binaries for Linux. The Linux community solves this through large applications of brainpower. As a consequence, Linux support for the devices comes through with a lag. If you get a state of the art computer, and try to install Linux on it, this will often prove to be challenging.

How can we avoid these risks and complexities? There are three conservative pathways to get to a fully working Linux machine.

Method 1: Use a chromebook

Chromebooks are wonderful machines where Google takes responsibility for your Linux install, and for over-the-air updates (exactly as they do with Android). There are a wealth of good Chromebooks out there, and one that is noteworthy is the Acer Chromebook Spin 513. The basics all work on a Chromebook, and then you get "the Linux development environment" which gives a familiar apt-get interface to installing packages. I have installed emacs, svn, R, latex, etc. and it all just-worked. On many Sundays, my morning ritual of writing a column for the Business Standard is done using emacs on a chromebook.

Method 2: Buy linux pre-installed

Firms like Dell or Lenovo offer Linux pre-installed on some computers [example]. Here, again, you're up and running with zero friction. You are guaranteed that all the devices are supported. But there is a downside: You are stuck with the distribution that was chosen by the vendor. This may or may not be to your taste.
It's good to have the complete knowledge, so as to deal with future situations of systems administration or full reinstall. As an example, it's nice to have your servers on the identical distribution as your laptop. So I feel incomplete if someone gives me a perfectly working machine that I did not install. This is indeed schizophrenic: with a chromebook or an android device, I do not expect to ever require systems administration or reinstall, but with a Linux machine, I do.

Method 3: A conservative path to choosing hardware and OS

As a long-time Linux user, I have found that it's good to understand and get used to one Linux distribution, and then stick with it across the years on all my systems. For me, this distribution of choice is Debian stable.

Debian stable will often not work well on a state of the art laptop. The moniker `stable' implies something that has stabilised after years of testing, and it will not know recent developments in the hardware. What is the way out?
Two factors that should be kept in mind. The laptops where Linux is available pre-installed from the vendor are those where device support is superior. And, the laptops that have high production volume are more likely to go out into the expert community that makes Linux work. As an example, Xiaomi's Mi laptops are a high volume part (so the second factor is in favour) but where Linux pre-installed is not a choice (so the first factor is not).

The key idea of this article is to look at the gap between the date of a laptop release and the date of the Linux kernel. Based on your ability to deal with glitches, you must establish a minimum delay that makes you comfortable. For me, this minimum delay is 1 year: once the linux kernel is atleast a year younger than the laptop, I'm in good shape, based on my ability to deal with difficulties and my risk tolerance. Each person should choose this one number.

With this in hand, we have a recipe for screening a laptop before purchase :
  1. For a laptop of interest, find out its release date. As an example, when I liked the Mi Notebook Ultra, I found this the release was in August 2021. Similarly the release date for the Xiaomi Notebook Pro 120G was August 2022.
  2. Look carefully at the Debian release of interest. The Debian stable of today, which is called `bookworm' has the kernel version 6.1. This has a release date of December 2022. 
  3. Restrict yourself to machines which are atleast a year older than this kernel.
Example: Mi Notebook Ultra. There is a decent delay between the release date of the Mi Notebook Ultra (August 2021) and the 6.1 kernel release date (December 2022). Hence, this is likely to work well.

Example: Xiaomi Notebook Pro 120G. This has a release date of August 2022. As an example of how these problems play out, this laptop has the sweet Intel work in the 12th generation "Alder Lake" CPU, with performance cores and efficiency cores. Harnessing these properly in the Linux kernel is non-trivial, and got done for kernel 5.18 in August 2022. Going by our recipe, we should wait a year after the laptop release, and thus ask for kernel 6.4. We don't yet know when it will show up in future Debian releases. What is Debian testing today ("trixie") uses kernel 6.3 that was released in April 2023, which does not satisfy the one-year test when compared with the release date of August 2022.

A long-run strategy that harnesses this recipe, to stay on contemporary hardware and software, consists of buying a new machine every time Debian testing reaches "release candidate 1" ("RC1"):
  1. Watch the current Debian testing. (At present, this is `trixie').
  2. Wait for it to achieve its Release Candidate 1 ("RC1"). For Debian 12 this was 3 April 2023.
  3. Identify the kernel version that they have in it and the release date of this kernel (using the URLs placed above).
  4. Limit yourself to examining equipment which has a release date of more than a year prior to this kernel release date. Buy this, and it's likely to work well.
  5. At this point, you are on a fully working Debian testing RC1, but this will rapidly mature into Debian stable, and then you have a few years of stability. For Debian 12, the stable release was 10 June 2023, which was about two months after RC1.
Under this strategy, every few years, when Debian testing reaches RC1, it is time to buy a new laptop. You will regularly buy a laptop that is at least one year older than the kernel version in Debian testing. Modern computers are fast enough that this is not an important constraint, and older laptops are cost-efficient.

Jumping into a testing RC1 is a bit risky. This level of risk seems fine for a personal laptop but for production systems it is better to do this differently: instead of going in roughly 3 months before the release date, it's good to wait 6 months after the release date.

I thank Chirag Anand, Ayush Patnaik and Megha Patnaik for useful conversations.