Ubuntu and lower memory installs

I don’t think the default install of Ubuntu is a good experience for desktop users who face memory constraints, say an 8GB machine. I see many Ubuntu support requests on reddit where new users experience the classic freezing of out of memory linux.

Windows and macos give their default desktop installs a dynamic swapfile (growing or shrinking according to demand) and compressed ram. Linux easily does this too. We just don’t configure it.

Ubuntu/debian can do this by installing the swapspace package and zswap.

The other thing is out of memory killing. The traditional kernel OOM is very reluctant to actually kill anything, hence the apparent freeze that users see. (systemd-oomd has effectively been turned off due to its mistakes)

User-space killers are hard. A user-space killer has to activate before the kernel OOM killer gets stuck, which means it has an even harder job than the kernel killer: it still faces the problem of working out what to kill, but it must also preempt the kernel killers without killing unnecessarily. systemd-oom is a very complicated attempt, but it was effectively disabled by Ubuntu and Fedora soon after being introduced because it was getting both things wrong: it will killing too early, and it was killing the wrong thing. I think it will be very hard to come up with settings which work, if only because users have wildly different preferences: for some, a browser using 4GB of ram means it should be the last thing to be killed since it the most important app open, and for others, it should be the first thing to be killed because it is the memory hog stopping libreoffice from working well. How can an automated killer know without user-specific tuning?

MGLRU has basically fixed the kernel OOM killer in my stress testing of 4GB VMs. It responds much more quickly. It is a radical improvement. So we get that for free.

OOM killing is the measure of last resort, and swap should provide more graceful handling of lack of ram. Eventually dynamic swap runs out of disk and the machine will get very slow, but I think a lot of time it will avoid OOM killing. I think it is a much better default than we get now.

SSDs: small size, low write endurance. This was the big argument against swap files a few years ago. But SSDs are bigger and better now.

What I wonder is if the installer can offer to install dynamic swap files via swapspace and integrate that with compressed ram via a well-configured zswap, which would offer the same approach as windows and as far as I know macos.


I thought it already did… unless that was changed. I do remember the OOM issue being fairly new, so, I suppose it was changed. Mint 20.3 swaps just fine. When I was running Ubuntu 22.04 on another machine, everything was fine, but I had 12GB of RAM.