Immutability: A Growing Trend
Tags: productivity, linux, beginners, systems
Published: 2024-02-03 20:07:15

### What is it, how it works, and why you should seriously consider checking it out!

<hr>

If you happen to pay any kind of attention to ongoing trends in the Linux OS sphere, you've more than likely come across posts, articles, or maybe a few videos that make reference to these interesting operating systems that tout having this magical structure that makes them "**immutable**".

> Immutable operating systems are built with the principle of immutability in mind. This basically means that the operating system is designed to be **unchangeable** and **unmodifiable** during runtime. Any updates or modifications to the system result in the creation of a new **instance** or **snapshot**...thus making it extremely easy to rollback to a previous configuration should a change produce undesirable effects.

Ok, so maybe a literal kind of definition isn't exactly the most tasteful way of explaining what makes these OS's different from everything else...

**Perhaps a better way to look at the difference between a typical OS many of us use, and an immutable one is like this:**
</br>
![Standard Linux Filesystem Hierarchy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6rk32evtsig39sica3y.png)
</br>
### Standard OS

- The vast majority of Linux operating systems, such as Arch or Ubuntu, follow a standard file system hierarchy (shown above).
- Users run their respective package manager commands to update their system, i.e. `apt upgrade` or `pacman -Syu`, to check whether or not there are newer software versions available.
- If a more recent version exists, the application binary (or shared libraries) is downloaded from the remote source and installed…consequently overwriting the previous installation files.
- Even though **Windows** differs in its system structure, it too follows a similar process for system updates.
- Such processes of _update and replace_ are ultimately what makes these **_mutable systems_**.

### Immutable Systems

- Upgrades happen in the complete **opposite way**.
- Instead of overwriting previous applications and files with their newest selves, an entirely new system state is created and stored separate from the previous one.
- This new state is then available at system boot, alongside any previous states from prior upgrades.

</br>
**Immutable systems function similarly to version management tools such as git.** Whenever you update or add new code to a project that's being tracked by git, you _**commit**_ the new changes to the code base, which in turn receives a new hash and other metadata attached to it. Even though your code is updated, **you're still able to _rollback_ to the previous commit and toss all those changes if something happened to break after the commit was made.**
</br>
![Simple versioning representation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j5rz5r12z217pnks0rll.png)
</br>
</br>
### Some Pros

1. **Version Control Mechanism:** Immutable operating systems enable easier version control and rollback capabilities. If an update or change results in an issue or unintended consequence, reverting to a previous version is as simple as switching back to a known stable image.
2. **Simplified Maintenance:** With immutable operating systems, the need for continuous patching and updates is significantly reduced. Since the system remains unchanged during runtime, there's no need for live updates or patches (unless of course you want to).
3. **Increased Stability:** Immutable operating systems provide a high level of stability due to their unchangeable nature. By eliminating the potential for unexpected modifications or conflicts, the system is less prone to errors and crashes.

</br>
### A Few (Slight) Cons

1. **Storage Requirements:** Since each system version or change requires the creation of a new instance or image, the storage requirements for immutable operating systems can be higher compared to traditional operating systems. **This isn't always the case though, as long as you keep the number of stored snapshots to a minimum.**
2. **Learning Curves:** Moving from a traditional operating system to an immutable one can involve a learning curve for some, especially for a system like NixOS which utilizes a single configuration file for defining system state. Users sometimes need to acquaint themselves with new tools and workflows for managing and updating the system. **As with everything, reading through documentation and user forums can quickly flatten any curve.**

</br>
There have been a number of immutable systems that have increasingly become more popular with users, and each has its own implementation of immutable file structures.

</br>
**A few of these worth mentioning include:**

- NixOS
- Fedora Silverblue
- VanillaOS
- macOS (through similar mechanisms)

</br>
![Check it out!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00f497k3hka5uevbimaz.png)
</br>
### So What?
I can already hear some of you saying it out loud:

</br>
> "So what? It sounds like just another flavor of something I don't really need"

</br>
And ya know, you may be right…**or you may be dead wrong!** The thing is, _immutable operating systems aren't the be-all-end-all of things_. For many, they are a means to an end, and for others…well, for others, they're the only option. 

Personally, I use NixOS on a daily basis on several of my laptops and desktops, but also love the bleeding edge and raw power that Arch Linux offers, and in certain scenarios the sysadmin qualities of CentOS/Rocky Linux.
</br>
</br>
### _The beautiful thing is, as with all things Linux…the choice is yours!_

</br>
![Photo by Javier Allegue Barros on Unsplash](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5sxjwvct485t3uiivqaf.jpeg)
</br>
### Wrapping Up
If you found this article intriguing, and would like to keep up with the wide world of application development and systems exploration, give me a follow and feel free to leave your thoughts! I try my best to respond to everyone's comments, and highly value all of your opinions!
</br>
![By the way...](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovrf759q24i5cnmrhu6c.png)
</br>
</br>
{% embed https://dev.to/dedsyn4ps3 %}
{% cta https://github.com/dedsyn4ps3 %} 💻 Check out my Github {% endcta %}