this post was submitted on 28 Aug 2023
133 points (100.0% liked)

Linux

1258 readers
85 users here now

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

Related Communities

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

founded 5 years ago
MODERATORS
 

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?

top 15 comments
sorted by: hot top controversial new old
[–] avidamoeba@lemmy.ca 73 points 1 year ago* (last edited 1 year ago) (2 children)

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.

[–] potpie 8 points 1 year ago

Thank you for this explanation.

[–] ultra@discuss.online 2 points 1 year ago (1 children)

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

[–] Wyrryel@pawb.social 15 points 1 year ago (1 children)

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

[–] avidamoeba@lemmy.ca 6 points 1 year ago (1 children)

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.

[–] Wyrryel@pawb.social 1 points 1 year ago

Interesting! I didn't know that, thanks for responding

[–] cerement@slrpnk.net 35 points 1 year ago* (last edited 1 year ago) (1 children)

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
[–] Tippon@lemmy.dbzer0.com 2 points 1 year ago

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.

[–] hottari@lemmy.ml 19 points 1 year ago

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.

[–] skullgiver@popplesburger.hilciferous.nl 15 points 1 year ago* (last edited 11 months ago)

[This comment has been deleted by an automated system]

[–] Jomn@jlai.lu 7 points 1 year ago (1 children)
load more comments (1 replies)
[–] jman6495@lemmy.ml 6 points 1 year ago

Security, Stability

[–] Grangle1@lemm.ee 5 points 1 year ago (1 children)

As far as use cases where immutable distros would be more or less convenient, it appears to me that due to the security and reproducibility factors, immutable distros are better for server or enterprise environments where updates need to be rolled out quickly and smoothly, which are most actual Linux systems out there and where Linux companies make their money (hence why they seem like the hot new thing right now), and for desktops where people are primarily concerned with not wanting to "break" anything. But a classical distro, IMO, would be better for folks like me who do want the control to change or customize things down to the core parts of the OS. As far as I'm aware, you don't have much freedom to tinker with an immutable distro until it's wiped away with the next update.

[–] Chewy7324@discuss.tchncs.de 2 points 1 year ago

NixOS/Guix still give users the control to change anything at any time. That's because they aren't image based and instead they achieve immutability with the Nix package manager (symlinks and a declarative system configuration file).

I agree with immutable OS on servers being great, but I also believe immutable systems are a good choice for desktops. Especially managed desktops (eg. my moms) work well with an image-based OS. Flatpak is often enough for those few gui apps and there's less risk of automatic updates failing (eg. pulling power plug while updating).