Ubuntu 22.04 has been out in the wild for a while now. Initial reviews of it where positive overall. A lot of people claimed that it was the best Ubuntu release in a very long time. So, I grabbed an ISO of the new Ubuntu and checked it out. In all honesty, I didn’t see much of a difference from the last LTS release. There were a couple of changes to the UI, mostly a result of Gnome 42 but nothing major that justified the praise it was getting. Don’t get me wrong, Gnome 42 is great but I had been using it for a while by the time Ubuntu 22.04 was released, so maybe that resulted in my lack of excitment.
Anyway, a month or two after my initial experience with 22.04, I found myself having to daily drive it. The circumstances leading to this are quite unfortunate; very deserving of their own blog post. Here is a gist however, so I got this HP Spectre laptop for work some time back (before the release of 22.04). My work to some extent does require using Windows. There is some stuff that can only be done with Visual Studio (SSIS yikes). Windows being a must, I decided to dual boot Windows and Debian (Debian Testing - my OS of choice). Unfortunately for me, this laptop refused to work with Debian and every other Linux distro I tried. Linux was unable to detect the SSD in the Laptop, I think due to Intel Optane (the SSD has this tech that tries to boost Windows’ performance - apparently just having an SSD is not enough for Windows, it somehow needs more). Being inexperienced with this wonderful tech from Intel, I was unable to figure out how to turn off Intel Optane (I was looking for a toggle for this in the laptop’s BIOS menu - unfortunately it’s not there), so I gave up and just accepted my fate. I was using Windows (an OS I have very little experience outside of playing pirated games) for work even though I only needed it for some 5% of my work and for the Linux stuff which is most of the stuff, I used WSL. Fortunately, one day I figured out a way to get GNU/inux running and unfortunately for me, only Ubuntu 22.04 worked quite right. The Ubuntu ride hasn’t been smooth so far, there have been a ton of issues. I will list some of them down here and maybe provide some work arounds.
Unfortunately, I left this in draft over 6 months ago, and I have moved on now but I am going try to fill in the gaps I left in the following sections.
Applications getting OOMD to death
Ubuntu has this systemd service called system-oomd (Out of Memory Daemon). This service kills processes when you hit a certain memory threshold. In Ubuntu, that threshold is set to half of the available swap space. Of criteria that
OOMD uses to kill processes, I am not so sure but from observation, I would guess that it goes for the processes using the most memory.
OOMD on its own isn’t a problem in my opinion. However, when combined with Ubuntu’s defaults, it becomes a pain. So, Ubuntu out of the gate these days, creates a swap file that’s 2 GB in size. Open a couple of tabs in your favourite browser, have vscode running on the side, and mix it up with a couple Java services (elasticsearch and co), you will quickly exhaust your 8GB/16GB memory. Next thing you know, you are past the the swap space threshold that
OOMD is looking for. It then starts killing processes without you getting notified in any way. You
<ALT-TAB>, only to find that the browser you had open or the editor you had open is gone. Seriously pissed me off, this.
It took me a while to figure out what exactly was happening but when I learnt of this, I had two potential (easy) solution. I could either just disable swap or expand my swap space to a big enough size that I never get to use half of it. I went with the latter because I only have 16GB of memory available and every once in a while when I work I do get pretty close or go slightly above the 16GB. In order to increase your swap space, you would have to trash the swapfile in use and manually create a new bigger swapfile. For me, 8GB was more than enough.
1 2 3 4 $ sudo swapoff $ sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 $ sudo mkswap /swapfile $ sudo swapon
This is another weird one, I think it was caused by a rogue Gnome shell extension but I am not sure. I simply learnt to live with it and never bothered looking for a permanent fix (upgrading to 22.10 did fix it though, eventually). What was happening was … every once in a while when the screen locks and I try to log back in, the lock screen would freeze. Apparently, it was still registering the keys I was hitting but for some reason the whole login process would take some seconds or worse a minute. So, after entering my password then hitting enter and waiting for some time, the login would succeed. I never had the patience to wait for the login, so I would simply hit
<CTRL-ALT-F1> to switch to
tty1 where there is a
gdm login screen available, that always worked.
I don’t recall exactly what this problem was but I am guessing it must have been a processor throttling issue. After a fresh install of Ubuntu 22.04, my laptop (HP Spectre) was running at full tilt, max boost clock speeds full time. The laptop burned so much, I could have used it to iron my clothes. After trying out a number of solutions I landed on thermald. I just
sudo apt install thermald and then rebooted. The spectre was now as cool as ice. All was seemingly well after that until I tried to run some services in minikube. I had these services running without issue before I installed
thermald. Strangely, after installing
thermald these services would just hang at start up and then minikube would murder them for failing their probe checks. After digging a little deeper, I figured the problem was the CPU limits I had set for these services. I had some of these services set to 500 millis (half a CPU) or so. So before thermald half a CPU on the Spectre was loosely half the boost clock (well over 1GHZ). After installing thermald, the CPU no longer boosted at all, so it was locked at something 1.3GHZ max (my processor is Intel(R) Core(TM) i7-1065G7 which is clocked 1.3GHZ base). Half of that is quite a low number that the services found too low to function correctly under.
The quick fix was to simply have the services run unconstrained. This slightly did make my work difficult as the limits I had set were following production values. I was simpy copying the configuration file I was using in production and using it for my local development setup. I eventually created a tool that allowed me to easily parameterize these values and have different values configuration paramters in production and local development setup (Shameless I know but here it is anyway). Upgrading to Ubuntu 22.10 did permanently resolve that lack of turbo-ing issue.
In case you are wondering how I get the MHz that my CPU is currently running at, I run the following command:
1 $ watch -n.1 "cat /proc/cpuinfo | grep '^cpu MHz'"