Bug 14858

Summary: IMAGE_FEATURE ptest causes conflict between dropbear and openssh in core-image.bbclass
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Pavel Zhukov <pavel>
Component: connectivityAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod
Version: unspecified   
Target Milestone: 4.1 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Bug Depends on:    
Bug Blocks: 14926    

Description Pavel Zhukov 2022-07-11 13:23:40 UTC
Looks like this has similar root cause as: https://bugzilla.yoctoproject.org/show_bug.cgi?id=5057 and highlighted by (regressed in) https://git.openembedded.org/openembedded-core/commit/?id=a98188e83b2c027d99cc38e3367e1ec2a98efbb0

If ptest is in IMAGE_FEATURES list then openssh-ptest is marked to be installed as complementary packages (via openssh-sftp-server -> openssh-ptest chain) and it requires openssh which conflicts with dropbear


$ cat /tmp/installed
openssh-sftp-server core2_64

$ oe-pkgdata-util -p /mnt/builds/oniroproject/goofy/builds/build-oniro-linux/tmp/pkgdata/qemux86-64  glob /tmp/installed  *-ptest
openssh-ptest

$ rpm -qpR tmp/deploy/rpm/core2_64/openssh-ptest-8.9p1-r0.core2_64.rpm 
[....]
openssh
openssh-misc
openssh-sftp
openssh-sftp-server
[.....]


Error: 
 Problem: problem with installed package dropbear-2020.81-r0.core2_64
  - package dropbear-2020.81-r0.core2_64 conflicts with openssh provided by openssh-8.9p1-r0.core2_64
  - package openssh-8.9p1-r0.core2_64 conflicts with dropbear provided by dropbear-2020.81-r0.core2_64
  - package openssh-ptest-8.9p1-r0.core2_64 requires openssh, but none of the providers can be installed
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)
Comment 1 Pavel Zhukov 2022-07-11 18:35:59 UTC
The easiest way to reproduce this is:

local.conf
EXTRA_IMAGE_FEATURES:append = " ptest-pkgs"
IMAGE_INSTALL:append = " packagegroup-core-ssh-dropbear "

bitbake core-image-minimal.

However in product images packagegroup-core-ssh-dropbear dependency can be hidden by core-image class and it's not so obvious why openssh is pulled in into the image and why it fails only with ptest
Comment 2 Pavel Zhukov 2022-07-11 20:45:46 UTC
core-image-weston brings ssh-server-dropbear feature too.
Comment 3 Pavel Zhukov 2022-07-14 15:00:00 UTC
To summarize the issue.

Easiest way to reproduce the bug:
EXTRA_IMAGE_FEATURES:append = " ptest-pkgs "
IMAGE_INSTALL:append = " packagegroup-core-ssh-dropbear "

If IMAGE_FEATURES contains "ptest-pkgs" it triggers installation of complementary packages (meta/lib/oe/package_manager/__init.py__:install_complementary) with "*-ptest" glob for every installed package (including openssh-sftp-server which is recommended by packagegroup-core-ssh-dropbear).
as the result [1] is called which returns openssh-ptest. Openssh-ptest depends on openssh (via openssh-misc) which causes the conflict with dropbear. 

PACKAGE_EXCLUDE_COMPLEMENTARY = "openssh" "fixes" this issue and can be used as a workaround however it may break some use cases when -dbg -dev -ptest or other COMPLEMENTARY_GLOB packages has to be installed but will be filtered out. 


[1] oe-pkgdata-util -p d.getVar(PKGDATA_DIR)  glob <installed_packages.file>  d.getVar(IMAGE_INSTALL_COMPLEMENTARY)
Comment 4 Richard Purdie 2022-08-10 09:50:07 UTC
Having given this some thought, I think PACKAGE_EXCLUDE_COMPLEMENTARY = "openssh" is a reasonable workaround as all the alternatives are a lot more invasive with worst potential side effects too.

I think we should set that somewhere in OE-Core by default, the next question would be where. It really needs to be somewhere in one of the image classes...