RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2203820 - Weird behavior when --add-slave and --keep-foreign used together for active alternative
Summary: Weird behavior when --add-slave and --keep-foreign used together for active a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: chkconfig
Version: 8.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Lukáš Nykrýn
QA Contact: Karel Volný
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-15 10:53 UTC by Jan Macku
Modified: 2023-11-14 18:05 UTC (History)
1 user (show)

Fixed In Version: chkconfig-1.19.2-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-14 15:49:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-sysv chkconfig issues 102 0 None closed Weird behavior when `--add-slave` and `--keep-foreign` used together for active alternative 2023-05-15 10:58:37 UTC
Github fedora-sysv chkconfig pull 104 0 None Merged Fix --keep-foreign when the target is missing completely 2023-05-15 10:58:37 UTC
Github fedora-sysv chkconfig pull 109 0 None open Fix --keep-foreign when the target is missing completely 2023-05-15 11:07:20 UTC
Red Hat Issue Tracker RHELPLAN-157217 0 None None None 2023-05-15 10:54:10 UTC
Red Hat Product Errata RHBA-2023:7121 0 None None None 2023-11-14 15:49:39 UTC

Description Jan Macku 2023-05-15 10:53:21 UTC
The issue was originally reported as a GitHub issue on upstream: https://github.com/fedora-sysv/chkconfig/issues/102 and fixed by: https://github.com/fedora-sysv/chkconfig/pull/104

We have a problem in python3.11-wheel package which we can probably solve by ourselves but I think the strange behavior of alternatives I discovered is still worth reporting.

When talking about packages, I mean the ones available in RHEL 8 and I'm using 1minutetip for testing. The most important ones are chkconfig-1.19.1-1.el8.x86_64 and python3.11-wheel-0.38.4-3.el8.noarch.

To reproduce the problem on RHEL 8:

1. `dnf install python36 python3.11`  (Python 3.6 is needed later.)
2. `alternatives --set python3 /usr/bin/python3.11`
3. `dnf install python3.11-wheel`

The installation of python3.11-wheel calls [this command in its `%post` scriptlet](https://gitlab.com/redhat/centos-stream/rpms/python3.11-wheel/-/blob/c8s/python3.11-wheel.spec#L121-125):
`alternatives --keep-foreign --add-slave python3 /usr/bin/python3.11 /usr/bin/wheel-3 wheel-3 /usr/bin/wheel-3.11`

The command produces the following error:

```
Running scriptlet: python3.11-wheel-0.38.4-3.el8.noarch                                 1/1 
failed to link /usr/bin/wheel-3 -> /etc/alternatives/wheel-3: /usr/bin/wheel-3 exists and it is either not a symlink or --keep-foreign was set and link points outside /etc/alternatives
```

But, if you set the alternative for python3 to python36 which means that the installation of python3.11-wheel will add the slave into an inactive alternative, it works fine and no error is shown. So these steps are fine:

1. `dnf install python36 python3.11`
2. `alternatives --set python3 /usr/bin/python3.6`
3. `dnf install python3.11-wheel`

If I understand it correctly `--keep-foreign` should prevent the `--add-slave` from removing/changing a symlink, if it already exists. If that's true, having `--add-slave` together with `--keep-foreign` makes perfect sense. The problem is that the error message is not true: `/usr/bin/wheel-3` does not exist in this case. Alternatives should create that file if you install python3.11-wheel when python3.11 is the active alternative for python3.

To sum this up:
* If python3.11 is active alternative for python3, the installation of python3.11-wheel does not create `/usr/bin/wheel-3` and shows the error mentioned above.
* If python36 is active alternative for python3, the installation succeedes without errors. Then, when you switch from python36 to python3.11 alternative, the file `/usr/bin/wheel-3` is there and works as expected: `/usr/bin/wheel-3 -> /etc/alternatives/wheel-3 -> /usr/bin/wheel-3.11`.

Bug report with some more context: https://bugzilla.redhat.com/show_bug.cgi?id=2181479

Does it make sense to use `--keep-foreign` with `--add-slave`? If so, could we fix the problem? And if not, could we improve the error message to make it clear that this is not supported?

Comment 8 errata-xmlrpc 2023-11-14 15:49:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (chkconfig bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:7121


Note You need to log in before you can comment on or make changes to this bug.