Bug 2160565

Summary: can't uninstall ksh rpm: "/usr/bin/ksh93 has not been configured as an alternative for ksh"
Product: [Fedora] Fedora Reporter: Andrew <travneff>
Component: kshAssignee: Vincent Mihalkovič <vmihalko>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 37CC: kdudka, svashisht, vmihalko
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-24 14:43:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew 2023-01-12 20:50:36 UTC
Disclaimer: I did not remember how I got ksh installed, and all of this might be just historical mess in my setup updated by `dnf distro-sync` for years.
Anyway, let it be here for google which doesn't know these ksh-related errors at all. Feel free to close this ticket as invalid.

The problem is this:

  # rpm -e ksh
  /usr/bin/ksh93 has not been configured as an alternative for ksh
  error: %preun(ksh-3:1.0.3-1.fc37.x86_64) scriptlet failed, exit status 2
  error: ksh-3:1.0.3-1.fc37.x86_64: erase failed

And for this case following part of install scriptlet can't complete as well:

  # /usr/sbin/alternatives --install /usr/bin/ksh ksh /usr/bin/ksh93 50
  the primary link for ksh must be /bin/ksh

At the same time:

  # ll /usr/bin/ksh /usr/bin/ksh93 /etc/alternatives/ksh
  lrwxrwxrwx. 1 root root      10 Apr 12  2020 /etc/alternatives/ksh -> /bin/ksh93
  lrwxrwxrwx. 1 root root      21 Apr 12  2020 /usr/bin/ksh -> /etc/alternatives/ksh
  -rwxr-xr-x. 1 root root 1428368 Sep 19 13:54 /usr/bin/ksh93

Comment 1 Vincent Mihalkovič 2023-07-24 14:43:39 UTC
I installed ksh on fresh fedora-37 (`dnf install ksh`)
and erased (uninstalled) it (`rpm -e ksh`) successfully - everything works as expected.