Timeshift integration


#1

Why is Timeshift not part of the live-system?
I think restoring snapshots is a common task for a live-system.

Is it possible to (optionally) integrate Timeshift in the package mangement tool stack?
Creating snapshots before installing system updates is a good life insurance.


#2

Like Yast and Snapper do in (open)SUSE.


#3

That sounds like a good idea!


#4

And make it optional too of course


#5

That sounds as if you don’t like the idea, but yes, optional would be the best.
I have also never liked a program like Timeshift, but as experiment I have started to use it on my laptop and I use it full time. I can always go back to a previous state, just did so this morning after I was trying out some new icon themes. I found out I lost several icons, the ones for typical KDE programs. Didn’t matter which one I chose, they were not there, so I restored yesterdays state of the system and now all is working well. Took maybe 2 minutes to do so, including the necessary reboot.


#6

I actually like the idea, but there’s always gonna be someone who just doesn’t want to use that feature because of X problem.


#7

For Manjaro Gnome it is and it is super helpful. Super easy to restore backups if you have a Manjaro Gnome live usb.


#8

Good to know. The XFCE edition does not include it.


#9

Exactly, please do not force anyone to use it, but offer it as an easy to use option


#10

Manjaro 18: I recently took a look on the GNOME Edition it has timeshift bundled in the live-system, but it seems that the XFCE one is missing it.

Please bundled it to the live-system in all spins. This thing can be a live saver for common-users getting problems in his updates.

I really like how Linux Mint uses Timeshift in their system. Especially for rolling distros I consider it a good idea having this for people wanting to rescue their system easily.


#11

Are you saying to get prompted by pacman to update timeshift snapshot right before running pacman -Syyu I would agree to that as long as the user is given the option to disable that prompt if they want.

Also I totally agree with your first point.


#12

If you wanted an automatic snapshot created prior to updating, I think that could be accomplished by writing a pacman hook. I’m no expert on pacman hooks, but they are fairly simple to write.


#13

thanks for the suggestion, looks really easy

[Trigger]
Operation = Upgrade
Type = Package
Target = *

[Action]
Depends = timeshift
When = PreTransaction
Exec = /usr/bin/timeshift --create --comments "from pacman hook"

How often is the hook triggered, for every package or once per pacman -Syyu?
it will try it out


#14

I belive if you use:

Target = * 

It will invoke the hook at any package upgrade operation. Test it out and let us know how it worked.


#15

That seems to work. I downgraded two installed packages and run pacman -Syyu
Only one snapshot was created :slight_smile:
But there is one side effect, downgrades trigger also the upgrade hook .
I can live with that behavior, definitely a nice solution!

Pacman output
sudo pacman -Syyu
:: Synchronizing package databases...
 core                                           147,4 KiB  2,88M/s 00:00 [#########################################] 100%
 extra                                         1852,6 KiB  11,1M/s 00:00 [#########################################] 100%
 community                                        5,1 MiB  11,8M/s 00:00 [#########################################] 100%
 multilib                                       184,7 KiB  13,9M/s 00:00 [#########################################] 100%
:: Starting full system upgrade...
warning: lib32-systemd: local (239.303-1) is newer than multilib (239.6-2)
warning: libsystemd: local (239.303-1) is newer than core (239.6-2)
warning: systemd: local (239.303-1) is newer than core (239.6-2)
warning: systemd-sysvcompat: local (239.303-1) is newer than core (239.6-2)
resolving dependencies...
looking for conflicting packages...

Packages (2) rclone-1.45-1  rsnapshot-1.4.2-3

Total Installed Size:  35,55 MiB
Net Upgrade Size:       2,97 MiB

:: Proceed with installation? [Y/n] y
(2/2) checking keys in keyring                                           [#########################################] 100%
(2/2) checking package integrity                                         [#########################################] 100%
(2/2) loading package files                                              [#########################################] 100%
(2/2) checking for file conflicts                                        [#########################################] 100%
(2/2) checking available disk space                                      [#########################################] 100%
:: Running pre-transaction hooks...
(1/1) pacman-timeshift.hook
------------------------------------------------------------------------------
Creating new snapshot...(RSYNC)
Saving to device: /dev/sda1, mounted at path: /home
Linking from snapshot: 2018-12-24_10-50-39
Synching files with rsync...
Created control file: /home/timeshift/snapshots/2018-12-24_13-49-27/info.json   
RSYNC Snapshot saved successfully (4s)
Tagged snapshot '2018-12-24_13-49-27': ondemand
------------------------------------------------------------------------------
:: Processing package changes...
(1/2) upgrading rclone                                                   [#########################################] 100%
(2/2) upgrading rsnapshot                                                [#########################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...