Bug 1256108

Summary: libdnf context doesn't honor installonly_limit
Product: [Fedora] Fedora Reporter: Sergio Basto <sergio>
Component: libdnfAssignee: Jaroslav Rohel <jrohel>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: urgent    
Version: rawhideCC: amlau, b.bellec, benedikt, chmelarz, craig48, david.byui, deadletterfile, devin, dmach, drizt72, ed.greshko, elavarde, erecio, fschwarz, gfdsa, jhaiduce, jmracek, jonathan, jrohel, jwakely, keramidasceid, klember, massi.ergosum, mblaha, ncross, pkratoch, rdieter, redhatbug, rhughes, robinlee.sysu, rpm-software-management, samuel-rhbugs, smparrish
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libdnf-0.43.1-1.fc31 libdnf-0.43.1-2.fc30 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-25 06:34:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Sergio Basto 2015-08-24 01:22:38 UTC
Description of problem:
I have set installonly_limit=4 in /etc/yum.conf and /etc/dnf/dnf.conf, and now packagitkit always ask for deletion the last kernel , I think that use defaults 
installonly_limit=3 ...



Version-Release number of selected component (if applicable):
libhif-0.2.0-3.fc21.x86_64
PackageKit-1.0.6-1.fc21.x86_64


How reproducible:
Wait for updates


Actual results:
Ago 24 01:16:54 segulix PackageKit[24510]: new update-packages transaction /40777_ddddcbcc scheduled from uid 500
Ago 24 01:16:56 segulix PackageKit[24510]: in /40777_ddddcbcc for update-packages package kernel;4.0.8-200.fc21;x86_64;installed:/kernel-4.0.8-200.fc21.x86_64 was removing for uid 500
Ago 24 01:16:56 segulix PackageKit[24510]: in /40777_ddddcbcc for update-packages package kernel-core;4.0.8-200.fc21;x86_64;installed:/kernel-core-4.0.8-200.fc21.x86_64 was removing for uid 500
Ago 24 01:16:56 segulix PackageKit[24510]: in /40777_ddddcbcc for update-packages package kernel-modules;4.0.8-200.fc21;x86_64;installed:/kernel-modules-4.0.8-200.fc21.x86_64 was removing for uid 500
Ago 24 01:16:56 segulix PackageKit[24510]: in /40777_ddddcbcc for update-packages package gnome-software;3.14.7-1.fc21;x86_64;updates was updating for uid 500
Ago 24 01:16:56 segulix PackageKit[24510]: update-packages transaction /40777_ddddcbcc from uid 500 finished with success after 1316ms

Comment 1 Sergio Basto 2015-09-12 21:37:54 UTC
Since the only backend available is default , this is packagekit problem . 


We got 2 questions in ask , one really question and one issue : 

https://ask.fedoraproject.org/en/question/64436/is-it-possible-to-use-yum-backend-for-packagekit-on-fedora-21/


https://ask.fedoraproject.org/en/question/75195/installonly_limit5-but-only-3-kernels-being-saved/?answer=75299#post-id-75299


Please replay something 
Thanks

Comment 2 Richard Hughes 2015-09-14 10:45:49 UTC
Why would libhif read dnf.conf? PackageKit doesn't use dnf, it only shares libraries used by dnf so it would be a bit peculiar to share a config file...

Comment 3 Fedora End Of Life 2015-11-04 10:30:30 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Sergio Basto 2015-11-04 14:55:10 UTC
In future will be nice, libhif follow one custom configuration .

Comment 5 Sergio Basto 2015-11-07 14:10:17 UTC
Also we can't make apper exclude packages .

Comment 6 Rex Dieter 2015-11-30 15:51:07 UTC
*** Bug 1237014 has been marked as a duplicate of this bug. ***

Comment 7 Rex Dieter 2015-11-30 15:51:50 UTC
*** Bug 1280590 has been marked as a duplicate of this bug. ***

Comment 8 Rex Dieter 2015-12-08 14:34:19 UTC
*** Bug 1288587 has been marked as a duplicate of this bug. ***

Comment 9 Rex Dieter 2016-02-13 13:05:00 UTC
Re comment #5

PackageKit (and dnf) will honor 
exclude=
directives added to .repo files under /etc/yum.repos.d/ (for any/all repos you want to be skipped and excluded)

Comment 10 Rex Dieter 2016-02-13 13:05:11 UTC
*** Bug 1307217 has been marked as a duplicate of this bug. ***

Comment 11 Sergio Basto 2016-02-13 15:59:04 UTC
(In reply to Rex Dieter from comment #9)
> Re comment #5
> 
> PackageKit (and dnf) will honor 
> exclude=
> directives added to .repo files under /etc/yum.repos.d/ (for any/all repos
> you want to be skipped and excluded)

I'm testing /etc/yum.repos.d/fedora.repo with:

[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=28d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
installonly_limit=4

but shouldn't libhif have one file the define the defaults  ? for example /etc/libhif.conf

Comment 12 Eric Lavarde 2016-02-15 07:26:05 UTC
As an admin user, I don't want to have two configuration files for the same topic, but I want to have package management acting the same on the command line and in whichever GUI.

(in 1307217, I complained that the versionlock plugin wasn't taken into account)

This accepted as a valid user story, the question "Is it possible to use yum backend for PackageKit on Fedora 21?" can be rewritten to "Is it possible to use dnf backend for PackageKit on Fedora 22+?"

Comment 13 Sergio Basto 2016-03-12 14:48:59 UTC
(In reply to Sergio Monteiro Basto from comment #11)

> installonly_limit=4

doesn't work PackageKit removed my 4th kernel

Comment 14 Rex Dieter 2016-03-12 14:54:57 UTC
Re: comment 12

currently, no

My own prior comments about moving directives to .repo files were only about include/exclude statements.  You all are right, that some directives are dnf-only.

Comment 15 Rex Dieter 2016-04-20 03:50:34 UTC
*** Bug 1328677 has been marked as a duplicate of this bug. ***

Comment 16 Sergio Basto 2017-01-06 00:20:44 UTC
*** Bug 1338975 has been marked as a duplicate of this bug. ***

Comment 17 Jonathan Wakely 2017-01-06 10:20:58 UTC
Repeated from the Bug 1338975 duplicate, which is not about dnf.conf but about the .repo files, which definitely are used by PK...

I have a repo with:

[a-repo]
name=repo name
baseurl=http://example.com/repo
enabled=1
# Only use this repo for foo
includepkgs=foo

where the repo contains two packages, foo and libzip-1.1.2-1.fc23.x86_64, which is newer than the libzip in the Fedora repos.

DNF does not try to update libzip, because I said to only include foo from [a-repo], but packagekit ignores the 'includepkgs' and keeps trying to update libzip to the version from [a-repo].

This effectively makes per-repository 'includepkgs' and 'exclude' useless unless I either never use PackageKit, or carefully vet all updates PackageKit does to ensure that 'foo' isn't updated from that repo.

PackageKit should support everything in a .repo file that's documented in yum.conf(5)

Comment 18 Sergio Basto 2017-01-08 21:14:38 UTC
https://bugzilla.redhat.com/show_bug.cgi?id=1350732

include exclude=foo in section of /etc/yum.repos.d/fedora.repo make crash packagekitd

please someone do something .

Comment 19 Rex Dieter 2017-02-22 22:26:31 UTC
*** Bug 1425925 has been marked as a duplicate of this bug. ***

Comment 20 Nick Cross 2017-05-03 09:14:47 UTC
I have noticed this running apper under Fedora 25 ; its very unexpected behaviour that the command line differs from the GUI and there is no (apparent) way of configuring the GUI to behave the same.

Comment 21 Nick Cross 2017-05-10 13:26:24 UTC
Further I want to exclude certain packages from update and even using the workaround of adding exclude to yum.conf, while it works on the CLI, it fails with the apper GUI. Tested on Fedora 25. Further wildcards don't work with packagekit (but they do with CLI) so individual packages have to be listed manually.

Comment 22 Rex Dieter 2017-05-10 13:53:20 UTC
Re: comment 21

For package exclusion, see comment #9 , that packagekit does honor include/exclude in individual .repo files

Comment 23 Sergio Basto 2017-08-04 10:28:53 UTC
2 years later , this does not work ! , should we remove it from the system ?

Comment 24 Samuel Sieb 2017-09-04 17:46:36 UTC
I tried adding the exclude to the repo file and packagekit still says it will update it.  I have to tell the users not to do any updates or their laptops will stop working...

Comment 25 Rex Dieter 2017-10-12 13:55:18 UTC
I can confirm exclude= (still) works for me on my f26 box.  My test was adding
exclude=firefox
to /etc/yum.repos.d/fedora-updates-testing.repo
and indeed a firefox update in -testing disappears after I do a 'pkcon refresh'

Comment 26 Sergio Basto 2017-10-16 10:59:04 UTC
*** Bug 1349518 has been marked as a duplicate of this bug. ***

Comment 27 Nick Cross 2017-10-19 09:25:02 UTC
Further I have noticed, as mentioned in Bug 1338975 and in a comment above. If I add

includepkgs=xxxx*

to a particular repository file, while the command line"dnf update" correctly notices and applies that, the apper gui (using PackageKit underneath) does _not_ use this configuration directive and attempts to use other packages from the aforementioned repository. The GUI should be consistent with the CLI to provide a quality user experience.

I am using Fedora 26.

Comment 28 John Haiducek 2018-09-21 14:19:09 UTC
(In reply to Rex Dieter from comment #25)
> I can confirm exclude= (still) works for me on my f26 box.  My test was
> adding
> exclude=firefox
> to /etc/yum.repos.d/fedora-updates-testing.repo
> and indeed a firefox update in -testing disappears after I do a 'pkcon
> refresh'

That does not work for me.

I add exclude=*nvidia* to /etc/yum.repos.d/rpmfusion-nonfree-updates.repo, and the nvidia driver updates still show up after a 'pkcon refresh'

Comment 29 Rex Dieter 2018-09-21 16:06:05 UTC
And I can (still) confirm that it works for me on f28.  My test case was again something from updates-testing.  My test case this time was adding
exclude=kmail*
to /etc/yum.repos.d/fedora-updates-testing.repo
to successfully avoid not updating to
https://bodhi.fedoraproject.org/updates/FEDORA-2018-2dcc691c7a
(which is currently in updates-testing)

No idea how/why this doesn't work for everyone else.

Comment 30 Rex Dieter 2018-09-24 01:24:39 UTC
Found the difference.

exclude=

with explicit package names works as expected.  Using globs does not work.

Comment 31 Jonathan Wakely 2018-10-09 08:29:26 UTC
Listing every package individually works:

  exclude=synergy,selinux-policy,selinux-policy-targeted

but as Rex said, globs don't work. This only excludes 'synergy' and neither of the slinux-policy* packages (on f27):

  exclude=synergy,selinux-policy*

I hope adding globbing support isn't too hard.

Comment 32 Sergio Basto 2019-05-21 02:28:24 UTC
Remove PackageKit seems to me the best solution , this bug is opened since 2015 


dnf remove PackageKit PackageKit-gstreamer-plugin PackageKit-gtk3-module

Comment 33 Jonathan Wakely 2019-11-27 15:26:55 UTC
Most of the complaints here (and the various duplicates) are about not honouring 'exclude' wildcards in .repo files. That is a bug in libdnf not PackageKit, and can be fixed by https://github.com/rpm-software-management/libdnf/pull/856

Either this bug should be re-assigned to libdnf (and the summary updated), or a separate bug should be opened for "libdnf package exclusion is inconsistent with DNF".

Comment 34 Rex Dieter 2019-11-27 16:33:44 UTC
Re-assigning

Comment 35 Jaroslav Rohel 2019-11-28 11:40:49 UTC
The problem was originally describet:
I have set installonly_limit=4 in /etc/yum.conf and /etc/dnf/dnf.conf, and now packagitkit always ask for deletion the last kernel , I think that use defaults 
installonly_limit=3 ...

So, the bug is about "installonly_limit". There are another bugs (marked as duplicates eg. bug 1237014) that refers to excludepkgs.

The bug mix more bugs together. I will rename it and solve the primary reported problem for this bug.

Comment 36 Jaroslav Rohel 2019-11-28 11:44:06 UTC
I created a patch that uses global configuration (/etc/dnf.conf) value "installonly_limit".
PR https://github.com/rpm-software-management/libdnf/pull/857

Comment 37 Jonathan Wakely 2019-11-28 12:02:06 UTC
OK, so can I reopen Bug 1338975 which I originally reported for the excludepkgs issue?

Comment 38 Jaroslav Rohel 2019-11-28 13:37:39 UTC
comment 37
> OK, so can I reopen Bug 1338975 which I originally reported for the excludepkgs issue?

Yes. Reopening the bug 1338975 is good idea. Bad is that its solution will not be simple.  That means transfer some code from DNF (Python) to "context" part of libdnf. Also, I don't know if it can be done transparently without any changes in PackageKit/microdnf. Probably long term plan.

Comment 39 Jaroslav Rohel 2019-11-28 14:11:27 UTC
PR https://github.com/rpm-software-management/libdnf/pull/857 was merged to upstream

Comment 40 Fedora Update System 2020-01-16 21:12:58 UTC
dnf-4.2.18-1.fc30, dnf-plugins-core-4.0.13-1.fc30, libdnf-0.43.1-1.fc30, microdnf-3.4.0-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-66c974fdb6

Comment 41 Fedora Update System 2020-01-16 21:39:37 UTC
dnf-4.2.18-1.fc31, dnf-plugins-core-4.0.13-1.fc31, libdnf-0.43.1-1.fc31, microdnf-3.4.0-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-9542e3ccfd

Comment 42 Fedora Update System 2020-01-25 06:34:43 UTC
dnf-4.2.18-1.fc31, dnf-plugins-core-4.0.13-1.fc31, libdnf-0.43.1-1.fc31, microdnf-3.4.0-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 43 Fedora Update System 2020-02-07 01:03:34 UTC
dnf-4.2.18-1.fc30, dnf-plugins-core-4.0.13-1.fc30, libdnf-0.43.1-2.fc30, microdnf-3.4.0-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-66c974fdb6

Comment 44 Sergio Basto 2020-02-07 19:11:34 UTC
@Jaroslav Rohel, thank you, I will give you feedback if possible , now I have a good reason to install kde packagekit again . It will use the same db of dnf ? instead his own packagekit db ? I'm just asking because is was a feature asked sometime ago , integration of packagekit with dnf (or yum) .

Comment 45 Fedora Update System 2020-02-22 01:16:08 UTC
dnf-4.2.18-1.fc30, dnf-plugins-core-4.0.13-1.fc30, libdnf-0.43.1-2.fc30, microdnf-3.4.0-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.