Bug 1201445 - "dnf autoremove" removes "user-installed" installonly packages installed using "dnf upgrade"
"dnf autoremove" removes "user-installed" installonly packages installed usin...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michael Mráka
Fedora Extras Quality Assurance
:
: 1213043 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-03-12 13:35 EDT by Conley Moorhous
Modified: 2016-11-02 04:39 EDT (History)
10 users (show)

See Also:
Fixed In Version: dnf-plugins-core-0.1.7-1.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-05-08 03:27:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
The output of a bash script iterating over and listing the info of each dnf transaction (204.86 KB, text/plain)
2015-03-12 13:35 EDT, Conley Moorhous
no flags Details
dnf history list (3.89 KB, text/plain)
2015-03-12 13:36 EDT, Conley Moorhous
no flags Details
dnf history userinstalled (278 bytes, text/plain)
2015-03-12 13:36 EDT, Conley Moorhous
no flags Details
dnf info kernel (2.84 KB, text/plain)
2015-03-12 13:55 EDT, Conley Moorhous
no flags Details

  None (edit)
Description Conley Moorhous 2015-03-12 13:35:52 EDT
Created attachment 1001153 [details]
The output of a bash script iterating over and listing the info of each dnf transaction

Description of problem: Autoremove removes kernel, kernel-core, and kernel-modules, while upgrade installs them (all version 4.0.0-0.rc2.git0.1.fc22). This can be done as many times as you like.


Version-Release number of selected component (if applicable): 0.6.4 2.fc22


How reproducible: Always
Steps to Reproduce:
1. 'dnf autoremove'
2. 'dnf upgrade'
3. 'dnf autoremove'
4. 'dnf upgrade'
5. ...

Actual results: The latest version of kernel, kernel-core, and kernel-modules is autoremoved and installed by "dnf autoremove" and "dnf upgrade" respectively


Expected results: "dnf autoremove" does not autoremove the kernel packages


Additional info: I don't know how to list the info of each historical transaction with dnf, so I ran

for i in {1..40}; do echo -e `sudo dnf history info $i` "\n\n"; done

It is attached as dnf-history-info.

Likewise, "dnf history list" is attached as dnf-history-list and "dnf history userinstalled" is attached as dnf-history-userinstalled. Notably, "kernel" is listed as user installed. I think it may have been listed as a dependency of some program.
Comment 1 Conley Moorhous 2015-03-12 13:36:15 EDT
Created attachment 1001154 [details]
dnf history list
Comment 2 Conley Moorhous 2015-03-12 13:36:45 EDT
Created attachment 1001155 [details]
dnf history userinstalled
Comment 3 Conley Moorhous 2015-03-12 13:55:32 EDT
Also, the kernel in use is 4.0.0-0.rc1.git0.1.fc22. See also "dnf info kernel"
Comment 4 Conley Moorhous 2015-03-12 13:55:53 EDT
Created attachment 1001159 [details]
dnf info kernel
Comment 5 Radek Holy 2015-03-13 08:30:41 EDT
Hello, thank you for the report. It's interesting for me that nobody hit this bug before. It seems that if a user installs a kernel using "dnf upgrade", the kernel is marked as a dependency and thus it can be removed using "dnf autoremove". By default, DNF inherits the "installation reason" from the upgraded package during the upgrade process but "installonly" packages are exceptions because in fact, they do not *replace* another packages.

The question is what is the correct solution. Should we always mark all installonly packages as "user-installed"? Should we ignore "reasons" when considering installonlies for autoremoval? Should we inherit the reason from another installed versions?
Comment 6 Radek Holy 2015-03-13 08:33:13 EDT
I suggest you to install the kernel using "dnf install" as a workaround.
Comment 7 Conley Moorhous 2015-03-13 19:40:19 EDT
Here's what I get:

conley@conley:~$ sudo dnf install kernel
Using metadata from Fri Mar 13 18:30:21 2015
Package kernel-4.0.0-0.rc1.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc2.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc1.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc2.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc1.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc2.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc1.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc2.git0.1.fc22.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Comment 8 Conley Moorhous 2015-03-13 21:39:25 EDT
Not sure if this is related or should be a different bug, but "yum upgrade" gave me a bunch of potential updates but then had a failed dependency resolution. "dnf upgrade" reported "nothing to do." After asking on IRC, I was told to try "dnf clean all" After this, dnf found all the upgrades and was able to install them.
Comment 9 Michael Mráka 2015-03-16 04:28:09 EDT
(In reply to Radek Holy from comment #5)
> The question is what is the correct solution. Should we always mark all
> installonly packages as "user-installed"? Should we ignore "reasons" when
> considering installonlies for autoremoval? Should we inherit the reason from
> another installed versions?

It seem to me the correct solution is to inherit the reason from previously installed version.
Comment 10 Radek Holy 2015-03-16 09:17:54 EDT
(In reply to Conley Moorhous from comment #7)
> Here's what I get:
> 
> conley@conley:~$ sudo dnf install kernel
> Using metadata from Fri Mar 13 18:30:21 2015
[...]
> Package kernel-4.0.0-0.rc2.git0.1.fc22.x86_64 is already installed, skipping.
> Dependencies resolved.
> Nothing to do.

So far, "dnf install kernel" checks if there is any version of "kernel" and if there is, it considers the request as satisfied, otherwise it installs the latest version. We are working on changing the behavior so that "dnf install kernel" should check if there is *the latest* version of "kernel" installed...

My suggestion was to use "dnf install kernel-4.0.0-0.rc2.git0.1.fc22" as the workaround.

(In reply to Conley Moorhous from comment #8)
> Not sure if this is related or should be a different bug, but "yum upgrade"
> gave me a bunch of potential updates but then had a failed dependency
> resolution. "dnf upgrade" reported "nothing to do." After asking on IRC, I
> was told to try "dnf clean all" After this, dnf found all the upgrades and
> was able to install them.

See http://dnf.readthedocs.org/en/latest/user_faq.html#why-do-i-get-different-results-with-dnf-upgrade-vs-yum-update . You can also use "dnf --refresh upgrade" as a shortcut. If there is an issue, let's discuss it somewhere else.
Comment 11 Conley Moorhous 2015-03-16 10:33:02 EDT
(In reply to Radek Holy from comment #10)
> (In reply to Conley Moorhous from comment #7)
> > Here's what I get:
> > 
> > conley@conley:~$ sudo dnf install kernel
> > Using metadata from Fri Mar 13 18:30:21 2015
> [...]
> > Package kernel-4.0.0-0.rc2.git0.1.fc22.x86_64 is already installed, skipping.
> > Dependencies resolved.
> > Nothing to do.
> 
> So far, "dnf install kernel" checks if there is any version of "kernel" and
> if there is, it considers the request as satisfied, otherwise it installs
> the latest version. We are working on changing the behavior so that "dnf
> install kernel" should check if there is *the latest* version of "kernel"
> installed...
> 
> My suggestion was to use "dnf install kernel-4.0.0-0.rc2.git0.1.fc22" as the
> workaround.

I can't seem to get it to work:

conley@conley:~$ sudo dnf install kernel-4.0.0-0.rc3.git0.1.fc22.x86_64
Using metadata from Sun Mar 15 19:06:08 2015
Package kernel-4.0.0-0.rc3.git0.1.fc22.x86_64 is already installed, skipping.
Package kernel-4.0.0-0.rc3.git0.1.fc22.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
conley@conley:~$ sudo dnf upgrade-to kernel-4.0.0-0.rc3.git0.1.fc22.x86_64
Using metadata from Sun Mar 15 19:06:08 2015
Dependencies resolved.
Nothing to do.
conley@conley:~$ sudo dnf reinstall kernel-4.0.0-0.rc3.git0.1.fc22.x86_64
Using metadata from Sun Mar 15 19:06:08 2015
Dependencies resolved.
================================================================================
 Package    Arch       Version                        Repository           Size
================================================================================
Reinstalling:
 kernel     x86_64     4.0.0-0.rc3.git0.1.fc22        updates-testing      59 k

Transaction Summary
================================================================================

Total download size: 59 k
Is this ok [y/N]: y
Downloading Packages:
kernel-4.0.0-0.rc3.git0.1.fc22.x86_64.rpm        46 kB/s |  59 kB     00:01    
--------------------------------------------------------------------------------
Total                                            27 kB/s |  59 kB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Reinstalling: kernel-4.0.0-0.rc3.git0.1.fc22.x86_64                       1/2 
  Erasing     : kernel-4.0.0-0.rc3.git0.1.fc22.x86_64                       2/2 
  Verifying   : kernel-4.0.0-0.rc3.git0.1.fc22.x86_64                       1/2 
  Verifying   : kernel-4.0.0-0.rc3.git0.1.fc22.x86_64                       2/2 

Reinstalled:
  kernel.x86_64 4.0.0-0.rc3.git0.1.fc22                                         

Complete!
conley@conley:~$ sudo dnf remove kernel
Using metadata from Sun Mar 15 19:06:08 2015
Dependencies resolved.
Error: The operation would result in removing the booted kernel: kernel-core-4.0.0-0.rc1.git0.1.fc22.x86_64.
conley@conley:~$ sudo dnf remove kernel-core-4.0.0-0.rc1.git0.1.fc22.x86_64
Using metadata from Sun Mar 15 19:06:08 2015
Dependencies resolved.
Error: The operation would result in removing the booted kernel: kernel-core-4.0.0-0.rc1.git0.1.fc22.x86_64.
conley@conley:~$
Comment 12 Radek Holy 2015-03-16 10:39:46 EDT
OK, let me describe the suggestion...
I assumed that you are in a state where kernel-4.0.0-0.rc1.git0.1.fc22 is running and no other kernel is installed.
I assumed that your goal is to install kernel-4.0.0-0.rc2.git0.1.fc22 in such a way that it won't be removed by "dnf autoremove".
As the workaround in the meantime, this can be achieved by "dnf install kernel-4.0.0-0.rc2.git0.1.fc22" instead of "dnf upgrade".
Comment 13 Conley Moorhous 2015-03-16 10:47:20 EDT
Oh, I get it. Yes, that resolves this issue. Apparently there is another bug with dnf or something because I cannot make F22 run the latest version of the kernel, even after dnf installs it;

uname -a still reports that I'm running rc1
Comment 14 Conley Moorhous 2015-03-17 13:31:35 EDT
My dumb mistake, I hadn't installed GRUB so naturally the new kernels were not being booted. Sorry for clogging up this bug report
Comment 15 Michael Mráka 2015-04-20 02:33:13 EDT
*** Bug 1213043 has been marked as a duplicate of this bug. ***
Comment 16 Michael Mráka 2015-04-20 03:27:15 EDT
Fixed in upstream by
https://github.com/rpm-software-management/dnf/pull/257
Comment 17 Fedora Update System 2015-05-02 09:49:43 EDT
dnf-plugins-core-0.1.7-1.fc22,hawkey-0.5.5-1.fc22,dnf-1.0.0-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/dnf-plugins-core-0.1.7-1.fc22,hawkey-0.5.5-1.fc22,dnf-1.0.0-1.fc22
Comment 18 Fedora Update System 2015-05-03 13:24:39 EDT
Package dnf-plugins-core-0.1.7-1.fc22, hawkey-0.5.5-1.fc22, dnf-1.0.0-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-core-0.1.7-1.fc22 hawkey-0.5.5-1.fc22 dnf-1.0.0-1.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-7483/dnf-plugins-core-0.1.7-1.fc22,hawkey-0.5.5-1.fc22,dnf-1.0.0-1.fc22
then log in and leave karma (feedback).
Comment 19 Fedora Update System 2015-05-08 03:27:19 EDT
dnf-plugins-core-0.1.7-1.fc22, hawkey-0.5.5-1.fc22, dnf-1.0.0-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 20 Vitaly Sulimov 2015-07-13 10:11:34 EDT
(In reply to Michael Mráka from comment #16)
> Fixed in upstream by
> https://github.com/rpm-software-management/dnf/pull/257

I still have a problem with dnf. When performing 
# dnf autoremove
I get an error "Error: The operation would result in removing the booted kernel: kernel-core-4.0.7-300.fc22.x86_64."

dnf and plugins-core versions:
dnf-1.0.1-2.fc22.noarch
dnf-plugins-core-0.1.9-1.fc22.noarch
Comment 21 Benjamin Xiao 2016-11-02 04:39:25 EDT
Still seeing this issue on Fedora 24 with kernel-modules-extra. This is not related to the autoremove bug from Fedora 23.

Note You need to log in before you can comment on or make changes to this bug.