Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917145 - Portage handles emulated USE flag renames in || any-of deps poorly (cannot install =sys-kernel/installkernel-systemd-2-r4)
Summary: Portage handles emulated USE flag renames in || any-of deps poorly (cannot in...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 155723 autounmask
  Show dependency tree
 
Reported: 2023-11-11 04:41 UTC by Sam James
Modified: 2024-01-24 14:39 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-11 04:41:18 UTC
We don't seem to handle || ( a[x(-)] a[y(-)] a[z(-)] b[y(-)] b[c(-)] ) very well at all, as in =sys-kernel/installkernel-systemd-2-r4:
"""
RDEPEND="
        !sys-kernel/installkernel-gentoo
        || (
                sys-apps/systemd[gnuefi(-)]
                sys-apps/systemd[boot(-)]
                sys-apps/systemd[kernel-install(-)]
                sys-apps/systemd-utils[boot]
                sys-apps/systemd-utils[kernel-install(-)]
        )
"
"""

This is there at the moment to handle a rename from USE=gnuefi -> USE=boot -> USE=kernel-install for the installkernel tools.

This looks a lot like some of the bugs we've had in the past with e.g. pulseaudio/libpulse/pulseaudio-daemon and xorg-server/xwayland, but it has an interesting interaction with || ( .. ) and USE flag "renames" via USE flag defaults.

With stage3-amd64-desktop-systemd-mergedusr-20231105T170200Z.tar.xz [0] at gentoo-mirror commit 3dc4b8428db1378f8f7b2819273645e9b4d22e38 [1], upon entering a chroot, we get:
```
# emerge --pretend sys-kernel/installkernel-systemd --verbose

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

Calculating dependencies... done!
Dependency resolution took 2.20 s.

[ebuild  N     ] sys-boot/gnu-efi-3.0.15::gentoo  USE="(-custom-cflags)" ABI_X86="(64) -32" 0 KiB
[ebuild     UD ] sys-apps/systemd-253.11:0/2::gentoo [254.5:0/2::gentoo] USE="acl dns-over-tls gcrypt gnuefi%* kmod lz4 openssl pam pcre policykit resolvconf seccomp sysv-utils zstd -apparmor -audit -cgroup-hybrid -cryptsetup -curl -elfutils -fido2 -gnutls -homed -http -idn -importd -iptables -lzma -pkcs11 -pwquality -qrcode -secureboot (-selinux) (-split-usr) -test -tpm -vanilla -xkb (-boot%)" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="(-python3_10%) (-python3_11%*) (-python3_12%)" 0 KiB
[ebuild  N     ] sys-kernel/installkernel-systemd-2-r4::gentoo  0 KiB
[uninstall     ] sys-kernel/installkernel-gentoo-7::gentoo  USE="-grub"
[blocks b      ] sys-kernel/installkernel-systemd ("sys-kernel/installkernel-systemd" is soft blocking sys-kernel/installkernel-gentoo-7)
[blocks b      ] sys-kernel/installkernel-gentoo ("sys-kernel/installkernel-gentoo" is soft blocking sys-kernel/installkernel-systemd-2-r4)

Total: 3 packages (1 downgrade, 2 new, 1 uninstall), Size of downloads: 0 KiB
Conflict: 2 blocks (all satisfied)

The following USE changes are necessary to proceed:
 (see "package.use" in the portage(5) man page for more details)
# required by sys-kernel/installkernel-systemd-2-r4::gentoo
# required by sys-kernel/installkernel-systemd (argument)
=sys-apps/systemd-253.11 gnuefi

 * IMPORTANT: 11 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
```

Okay, let's try without autounmask:
```
# emerge --pretend sys-kernel/installkernel-systemd --verbose --autounmask=n

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

Calculating dependencies... done!
Dependency resolution took 0.72 s.


emerge: there are no ebuilds built with USE flags to satisfy "sys-apps/systemd[gnuefi(-)]".
!!! One of the following packages is required to complete your request:
- sys-apps/systemd-253.11::gentoo (Change USE: +gnuefi)
(dependency required by "sys-kernel/installkernel-systemd-2-r4::gentoo" [ebuild])
(dependency required by "sys-kernel/installkernel-systemd" [argument])

 * IMPORTANT: 11 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
```

Okay, let's try with masking older systemd:
```
# cat /etc/portage/package.mask/test
<sys-apps/systemd-254

# emerge --pretend sys-kernel/installkernel-systemd --verbose --autounmask=n

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

Calculating dependencies... done!
Dependency resolution took 0.73 s.


!!! All ebuilds that could satisfy "sys-apps/systemd[gnuefi(-)]" have been masked.
!!! One of the following masked packages is required to complete your request:
- sys-apps/systemd-9999::gentoo (masked by: missing keyword)
- sys-apps/systemd-254.6::gentoo (masked by: ~amd64 keyword)
- sys-apps/systemd-254.4::gentoo (masked by: ~amd64 keyword)
- sys-apps/systemd-254.3::gentoo (masked by: ~amd64 keyword)
- sys-apps/systemd-253.13::gentoo (masked by: package.mask, ~amd64 keyword)
- sys-apps/systemd-253.12::gentoo (masked by: package.mask, ~amd64 keyword)
- sys-apps/systemd-253.11::gentoo (masked by: package.mask)
- sys-apps/systemd-253.6::gentoo (masked by: package.mask)
- sys-apps/systemd-253.3-r1::gentoo (masked by: package.mask)

(dependency required by "sys-kernel/installkernel-systemd-2-r4::gentoo" [ebuild])
(dependency required by "sys-kernel/installkernel-systemd" [argument])
For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.


 * IMPORTANT: 11 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
```

[0] https://mirror.bytemark.co.uk/gentoo//releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd-mergedusr/stage3-amd64-desktop-systemd-mergedusr-20231105T170200Z.tar.xz
[1] https://github.com/gentoo-mirror/gentoo/commit/3dc4b8428db1378f8f7b2819273645e9b4d22e38
Comment 1 Larry the Git Cow gentoo-dev 2023-11-11 04:44:03 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ba3e5e0f675dc5a1b7477eb73c7ea05d5b5c26b

commit 4ba3e5e0f675dc5a1b7477eb73c7ea05d5b5c26b
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-11-11 04:42:26 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-11 04:43:55 +0000

    sys-kernel/installkernel-systemd: drop attempt to emulate USE flag renames
    
    This ends up confusing Portage to an appalling level so we can't carry on with it,
    even though I liked the idea and tried it myself with the gnuefi->boot rename.
    
    (I'm not sure if that actually worked properly or if the third-order kernel-install
    "rename" bit tipped it over the edge?)
    
    Stable versions of systemd & systemd-utils have the new flags, so just simplify
    the || ( ... ) to systemd[kernel-install(-)] and systemd-boot[kernel-install(-)].
    
    Bug: https://bugs.gentoo.org/917145
    Signed-off-by: Sam James <sam@gentoo.org>

 .../installkernel-systemd-2-r5.ebuild              | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-11 04:47:06 UTC
My assumption is that we currently do something like just discard the cpv entirely if we fail a use flag default dep, but not looked yet
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-11 05:08:29 UTC
(In reply to Sam James from comment #2)
> My assumption is that we currently do something like just discard the cpv
> entirely if we fail a use flag default dep, but not looked yet

It's more nuanced than that.. if we have IUSE="+gnuefi" and IUSE="+kernel-install", then we rightly prefer the newer systemd-254 w/ kernel-install over systemd-254 with gnuefi...
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-11 05:18:25 UTC
Added a test case in https://github.com/gentoo/portage/pull/1180.
Comment 5 Zac Medico gentoo-dev 2023-11-12 23:38:36 UTC
I would think it would probably be fine at least in the stage3 if the old stuff was moved to the right, very much like flipping the libxcrypt/glibc order for bug 814335.
Comment 6 Larry the Git Cow gentoo-dev 2024-01-12 11:25:18 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1548f149879fca4915d49d3a1991d9d2ebd03e57

commit 1548f149879fca4915d49d3a1991d9d2ebd03e57
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2024-01-12 11:22:40 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
CommitDate: 2024-01-12 11:24:52 +0000

    */*: move sys-kernel/installkernel-gentoo to sys-kernel/installkernel
    
    Bug: https://bugs.gentoo.org/917145
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>

 eclass/kernel-install.eclass                                      | 8 ++++----
 profiles/updates/1Q-2024                                          | 1 +
 sys-apps/debianutils/debianutils-5.14.ebuild                      | 4 ++--
 sys-kernel/installkernel-gentoo/Manifest                          | 2 --
 .../installkernel-systemd/installkernel-systemd-2-r4.ebuild       | 4 ++--
 .../installkernel-systemd/installkernel-systemd-2-r5.ebuild       | 4 ++--
 sys-kernel/installkernel-systemd/installkernel-systemd-3.ebuild   | 4 ++--
 sys-kernel/installkernel-systemd/installkernel-systemd-4.ebuild   | 6 +++---
 sys-kernel/installkernel/Manifest                                 | 2 ++
 .../installkernel-12.ebuild}                                      | 0
 .../installkernel-14.ebuild}                                      | 0
 sys-kernel/{installkernel-gentoo => installkernel}/metadata.xml   | 0
 12 files changed, 18 insertions(+), 17 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c0e18bea2ae37ba19d0720867ebca5836f105c1

commit 4c0e18bea2ae37ba19d0720867ebca5836f105c1
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2024-01-12 11:11:09 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
CommitDate: 2024-01-12 11:24:51 +0000

    sys-kernel/installkernel-systemd: add 4
    
    4 is just a wrapper that depends on installkernel-gentoo.
    
    This wrapper allows us to keep these changes in unstable for now, while
    retaining the "split" behaviour on stable.
    
    Bug: https://bugs.gentoo.org/917145
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>

 sys-kernel/installkernel-systemd/installkernel-systemd-4.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=285bb764b6339b94621f68b7495a72a8235b0036

commit 285bb764b6339b94621f68b7495a72a8235b0036
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2024-01-12 11:10:42 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
CommitDate: 2024-01-12 11:24:50 +0000

    sys-kernel/installkernel-systemd: add 4
    
    Bug: https://bugs.gentoo.org/917145
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>

 .../installkernel-systemd-4.ebuild                 | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdd56b68122666ee19d8e9a755474b696a88fc23

commit bdd56b68122666ee19d8e9a755474b696a88fc23
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2024-01-12 11:03:30 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
CommitDate: 2024-01-12 11:24:49 +0000

    sys-kernel/installkernel-gentoo: add 14
    
    Changelog:
    - added grub-mkconfig plugin for systemd's kernel-install
    - call systemd's kernel-install if it is installed, this can be controlled
    with the SYSTEMD_KERNEL_INSTALL env var, whose default is set by the ebuild
    depending on USE=systemd
    - imported plugins from installkernel-systemd
    - clarified warning messages when dracut/ukify is not installed
    - set some default install.conf based on the flags we already have for
    the "legacy" install anyway. Use /etc/ instead of /usr/lib because systemd
    already installs a dummy file to /usr/lib and we would have a file conflict
    with this.
    
    Bug: https://bugs.gentoo.org/917145
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>

 sys-kernel/installkernel-gentoo/Manifest           |  1 +
 .../installkernel-gentoo-14.ebuild                 | 85 ++++++++++++++++++++++
 sys-kernel/installkernel-gentoo/metadata.xml       |  1 +
 3 files changed, 87 insertions(+)
Comment 7 Larry the Git Cow gentoo-dev 2024-01-24 14:39:51 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd777824a5523f812a7fd267ae474320be536411

commit dd777824a5523f812a7fd267ae474320be536411
Author:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
AuthorDate: 2024-01-24 14:38:26 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan@gentoo.org>
CommitDate: 2024-01-24 14:38:26 +0000

    sys-kernel/installkernel: drop default +dracut
    
    This is now possible due to the last-rites of
    installkernel-systemd
    
    Closes: https://bugs.gentoo.org/922772
    Bug: https://bugs.gentoo.org/917145
    Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>

 sys-kernel/installkernel/installkernel-12.ebuild    | 2 +-
 sys-kernel/installkernel/installkernel-15-r1.ebuild | 2 +-
 sys-kernel/installkernel/installkernel-17.ebuild    | 2 +-
 sys-kernel/installkernel/installkernel-18.ebuild    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)