Linux is so easy - rolling back with timeshift

My system froze during a kernel update. I was downloading a big file at the same time, so I think I ran out of ram. I couldn't access tty, so I just forced reboot with powerbutton. As one might expect, system could not boot normally after an interrupted kernel update.

Normally I would boot an iso from grub, chroot in, update, regenerate initcpio and update grub. But I have Timeshift-autosnap installed, so it was even easier to fix: I chose snapshot from 2 minutes ago from grub and booted into it. Opened timeshift and after two clicks my system was restored and I could reboot normally.

So... Thanks @Librewish @schinfo and gobonja

12 Likes

My speech :wink:

gobonja

https://gitlab.com/gobonja/timeshift-autosnap

Never again say, not today :slight_smile:

6 Likes

Interesting reading thanks.

Until this thread i'd not heard of this. I simply use "standard" Timeshift, for years [indeed, predating my time in Arch-based distros], & for me it has been a marvellous emergency recovery resource. Whilst for sure i have only needed it rarely, on those occasions i greatly appreciated having it available.

I have it set for daily system [not data] snapshots, & i ensure that i do not do big system updates before the daily TS run has occurred & completed. As such, though this script seems clever & nice, i can't really grasp atm how it might materially advantage me over my current arrangements.

1 Like

@Chrysostomus
perhaps you should try

https://aur.archlinux.org/packages/performance-tweaks

so system wont freeze
due to cpu/ram

but this wont prevent freezes due to gpu

From the descriptions at hand I think the difference is automation (and how).

(you gave me shrugs so I will explain a bit better @kdemeoz .. your way seems to be done at intervals. This way happens automatically before every update and automatically creates a grub-selectable boot option to the restore)

2 Likes

Timeshift backup size is understandable for me

I have setting to keep 5 daily backups and 3 weeks. My each days backup uses around 10 GB (root partition is around 17 GB). So if we exclude pacman cache, root home folder and others directories which are in the timeshift exclude list it will be almost whole / partition
Why so many? Doesn't timeshift should backup only modified files?

Thanks, I'll look into it. I had been thinking of using zram, but my processor is not that great either.

Shouldn't do, rsync only copies the changes after the first backup and hardlinks the rest.

If you examine the folders in a file manager it'll look like they're all full size but they aren't actually taking up that much space.

(if you have questions open a new thread)

1 Like

Zswap, it writes oldest zram to disk (swap partition) when RAM is getting full, but it is a bit tricky to set up. (Shouldn't be too difficult for you.) I've set it up with kernel parameters.

Ta for the expansion, which now obviates the shrug. Thing is though that whilst clearly this script is clever & useful broadly, i still cannot grasp how it benefits my narrow use-case. For as long as i maintain my self-discipline of not doing updates until that day's TS snapshot has been created [automatically by the TS scheduler, not manually by me], then surely [Shirley] i'm still adequately covered. Ie, if the update goes bad, & i can't directly resolve it myself, & if i can't fix it via chrooting, then i have my TS fallback option [historically proven] of booting from LiveUSB & using its TS to select my desired snapshot, restore it, & reboot back into recovered system. I still can't quite see how this script helps me. However, it was not written for me, duh, so if helps others, then that's truly wonderful.

1 Like

Yes exactly .. youve grasped the difference .. but assuming you keep to your regimen then its not necessary. It doesnt apply to me either because I'm still kickin it with the No-Backup-Crew :wink:

3 Likes

It's even better if you have BTRFS on root! I've been able to just run timeshift --restore from a TTY (and supposedly a chroot) and it instantly reverts back to the snapshot without copying files, only rebooting afterwards.

I do have btrfs root. That's why it is awesome, the restoration is instant. Running one command or pressing one button and that's it.

1 Like

well
i hope btrfs becomes the default fs
for rolling distro.
although opensuse does this.
but its lacking pacman and aur.
and zypper just sucks.
same for snapper.

i am doing this with my spins as far as i can but this is limited in scope i dont even know
if some people are using it and some might have moved onto other distro.

1 Like

I've done a lot of automation for btrfs in manjaro-architect. I'm not sure if it's the right default for everyone, but I like it for myself.

2 Likes

Forum kindly sponsored by