5

What is the correct way to identify which version of SunOS is currently running?

user9517
  • 114,104
  • 20
  • 206
  • 289
Adrian
  • 229
  • 2
  • 4
  • 12

3 Answers3

7

To clear things up for everyone:

  • uname -r will show the major version number prefixed by 5. (e.g., Solaris 9 will be 5.9, 10 will be 5.10 and 11 will be 5.11)
  • uname -v will be the kernel patch number or nevada build number. Prior to OpenSolaris this will be meaningless to you as patches can be installed independent of update releases. On Solaris 10 & earlier it's a patch number (on S10 x86 it's "Generic_142910-17", or thereabouts). Any Nevada build (OpenSolaris, Solaris 11 and IllumOS based releases) will be the build number. On Solaris 11 Express it's "snv_151a"
  • The contents of /etc/release will be have the actual product version. E.g., Solaris 10 update 9 will show "Solaris 10 9/10 s10x_u9". Again, Nevada builds will have the snv build number.

In any case the best way to get the correct meaningful version number is the contents of /etc/release. Specifically, the second to the last field of the first line.

Or most simply:

$ head -1 /etc/release | awk ' { print $(NF-1) }'
s10x_u9wos_14a

Edit:

A note about major/minor version confusion on Solaris.

Solaris started life as SunOS, which was based on BSD, which ended with the kernel at version 4 (same as the BSD 4.x line). Time passes and it's re-based on System V. The product is renamed Solaris, and branded as Solaris 2. The kernel version is set to 5.0. Solaris 2 through 2.6 are released, corresponding with kernel versions 5.0-5.6. With the next release the "major" numbers are completely removed from marketing and branding and it's simply called as Solaris 7. This tradition continues to today. So Solaris 10 is actually Solaris 2.10, kernel version 5.10. Solaris 11 is likewise 2.11 and 5.11.

But for all intents and purposes the traditional "minor" number is now the "major" number. There will never be SunOS 6.0, nor Solaris "3", which is why I refer to it as the major number.

bahamat
  • 6,193
  • 23
  • 28
  • « uname -r will show the major version number prefixed by 5» — As far as SunOS (i.e. not Solaris) is concerned, 5 is the major version, 9, 10, and 11 are minor versions. – jlliagre Aug 15 '11 at 03:38
  • « uname -v will be the repository version number» — With Solaris 10 and older, you'll get the kernel patch number here which isn't that meaningless. With newer versions, that's the build number as patching is no more implemented. – jlliagre Aug 15 '11 at 03:43
  • @jlliagre I'll update my answer for further explanation. – bahamat Aug 15 '11 at 03:58
  • 2
    It is not "svn_151a" but "snv_151a" as "151a" is a Solaris Nevada build number, not a subversion number. SunOS started as SunOS 1, not SunOS 4. Latest SunOS 4 was based on BSD 4.3, not 4.4. You shouldn't say "Solaris 10 is actually Solaris 2.10" as there is no "Solaris 2.10" in the first place. You shouldn't write "There will be no SunOS 6.0" even while it's unlikely to happen. – jlliagre Aug 15 '11 at 05:02
  • Yes, it's important to quibble over these details that I'm *intentionally* trying to abstract away for the explicit purpose of distracting from the fact that `/etc/release` is the best place to get the actual product version. There will never be SunOS 6.0, nor Mac OS XI. – bahamat Aug 15 '11 at 05:14
  • 1
    /etc/release is indeed the right place to look for the installed Solaris version, which is what most people are interested with. I'm not commenting about "intentionally abstracted away details" but about inaccurate or definitive statements. For example, you are still claiming the kernel patch release number is meaningless while most Solaris admins and support people will care a lot. Only the owner of the SunOS brand can decide if a 6.0 version will show up or not. Solaris development uses mercurial since 2008, subversion was never used to manage its source tree. – jlliagre Aug 15 '11 at 06:03
  • Glad you finally accepted (almost all of) my comments. – jlliagre Aug 15 '11 at 14:23
4

Use following command uname -r in terminal

Kumar
  • 823
  • 3
  • 20
  • 43
  • That will probably tell you what you want. In sun lingo, "-r" is the "release level" and "uname -v" is the version. "uname -a" will almost certainly tell you what you need to know. – quadruplebucky Mar 01 '10 at 13:01
  • Using `uname` is very imprecise on Solaris. You almost might as well just use `uname -s`. See my answer for the correct way to do this. – bahamat Aug 14 '11 at 21:22
3

You can also try:

cat /etc/release
Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148