First things first, let's generate a list of [all official Arch Linux packages](https://archlinux.org/packages/). Fortunately, `pacman`, the best pragmatic package manager in existence, makes this a breeze.
It's time to put our algorithms knowledge to good use. This is *just* a graph! We can think of each package as a node in a graph and each conflict is an edge. Since we don't care about dependency checks (which would make for a likely broken system but who cares), we don't need to add any other edges to the graph.
For each edge, we need to pick at most one package, but not both. That sounds a lot like a [maximum independent set](https://en.wikipedia.org/wiki/Maximum_independent_set)!
Well, do we have 12000 *connected* nodes? No, since the largest connected component is probably only a few nodes. We aren't going to have hundreds or thousands of packages all conflicting with each other. Therefore, we don't need to prove [P = NP](https://en.wikipedia.org/wiki/P_versus_NP_problem) to be able to find the maximum independent set of this particular graph. Phew!
We're going to use [Julia](https://julialang.org/) for implementing this algorithm, because Julia is Python but better. We first need to get a list of all packages:
Now we can find each connected component using [BFS](https://en.wikipedia.org/wiki/Breadth-first_search), and brute-force the maximum independent set by trying every subset of the nodes in that component. It's implemented here using some bit manipulation trickery. Since the components are all very small, the brute-force finishes really quickly!
Alright, time to install everything! It'll take about 30 minutes for everything to download, depending on your internet connection. Make sure you have the `multilib` repository enabled. We can also speed this up by disabling package signature checking.
Success! Now, time for yet another 30 minute wait, and even better, there's *52*`pacman` hooks at the end. Yeah, we'll just have to wait as every DKMS module is compiled for each of the four kernels we have installed.
## Exploring the system
Alright, let's reboot and check out our new and improved Arch Linux system!
The first obstacle that we encounter is that most display managers, with the exception of [LXDM](https://wiki.archlinux.org/title/LXDM), don't have a scrollbar for selecting the desktop session (Because when would you ever have that many sessions installed?). So, let's `sudo systemctl start lxdm` and choose one of the 44 desktop sessions to explore.
Surprisingly, KDE Plasma starts up pretty snappily, but 10 different background services also popped up in the system tray. Memory usage is pretty high, but what can you expect? We also have over 30 different terminals to choose from for our `neofetch` screenshot.
Surprisingly, yes! It's hard to judge how bad the performance really is, since it's in a virtual machine, but all the software that I tested was definitely usable. It's somewhat slow, but that's exactly what you'd expect. As we used a lot of unsafe hacks (disabling dependency and file conflict checking, for instance) to get this to actually work, I wouldn't recommend using this system for anything other than proving it's possible.
Now is this useful? The short answer is no. The long answer is also no. I can think of exactly zero uses of this experiment (and I must be pretty crazy for doing it).
Uh, don't do it, but if you insist, you need a fresh new Arch Linux system, 250 GB of free disk space, Julia, a boatload of patience, and a healthy dose of insanity. You can download the Julia code as a [Pluto notebook](/src/solveconflicts.jl) and run it with `julia --threads=auto solveconflicts.jl`. I'd recommend doing the actual installation (`sudo pacman -Sdd $(cat out) --overwrite '*' --needed`) in a VM since this completely destroys an Arch Linux system, and there's no going back once you finish.
And before you start, please ask yourself three times, why am I doing this???
## Further potential explorations
- Install every package of a different distro? In particular, I'd like to see someone do this for Ubuntu, Debian, and NixOS and watch them suffer. This was painful enough.
- Investigate the file conflicts and file some Arch Linux [bugs](https://bugs.archlinux.org/task/73574).
- Figure out how to make `pacman` skip all package conflict checks, possibly by editing the `pacman` source code and disabling the relevant code that does these checks, so we can *really* install every single Arch package.
- Build a time machine so I can get back the 10 hours that I wasted by doing this project. (I also destroyed 6 testing VMs) Oh well. Now we know what really happens when you install all Arch Linux packages!