openSUSE / snapper

Manage filesystem snapshots and allow undo of system modifications
http://snapper.io/
GNU General Public License v2.0
896 stars 126 forks source link

Feature Request: A guided recovery for a non booting system on a BTRFS volume #446

Open FranzGotsis opened 5 years ago

FranzGotsis commented 5 years ago

The idea is to boot a different system to fix a non booting linux running on a btrfs system. Currently snapper reads its default configuration from a point in the filesystem belonging to the booted linux release.

In case you want to fix a non-booting system you would need to read the snapshots from a partition the user has to provide. In such a case you do not need the features for creating snapshots but rather a an ideally guided way to retrieve snapshot information from a partition that contains a non-booting linux system. As snapper is using btrfs functions, all the information to roll back is there on this separate partition.

This is typically the case when you boot a rescue system (for instance Knoppix, PartedMagic or OpenSuse's rescue). In such a case a guided recovery would be great. something like snapper -rollback-guided Which would then ask for the partition with btrfs, read all available information and present that to the user in a way that the next steps can be selected (for instance rollback to a specific snapshot).

Relying on grub2 won't help either if the feature to allow to boot from existing snapshots is implemented.

FranzGotsis commented 5 years ago

Reporting a behavior that seems strange to me: If you run a system with several linux operating systems (distributions installed) and you want to create a snapper configuration that allows to manage snapshots on that partition, snapper complains that it cannot create the configuration, because the directory .snapshots exists on that specific partition, it seems that by trying the create the configuration the snapper deamon snapperd is instructed to start creating snapshots instead of just reading the existing snapshots.

The consequence is that snapper can only manage those partitions that it also controls directly. That means not only the guided rollback via snapper is not possible but also a non guided one is not supported.

This kind of adds another argument to the feature request I wrote previously (see above).

just for the sake of making it easier I post the commands and the entry in the logfile of snapper trying to add a configuration for a root file-system of a second btrfs-root partition.

System running OpenSuse Leap 15 command pcwithlinux:/other_linux_installations # snapper -c osuse_backup_root create-config /other_linux_installations/osuse_backup_root/ Creating config failed (creating btrfs subvolume .snapshots failed since it already exists).

logfile content: 2018-11-12 00:40:34 MIL libsnapper(6593) Snapper.cc(createConfig):313 - Snapper create-config 2018-11-12 00:40:34 MIL libsnapper(6593) Snapper.cc(createConfig):314 - libsnapper version 0.5.6 2018-11-12 00:40:34 MIL libsnapper(6593) Snapper.cc(createConfig):316 - config_name:osuse_backup_root subvolume:/other_linux_installations/osuse_backup_root fstype:btrfs template_name:default 2018-11-12 00:40:34 MIL libsnapper(6593) Snapper.cc(getConfigs):272 - Snapper get-configs 2018-11-12 00:40:34 MIL libsnapper(6593) Snapper.cc(getConfigs):273 - libsnapper version 0.5.6 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(reload):114 - loading file /etc/sysconfig/snapper 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(getValue):235 - key:SNAPPER_CONFIGS value:root 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(reload):114 - loading file /etc/snapper/configs/root 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(getValue):235 - key:SUBVOLUME value:/ 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(reload):114 - loading file /etc/sysconfig/snapper 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(getValue):235 - key:SNAPPER_CONFIGS value:root 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(save):139 - saving file /etc/sysconfig/snapper 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(reload):114 - loading file /etc/snapper/config-templates/default 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(save):139 - saving file /etc/snapper/configs/osuse_backup_root 2018-11-12 00:40:34 ERR libsnapper(6593) Btrfs.cc(createConfig):126 - create subvolume failed, ioctl(BTRFS_IOC_SUBVOL_CREATE) failed, errno:17 (File exists) 2018-11-12 00:40:34 WAR libsnapper(6593) Btrfs.cc(createConfig):132 - THROW: creating btrfs subvolume .snapshots failed since it already exists 2018-11-12 00:40:34 WAR libsnapper(6593) Snapper.cc(createConfig):394 - CAUGHT: creating btrfs subvolume .snapshots failed since it already exists 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(reload):114 - loading file /etc/sysconfig/snapper 2018-11-12 00:40:34 MIL libsnapper(6593) AsciiFile.cc(getValue):235 - key:SNAPPER_CONFIGS value:root osuse_backup_root 2018-11-12 00:40:34 MIL libsnapper(6593) SystemCmd.cc(SystemCmd):46 - constructor SystemCmd:"/usr/bin/rm '/etc/snapper/configs/osuse_backup_root'" 2018-11-12 00:40:34 MIL libsnapper(6593) SystemCmd.cc(execute):82 - SystemCmd Executing:"/usr/bin/rm '/etc/snapper/configs/osuse_backup_root'" 2018-11-12 00:40:34 MIL libsnapper(6593) SystemCmd.cc(doExecute):267 - stopwatch 0.001863s for "/usr/bin/rm '/etc/snapper/configs/osuse_backup_root'"