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.


  1. This is from Shuvam Misra --

    The experiences reported here vastly differ from ours, and it may be good to look at datasets which look vastly different from what's reported here, to recognize that the problem "may not lie with Linux".

    I am part of a software projects company with several hundred employees, where 90% of the employees are expected to use only Linux on their laptops. Most employees are allotted laptops owned and provisioned by the company's team. As is the norm in our industry, one-third of our young developers resign every year and are replaced, plus there is a net increase in headcount exceeding 25% PA, which means we are steadily buying new laptops. These laptops are almost all Dell and HP ones, and Linux is installed on them, and works flawlessly. We do not take special care to cherry-pick specific models. But none of the walking-on-eggshells care which has been described in this article seem to apply to our experience.

    What do we do different?

    First, we do not play with laptops from Chinese brands whose entire positioning is in the consumer space. We do not touch Xiaomi or MI or similar brands. We treat laptops as valuable long-term assets, which will last at least 3 years, so we do not see any point in choosing brands whose positioning is for the use-and-throw consumer space.

    Second, we do not use Debian stable as our distro of choice. We believe that it is a poor choice of distro for those who want out-of-the-box hardware compatibility and flawless performance. There is a world-renowned Debian-based distro which has made it its mission to provide this kind of flawless compatibility, which is Ubuntu. (There are others too.) We do not have any idea why anyone who suffers compatibility problems with modern laptop hardware chooses Debian stable. We use Ubuntu LTS releases exclusively. This means that after May 2020, we started installing Ubuntu 20.04 LTS on all laptops. After May 2022, we started installing Ubuntu 22.04 LTS on all new laptops, and so on. And we did not do any careful trials or tests to match the Linux distro to our hardware. And all our laptops constantly auto-update to the latest updates. Constant updates are essential for hardware compatibility, we have found.

    A third point of difference: we find the Chromebooks referred to here to be useless for our needs. We are not aware of Chromebooks which have 16GB RAM, and no developer in our company will find a laptop with 8GB RAM usable. Therefore, Chromebooks may be useful for some, but are not meant for software developers who use GUI IDE (integrated development environments like MS VS Code, with graphical user interfaces) with their host of extensions and plugins. Yes, we know that it's possible for software to be developed without such IDE, but that's not how our developers are comfortable developing their code, and we prefer not to create religious issues about what tools they can and cannot use. (I personally write code using VIM and do not use any IDE, but I'm almost 60 years old.)

  2. This is the previous Shuvam Misra comment continued --

    A word on laptop brands and chipsets. Laptops use chips, 90% of which are not made by the laptop manufacturer. When HP makes a laptop, it uses a USB interface chip from one manufacturer, a wifi chip from another manufacturer, an audio chip from a third, and so on. None of these are made by HP. We have found that the more reputed laptop manufacturers choose more expensive, more well supported chips. IBM (now Lenovo) Thinkpads used to use Intel chips for their LAN and wifi interfaces, while cheap consumer-only models of laptops from the cut-price far eastern brands would use chips from Realtek or other far eastern chip manufacturers. We have consistently found that these far eastern chips have poor support in Linux and are also a bit unstable even on Windows. Intel, on the other hand, invests resources to ensure that the Linux device drivers for their chips are in excellent shape, both for Linux and Windows. Therefore, by avoiding these bottom-of-price-barrel laptop brands, we indirectly avoid the less well supported chipsets, and this gives us awesome Linux stability.

    So, in short, Linux has superb hardware compatibility with modern laptops from brands which use reputed (and slightly more expensive) components from reputed chipset manufacturers. Choose the right Linux distro, choose reputed laptop brands, and always use the latest updated versions of your software. The problem does not lie with Linux.

  3. On chromebooks. I have used chromebooks released ~ 5 years ago for the normal cycle of emacs/latex/make for full complex problems. Those machines get disproportionate efficiency, in my opinion.

    And, google just solved your problem about beefier chromebooks:


Please note: Comments are moderated. Only civilised conversation is permitted on this blog. Criticism is perfectly okay; uncivilised language is not. We delete any comment which is spam, has personal attacks against anyone, or uses foul language. We delete any comment which does not contribute to the intellectual discussion about the blog article in question.

LaTeX mathematics works. This means that if you want to say $10 you have to say \$10.