Disclaimer
I'm the PCP package maintainer at SUSE, and one of the main
contributors to openSUSE's PCP package.
Background
A growing number of distributions ship with a read-only /usr and a
writable /var on a separate subvolume, with transactional updates
that snapshot /usr independently of /var.
Examples include Fedora Atomic and openSUSE MicroOS.
On these distributions, files that the PCP package ships under
/var/lib/pcp/ are problematic:
- They live on a subvolume not covered by
/usr snapshots, so they
don't roll back with the rest of the system.
- They're flagged by distro packaging checks (e.g. rpmlint's
dir-or-file-outside-snapshot warning on openSUSE, and the broader
rpm-ostree expectations on Fedora variants).
- Some downstream distros refuse to publish builds that violate this.
This has been discussed in this tracker before, partially, through issues #816 and #1418.
To work around this, distributions are converging on a standard
pattern: symlinking /var directories to read-only locations in
/usr or /etc.
SUSE is about to ship an implementation using systemd-tmpfiles.
This involves recreating the /var/lib/pcp/ tree at boot with
symlinks targeting /usr/libexec/pcp/ and /etc/pcp/, while
relocating the testsuite's files to /usr/libexec/pcp/stash/.
The intent behind this issue is to ask whether upstream would welcome
a more coordinated approach, so each distro isn't re-inventing the
wheel slightly differently.
What we built downstream (for context)
Briefly, the SUSE approach is:
- A buildroot-relocation helper runs after
make install_pcp.
For each subpackage's file list, it classifies entries under
/var/lib/pcp/ by type (symlink / regular file / directory).
- Pre-existing symlinks (most PMDA content) get
%ghost'd in the RPM
and an L+ tmpfiles.d entry is emitted pointing at the original
/usr/libexec/pcp/... or /etc/pcp/... target.
- Real files (only
pcp-testsuite) are cp -a'd to
/usr/libexec/pcp/stash/, %ghost'd at the legacy location, and
an L+ entry points at the stash copy.
- systemd-tmpfiles recreates the legacy
/var/lib/pcp/ tree at boot,
so PCP's runtime sees the layout it was built for.
The runtime environment is unchanged: PCP_VAR_DIR=/var/lib/pcp stays
correct, no PCP source is patched, regular non-transactional installs
are unaffected.
We can share the spec and helper script if useful. We're not proposing
them as-is for upstream adoption, as they're SUSE-specific, but they
may be useful as a reference for what works.
I haven't checked what Fedora is doing in detail, although that may be
interesting as well.
Open questions & next steps
We'd like to open a discussion on whether upstream is interested in coordinating support for immutable distributions, or if this should remain a per-distro effort indefinitely.
If upstream consolidation makes sense, potential paths include:
- Documenting a standard symlink pattern.
- Shipping an upstream build helper to generate tmpfiles.d snippets.
- Adding a
/usr-only configure flag.
- Reconsidering the file layout to move static content out of
/var.
Note: This was ruled out for the SUSE-specific packages as simply changing PCP_VAR_DIR might break established documentation and runtime expectations.
We are happy to share our SUSE implementation, help prototype, and test patches.
Even a brief signal on your preferred direction, or confirmation that
we should continue handling this downstream, would be incredibly
helpful for us to plan our next steps.
Disclaimer
I'm the PCP package maintainer at SUSE, and one of the main
contributors to openSUSE's PCP package.
Background
A growing number of distributions ship with a read-only
/usrand awritable
/varon a separate subvolume, with transactional updatesthat snapshot
/usrindependently of/var.Examples include Fedora Atomic and openSUSE MicroOS.
On these distributions, files that the PCP package ships under
/var/lib/pcp/are problematic:/usrsnapshots, so theydon't roll back with the rest of the system.
dir-or-file-outside-snapshotwarning on openSUSE, and the broaderrpm-ostree expectations on Fedora variants).
This has been discussed in this tracker before, partially, through issues #816 and #1418.
To work around this, distributions are converging on a standard
pattern: symlinking
/vardirectories to read-only locations in/usror/etc.SUSE is about to ship an implementation using
systemd-tmpfiles.This involves recreating the
/var/lib/pcp/tree at boot withsymlinks targeting
/usr/libexec/pcp/and/etc/pcp/, whilerelocating the testsuite's files to
/usr/libexec/pcp/stash/.The intent behind this issue is to ask whether upstream would welcome
a more coordinated approach, so each distro isn't re-inventing the
wheel slightly differently.
What we built downstream (for context)
Briefly, the SUSE approach is:
make install_pcp.For each subpackage's file list, it classifies entries under
/var/lib/pcp/by type (symlink / regular file / directory).%ghost'd in the RPMand an
L+tmpfiles.dentry is emitted pointing at the original/usr/libexec/pcp/...or/etc/pcp/...target.pcp-testsuite) arecp -a'd to/usr/libexec/pcp/stash/,%ghost'd at the legacy location, andan
L+entry points at the stash copy./var/lib/pcp/tree at boot,so PCP's runtime sees the layout it was built for.
The runtime environment is unchanged:
PCP_VAR_DIR=/var/lib/pcpstayscorrect, no PCP source is patched, regular non-transactional installs
are unaffected.
We can share the spec and helper script if useful. We're not proposing
them as-is for upstream adoption, as they're SUSE-specific, but they
may be useful as a reference for what works.
I haven't checked what Fedora is doing in detail, although that may be
interesting as well.
Open questions & next steps
We'd like to open a discussion on whether upstream is interested in coordinating support for immutable distributions, or if this should remain a per-distro effort indefinitely.
If upstream consolidation makes sense, potential paths include:
/usr-only configure flag./var.Note: This was ruled out for the SUSE-specific packages as simply changing
PCP_VAR_DIRmight break established documentation and runtime expectations.We are happy to share our SUSE implementation, help prototype, and test patches.
Even a brief signal on your preferred direction, or confirmation that
we should continue handling this downstream, would be incredibly
helpful for us to plan our next steps.