When I started using Arch I just set it up on a btrfs filesystem and wrote a simple btrbk hook to take a snapshot before any package updates. That made it trivial to unfuck anything that broke after an update. I can’t remember the last time I had to roll the system back but it’s nice for peace of mind.
Start by playing with subvolumes and snapshots so you can get a feel for how they work. Once you’ve got that down you can break down your root filesystem into sensible subvolume chunks (/, /home, /var/log, /var/cache etc) so that you only snapshot relevant content during each update. I wrote a btrbk config at that point, tested it a few times and then wrote a pacman hook to fire it on install, update or package remove events and went from there.
Here’s what I use to take snapshots - you’ll need to write an appropriate btrbk config file for your subvolume layout but it’s otherwise feature complete. https://gitlab.com/arglebargle-arch/btrbk-autosnap
Like I mentioned above, I haven’t actually needed to roll the system back in ages but I get a lot of mileage out of being able to reach back in time and grab old versions of files for comparison.
Time shift is a lot easier if you’re just starting out but it also requires a specific subvolume structure and isn’t very flexible.
Edit: pro tip: don’t make /var a separate subvolume from /, it’s way, way, way too easy to roll one or the other (/ or /var) back without the other. If you do that by accident pacman’s state becomes out of sync with the running system and everything breaks. Stick to splitting frequently rewritten data like /var/cache and /var/log off, leave /var itself in the root subvolume.
I feel like I keep posting this everywhere but there’s a project called AstOS that attempts this. Also someone clued me in on this distro neutral solution. AshOS. Full disclosure I haven’t used either.
It looks like solutions like these miss the whole point of what Nix is trying to do. Nix comes with the belief: “Unix has some fundamental issues, because it was designed in specific way. If we store things differently it works really well, and we even get those cool properties for free”.
The authors of those projects instead of thinking “this looks interesting, and it is a paradigm shift but it might be worth to to try feel like Linux noob for some time and start thinking a bit differently how the file system is structured to see if this change is really worth it”
Instead it is: “I don’t need to be PhD in Computer Science (whatever that means), here is how I can force this Nix feature or two on traditional Linux, with ansible, bubble gum and some duct tape and make it immutable-ish, which fails sometimes but, hey, it has the same feature on paper.”
Well to be fair I think it’s because they aren’t trying to be NixOS. You could leverage those arguments against any distro that’s trying out an immutable flavor. Which is mostly accomplished through btrfs features.
I agree that Nix/NixOS does a lot more and it’s a genuinely impressive and paradigm shifting project but it does break with traditional Linux layouts and thinking in a way that immutability doesn’t necessarily have to do.
You could also make the same argument with the systemd and non-systemd crowd.
Either way I look forward to the future of both immutability projects and NixOS. I feel like both areas still need a bit of work but they’re both really exciting fields.
Well yeah obviously like NixOS. My reason for not using it is that they use a non standard Linux filesystem and it renders a # of packages I want to install incompatible.
I love it, because you can also get best out of both worlds in relation to the comic discusses. You can personalize OS to your liking, and the entire configuration is in a file, so you can redeploy the same setup again.
Just add rescue to kernel options (if you use GRUB, press e to edit it for the current boot) and it will boot into console from which you can do downgrade.
Honestly this is the reason I want an immutable build of Arch like NixOS.
Let me roll back my mistakes and I could live more happily with rolling release.
When I started using Arch I just set it up on a btrfs filesystem and wrote a simple btrbk hook to take a snapshot before any package updates. That made it trivial to unfuck anything that broke after an update. I can’t remember the last time I had to roll the system back but it’s nice for peace of mind.
That’s quite clever, are there any guides for getting that set up? I’m using btrfs but haven’t gotten into snapshotting yet.
Start by playing with subvolumes and snapshots so you can get a feel for how they work. Once you’ve got that down you can break down your root filesystem into sensible subvolume chunks (
/
,/home
,/var/log
,/var/cache
etc) so that you only snapshot relevant content during each update. I wrote a btrbk config at that point, tested it a few times and then wrote a pacman hook to fire it on install, update or package remove events and went from there.Here’s what I use to take snapshots - you’ll need to write an appropriate btrbk config file for your subvolume layout but it’s otherwise feature complete. https://gitlab.com/arglebargle-arch/btrbk-autosnap
Like I mentioned above, I haven’t actually needed to roll the system back in ages but I get a lot of mileage out of being able to reach back in time and grab old versions of files for comparison.
Time shift is a lot easier if you’re just starting out but it also requires a specific subvolume structure and isn’t very flexible.
Edit: pro tip: don’t make
/var
a separate subvolume from/
, it’s way, way, way too easy to roll one or the other (/ or /var) back without the other. If you do that by accident pacman’s state becomes out of sync with the running system and everything breaks. Stick to splitting frequently rewritten data like /var/cache and /var/log off, leave /var itself in the root subvolume.Timeshift, Timeshift auto-snap, and btrfs in the grub menu to have your snapshots there, too. Auto-snap takes a snapshot automatically whenever you upgrade or install some packages.
I feel like I keep posting this everywhere but there’s a project called AstOS that attempts this. Also someone clued me in on this distro neutral solution. AshOS. Full disclosure I haven’t used either.
I’m looking to reload my daily driver and there’s just not enough support for that.
Oh totally fair, it doesn’t have a huge maintainer base for sure. But it’ll never be anyone’s daily driver if no one knows about it.
It looks like solutions like these miss the whole point of what Nix is trying to do. Nix comes with the belief: “Unix has some fundamental issues, because it was designed in specific way. If we store things differently it works really well, and we even get those cool properties for free”.
The authors of those projects instead of thinking “this looks interesting, and it is a paradigm shift but it might be worth to to try feel like Linux noob for some time and start thinking a bit differently how the file system is structured to see if this change is really worth it”
Instead it is: “I don’t need to be PhD in Computer Science (whatever that means), here is how I can force this Nix feature or two on traditional Linux, with ansible, bubble gum and some duct tape and make it immutable-ish, which fails sometimes but, hey, it has the same feature on paper.”
Well to be fair I think it’s because they aren’t trying to be NixOS. You could leverage those arguments against any distro that’s trying out an immutable flavor. Which is mostly accomplished through btrfs features.
I agree that Nix/NixOS does a lot more and it’s a genuinely impressive and paradigm shifting project but it does break with traditional Linux layouts and thinking in a way that immutability doesn’t necessarily have to do.
You could also make the same argument with the systemd and non-systemd crowd.
Either way I look forward to the future of both immutability projects and NixOS. I feel like both areas still need a bit of work but they’re both really exciting fields.
You mean like nixos-unstable, the rolling release channel of NixOS?
Well yeah obviously like NixOS. My reason for not using it is that they use a non standard Linux filesystem and it renders a # of packages I want to install incompatible.
In that case, couldn’t you just use something like btrfs snapshots + Timeshift to pull this off?
Yeah you could put some together I think, possibly with OverlayFS as well.
I feel like the value those distros add is not just the rolling mechanism but the package manager being tied into it.
So you just use the package manager like any other and it works.
Which packages?
I ended up packaging the thing myself, actually. The best part is my pull request was approved and I was able to contribute my work
I love it, because you can also get best out of both worlds in relation to the comic discusses. You can personalize OS to your liking, and the entire configuration is in a file, so you can redeploy the same setup again.
You can downgrade packages on arch too via
downgrade
.If your pc still boots.
Just add
rescue
to kernel options (if you use GRUB, presse
to edit it for the current boot) and it will boot into console from which you can dodowngrade
.https://wiki.archlinux.org/title/snapper