File System Consistency: what Linux fails hard at that others don't.

Posted 31 May 2022 (2022-05-31)

Linux has made many successful moves in just the last 5 years. The possibility of gaming without hackery has became near-normality, the kernel continues to get better with every release as does the software. Yet there is one area that Linux has never really figured out correctly due to its age: the file-system heirarchy.

Now, don’t get me wrong, there has been attempts in the past to remedy this issue. For example, Lennart Poettering, creator of systemd, once proposed something called the usrmerge which would symlink the /{bin,sbin,lib} directories to /usr/{bin,sbin,lib}. At first this was controversial because, well, Lennart. But it soon was adopted by a lot of distributions. One of which was Debian. Even to this day Debian is still carrying out the merge due to how inconsistent it is when it comes to packaging.

Other attempts at standardising the directory structure of what should make up the bare minimum of a Linux system have been carried out by the Linux foundation and many other groups. They created the Linux Standard Base which outlines what every directory’s job is in the system. This was a step in the right direction but it was also just guidance. When there’s nothing set in stone it can get really messy and even to this day a lot of distributions still do not follow the LSB out of what they see as convenience on their part.

Config files are another great example of guidance set out but hardly followed. Yes there is a standard for configuration files and yes a lot of people follow it but there is also a large number that do not and just chuck files wherever, in dot directories under $HOME for example. This leads to mess and confusion on where to find files. It’s just plain inconsistent and annoying.

So enough complaining, what’s the solution?

I’ve thought long and hard about this and have came to a conclusion that the only way to fix this mess is to dramatically overhaul the Linux filesystem from scratch. First of all, Windows doesn’t get a lot of things right, but what it does get right is where it stores all of its programs. It has a set location for them all which is easy to find and navigate. This is what we need on Linux. Set out in the Linux Standard Base (which is a cool read btw) is the /opt directory. Not many people know its function but it’s made for storing add-on system packages. If all system packages where stored here it would make life so much easier. But what does that mean for binaries and libraries? Well that’s where the next part comes in. Within the /opt directory it would be the program name and version, for example: bash-1.2.3/, then inside of that you would have the classic bin, lib, share, etc, what have you, directories that you get in /usr after the usrmerge. This way a program and its files are stored all together and neatly.

I think this small change is a massive start to the Linux ecosystem. Perhaps there could be others when it comes to headers and so on and so forth. But for now this would do and it is relatively easy to do as well. So lets do it!