From Fedora Project Wiki
(Change rejected by FESCo as currently proposed)
(Added additional information and examples to proposal)
Line 4: Line 4:
== Summary ==
== Summary ==
Make DNF always try to upgrade to the highest available version of a package, even only to fail due to dependency problems.
Make DNF always try to upgrade to the highest available version of a package, even only to fail due to dependency problems.
'''Note:''' We are aware of the fact that this is a late proposal for Fedora 30, however, we think it is very important from the security standpoint.


== Owner ==
== Owner ==
Line 55: Line 53:
Set best option as false, therefore transactions are not limited to only best candidates.
Set best option as false, therefore transactions are not limited to only best candidates.
</pre>
</pre>
'''Change in DNF output - missing vim-enhanced-2:8.1.1561-1.fc30'''
Original output. DNF succeed with return code 0:
<pre>
sudo dnf upgrade
Last metadata expiration check: 2:16:40 ago on Mon 24 Jun 2019 04:27:16 PM CEST.
Dependencies resolved.
Problem: package vim-enhanced-2:8.1.1471-1.fc30.x86_64 requires vim-common = 2:8.1.1471-1.fc30, but none of the providers can be installed
  - cannot install both vim-common-2:8.1.1561-1.fc30.x86_64 and vim-common-2:8.1.1471-1.fc30.x86_64
  - problem with installed package vim-enhanced-2:8.1.1471-1.fc30.x86_64
  - cannot install the best update candidate for package vim-common-2:8.1.1471-1.fc30.x86_64
  - package vim-enhanced-2:8.1.1561-1.fc30.x86_64 is excluded
===================================================================================================================================
Package                        Architecture              Version                                Repository                  Size
===================================================================================================================================
Skipping packages with conflicts:
(add '--best --allowerasing' to command line to force their upgrade):
vim-common                    x86_64                    2:8.1.1561-1.fc30                      updates                    6.7 M
Transaction Summary
===================================================================================================================================
Skip  1 Package
Nothing to do.
Complete!
</pre>
Output after the change. DNF fails with return code 1, but proposing `--nobest` option as an option to resolve the issue:
<pre>
sudo dnf upgrade
Last metadata expiration check: 2:16:36 ago on Mon 24 Jun 2019 04:27:16 PM CEST.
Error:
Problem: package vim-enhanced-2:8.1.1471-1.fc30.x86_64 requires vim-common = 2:8.1.1471-1.fc30, but none of the providers can be installed
  - cannot install both vim-common-2:8.1.1561-1.fc30.x86_64 and vim-common-2:8.1.1471-1.fc30.x86_64
  - problem with installed package vim-enhanced-2:8.1.1471-1.fc30.x86_64
  - cannot install the best update candidate for package vim-common-2:8.1.1471-1.fc30.x86_64
  - package vim-enhanced-2:8.1.1561-1.fc30.x86_64 is excluded
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
</pre>
'''Q&A'''
Can be a default of the best configuration option overwritten easily and permanently by user?
Yes, just add `best=false` to `/etc/dnf/dnf.conf`
<pre>
[main]
best=False
</pre>
Can be a default of the best configuration option overwritten easily from commandline?
Yes, just add `--nobest` to command
<pre>
dnf upgrade --nobest
</pre>
What about PackageKit and Gnome Software
<pre>
PackageKit and Gnome Software will be not affected by the change. In case that the same behavior will be desired for PackageKit, It will require changes in PackageKit code.
</pre>
What about Microdnf
<pre>
Microdnf will be not affected by the change. There is a plan to unify functional parity and behavior DNF with Microdnf but not before Fedora 33.
</pre>


== Benefit to Fedora ==
== Benefit to Fedora ==
Line 67: Line 132:


As a secondary benefit, broken upgrade paths in the Fedora repositories will hopefully be noticed, reported and therefore fixed sooner.
As a secondary benefit, broken upgrade paths in the Fedora repositories will hopefully be noticed, reported and therefore fixed sooner.
'''Summary of benefits:'''
# Broken dependencies faster disappear from Fedora distribution
# Problems will be reported more often - opportunity to fix issues
# Increase in stability of Fedora distribution
# Less issues after branching


== Scope ==
== Scope ==

Revision as of 17:18, 24 June 2019

DNF Make Best Mode the Default

Summary

Make DNF always try to upgrade to the highest available version of a package, even only to fail due to dependency problems.

Owner

Current status

  • Targeted release: Fedora 31
  • Last updated: 2019-06-24
  • Tracker bug: <will be assigned by the Wrangler>

Detailed Description

Change the built-in default value of the best configuration option from 0 (false) to 1 (true).

As a result, unless best is overridden in the /etc/dnf/dnf.conf file or using --setopt, it will default to 1. As a convenience, we will also put the explicit best=1 assignment in the shipped /etc/dnf/dnf.conf file for better transparency, and introduce the new --nobest command-line switch.

The purpose of the --nobest switch (as a shorthand for --setopt=best=0) is to make it easy for the user to override the default setting when needed, and it will also be suggested in the DNF output when a dependency error occurs.

Relevant excerpt from the updated dnf.conf(5):

best  boolean
When upgrading a package, always try to install its highest version available, even only to find out some of its deps are not satisfiable. Enable this if you want to experience broken dependencies in the repositories firsthand. The default is True.

Relevant excerpt from the updated dnf(8):

--nobest
Set best option as false, therefore transactions are not limited to only best candidates.

Change in DNF output - missing vim-enhanced-2:8.1.1561-1.fc30

Original output. DNF succeed with return code 0:

sudo dnf upgrade
Last metadata expiration check: 2:16:40 ago on Mon 24 Jun 2019 04:27:16 PM CEST.
Dependencies resolved.

 Problem: package vim-enhanced-2:8.1.1471-1.fc30.x86_64 requires vim-common = 2:8.1.1471-1.fc30, but none of the providers can be installed
  - cannot install both vim-common-2:8.1.1561-1.fc30.x86_64 and vim-common-2:8.1.1471-1.fc30.x86_64
  - problem with installed package vim-enhanced-2:8.1.1471-1.fc30.x86_64
  - cannot install the best update candidate for package vim-common-2:8.1.1471-1.fc30.x86_64
  - package vim-enhanced-2:8.1.1561-1.fc30.x86_64 is excluded
===================================================================================================================================
 Package                        Architecture               Version                                Repository                   Size
===================================================================================================================================
Skipping packages with conflicts:
(add '--best --allowerasing' to command line to force their upgrade):
 vim-common                     x86_64                     2:8.1.1561-1.fc30                      updates                     6.7 M

Transaction Summary
===================================================================================================================================
Skip  1 Package

Nothing to do.
Complete!

Output after the change. DNF fails with return code 1, but proposing --nobest option as an option to resolve the issue:

sudo dnf upgrade
Last metadata expiration check: 2:16:36 ago on Mon 24 Jun 2019 04:27:16 PM CEST.
Error: 
 Problem: package vim-enhanced-2:8.1.1471-1.fc30.x86_64 requires vim-common = 2:8.1.1471-1.fc30, but none of the providers can be installed
  - cannot install both vim-common-2:8.1.1561-1.fc30.x86_64 and vim-common-2:8.1.1471-1.fc30.x86_64
  - problem with installed package vim-enhanced-2:8.1.1471-1.fc30.x86_64
  - cannot install the best update candidate for package vim-common-2:8.1.1471-1.fc30.x86_64
  - package vim-enhanced-2:8.1.1561-1.fc30.x86_64 is excluded
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Q&A

Can be a default of the best configuration option overwritten easily and permanently by user? Yes, just add best=false to /etc/dnf/dnf.conf

[main]
best=False

Can be a default of the best configuration option overwritten easily from commandline? Yes, just add --nobest to command

dnf upgrade --nobest

What about PackageKit and Gnome Software

PackageKit and Gnome Software will be not affected by the change. In case that the same behavior will be desired for PackageKit, It will require changes in PackageKit code.

What about Microdnf

Microdnf will be not affected by the change. There is a plan to unify functional parity and behavior DNF with Microdnf but not before Fedora 33.


Benefit to Fedora

This change allows the users to be properly notified when a package cannot be upgraded to the latest version, instead of silently ignoring it as an upgrade candidate.

Right now, when DNF runs in best=0 mode, if a package cannot be upgraded due to dependency problems, it is skipped and a warning is printed in the transaction summary table. However, this poses a risk of important security fixes being overlooked by the user in case they are broken for some reason, such as due to a repository misconfiguration or inconsistency within the metadata itself.

Moreover, since DNF always exits with the return code 0 (success) when in best=0 mode, this mode is especially risky in automated scripts invoking DNF in assumeyes mode in which case such unsuccessful package upgrades could easily go unnoticed unless the logs are manually examined after the fact.

The new behavior is also more in line with the generally accepted software development practice of failing early and failing fast.

As a secondary benefit, broken upgrade paths in the Fedora repositories will hopefully be noticed, reported and therefore fixed sooner.

Summary of benefits:

  1. Broken dependencies faster disappear from Fedora distribution
  2. Problems will be reported more often - opportunity to fix issues
  3. Increase in stability of Fedora distribution
  4. Less issues after branching

Scope

  • Proposal owners:

Backport the following upstream pull requests into the DNF stack on Fedora:

https://github.com/rpm-software-management/libdnf/pull/678
https://github.com/rpm-software-management/dnf/pull/1311
https://github.com/rpm-software-management/dnf/pull/1316
https://github.com/rpm-software-management/dnf/pull/1319

  • Other developers: N/A (not a System Wide Change)
  • Policies and guidelines: N/A (not a System Wide Change)
  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

N/A (not a System Wide Change)

How To Test

N/A (not a System Wide Change)

User Experience

Broken upgrades are recognized early, enabling the users to act upon them by double-checking their repository configuration or filing bugs, instead of assuming no upgrades are available.

Dependencies

N/A (not a System Wide Change)

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No
  • Blocks product? product

Documentation

N/A (not a System Wide Change)

Release Notes