Java symlinks disappear on Centos migration

I just moved my main desktop computer to Rocky from Centos 8 using migrate2rocky.sh. The whole process was as slick as… well, something really slick!

However, I’ve just noticed that java symlinks have disappeared after the migration.

Before migration (Centos 8):
$ ls -l /etc/alternatives/j*
lrwxrwxrwx. 1 root root 73 Nov 19 22:36 /etc/alternatives/java → /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java
lrwxrwxrwx. 1 root root 77 Nov 19 22:36 /etc/alternatives/java.1.gz → /usr/share/man/man1/java-java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64.1.gz
lrwxrwxrwx. 1 root root 72 Nov 19 22:36 /etc/alternatives/jjs → /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/jjs
lrwxrwxrwx. 1 root root 76 Nov 19 22:36 /etc/alternatives/jjs.1.gz → /usr/share/man/man1/jjs-java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64.1.gz
lrwxrwxrwx. 1 root root 64 Nov 19 22:36 /etc/alternatives/jre → /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre
lrwxrwxrwx. 1 root root 64 Nov 19 22:36 /etc/alternatives/jre_1.8.0 → /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre
lrwxrwxrwx. 1 root root 59 Nov 19 22:36 /etc/alternatives/jre_1.8.0_openjdk → /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64
lrwxrwxrwx. 1 root root 64 Nov 19 22:36 /etc/alternatives/jre_openjdk → /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre

After migration to Rocky:
$ ls -l /etc/alternatives/j*
ls: cannot access ‘/etc/alternatives/j*’: No such file or directory

Before migration:
$ ls -l /usr/lib/jvm
drwxr-xr-x. 3 root root 17 Nov 13 02:29 java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64
lrwxrwxrwx. 1 root root 21 Nov 1 2020 jre → /etc/alternatives/jre
lrwxrwxrwx. 1 root root 27 Nov 1 2020 jre-1.8.0 → /etc/alternatives/jre_1.8.0
lrwxrwxrwx. 1 root root 35 Nov 1 2020 jre-1.8.0-openjdk → /etc/alternatives/jre_1.8.0_openjdk
lrwxrwxrwx. 1 root root 51 Nov 13 02:29 jre-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64 → java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre
lrwxrwxrwx. 1 root root 29 Nov 1 2020 jre-openjdk → /etc/alternatives/jre_openjdk

After migration:
$ ls -l /usr/lib/jvm
drwxr-xr-x. 7 root root 135 Dec 29 00:17 java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64
lrwxrwxrwx. 1 root root 51 Nov 9 18:00 jre-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64 → java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre

EDIT: FURTHER OBSERVATIONS A COUPLE OF HOURS LATER

I installed java-1.8.0-openjdk on a Rocky Linux virtualbox image and afterward I got this:

alternatives --config java

There is 1 program that provides ‘java’.
Selection Command

*+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java)

So I did a dnf remove and dnf install on java-1.8.0-openjdk on this computer to see if that would solve the problem but alternatives --config java still shows no output at all.

This is known to happen during a migration with java installed. The readme for the migration script gives this command for java:

rpm -qa --scripts java-{1.8.0,11}-openjdk-{headless,devel} | sed -n '/postinstall/, /exit/{ /postinstall/! { /exit/ ! p} }' | sh

Fantastic!

May I suggest that someone add this useful bit of information to the documentation page at Migrating To Rocky Linux - Documentation ?

I just used the information on that page to do my migration and was completely unaware until right this minute that there was an additional readme file available.

Anyway, my problem is now solved so please accept my sincere thanks for giving me the steer!