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

Move /var content to /usr/share/factory/var #569

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

cgwalters
Copy link
Member

Instead of dropping /var content on the floor, move it into /usr/share/factory/var.

With this change, a systemd-tmpfiles fragment like this: C+ /var - - - - -
is sufficient to get "populate /var" automatically on initial installation and across upgrades.

Instead of dropping `/var` content on the floor, move it into
`/usr/share/factory/var`.

With this change, a systemd-tmpfiles fragment like this:
`C+ /var - - - - -`
is sufficient to get "populate /var" automatically on initial
installation and across upgrades.
@cgwalters cgwalters marked this pull request as ready for review November 30, 2023 21:42
@cgwalters
Copy link
Member Author

Pairs with ostreedev/ostree#3103

@rhatdan
Copy link

rhatdan commented Dec 1, 2023

LGTM
@vrothberg PTAL

@cgwalters cgwalters merged commit b59aaaa into ostreedev:main Dec 1, 2023
8 checks passed
@mrguitar
Copy link

mrguitar commented Dec 1, 2023

Will this also solve the problem of rpms installing under /opt? ...he asked while making doe eyes at @cgwalters
On the surface it seems like it would.

cgwalters added a commit to cgwalters/bootc that referenced this pull request Dec 1, 2023
This will help ensure we're testing what's there before release,
in particular ostreedev/ostree-rs-ext#569
cgwalters added a commit to cgwalters/bootc that referenced this pull request Dec 1, 2023
This will help ensure we're testing what's there before release,
in particular ostreedev/ostree-rs-ext#569

Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters
Copy link
Member Author

Will this also solve the problem of rpms installing under /opt?

The core issue remains that:

  • rollbacks won't roll back data in /var
  • Content that is added is never automatically deleted; so you can "leak" state

But yes, some will probably start working modulo those caveats.

Copy link

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vrothberg
Copy link

@cgwalters are the caveats recorded/documented somewhere?

@travier
Copy link
Member

travier commented Dec 19, 2023

From https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html (see ostreedev/ostree#3103):

C, C+
           Recursively copy a file or directory, if the destination files or directories do not exist yet
           or the destination directory is empty. Note that this command will not descend into
           subdirectories if the destination directory already exists and is not empty, unless the action
           is suffixed with +. Instead, the entire copy operation is skipped. If the argument is omitted,
           files from the source directory /usr/share/factory/ with the same name are copied. Does not
           follow symlinks. Contents of the directories are subject to time-based cleanup if the age
           argument is specified.

If I understand correctly, I've found the following caveats to document:

On updates (N -> N+1), the following will happen:

  • Files added in N+1 are copied to /var.
  • Files removed in N+1 are not removed from /var. New installations will not have those files.
  • Files modified in N+1 are not copied to /var. New installations will have the N+1 version of those files.

On rollbacks (N+1 -> N):

  • Files added in N+1 are left in /var.
  • Files removed in N+1 are re-added to /var if something else removed them from /var in N+1.

In general, I think we should recommend users include another unit that calls to rsync (for example) with a list of files to update in sync between updates on boot. If they want files to be removed, they will have to make another unit.

I still need to verify that C+ does not overwrite existing files on update. This is unclear from the man page.

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.

None yet

6 participants