Project

General

Profile

Actions

Bug #38554

closed

Host registration on Debian based systems fail because dpkg options are improperly formatted

Added by Macley kun 6 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

The Why:
We noticed after upgrading foreman that we couldn't register Ubuntu hosts anymore. I created a forum post about it to see who has the issue aswell:
https://community.theforeman.org/t/host-registration-script-fails-with-dpkg-error-need-an-action-option/43619

The error:

here it goes wrong
+ apt-get -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install -y subscription-manager
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-5.15.0-140 linux-headers-5.15.0-140-generic linux-image-5.15.0-140-generic linux-modules-5.15.0-140-generic linux-modules-extra-5.15.0-140-generic
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
python3-subscription-manager
Suggested packages:
python3-subscription-manager-doc
The following NEW packages will be installed:
python3-subscription-manager subscription-manager
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/468 kB of archives.
After this operation, 2813 kB of additional disk space will be used.
dpkg: error: need an action option
The search:
Running that command in the terminal worked, also using it directly into the script worked.
A few users pointed out the quoting, but i didn't saw anything wrong with it.
One user also pointed to the PR that may have caused this issue: #10436

The workaround:
I noticed if i installed the subscription-manager after the script broke, that it worked. So in our playbook i run the registration script, and if it fails i install the subscription-manager and then retry the registration script again.
But this felt wrong and i can imagine other people may have this issue aswell i though.

The solution:
After a busy week with other prioties i took the whole script and checked on quote's/formatting errors but didn't notice anything again.
Using set -x i did notice the same error again and with the users pointing out about missing a quote, i wonderd if the single quotes were causing the issue.
I did saw it used alot (single quote's) for the various distributions, but for debian these extra options were unique so i gave it a try.

here it goes wrong
+ apt-get -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold install -y subscription-manager
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-5.15.0-140 linux-headers-5.15.0-140-generic linux-image-5.15.0-140-generic linux-modules-5.15.0-140-generic linux-modules-extra-5.15.0-140-generic
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
python3-subscription-manager
Suggested packages:
python3-subscription-manager-doc
The following NEW packages will be installed:
python3-subscription-manager subscription-manager
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/468 kB of archives.
After this operation, 2813 kB of additional disk space will be used.
Selecting previously unselected package python3-subscription-manager.
(Reading database ... 167795 files and directories currently installed.)
Preparing to unpack .../python3-subscription-manager_1.30.5-2_amd64.deb ...
Unpacking python3-subscription-manager (1.30.5-2) ...
Selecting previously unselected package subscription-manager.
Preparing to unpack .../subscription-manager_1.30.5-2_all.deb ...
Unpacking subscription-manager (1.30.5-2) ...
Setting up python3-subscription-manager (1.30.5-2) ...
Setting up subscription-manager (1.30.5-2) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for dbus (1.14.10-4ubuntu4.1) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
+ set +x
It worked! Because i only have an issue with this part of the script for Ubuntu hosts, i only changed to what i'm sure actually fixes the functionality and not break anything else (especially if i can't test it).

Actions #1

Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/10594 added
Actions #2

Updated by The Foreman Bot 6 months ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/10594)
Actions #3

Updated by The Foreman Bot 6 months ago

  • Pull request https://github.com/theforeman/foreman/pull/10614 added
Actions #4

Updated by The Foreman Bot 6 months ago

  • Fixed in Releases 3.16.0 added
Actions #5

Updated by Anonymous 6 months ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF