Immutable Linux distributions
itsfoss.com
itsfoss.com
What I'd like to see come up is a distribution that in addition to immutability provides the following:
1. separate install prefix directory for each currently installed package version (except for a minimal immutable core), thus allowing the coexistance of difference versions … and making access control policies practicable without the mess they are on a filesystem where there is a wild and hard to separate mix of stuff from lots of packages and other origins.
2. a modern and secure binding/mapping mechanism between the package install prefixes and what each of those and the user are supposed to see (dependig on profiles that can vary not only between packages but also e.g. between different users, different use cases etc). The "modern and secure" part meaning: not an old symlink based thing but something that uses the modern isolation techniques, cgroup/namespace, bind mounts, and the other mechanisms the kernel provides today.
3. a nice frontend for making the administration of those package-versions/mappings and the setting of access control policies based on them easy, with a sensible set of distribution curated profiles for the mappings, isolation settings and access control policies.
Parts of that already exist, e.g:
1. (the per-package version install prefix) has been spearheaded by Nix/NixOS … (but it's missing 2. and 3.)
2. the secure isolation, cgroups, namespaces, bind mounts etc part of 2. has been spearheaded by Containers… but their simple layering structure doesn't allow to map the more complex depndency graph of a package management system.
cgroups and linux namespaces are great and all but pervasive namespace abstraction really really needs a fluid, low-friction interface for constructing those namespaces and subsequently examining precisely how they're put together. this is why typing ns in plan 9 is a huge eye-opener for a lot of newcomers. suid and friends ensure a perpetual lower bound on red tape and drudgery where traditional unix-likes implement namespaces.
does a service need to see all of the store? no; just its closure. all of /proc? probably not. i would love to stop caring about secrets in the store
something as heavyweight as a container just to achieve those restrictions almost feels insulting, and something like pledge(2) approaches the problem from the wrong end.
then you take those well-defined boundaries, and you know exactly where you can deploy that service. take advantage of that well-known nix reproducibility, stub out the endpoints, plop it down on your local system, debug it at zero latency, revise it, deploy the fixed version.
https://en.wikipedia.org/wiki/Tmpfs
fileSystems =
{
"/" = {
device = "none";
fsType = "tmpfs";
options = [ "defaults" "size=8G" "mode=755" ];
};
"/boot" = {
device = v.bootDev;
fsType = "vfat";
};
"/nix" = {
device = "tank/nix";
fsType = "zfs";
};
"/persist" = {
device = "tank/persist";
fsType = "zfs";
options = [ "zfsutil" ];
};
"/home" = {
device = "tank/home";
fsType = "zfs";
options = [ "zfsutil" ];
};
"/cache" = {
device = "tank/cache";
fsType = "zfs";
options = [ "zfsutil" ];
};
"/etc/nixos" = {
device = "/persist/nixos";
fsType = "none";
options = [ "bind" ];
};
"/var/lib/bluetooth" = {
device = "/persist/bluetooth";
fsType = "none";
options = [ "bind" ];
};My home server is set up this way. At the time, I more or less followed this guide, which explains things nicely:
https://grahamc.com/blog/erase-your-darlings/
Been erasing root for almost 2 years I think now. Works great!
Please share :)
Side note: everything living in configuration.nix makes flake-ifying your system a lot easier, which is a win in my book.
https://nixops.readthedocs.io/en/latest/overview.html#managi...
c.f. Google trends for "nixos, fedora silverblue, guix" https://trends.google.com/trends/explore?q=nixos,fedora%20si... which suggests NixOS is relatively more searched for than silverblue.
It's more to create images to deploy server-side applications.
Many of those who do use NixOS as a desktop Linux are enthusiastically happy about it.
Indeed, this user described the combination of nice features & rough edges as "cursed". (It's so good you won't want to use anything else, but it's too rough to recommend generally). https://blog.wesleyac.com/posts/the-curse-of-nixos
1. How does that address the fact that NixOS is immutable?
2. If discussing server side applications was the intention of the author, why didn't they make that the explicit focus of the article? As the article currently stands, that's not the stated topic, but it is a point included in the article about why immutable OSes are cool. That's a noticeably different reality.
3. Even if we look past the above, NixOS can be used for server side deployment and in many cases is favourable to, say, Ansible deployments, so that STILL doesn't explain why it was left off!
But NixOS is actually a very popular choice for desktop OS within the Nix community! That doesn't mean it's right for everyone, but it means that quite a lot of people who find Nix advantageous in other contexts also find it enjoyable or even indispensable for desktop usage.
When I still had an HTPC/living room gaming PC, it ran NixOS. It ran Kodi, a bunch of emulators with EmulationStation as the frontend, Steam, and a Plasma desktop (KWin's built-in fullscreen zoom + a good Steam Controller configuration is actually a great interface for full-fledged web browsing on a TV!) and served me very well for years.
It's the source of one of my favorite NixOS stories: one night my aunt was over to watch a movie with me, and I was running a NixOS system upgrade in the background while the movie played. It was a stormy night, and we had a brownout that forced the computer to reboot. Thanks to NixOS' atomic update procedure, the computer just booted right back up in a few seconds, and we put the movie back on! No need to troubleshoot or repair in order to get a working system. (I did later have to nuke some Nix cache which was corrupted by the process, but that affected only some of Nix's own operation and none of the application software or OS components that Nix managed on the system. Super cool!)
I'd put it more like: NixOS is 95% wonderful, 5% very painful.
Most of the things you'll want to do are simple to achieve.
But, yeah, if you hit something & you're not sure what to do: there's less support for NixOS than other Linuxes; and the NixOS documentation is quite fragmented. Community resources like the wiki or blog posts may even be outdated.
There is no other distro (maybe besides Arch and it's wiki) that shows you, say, all the 293 (channel 22.11 at 2023-03-31) places where you can mess with DNS in the entire distro.
For my own use, it has been a net improvement over solving the same problems again and again on other distributions.
Also: most problems are solved by a single tool (writing nix expressions), so there's a real breakthrough once you get good at it.
Generally, the NixOS feature discovery/troubleshooting/documentation workflow should not involve Google.
It should start with a NixOS Options Search on search.nixos.org, where for most software projects the search will also end when you turn up a one-liner (or close to it) that enables your desired service or sets your desired configuration.
Then if you need to know more, check the NixOS manual and maybe the Nixpkgs manual.
If those things don't (quickly!) answer your question, then it's time to start Googling, checking the wiki, grepping through the Nixpkgs codebase, asking on Discourse or Matrix or IRC, etc.
Just wanted to note that here even though you were joking because that search order is a super simple way to make using NixOS a lot more enjoyable and less painful. Most NixOS users settle on a flow similar to that over time, but if you use that search order from the start, it'll help keep things fun. :)
Flatpak is the preferred app packaging format, and Endless maintains its own collection of curated apps in the App Center.
I think it’s straightforward to install anything from Flathub as well, but it’s been a while since I last checked.
I also agree with many other commenters about inclusion of NixOS and GuixSD.
https://easyos.org/about/how-and-why-easyos-is-different.htm...
The article doesn't really explain anything. The filesystem is read-only (from the perspective of the user) in all linux distributions. How is this different?
Android.
Do you consider ChromeOS a Linux distro? it's based on Gentoo.
To me, a Linux distribution is an OS where, given that I am very comfortable with another Linux distribution, I will quickly be able to find my way around.
Does Android have services? As root, can I start/stop them? Can I install libraries somewhere and use them somehow? How do I package an app (other than by running "build" in Android-Studio and letting the magic happen)? Could I install my own window manager?
=> I don't know any of that, so it's not a Linux distro.
As a comparison, SteamOS is based on Arch Linux and has a particular setup (with a read-only "core" partition I guess?), but I am pretty sure that if you give me a shell, I will feel like I am in a Linux distro.
Yes, every app can define its own services.
>As root, can I start/stop them?
Yes, you use `am startservice <service>` and `am stopservice`.
>How do I package an app (other than by running "build" in Android-Studio and letting the magic happen)
If you mean to manually do what the android grable plugin does you can manually call javac to compile your Activity, you can manually call d8 to turn the class into a dex, you can manually call aapt2 to compile your resources, you can manually zip all of it up, you can manually call zip align on that zip, and you can manually call apksigner to sign the apk.
>Could I install my own window manager?
Android's window manager service is built into system_server. You can't really install your own. Someone could edit WindowManagerService.java, share it with you, and you can rebuild system_server to include that.
But yeah I'd like to learn more about Android. Unfortunately I haven't found documentation that got me started. Maybe it is there, but when searching about Android, I tend to get the Android SDK, not Android-as-an-OS stuff.
If you have any resources to share then, it would be nice :-).
https://source.android.com/docs
There are also some books about Android's internals, but they are somewhat outdated.
One such book is Android Security Internals and is about Android KitKat (2014). Android has evolved since then, but the basic concepts are the same.
https://ia600608.us.archive.org/29/items/android-internals/a...
If you want fully up to date information about something not in the official docs you will probably just have to dig in to the source code.
My point was really that if I you say "I work on a Linux distribution", I think about something like Debian/Fedora/Ubuntu/... I could be pedantic and say "oh, is that a GNU/Linux distribution?", to which you could answer "nope, it's Alpine". And then we could debate on exactly what is required to call it "GNU/Linux" and not "something-else/Linux".
If now you showed me your computer running Android, I would honestly be very surprised. Why didn't you say "Android" instead of "a Linux distribution"?
If you tell me "I run Linux", I won't say "oh, do you not run a userland then?" either. Linux is a kernel, but it is also the name commonly given to a group of OSes that are very similar (and that are commonly referred to as "Linux distributions"). Android is not part of that group.
That isn't true. While AOSP does include 203 patches for Linux, you can run Android with a stock Linux kernel.
Which is technically true, but in reality no consumer Android device actually does this, so irrelevant.
Of course it is a gradient, but Android goes pretty far away from the common understanding of "Linux distribution".
At best it is "based on Linux", or maybe "Linux-compatible".
This is an extremely important distinction, because proprietary kernels and drivers is why you can't install a different Linux distribution on your Samsung or Xiaomi phone.
This article is focused on containers because when the root OS is immutable, then mutable developer workflows/etc necessarily happen in containers (distrobox, toolbox, whatever). OSTree is/was commonly described as "git for filesystems". Every update is an entirely new system image which applies a 3-way diff. It's possibly to state in a single command "show me the drift in my config files/data versus the ref I'm running" and/or "show me the diff between my running system and an update I may apply".
I can see how this can be usable for configuration. But I am having a hard time imagining how this would look for something like PostgreSQL's data files.
The lines for what counts as "environment" are fuzzy which might pose a challenge, but the fix for that could be as simple as offering sane defaults and letting the user decide what is/isn't included.
Yes! I've been thinking about the same thing as an accessibility feature for disabled users, as well. I recently learned that I'm going blind, and so I've been thinking about how this kind of mechanism could be used to ensure that a system always has, e.g., a working screen reader and fullscreen magnification software. I'd like to add something like this to NixOS, which is my favorite distro and daily driver.
https://github.com/89luca89/distrobox/blob/main/docs/posts/r...
For example, let's say that you have Postfix using a smarthost as a relay, and the new version of Postfix requires relays to have a shared secret for authentication with each of their trusted clients. That isn't something that can be handled by an automated config translator.
This sort of thing happens a lot. The best that can be done is putting the changes into a document for you to read, understand, and then make decisions.
A distro that has a simulate upgrade command, which generates a report on all these incompatibilties, would be one way.
It should be read completely, if you maintain a lot of boxes...
(It isn't the same as you want, but it absolutely does take "the unknown* away.)
This would be roughly equivalent to adding a new column or a table in a relational database with some non-NULL/empty data in it, right? Somehow we deal with this in that case, or at least we are forced to deal with it or the transaction gets aborted rather than what we have currently, which is, "oops, new postfix has been installed, you didn't read the documentation carefully, and none of your servers can send mail anymore".
How would your distribution make this better?
It seems they are more optimized for temporary k8s nodes, not something that's long term.
You set a maintenance window for the reboots and then basically you don't need to touch it. I keep all my docker-compose files in github and just have them all set to launch on boot. linuxserver.io has well maintained images for just about everything you'd want to run at home.
Both Fedora CoreOS (ostree based) and openSUSE's MicroOS are the same way, they give you a kernel, systemd, and a container runtime and then the workload is decoupled into containers, it's a nice setup.
I maintain an awesome-list of immutable resources with a collection of talks and presentations from the people making the stuff. They do a better job explaining it than I can in an hn comment: https://github.com/castrojo/awesome-immutable
However the list is currently focused on desktop stuff since this is a fairly common pattern in cloud already, I should probably write it up.
Semi-related, a few of us have started a community around composable OCI fedora images, and one of our images is intended to be used as a home server built on CoreOS with ZFS, cockpit, and all the goodies you'd need. It's still fresh and we're looking for help if anyone's interested: https://github.com/ublue-os/ucore (Disclaimer: I helped start this project)
Also its hard to find cloud providers offering microOS. The best way seems to just treat an Ubuntu/Debian system as an immutable one, using unattended-upgrades for everything
A very good adaptation for living in an authoritarian society (a "police state") with draconian laws, where they are actively trying to clamp down on dissent, including suppression of certain political views. Down with Big Brother and the Thought Police!!!
Exactly what we are doing when we are eg working on a C program: we don't monkey patch the binary, we run the build system again.
Then it wouldn't fit with the lists theme?
If you use Linux distros in Qubes OS, then I would say that it counts as a Linux distro (by default you get Fedora).
And by default you run in VMs, where some parts are persistent (e.g. your home) and some are not. Just like running a container with some persistent storage.
It depends on your use-case whether you like it or not, but I would definitely put Qubes OS in the list.
That's the problem. I don't want to buy new hardware just for running an OS or having the ability to suspend/hibernate, especially so if it's more expensive than what I have.
If you have a PC right now and want macOS, then you will have to buy new hardware (e.g. a macbook) for running it. You wouldn't say that this is a problem with macOS, though, would you?
We have several "container as app" solutions around:
* Microsoft Universal Windows Platform;
* Canonical snaps;
* Flatpak;
* containertoolbx/Distrobox (this one is very DIY and what I use);
It's just that (as of now) most apps rely (and are allowed to be deployed in "stores") on very leaky container isolation (like full filesystem access) so might as well not be deployed inside containers in the first place.
To me, "planned obsolescence" says "we engineer the product such that it does not last". Premature obsolescence says "our product is not good enough to last longer".
The tendency is to build cheap crap, so of course it doesn't last. Doesn't mean that the engineers spent resources making sure it would not last.
Whatever the reasons, it should be fought against.
The real scammers use the word "innovation" to hide their planned obsolescence.
And we reach a point where the real innovation is often removing and simplifying instead of adding/complexifying.
The difference is you won't have to spent 2 years learning a custom policy language.
Absolute nonsense.
> The difference is you won't have to spent 2 years learning a custom policy language.
If you had bothered to spend maybe 2 months bothering to learn this tech that's been around for almost 20 years, you wouldn't have to use specialty distros to accomplish what your distro can already do natively.
I've never been a fan of willful ignorance and fearmongering, and I see a lot of that when it comes to SELinux.
My point, by comparing selinux to "mount" and calling them equally useless, was not that they are not useful tools in their niches.
My point was that they are useless if your goal is to build a usable immutable distro.
SELinux is a hammer that cannot be used to turn a default debian installation into a usable immutable linux distro. The initial claim of "using SELinux rather than a dedicated distro can work" was nonsense, so of course the thread of replies off this is nonsense. GIGO as they say.
It's only a hammer if you use it as one. It's a very fine grained tool and it can be as precise as you want it to be.
> The initial claim of "using SELinux rather than a dedicated distro can work" was nonsense
It wasn't at all, and it's baffling to me why anyone would claim so.
The mechanisms that allow for program confinement also allow you to construct an immutable OS.
> Running each daemon in its own fs/user/net namespace comes a lot closer to mimicking the value of SELinux than making the OS immutable.
Maybe, but it's still pretty far off. SELinux is about removing DAC/an all powerful user much more than it is about sandboxing.
Honestly, if you really want something immutable and distro-agnostic, you probably want something like btrfs snapshots; however, converting the root filesystem to btrfs is probably a pain, and there will be some initial configuration to prepare some cloud-init, ignition, etc before you take your initial snapshot and you'll also probably want to configure some "boot from snapshot" type functionality, at which point it would be pretty nice to have all of this packaged up in a distro so each user doesn't have to figure all of that out every time.
Also with Silverblue, there's a mechanism for getting the base OS from a OCI container image (check out https://ublue.it/)
For sure, I can see there are use cases and a market for it.
In terms of server workloads, I run immutable containers, so doesn't matter what the base OS is. But I want the OS to be something very popular and stable with paid support.