Bug 12936

Summary: rpm: unrecognized option
Product: Busybox Reporter: Swampcritter <maworsham>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED WONTFIX    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: chef-stacktrace.out error file

Description Swampcritter 2020-05-22 16:40:37 UTC
Created attachment 8466 [details]
chef-stacktrace.out error file

We are using Chef Habitat to install several RPM packages (DataDog 'Agent' is currently the big one we are trying to deploy) on Linux AWS EC2 instances and have noticed in the chef-stacktrace.out error file that references BusyBox. We are trying to narrow down where the problem is located - is it a BusyBox, Chef Habitat, Chef Server or Chef Infra client issue?

I also submitted the bug/issue here: https://github.com/mirror/busybox/issues/25


Reference:
https://github.com/DataDog/chef-datadog/blob/master/recipes/repository.rb

Mixlib::ShellOut::ShellCommandFailed: execute[rpm-import datadog key e09422b3] (datadog::repository line 85) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of rpm --import /hab/svc/wabtec_base_tools/data/cache/cache/DATADOG_RPM_KEY_E09422B3.public ----
STDOUT:
STDERR: rpm: unrecognized option: -
BusyBox v1.29.2 (2019-01-15 01:45:56 UTC) multi-call binary.

Usage: rpm -i PACKAGE.rpm; rpm -qp[ildc] PACKAGE.rpm

Manipulate RPM packages

Commands:
-i Install package
-qp Query package
-qpi Show information
-qpl List contents
-qpd List documents
-qpc List config files
---- End output of rpm --import /hab/svc/wabtec_base_tools/data/cache/cache/DATADOG_RPM_KEY_E09422B3.public ----
Ran rpm --import /hab/svc/wabtec_base_tools/data/cache/cache/DATADOG_RPM_KEY_E09422B3.public returned 1
Comment 1 Ron Yorston 2020-05-25 07:19:30 UTC
BusyBox rpm only supports a limited subset of functionality. It doesn't have the '--import' option. In fact, it doesn't have any long options which is why it complains that '-' is an unknown option.

If your chef's recipe calls for '--import' you'll have to give them the proper ingredients: a full version of rpm.
Comment 2 Denys Vlasenko 2021-02-25 16:39:56 UTC
In upstream package,
rpm --import PUBKEY is an alias for rpmkeys --import PUBKEY

busybox's rpm applet is only intended to be used as "unpacker" of .rpm files (example: running an emergency shell and installing a package form a .rpm file on a system which was broken by failed update or erroneous removal of a critical package).

It knows nothing about keys, a database of installed packages, etc.