Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioning based on btrfs snapshots #3420

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Borgvall
Copy link

@Borgvall Borgvall commented Jul 5, 2024

Description

I actually like the bottles application for managing wine prefixes. However it itches me, that I can not create the bottles as btrfs subvolumes, which I want to use it with my backup solution, to backup/restore bottles independently. I also tried to create the subvolume in place before creating a bottle, but bottles is appending a random number to the path, if the bottle directory already exists. This motivates the commits up to fc7513a.

I went a bit over the top and implemented it further, until I can create and restore bottle snapshots using the bottles GUI. With all updates added to this PR, I think this is ready to be merged.

Any feedback is appreciated.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • btrfsutil's calls work also inside flatpak's sandbox
  • Bottles are created as btrfs subvolumes, if the filesystem is btrfs.
  • Creating snapshots and resetting to them using btrfs snapshots.
  • All snapshots have meaningful timestamps
  • The "active" state is marked
  • Duplicated bottles are created as subvolumes. This can be used to "import" existing bottles into btrfs snapshot based versioning
  • Duplicated bottle, where the source bottle is a subvolume, is created as a lightweight snapshot bottle
  • Deleting a bottle, deletes the associated btrfs snapshots
  • If the bottle is not a subvolume or has pre-created FVS states, it falls back to the FVS system. (I encountered a critical bug [Bug]: Snapshot newer as the active state can not be restored #3416, which affects the release version, too)
  • TODO regression testing on non btrfs filesystem. (Help would be appreciated)

@Borgvall
Copy link
Author

Borgvall commented Jul 8, 2024

@Henry-Hiles
Copy link

Does this work within a flatpak sandbox?

@Borgvall
Copy link
Author

Borgvall commented Jul 12, 2024

Good question @Henry-Hiles. So far I have only tested this without flatpak. The question contains two subparts. The first one is, that libbtrfsutil (and it's dependencies and Python bindings) must be added to bottle's flatpak. The other question is, if the flatpak sandbox intercepts the btrfs specific features?
I have never done any flatpak building or investigated the details of flatpk sandboxing. Can someone with more flatpak expertise step in here?

@Borgvall
Copy link
Author

It was quite clunky (and a flatpak expert might laugh at me), but I was able to test this branch in a flatpak today. I followed the meson build instruction in Bottles' Readme.md, and then build the release tar ball https://github.com/kdave/btrfs-progs/releases/tag/v6.9.2 inside the flatpak's bash shell like this:

./autogen.sh
./configure --disable-documentation --disable-lzo --enable-python --prefix=/home/johannes/src/Bottles/build
make -j
make install
export MY_PATH=/home/johannes/src/Bottles/build/lib/
cp libbtrfsutil/python/btrfsutil.cpython-311-x86_64-linux-gnu.so $MY_PATH
LD_LIBRARY_PATH=$MY_PATH PYTHONPATH=$MY_PATH /home/johannes/src/Bottles/build/bin/bottles

Then bottles can import btrfsutil, and everything works as expected:

  • Bottle duplicate as subvolume
  • Create snapshots
  • Reset state to snapshot
  • Deleting the bottle deletes the corresponding snapshots

@Borgvall Borgvall changed the title WIP Versioning based on btrfs snapshots Versioning based on btrfs snapshots Jul 15, 2024
@Borgvall
Copy link
Author

Today I dived into flatpak building, and added the needed btrfs-progs package to bottles' flatpak build. I also moved the corresponding git commit back into the history, in order to avoid commits, where bottles' flatpak fails to start due to the missing btrfsutils module.

@TheEvilSkeleton
Copy link
Member

TheEvilSkeleton commented Jan 3, 2025

Hey @Borgvall, are you still interested in working on this? It seems like, based on your tests, the functionality works inside Flatpak, so I'm all for pushing this feature in the future. I personally don't really like the current implementation because it's largely unmaintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants