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
I installed ksh on fresh fedora-37 (`dnf install ksh`) and erased (uninstalled) it (`rpm -e ksh`) successfully - everything works as expected.