this post was submitted on 14 Jan 2025
19 points (95.2% liked)

Arch Linux

7943 readers
2 users here now

The beloved lightweight distro

founded 5 years ago
MODERATORS
 

I've seen some tools that do things like take snapshots periodically and ones that add snapshots to grub, but not this specifically. Does something exist?

This will probably be on EndeavourOS, not Arch directly, if it matters.

top 15 comments
sorted by: hot top controversial new old
[–] [email protected] 17 points 1 week ago

You can run scripts before/after pacman commands using hooks

https://wiki.archlinux.org/title/Pacman#Hooks

[–] [email protected] 7 points 1 week ago* (last edited 1 week ago)

alias upgrayedd='<snapshot cmd> && pacman/paru ...'

OR

upgrayedd() {
    <pre>
    <snapshot cmd>
    pacman/paru "$1"
    <post>
}
[–] [email protected] 5 points 1 week ago (1 children)
[–] [email protected] 3 points 1 week ago

This is what I use, I am on endeavouros too.

[–] [email protected] 3 points 1 week ago (1 children)

I don't know the details, but CachyOS uses a pacman hook to do exactly that, so it's possible. It looks like there are AUR packages to do the same thing, but I haven't looked at them

[–] JackbyDev 2 points 1 week ago (1 children)

Does it do this out of the box? CachyOS is another option on my radar and that might push it over the edge for me over EOS.

[–] [email protected] 2 points 1 week ago (1 children)

Yep, as long as you use btrfs during the install and select snapper support

[–] JackbyDev 1 points 1 week ago (1 children)

Just installed CachyOS and chose btrfs when installing, but it never asked about snapper. Maybe I need to do it manually.

[–] [email protected] 2 points 1 week ago (1 children)

If you open cachy hello, you'll see an option to install snapper support there. I should also add, you need to use grub for the boot images to work when you do a kernel upgrade

[–] JackbyDev 1 points 1 week ago (1 children)

Awesome! I installed it. Hopefully if something goes wrong I should be good. And yes, I used Grub!

[–] [email protected] 1 points 1 week ago

You can always test it by booting off a backup image. If it works, you have peace of mind, and you can just reboot again from the correct image

[–] [email protected] 2 points 1 week ago

I use snapper. It takes snapshots not only triggered by pacman hooks but also on an interval or manually.

https://wiki.archlinux.org/title/Snapper

[–] [email protected] 2 points 1 week ago

manjaro does this with timeshift. i think opensuse does as well.

[–] [email protected] 2 points 1 week ago

The AUR package btrfs-autosnap does this. You define which subvolumes need to be snapshotted and how many it should keep of each. It adds a pacman hook that then takes a snapshot before updating.

[–] [email protected] 1 points 1 week ago

I'm also on EndeavourOS and used this tutorial to do exactly that.

All you should have to do is

yay -S snapper-support btrfs-assistant