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

VCS/devel tracking breaks after rollbacks with immutable systems due to persistent 'STATE DIRECTORY' #1334

Open
GrabbenD opened this issue Feb 13, 2025 · 0 comments

Comments

@GrabbenD
Copy link

GrabbenD commented Feb 13, 2025

Problem

Users running immutable system like ostree or even plain BTRFS Snapshots will suffer from inconsistent VCS database state after a system rollback (#1333).

This is caused by the default --devel option persisting data in the STATE DIRECTORY whose location ($XDG_STATE_HOME) is not compatible with common design of cattle/immutable systems.

System's State is typically kept in Variable Data directory (/var) to separate it from Persistent Data (like /home).

STATE DIRECTORY

The state directory is $XDG_STATE_HOME/paru/. If $XDG_STATE_HOME is unset, the state directory will fall back to $HOME/.local/state/paru.

Solutions

  1. Pacman approach

    Pacman has solved this elegantly by storing its state (DBPath) in /var/lib/pacman/ system location by default which is analogous to $XDG_STATE_HOME. Providing /var/lib/paru as the state directory would support immutable systems and rollbacks out-of-the box.

  2. Customizable database location

    Ability to tweak STATE DIRECTORY through StateDir = /var/lib/paru config option.

  3. Command parameter

    Option to bypass cached commits in STATE DIRECTORY through a buildin flag like --develcheck which would mimic the slower pacaur-like devel check but without explicitly forcing re-installation of detected packages (e.g. --norebuild). For reference, see workaround below.

Example

Consider the following flow

  • User updates the system:

    $ paru --sync --refresh --sysupgrade
  • This causes VCS database to be updated in $XDG_STATE_HOME/paru/ via --devel (provided by default in /etc/paru.conf):

    # ~/.local/state/paru/devel.toml
    [[vkd3d-proton-mingw-git]]
    url = "https://github.com/HansKristian-Work/vkd3d-proton.git"
    commit = "7dbfa851c1f7c73b8468e9b96e763b823242db2f"
  • User performs a system rollback, in such scenarios $HOME might be a separate mount to abstract persistent data from system's state /.

  • This causes ~/.local/state/paru/devel.toml to retain information about currently installed devel packages which do not reflect the current state of / system-rootfs.

  • Re-attempting to update will cause devel packages to not detect updates.

Workarounds

  1. Symlinks

    Considering Paru's state location cannot be customized in v2.0.3, make a symlink to the appropriate location:

    $ sudo mv --verbose $XDG_STATE_HOME/paru /var/lib/paru
    $ sudo ln --verbose --symbolic /var/lib/paru $XDG_STATE_HOME/paru

    If devel.toml is accidentally deleted, it can be re-generated with $ paru --gendb (which injects latest commits and not the currently installed version). Then run manual resolve step from below to make sure that installed packages match the database state.

  2. Manual Resolve

    After a rollback, perform slower pacaur-like devel checks which forces VCS packages to be explicitly re-installed:

    $ pacman -Qmq | grep -Ee '-(cvs|svn|git|hg|bzr|darcs)$' | paru -Ta - | paru -S --needed -
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

No branches or pull requests

1 participant