Setting a Preferred Path that is Not Available: Consequences and Recovery

The following output shows only one implementation available in this image for the perl command:

$ pkg mediator -a perl
MEDIATOR     VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
perl         vendor    5.22    vendor
perl         system    5.12    system

Though only one implementation is available, the path is still a mediated link:

$ which perl
/usr/bin/perl
$ ls -l /usr/bin/perl
lrwxrwxrwx   1 root     root          22 Mar 23 16:06 /usr/bin/perl -> ../perl5/5.12/bin/perl

Perhaps you know that a newer version exists, and you enter the following command to update the link to point to the newer version. The following command is incorrect because the specified version is not currently available in this image:

$ pkg set-mediator -vV 5.22 perl
            Packages to change:         2
           Mediators to change:         1
     Estimated space available: 867.06 GB
Estimated space to be consumed: 241.78 MB
       Create boot environment:        No
Create backup boot environment:       Yes
          Rebuild boot archive:        No

Changed mediators:
  mediator perl:
           version: 5.12 (vendor default) -> 5.22 (local default)
...

The pkg mediator command shows the updated setting:

$ pkg mediator perl
MEDIATOR     VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
perl         local     5.22    system

However, the pkg mediator -a command shows that the current setting is not available:

$ pkg mediator -a perl
MEDIATOR     VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
perl         vendor    5.12    vendor

The result of the incorrect version specification is that the mediated link was removed:

$ which perl
no perl in /usr/sbin /usr/bin
$ ls -l /usr/bin/perl
/usr/bin/perl: No such file or directory

You could work around this problem by specifying the full path to the command (/usr/perl5/5.12/bin/perl). The target path was not affected. Only the mediated link was removed.

Any one of the following actions should fix this problem:

  • Set the preferred version back to the version that is available.

    $ pkg set-mediator -V 5.12 perl
  • Use the pkg unset-mediator command to allow the system to select a new implementation from among the available implementations.

    $ pkg unset-mediator perl
  • Install the packages that deliver the updated version that you want.

    The output from the following command shows which packages deliver perl mediated links:

    $ pkg search -o pkg.name,mediator-version link:mediator:perl

    The runtime/perl-522 and terminal/cssh-522 packages deliver perl mediated links for version 5.22. The terminal/cssh-522 package installs the runtime/perl-522 package. To fix the problem, you only need to install terminal/cssh-522.

    $ pkg install terminal/cssh-522

If you cannot fix or work around the issue, reboot to the backup BE that was created when you used the pkg set-mediator command.