Hey guys! Trying to understand what developers actually do to create a yet another distro, or what are the differences between existing distros. Lets say we have ubuntu and fedora. What are the differences? Excluding DE, Installer, theme, installed packages/libs and package manager. They both are FHS compliant, both running systemd what else?
Just wondering if there could be a way to “simulate”, lets say ubuntu on fedora. For example providing every program that should be present on ubuntu in fedora. Would it be enough to be able to run .deb packages on fedora? Im not gonna do that though, just curious about this question.
Thank you!
This is a great question!
It’s hard to really wrap your head around it without doing a ton of low-level taking things apart and putting them together differently.
But to answer, it’s pretty impressive the extent to which a full Linux install of any distro tends to just be like a bunch of legos put together in one particular way.
Theoretically, there’s no reason why you couldn’t ship-of-Thesius one distro into another. You’d have to have a good idea of what the differences between the two are, but it can certainly be done.
There’s a thing called a “chroot.” It’s basically a whole OS installed in a subdirectory on another whole OS. And there’s a command (also called “chroot”) that can be used to tell the parent OS to “give me a shell in the chroot OS – as in run the /path/to/chroot/bin/bash (or whatever) executable in ‘The Matrix’ such that that process thinks that the chroot is the root OS.”) That lets you do some pretty cool stuff like building an OS to be installed on another box. But when you run in the chroot, it doesn’t load the guest OS’s kernel or (typically) init system or anything. The processes run on the host system’s kernel.
And it’s entirely possible to have the guest chroot system be a whole different distro than the host. (Though some distros will have tools that make it easier to chroot into a guest chroot of the same distro.) Which implies that you can just kindof substitute one distro’s kernel for another distro’s, right?
Turns out the answer to that question is “at least mostly yes.” Quick funny personal story. I started working somewhere recently where they allowed new hires a choice between Windows, Mac, or Linux on their work laptop. I chose Linux, but didn’t like the distro they pre-installed on it. (KDE Neon. I preferred Arch. Insert hate here.) But the laptop had secure boot enabled and the PC support department wasn’t willing to let me disable that. The laptop would only allow certain kernels to boot. Windows and some kernels from some unknown set of Linux distros.
Just as a quick aside, the way it knew how to deny a specific kernel from running or allow another to run was with signatures. Canonical which makes Ubuntu includes cryptographic signatures in the kernel file identifying that kernel image as made and certified by Canonical. (Microsoft does roughly the same thing for Windows kernels.) The secure boot system on the laptop has a list of trusted certificates. If the kernel that the bootloader (which is also signed, by the way) asks the secure boot system to boot is signed by one of those certificates, it boots. If not, secure boot denies the request. Theoretically more certificates can probably be configured/trusted, but that wasn’t an option in my case.
But I still wanted to run Arch! Now, KDE Neon uses the Ubuntu kernel, so I knew that was one I could boot without access to the secure boot config. So I grabbed the .deb for the Ubuntu kernel, wrote a script to convert the .deb for the Ubuntu kernel into an Arch package. (Arch doesn’t use .debs or .rpms. It uses “pacman packages”.) I installed that arch package, configured the bootloader to point to the arch install including that Ubuntu kernel, and booted it. Viola! Arch (mostly) without secure boot access!
What I was running was really kindof 95% Arch and 5% Ubuntu kernel. Kindof a Frankenstein’s monster of OS’s. But it worked perfectly.
And theoretically, just about any part of a distro can be replaced with the equivalent from another distro. (Or from the upstream/source version.) You could technically take a Fedora system and replace the package manager with apt (I’m guessing there isn’t an rpm package that would install apt on your Fedora, so you might have to make it yourself or just build it from source and install it manually) pointed at Ubuntu repositories and transform Fedora piece-by-piece into Ubuntu. It’d be a pretty wild and messy process. And it would probably be easier to just reformat and install Ubuntu. But it could be done.
Similarly, you could replace the init system. Artix is a fork of Arch that gives a choice of init systems whereas Arch only supports Systemd. And it’s kindof another Frankenstein’s monster of an OS because it still relies heavily on the Arch repos. But it works.
Thank you for this nice answer!
Would it be enough to be able to run .deb packages on fedora?
Unpacking a .deb on Fedora, or unpacking an .rpm on Ubuntu isn’t a big deal. The files inside are often actually identical.
But would not be useful because the files inside usually rely on shared libraries, which may or may not already be installed. Those shared libraries are installed in different places on each Linux distro. Figuring out which ones to ask for (and making sure the program can find them) is the real work that the .Deb or .RPM installers do.
A fun way to try this out is with Portable Apps. Anything called a “portable app” either doesn’t use additional libraries, or carries the libraries it needs with it.
If you find a portable app for Ubunutu, there’s a good chance the Fedora version is an identical file, and works fine on Ubuntu. There’s lots of reasons it might not work, but it can be fun to try.
For the most part, the only reason any Linux program is unavailable on a different version of Linux is that no one has bothered to build the necessary installer for that combination of program and OS.
.RPM was supposed to solve this by being universal, since any other OS can implement it to match .Deb was supposed to solve this by being universal, since any other OS can implement it to match (about 60% actually do). I think Flatpacks and Snaps might solve this by being universal, at some point…
Source: I’ve built installer packages for various operating systems.
The differences between distros are the things you mentioned. They all use the Linux kernel, so the differences are in the DE, installer, theme, default packages, and package manager. These changes come about from design choices: rolling vs versioned releases, stability goals, FOSS vs proprietary packages/repositories, things like systemd vs alternatives, and overall goals/use cases (lightweight, server, etc).
A distro can be as little as a theme change. The famous Hannah Montana Linux is KUbuntu with a custom theme, icon pack, and Hannah Montana as the background.
So basically if i have all Voidlinux’s programs installed on NixOS, i can have some decent amount of packages (that are not heavily depending on init systems or some other non trivial stuff) from Void repos running on NixOS?
Hannah Montana Linux
Yeah, love it
deleted by creator
How much snap you have/need. Or the stability I guess, but in my experience that hasn’t been a problem yet.
Fedora ships Btrfs and Zram by default.