With the retirement of the linux-latest
metapackage, it has become somewhat tricky to know exactly which kernel version ought to be installed when running Manjaro strictly in a headless manner. Let’s assume that I am using a headless Manjaro system and that I would like to remain on the latest officially Recommended
kernel version. How do I find out what that is?
Turns out this is not so simple to do even manually. The only way I found, short of reviewing the source code of the Manjaro Settings Manager (more on that later), was to install Manjaro inside a VM, run the Manjaro Settings Manager, and view the recommended (or LTS, or whatever) tags there. It only takes a few minutes nowadays on a decently-capable system to do this, but it’s an understatement to say that this is a very roundabout way of doing things.
The source code does tell us what we need. Here is an excerpt from https://gitlab.manjaro.org/applications/manjaro-settings-manager/-/blob/master/src/libmsm/KernelModel.cpp
:
QStringList
KernelModel::getLtsKernels() const
{
return QStringList() << "linux310" << "linux312" << "linux314" << "linux316" << "linux318" << "linux41" << "linux44" << "linux49" << "linux414" << "linux414-rt" << "linux419" << "linux419-rt" << "linux54" << "linux510";
}
QStringList
KernelModel::getRecommendedKernels() const
{
return QStringList() << "linux414" << "linux419" << "linux54" << "linux510";
}
Just a couple of hard-coded constants on line 300-something, surrounded by logic. Nothing to see here.
When someone requested that the mhwd-kernel
tool display the Manjaro kernel tags in another post (https://forum.manjaro.org/t/mhwd-kernel-display-tags-attributes-lts-recommended-when-listing/65500
), the less-than-helpful response was:
The idea is good, but unfortunately it cannot be implemented. The reason for this is that mhwd-linux queries the existing or installed kernels via pacman and this information is not stored there.
True enough, as far as that is concerned: the information is stored inside the compiled manjaro-settings-manager
binary (shudder). There has to be a better way.
The simplest and canonical way to share static data between programs in Linux is to use the filesystem. In this case, manjaro-settings-manager
could write out the kernel version tags to /usr/share/manjaro-settings-manager/kernel_versions
or some such. Or the /etc
tree could be used, though by convention /usr
strongly implies that the data is read-only, while /etc
makes no such representations.
If it is desirable to continue setting the tags via hard-coded constants in C++ code (shudder), this can continue. The only change would be that manjaro-settings-manager
would also expose those settings to the filesystem. This would become an interface for any other program (mhwd-kernel
or anything else) to access the information.
If the devs want to keep the definitions solely within C++ code for some reason, then perhaps they can be moved to some kind of configuration object that could be exported as a shared library. This seems clunky but would be doable.
I understand that Manjaro primarily targets less-experienced folks and graphical systems, but that doesn’t mean more experienced users and headless systems can’t also be supported. Especially in a case like this where the existing mechanism needs a bit of work anyways (maybe it’s a subjective thing, but I really don’t like that these tags are set way down in the middle of business code).
[Edited to include both LTS and Recommended tags and to specify that I’m after the most recent Recommended version]