One of the most common questions we've seen asked by new OpenSolaris users seems quite simple on the surface: “Why doesn't my favorite application have color in the terminal?” Usually the application is vim, and some note that it "works" in GNU screen.

Of course, long-time Solaris users don't generally notice the problem, as the answer is “Solaris ships with ancient information about terminals.” No one at Greenviolet claims to know the reasons why this is, though there is plenty of speculation, though we do have to thank Sun for releasing such a comprehensive historical archive of terminal definitions to the world. Yes, ncurses ships with a far larger database, but it's not a snapshot in time of what was actually shipped by any vendor. Sun's database appears to have been untouched since early Solaris. That's potentially almost 20 years ago. Did we say ancient? Yup.

Until the (Open)Solaris terminal database is modernized and packaged and everything else that needs to happen before it ends up on the desktops and servers of users everywhere, there needs to be an interim solution. Fortunately, the solution is technically simple. Unfortunately, it's far too confusing to walk most people through without some background. So we've come up with what we hope is a good answer for now...

We've put up a script that does everything that should be needed to update a system's terminal database. It grabs the latest ncurses terminfo and termcap files (potentially newer than whichever OpenSolaris release it's installed on) and updates the system. What could go wrong? ;)

Well, potentially many things. These files are also delivered by the operating system , so when you upgrade you could suddenly "lose" your color again. There could also potentially be a bug which would prevent the upgrade from happening in the first place. Any number of things could go wrong. Luckily, it's quick and easy to undo the changes made by the script, and to redo them, you just run the script again.

To install:

jack@opensolaris:~$ wget -O ~/update-terminals.sh http://www.greenviolet.net/Solaris/update-terminals.sh
jack@opensolaris:~$ sh ~/update-terminals.sh
<INFORMATION AND WARNING APPEARS>
If you have no issues with the above warning, please press 'Y' to continue.
Any other input will abort installation.
Y [This must be a capital Y or the installation WILL abort.]
<The script does its thing and returns you to your prompt. You should now see color in your terminals.>

To uninstall:

jack@opensolaris:~$ pfexec rm -rf /usr/share/lib/terminfo /usr/share/lib/termcap /usr/gnu/share/terminfo; pfexec pkg fix SUNWcs SUNWter SUNWncurses

Some notes:

  • This script is provided as a convenience. While we will try to answer any questions you have, we cannot guarantee support, nor can we offer any guarantee or warranty.
  • You cannot stop the script once you hit "Y". This is to prevent leaving your system in an inconsistent state. Really, don't try. It's seven years of bad luck.
  • This script may break at any time when doing an OpenSolaris upgrade. Please read the release notes before starting on an upgrade to verify that there are no issues which may be exacerbated by this script.
  • The uninstallation command-line must be input as a single line, even if it wraps in your browser. Most browsers do the right thing if you copy and paste out of them.
  • We do not currently have a version of this script for Solaris 10. We may be able to provide one upon request.
  • This script does not make accommodation for the now-defunct SXCE. If you are still using SXCE, you probably have the skill to adapt this script. Creating a fresh BE first is recommended. If you don't know what SXCE is, you probably don't have it.
  • In the event of something happening where you lose your colors (such as updating to a newer version of the OS), please run the uninstallation command line then reinstall from a fresh copy of the script.
  • This script does "bad things". Don't try to mimic it with your own scripts. Please. And don't do the sorts of things it does from the command line, either. The proper approach for something like this is to package up the changes and get them released. It's really not a good idea to hope that you manage to not upset the packaging system.

Please feel free to leave a comment below, or email the address displayed when you run the script with feedback. If we can make this better, we would love to!

1 comment

  1. "We do not currently have a version of this script for Solaris 10. We may be able to provide one upon request." Please, provide one per this my request!

    Steve A. Fri, 16 Apr 2010