For once I feel a little out of touch after I took a bit of a break from following the news to focus on studying, and suddenly everyone is talking about immutable distributions. What are they exactly? What are the benefits and the disadvantages of immutable systems?

98 points
*

Have you used Android? Has it ever failed an update or break due to an app install in a way that can’t be fixed by uninstalling it or factory resetting? Android is an immutable Linux OS. Its system files are stored on a read-only partition. They’re only mounted read-write during update. (That’s a lie, this is no longer the case, but it used to be, these days there are two partitions and the whole inactive partition is written during an update, or a volume snapshot pretending to be a partition is created and then merged, but functionally it’s consistent with the lie.) Apps are also stored in read-only form. One implication of this is that upon update, the partition/files you want to update are always in a predictable, unchanged state. That guarantees successful updates. It also allows trivial diff updates. The other implication of these facts is that you can always delete the mutable part of the OS, where your data and the apps’ data is stored, and you’ll always end up with a clean, working OS in a factory state. On Android you can also do this per-app by tapping “Clear data”.

Wouldn’t it be nice if you desktop or server behaved like this? Some folks think so and are trying to implement it.

There are few disadvantages beyond having to change how some systems work to accomodate this model. There’s typically more space wasted.

permalink
report
reply
8 points

Thank you for this explanation.

permalink
report
parent
reply
2 points

With tbis update system, I don’t understand why you can’t use your phone while doing it.

permalink
report
parent
reply
23 points

You can. Google pixel updates are just a reboot. Sadly many OEMs don’t do A/B updates, like samsung, so your phone can’t be used while updating the system partition

permalink
report
parent
reply
8 points

It’s worth mentioning that they often do this to reduce flash size, i.e. save 💰. Virtual AB was introduced to help with this but it’s relatively new. With it, there’s no need to reserve the space for 2x system partition. The needed extra space during update is taken from /data and released post success. There’s also a compressed virtual AB scheme now which helps reduce the space needed from /data to enable really space-crippled devices like CCwGTV and other Android TV things like Sony and other TVs.

permalink
report
parent
reply
48 points
*

the whole concept of immutable is focused on stability and safety of your system – yes, it is still possible to break an immutable distro, but it’s a LOT harder and takes some actual effort – there’s also a few concepts wrapped up into the “immutable” phrasing:

  • immutable filesystem – the root filesystem is set as read only, updates are queued up and applied during an upgrade (some distros require a reboot, some don’t)
    • VanillaOS keeps two copies of the root system (ABroot), upgrades the inactive copy and then swaps them out
    • NixOS has everything defined in a master config file and keeps an archive of previous generations of the config file allowing you to boot into whichever generation you want
  • atomicity – updates are applied individually and checked, if the update breaks then it’s reverted to the previous working state (ie. you are never left with a borked system)
  • containerized apps – user space apps isolated or sandboxed in some way like Flatpaks or Docker containers or OCI so if they break, they don’t take anything else down with them
  • declarative systems – the whole system (and packages and configs) are defined (declared) in one master config file – back up that config file and if something happens to your system, you just need that one file to do a full rebuild (or make an identical copy of your system on another computer) – NixOS and GNU Guix are the two more well-known in this space
    • EDIT: minor side-effect of this is you can easily tell exactly what packages are installed on your system at any given time – no hunting through history or trying to remember what you installed last month when you were testing out video players
permalink
report
reply
4 points

I like the idea of containerised apps, especially if you can have multiples of the same app.

A few years ago, when I was pretty much fully on Windows, I used PortableApps to manage a few websites and their emails, and having a simple way to do the same thing is one of the few reasons I’m still stuck with Windows.

On top of that, I like trying out new apps and programs, but uninstalling them doesn’t always get rid of the extras, like new dependencies.

permalink
report
parent
reply
40 points

My understanding is “immutable” is a bit of a misnomer and avoids the “point” of using these distros.

“Layered Distros” is a better terminology, where you can imagine the OS as multiple layers, and you can swap 1 layer out for another without modifying the others and still have a functional operational machine.

Now some of those layers have to be immutable ones at runtime for this concept to work, so thats where that part of the name comes from, but thats an implicit result from the actual point/use case of these distros, not the selling point.

So you can swap versions/releases of your OS very cleanly at boot, without modifying userland, and it will continue to function just the same. This lets you do stuff at the admin level like broadly releases a version update merely by having users just reboot their machines, and next time they boot up their machine will now be running on the new OS layer, with their local “user” layer being unchanged.

permalink
report
reply
17 points

They also separate concerns better than classical distros. Executable binaries & libraries are separate from configuration which is separate from data. It makes backups much simpler, makes configuring new machines easier than something like Ansible, etc.

permalink
report
parent
reply
5 points

I especially look forward to replacing Ansible :)
Tried to do so with Guix though and I have to say I found it quite difficult, but I hope it catches on and becomes easier to use.

permalink
report
parent
reply
4 points

NixOS is a tad simpler IMO

permalink
report
parent
reply
30 points

Immutable distros are locked-down versions of the traditional operating systems. Literally.

In the normal traditional world, you can use the package manager to remove python as a system package and all its dependencies if you so wished. You could rm -rf / too.

With immutable, the whole filesystem is on ro mode. Every system program that a user needs is bundled by the OS and no other changes can be made without breaking the model.

This model of having the OS immutable means less chances of malware getting persistence, high systems availability and reproducible environments since the OS controls the state of the versions available and makes this state available to all users of the distro.

permalink
report
reply
23 points

####For an in the wild example, Steam Deck.

Steam Deck runs Steam OS, which is a heavily customized version of Arch Linux by Valve. But unlike normal Arch installs, Valve has locked the System partition(/) to read-only.

The reasons they’ve done this is two fold. First, there’s actually two copies of the system partition. The reason for this is that when an update is downloaded it’s actually written to the other partition, not the one you’re currently using. This way the update happens in the background, and then you just need to reboot for it to switch partitions and do some house cleaning. What this means though, is that any changes you might’ve normally made to the system partition, disappear, as they are now on the other partition you aren’t using. So if any changes you make won’t matter, not much point in letting people make them in the first place. Using Flatpaks, any applications users install would instead be stored in the user partition, and never touch the OS itself.

The second major reason for doing this, is consistency. If people are discouraged or blocked from modifying the system partition, then any bugs or issues that crop up are, 99% of the time, Valve’s fault. And because of that, Valve can more easily diagnose and try to reproduce any reported issues, because theoretically, the user’s Steam Deck should be configured exactly the same as one at Valve HQ. All that’s needed is for a user to report what they were doing when they encountered the issue, and Valve can follow those same steps and hopefully encounter the same issue, get detailed logs, and hopefully quickly push out a patch as needed.

And that’s one version of Immutability. Valve doesn’t go the full nine-yards here, just enough for their use case. In other Immutable Distros, versioning is taken even further, where you can control multiple versions and reset the OS state on the fly as needed, keeping any changes to a minimum and in controlled sand boxes. There’s a ton of use cases for these, but the most obvious benefits are for enterprise and mass-market solutions, where a single configuration is multiplied across a large amount of servers, or end-user devices, allowing for easier diagnoses of issues and pushing of patches. For end-user clients especially, if they aren’t expected to be customizing the OS to begin with, it makes support much easier for IT.

For your average Linux user, the benefits aren’t as large, as you’ll often want to be able to tweak things to your liking. But your Average Joe that just wants a computer that can surf the web and install some apps that can be found as Flatpaks, an immutable OS that they can’t easily screw up is a plus.

permalink
report
reply
1 point

I just have a big shell script that will redo all my changes after updates. I only broke my install once :>

permalink
report
parent
reply
3 points
*

/jk

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 9.6K

    Monthly active users

  • 6.1K

    Posts

  • 170K

    Comments