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

F36: Complete adaption to https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr #3397

Open
lucab opened this issue Feb 3, 2022 · 4 comments

Comments

@lucab
Copy link
Contributor

lucab commented Feb 3, 2022

As part of F36 changes, there is this rpmdb move to /usr: https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr

It just landed in rawhide with this commit: https://src.fedoraproject.org/rpms/rpm/c/0b9f813cd529a1fc7c1336e62d82b90c81f517f1?branch=rawhide

So starting with rpm-4.17.0-7 the package is shipping an empty directory at /usr/lib/sysimage/rpm.

FCOS composes are now failing with:

Finalizing rootfs: Hardlinking rpmdb to base location: File exists (os error 17)

This is because we currently try to create a symlink there to our rpmdb:

// And write a symlink from the proposed standard /usr/lib/sysimage/rpm
// to our /usr/share/rpm - eventually we will invert this.
rootfs.symlink(RPMOSTREE_SYSIMAGE_RPMDB, "../../share/rpm")?;

@lucab lucab changed the title rawhide: rpmdb now relocated to /usr rawhide: relocated rpmdb, /usr/lib/sysimage/rpm now exists Feb 3, 2022
@lucab
Copy link
Contributor Author

lucab commented Feb 3, 2022

I started looking into this, and then realized it has further implications on other parts of the codebase.

As a transitory measure, perhaps we can try starting to hardlink the content of /usr/share/rpm/ under /usr/lib/sysimage/rpm.
Then complete the migration by using /usr/lib/sysimage/rpm directly, but that would involve further %_dbpath friction.

@jlebon
Copy link
Member

jlebon commented Feb 3, 2022

As a transitory measure, perhaps we can try starting to hardlink the content of /usr/share/rpm/ under /usr/lib/sysimage/rpm.

Could we also just replace the directory back to a symlink? That way we don't have to think about whether rpm or other things do tempfile & replace or in-place modifications.

Doing what's in the comment in the code snippet above is what we should do eventually, but we should think through it carefully, esp. around upgrades now that we ship a macro dropin to set it even on client systems.

jlebon added a commit to jlebon/rpm-ostree that referenced this issue Feb 3, 2022
Rawhide has moved the rpmdb to `/usr/lib/sysimage/rpm`, which is great!
FCOS composes started breaking because rpm now creates that directory:

coreos#3397

We should be able to eventually flip our `_dbpath` macro with this (and
eventually much later once it hits RHEL, stop overriding the macro at
all). This will require some careful changes and testing.

But anyway we probably don't want to do this yet on f35 to match Fedora,
so we will want a transition mechanism; e.g. a `rpmdb-in-sysimage`
treefile knob.

For now just to unblock rawhide changes, let's remove the empty dir so
we can symlink and keep `/usr/share/rpm` as canonical. We'll rework once
we have the permanent solution.
cgwalters pushed a commit that referenced this issue Feb 3, 2022
Rawhide has moved the rpmdb to `/usr/lib/sysimage/rpm`, which is great!
FCOS composes started breaking because rpm now creates that directory:

#3397

We should be able to eventually flip our `_dbpath` macro with this (and
eventually much later once it hits RHEL, stop overriding the macro at
all). This will require some careful changes and testing.

But anyway we probably don't want to do this yet on f35 to match Fedora,
so we will want a transition mechanism; e.g. a `rpmdb-in-sysimage`
treefile knob.

For now just to unblock rawhide changes, let's remove the empty dir so
we can symlink and keep `/usr/share/rpm` as canonical. We'll rework once
we have the permanent solution.
@cgwalters
Copy link
Member

OK, retitling this issue; let's keep it open to track:

  • inverting things so that /usr/share/rpm is a symlink to /usr/lib/sysimage/rpm
  • Stop changing %_dbpath if it's already what we want (but we need to handle cross-builds i.e. targeting rhel8 from a fedora container)

@cgwalters cgwalters changed the title rawhide: relocated rpmdb, /usr/lib/sysimage/rpm now exists F36: Adapt to https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr Feb 4, 2022
@cgwalters cgwalters changed the title F36: Adapt to https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr F36: Complete adaption to https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr Feb 4, 2022
dustymabe added a commit to dustymabe/fedora-coreos-config that referenced this issue Feb 8, 2022
The workaround for coreos/rpm-ostree#3397
has landed upstream in coreos/rpm-ostree@12147dd,
which made it into rpm-ostree v2022.2. This rpm-ostree is now in
COSA so we can drop this pin.

Fixes coreos/fedora-coreos-tracker#1087
dustymabe added a commit to coreos/fedora-coreos-config that referenced this issue Feb 8, 2022
The workaround for coreos/rpm-ostree#3397
has landed upstream in coreos/rpm-ostree@12147dd,
which made it into rpm-ostree v2022.2. This rpm-ostree is now in
COSA so we can drop this pin.

Fixes coreos/fedora-coreos-tracker#1087
@cgwalters
Copy link
Member

Yeah at some point we will have to address this tech debt, it keeps coming up and is really painful when it does. Right now I'm working on https://gitlab.com/fedora/bootc/tracker/-/issues/32 and we're creating a pattern of doing this in an nutshell:

FROM quay.io/fedora/fedora:rawhide as repos
# See https://github.com/coreos/rpm-ostree/issues/3397
RUN ln -sr /usr/lib/sysimage/rpm /usr/share/rpm

# BOOTSTRAPPING: This can be any image that has the following packages.
FROM fedora as builder
RUN dnf -y install rpm-ostree selinux-policy-targeted sqlite
... # copy sources
RUN rpm-ostree experimental compose rootfs --source-root=/repos base/manifest.yaml /target-rootfs

But notice I had to add that symlink in the repos container.

It's because rpmostree-core.cxx overrides _dbpath to /usr/share/rpm before we init libdnf.

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

3 participants