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

core: Use SOLVER_LOCK for locking base packages #2125

Merged
merged 1 commit into from
Aug 28, 2020

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Jun 9, 2020

For the Fedora CoreOS extensions work, when layering packages, we need
to be able to tell libsolv to pick the packages which will go with the
base packages. IOW, it needs to know that the base packages shouldn't be
uninstalled.

While investigating
coreos/fedora-coreos-tracker#525, I realized
that libsolv does have a flag which allows us to express this:
SOLVER_LOCK.

This then allows libsolv to choose the right package for us (if found).
And in the case where it can't find a matching package, libsolv itself
will print exactly what the conflict is, which is more informative than
the "forbidden replacements" error we currently print out.

Update submodule: libdnf

@openshift-ci-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@jlebon
Copy link
Member Author

jlebon commented Jun 9, 2020

Requires: rpm-software-management/libdnf#974

@dustymabe
Copy link
Member

and lets libsolv/libdnf print exactly what the conflict
is.

well that would be amazing!

@jlebon
Copy link
Member Author

jlebon commented Jun 9, 2020

Sample output in coreos/fedora-coreos-tracker#525 (comment).

@jlebon
Copy link
Member Author

jlebon commented Jun 9, 2020

It also helps to more easily diagnose the split base/layered problem too (#415). Here the machine has gnutls-3.6.13 installed, but gnutls-3.6.14 is in the repos. Let's try to add gnutls-utils which is version-locked with gnutls:

[root@cosa-devsh ~]# rpm-ostree install gnutls-utils
Checking out tree 08040be... done
Enabled rpm-md repositories: fedora-cisco-openh264 updates fedora fedora-modular updates-modular
rpm-md repo 'fedora-cisco-openh264' (cached); generated: 2020-03-17T20:10:45Z
rpm-md repo 'updates' (cached); generated: 2020-06-07T18:20:54Z
rpm-md repo 'fedora' (cached); generated: 2020-04-22T22:22:36Z
rpm-md repo 'fedora-modular' (cached); generated: 2020-04-22T21:03:13Z
rpm-md repo 'updates-modular' (cached); generated: 2020-06-05T04:14:06Z
Importing rpm-md... done
Resolving dependencies... done
error: Could not depsolve transaction; 1 problem detected:
 Problem: conflicting requests
  - package gnutls-utils-3.6.14-1.fc32.x86_64 requires libgnutls.so.30(GNUTLS_3_6_14)(64bit), but none of the providers can be installed
  - package gnutls-utils-3.6.14-1.fc32.x86_64 requires gnutls(x86-64) = 3.6.14-1.fc32, but none of the providers can be installed
  - package gnutls-utils-3.6.13-1.fc32.x86_64 requires gnutls(x86-64) = 3.6.13-1.fc32, but none of the providers can be installed
  - cannot install both gnutls-3.6.14-1.fc32.x86_64 and gnutls-3.6.13-4.fc32.x86_64
  - cannot install both gnutls-3.6.13-1.fc32.x86_64 and gnutls-3.6.13-4.fc32.x86_64

src/libpriv/rpmostree-core.c Outdated Show resolved Hide resolved
src/libpriv/rpmostree-core.c Outdated Show resolved Hide resolved
src/libpriv/rpmostree-core.c Outdated Show resolved Hide resolved
src/libpriv/rpmostree-core.c Outdated Show resolved Hide resolved
src/libpriv/rpmostree-core.c Outdated Show resolved Hide resolved
src/libpriv/rpmostree-core.c Show resolved Hide resolved
jlebon added a commit to jlebon/libdnf that referenced this pull request Aug 25, 2020
This will be useful in rpm-ostree for us to express the fact that base
packages by default should be "locked"; i.e. we don't want libsolv to
try to update them.

For more information, see:
coreos/rpm-ostree#2125
rh-atomic-bot pushed a commit to rpm-software-management/libdnf that referenced this pull request Aug 25, 2020
This will be useful in rpm-ostree for us to express the fact that base
packages by default should be "locked"; i.e. we don't want libsolv to
try to update them.

For more information, see:
coreos/rpm-ostree#2125

Closes: #974
Approved by: kontura
@jlebon jlebon changed the title WIP: Use SOLVER_LOCK for locking base packages core: Use SOLVER_LOCK for locking base packages Aug 26, 2020
For the Fedora CoreOS extensions work, when layering packages, we need
to be able to tell libsolv to pick the packages which will go with the
base packages. IOW, it needs to know that the base packages shouldn't be
uninstalled.

While investigating
coreos/fedora-coreos-tracker#525, I realized
that libsolv does have a flag which allows us to express this:
`SOLVER_LOCK`.

This then allows libsolv to choose the right package for us (if found).
And in the case where it can't find a matching package, libsolv itself
will print exactly what the conflict is, which is more informative than
the "forbidden replacements" error we currently print out.

Update submodule: libdnf
@jlebon jlebon marked this pull request as ready for review August 27, 2020 13:10
@jlebon
Copy link
Member Author

jlebon commented Aug 27, 2020

Ready for review and now with (passing) tests!

@jlebon
Copy link
Member Author

jlebon commented Aug 27, 2020

The added test describes what is now possible, but just for a more realistic example, here's an older f32-based FCOS stable release trying to overlay systemd-journal-remote before and after this patch using Dusty's POC archive repo.

Before:

# rpm-ostree install systemd-journal-remote
...
Forbidden base package replacements:
  systemd 245.6-2.fc32 -> 245.7-1.fc32 (updates)
  systemd-libs 245.6-2.fc32 -> 245.7-1.fc32 (updates)
  systemd-container 245.6-2.fc32 -> 245.7-1.fc32 (updates)
  systemd-pam 245.6-2.fc32 -> 245.7-1.fc32 (updates)
  systemd-rpm-macros 245.6-2.fc32 -> 245.7-1.fc32 (updates)
  systemd-udev 245.6-2.fc32 -> 245.7-1.fc32 (updates)
This likely means that some of your layered packages have requirements on newer or older versions of some base packages. Doing `rpm-ostreResolving dependencies... done
error: Some base packages would be replaced

After, without the archive repo:

# rpm-ostree install systemd-journal-remote
...
Resolving dependencies... done
error: Could not depsolve transaction; 1 problem detected:
 Problem: conflicting requests
  - package systemd-journal-remote-245.7-1.fc32.x86_64 requires systemd(x86-64) = 245.7-1.fc32, but none of the providers can be installed
  - package systemd-journal-remote-245.4-1.fc32.x86_64 requires systemd(x86-64) = 245.4-1.fc32, but none of the providers can be installed
  - cannot install both systemd-245.7-1.fc32.x86_64 and systemd-245.6-2.fc32.x86_64
  - cannot install both systemd-245.4-1.fc32.x86_64 and systemd-245.6-2.fc32.x86_64

It's a little verbose, but it contains more precise information about the issue: systemd-journal-remote wants newer systemd, and libsolv refuses to install both the old and new systemd at the same time. Ideally, libsolv/libdnf would improve the error message here so that it explicitly also says e.g. "cannot uninstall locked package systemd-245.6-2.fc32.x86_64".

But this is still a major improvement because we can actually trace which packages we're trying to layer wants the base to move.

And now, retrying the same operation, but with Dusty's archive repo containing older packages:

# rpm-ostree install systemd-journal-remote
...
Added:
  info-6.7-6.fc32.x86_64
  libmicrohttpd-1:0.9.71-1.fc32.x86_64
  systemd-journal-remote-245.6-2.fc32.x86_64
Run "systemctl reboot" to start a reboot

IOW, libsolv correctly picks the older systemd-journal-remote which matches the systemd from the base layer. So this in effect solves #415.

@dustymabe
Copy link
Member

But this is still a major improvement because we can actually trace which packages we're trying to layer wants the base to move.

It is a MAJORRRRR improvement!

And now, retrying the same operation, but with Dusty's archive repo containing older packages:

# rpm-ostree install systemd-journal-remote
...
Added:
  info-6.7-6.fc32.x86_64
  libmicrohttpd-1:0.9.71-1.fc32.x86_64
  systemd-journal-remote-245.6-2.fc32.x86_64
Run "systemctl reboot" to start a reboot

IOW, libsolv correctly picks the older systemd-journal-remote which matches the systemd from the base layer. So this in effect solves #415.

🎉🎉🎉🎉

@cgwalters
Copy link
Member

/lgtm
Very nice and simple!

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, jlebon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 71992e3 into coreos:master Aug 28, 2020
dustymabe added a commit to dustymabe/fedora-coreos-config that referenced this pull request Oct 7, 2020
This is the culmination of a lot of work to make package layering
more reliable. This archive repo provides all packages that have
ever been in the updates repository, which means there should always
be a solution that will depsolve given the existing set of base layer
packages.

Pairing this along with coreos/rpm-ostree#2125
means that we should finally see less of the split base layer vs update
repo problem and see less `Forbidden base package replacements` errors.

Fixes: coreos/fedora-coreos-tracker#400
dustymabe added a commit to dustymabe/fedora-coreos-config that referenced this pull request Oct 7, 2020
This is the culmination of a lot of work to make package layering
more reliable. This archive repo provides all packages that have
ever been in the updates repository, which means there should always
be a solution that will depsolve given the existing set of base layer
packages.

Pairing this along with coreos/rpm-ostree#2125
means that we should finally see less of the split base layer vs update
repo problem and see less `Forbidden base package replacements` errors.

Fixes: coreos/fedora-coreos-tracker#400
dustymabe added a commit to coreos/fedora-coreos-config that referenced this pull request Oct 7, 2020
This is the culmination of a lot of work to make package layering
more reliable. This archive repo provides all packages that have
ever been in the updates repository, which means there should always
be a solution that will depsolve given the existing set of base layer
packages.

Pairing this along with coreos/rpm-ostree#2125
means that we should finally see less of the split base layer vs update
repo problem and see less `Forbidden base package replacements` errors.

Fixes: coreos/fedora-coreos-tracker#400
martinpitt pushed a commit to martinpitt/ostree-pitti-workstation that referenced this pull request Dec 12, 2020
This is the culmination of a lot of work to make package layering
more reliable. This archive repo provides all packages that have
ever been in the updates repository, which means there should always
be a solution that will depsolve given the existing set of base layer
packages.

Pairing this along with coreos/rpm-ostree#2125
means that we should finally see less of the split base layer vs update
repo problem and see less `Forbidden base package replacements` errors.

For context see coreos/fedora-coreos-tracker#400

(cherry picked from commit 5ee6bce)
kelvinfan001 pushed a commit to kelvinfan001/fedora-coreos-config that referenced this pull request Dec 14, 2020
This is the culmination of a lot of work to make package layering
more reliable. This archive repo provides all packages that have
ever been in the updates repository, which means there should always
be a solution that will depsolve given the existing set of base layer
packages.

Pairing this along with coreos/rpm-ostree#2125
means that we should finally see less of the split base layer vs update
repo problem and see less `Forbidden base package replacements` errors.

Fixes: coreos/fedora-coreos-tracker#400
martinpitt pushed a commit to martinpitt/ostree-pitti-workstation that referenced this pull request Feb 11, 2021
This is the culmination of a lot of work to make package layering
more reliable. This archive repo provides all packages that have
ever been in the updates repository, which means there should always
be a solution that will depsolve given the existing set of base layer
packages.

Pairing this along with coreos/rpm-ostree#2125
means that we should finally see less of the split base layer vs update
repo problem and see less `Forbidden base package replacements` errors.

For context see coreos/fedora-coreos-tracker#400
@jlebon jlebon deleted the pr/wip-lock branch April 23, 2023 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants