Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 833014 - emerge refuses to replace sys-kernel/installkernel-gentoo with sys-kernel/installkernel-systemd-boot if sys-kernel/gentoo-kernel-bin is also on cmdline
Summary: emerge refuses to replace sys-kernel/installkernel-gentoo with sys-kernel/ins...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 837899
Blocks: 155723
  Show dependency tree
 
Reported: 2022-02-09 22:14 UTC by Michał Górny
Modified: 2022-07-10 16:31 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (info.txt,5.14 KB, text/plain)
2022-02-09 22:14 UTC, Michał Górny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-02-09 22:14:40 UTC
Created attachment 764732 [details]
emerge --info

Let's say I start with a clean amd64 systemd stage3.  This stage has sys-kernel/installkernel-gentoo preinstalled.

If I do:

```
# emerge -vp installkernel-systemd-boot

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] sys-kernel/installkernel-systemd-boot-1::gentoo  0 KiB
[uninstall     ] sys-kernel/installkernel-gentoo-3::gentoo 
[blocks b      ] sys-kernel/installkernel-gentoo ("sys-kernel/installkernel-gentoo" is soft blocking sys-kernel/installkernel-systemd-boot-1)
[blocks b      ] sys-kernel/installkernel-systemd-boot ("sys-kernel/installkernel-systemd-boot" is soft blocking sys-kernel/installkernel-gentoo-3)

Total: 1 package (1 new, 1 uninstall), Size of downloads: 0 KiB
Conflict: 2 blocks (all satisfied)
```

i.e. emerge correctly establishes that one can replace the other.  However, if I add a package that has a

  || (
    sys-kernel/installkernel-gentoo
    sys-kernel/installkernel-systemd-boot
  )

dependency, Portage is no longer able to figure it out:

```
# emerge -vtp installkernel-systemd-boot gentoo-kernel-bin

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[nomerge       ] sys-kernel/gentoo-kernel-bin-5.15.19:5.15.19::gentoo  USE="initramfs -test" 
[ebuild  N     ]  virtual/dist-kernel-5.15.19:0/5.15.19::gentoo  0 KiB
[ebuild  N     ]   sys-kernel/gentoo-kernel-bin-5.15.19:5.15.19::gentoo  USE="initramfs -test" 187515 KiB
[ebuild  N     ] sys-kernel/installkernel-systemd-boot-1::gentoo  0 KiB
[nomerge       ] sys-kernel/gentoo-kernel-bin-5.15.19:5.15.19::gentoo  USE="initramfs -test" 
[ebuild  N     ]  virtual/libelf-3:0/1::gentoo  ABI_X86="(64) -32 (-x32)" 0 KiB
[ebuild  N     ]   dev-libs/elfutils-0.186::gentoo  USE="bzip2 nls utils -lzma -static-libs -test (-threads) -valgrind -zstd" ABI_X86="(64) -32 (-x32)" 9018 KiB
[ebuild  N     ]  sys-devel/bc-1.07.1-r3::gentoo  USE="readline -libedit -static" 411 KiB
[ebuild  N     ]  sys-kernel/dracut-055-r4::gentoo  USE="(-selinux) (-test)" 354 KiB
[ebuild  N     ]   app-text/asciidoc-9.1.0::gentoo  USE="-doc -test" PYTHON_SINGLE_TARGET="python3_9 (-pypy3) -python3_8 -python3_10" 1221 KiB
[ebuild  N     ]   app-arch/cpio-2.12-r1::gentoo  USE="nls" 1230 KiB
[blocks B      ] sys-kernel/installkernel-gentoo ("sys-kernel/installkernel-gentoo" is soft blocking sys-kernel/installkernel-systemd-boot-1)
[blocks B      ] sys-kernel/installkernel-systemd-boot ("sys-kernel/installkernel-systemd-boot" is soft blocking sys-kernel/installkernel-gentoo-3)

Total: 9 packages (9 new), Size of downloads: 199746 KiB
Conflict: 2 blocks (2 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (sys-kernel/installkernel-systemd-boot-1:0/0::gentoo, ebuild scheduled for merge) pulled in by
    installkernel-systemd-boot

  (sys-kernel/installkernel-gentoo-3-1:0/0::gentoo, installed) pulled in by
    sys-kernel/installkernel-gentoo required by (sys-kernel/gentoo-kernel-bin-5.15.19:5.15.19/5.15.19::gentoo, ebuild scheduled for merge) USE="initramfs -test" ABI_X86="(64)"
```
Comment 1 pmn 2022-02-09 22:29:51 UTC
Wed Nov 24 12:36:59 2021 is the last time portage did the replace; might be a good place to start the bisect.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-02-09 22:36:20 UTC
Bisected it to:

commit a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee
Author: Zac Medico <zmedico@gentoo.org>
Date:   Sat Dec 4 15:54:47 2021 -0800

    dep_zapdeps: avoid new slots when appropriate (bug 828136)
    
    Place choices that do not pull in new slots into a preferred
    choice bin, so that they will not be mixed with choices that
    contain unnecessary upgrades. This fixes the included test
    case so that an unnecessary new python slot is not pulled in.
    
    Bug: https://bugs.gentoo.org/828136
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/dep/dep_check.py                       |  6 ++-
 .../tests/resolver/test_unecessary_slot_upgrade.py | 62 ++++++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 lib/portage/tests/resolver/test_unecessary_slot_upgrade.py
Comment 3 Zac Medico gentoo-dev 2022-02-12 01:14:21 UTC
(In reply to Michał Górny from comment #2)
> Bisected it to:
> 
> commit a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee
> Author: Zac Medico <zmedico@gentoo.org>
> Date:   Sat Dec 4 15:54:47 2021 -0800
> 
>     dep_zapdeps: avoid new slots when appropriate (bug 828136)
>     
>     Place choices that do not pull in new slots into a preferred
>     choice bin, so that they will not be mixed with choices that
>     contain unnecessary upgrades. This fixes the included test
>     case so that an unnecessary new python slot is not pulled in.
>     
>     Bug: https://bugs.gentoo.org/828136
>     Signed-off-by: Zac Medico <zmedico@gentoo.org>

Note that you can use the --update flag to avoid the new behavior.

Of course we can always revert the patch if the new behavior is deemed too troublesome.
Comment 4 Larry the Git Cow gentoo-dev 2022-02-14 00:14:18 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=041763a8b7cda7dac0b75aa4a85eb73f333b7e55

commit 041763a8b7cda7dac0b75aa4a85eb73f333b7e55
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2022-02-14 00:11:43 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2022-02-14 00:13:05 +0000

    Add unit test to reproduce bug 833014
    
    Bug: https://bugs.gentoo.org/833014
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/tests/resolver/test_installkernel.py | 111 +++++++++++++++++++++++
 1 file changed, 111 insertions(+)
Comment 5 Zac Medico gentoo-dev 2022-03-05 00:39:04 UTC
Should we revert the behavior, or is it acceptable to use --update and --deep for cases like this?
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-05 01:59:32 UTC
(In reply to Zac Medico from comment #5)
> Should we revert the behavior, or is it acceptable to use --update and
> --deep for cases like this?

IMO, it's a lesser evil to revert than keep the current behaviour (bug 828136 was a bit odd, but less confusing than this, and less likely for people to hit it).
Comment 7 Larry the Git Cow gentoo-dev 2022-03-05 19:40:22 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=17d64dba6363c15069f49bfe3dc2060a9811e288

commit 17d64dba6363c15069f49bfe3dc2060a9811e288
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2022-03-05 19:22:08 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2022-03-05 19:23:39 +0000

    Revert "dep_zapdeps: avoid new slots when appropriate (bug 828136)"
    
    Revert the change from bug 828136, since it prevents solving
    of some blockers unless --update and --deep are specified as
    reported in bug 833014.
    
    Bug: https://bugs.gentoo.org/833014
    Reverts: a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/dep/dep_check.py                         |  6 +-----
 lib/portage/tests/resolver/test_installkernel.py     | 20 +-------------------
 .../tests/resolver/test_unecessary_slot_upgrade.py   | 11 -----------
 3 files changed, 2 insertions(+), 35 deletions(-)