Determine if you are in a Legacy Zone?

Hi Folks,

Just a quick question here, about Legacy Zones. Well more about how to determine if you are actually in one, on logging into a legacy zone - is there a quick way of checking that?

Regards

Gull04

If you are on Solaris 10 uname -a will not show as version 10 - either 8 or 9?

Is that what you mean?

Hi Jim,

Thanks for the reply, I haven't explained this very well. I have a couple of hundred servers here, covering Solaris 2.5.1 up to Solaris 11.2. They are probably 50/50 physical and virtual, all the virtual are zones (no LDOMS in use).

When I connect to a server, I'd like to identify it as a zone if possible. This is simple for Solaris 10 and 11, as you can use the zonename command to test.

However on Solaris 8 and 9, the servers can be either physical or virtual and running a

uname -a

will just return the OS, hostname, kernel version etc.

What I was looking for was a simple way of determining whether I was on a virtual or physical, but having spent a bit of time on this now it's looking like there is no easy way to tell.

Regards

Gull04

Looks like you could use patchadd or pkg command to determine certain set of packages...

I see oracle recommends installing packages SUNWs8brandr from solaris 10 media, perhaps this is a good way to start...

Also there is a tool called p2v, take a look at this illumos code

warn_zones function looks like it looks at some files which determine various info regarding zones.
Perhaps oracle version is still a plain text script :slight_smile:

But then again i have no experience with above, so it is just babble :wink:

Regards
Peasant.

Hmmmmm.......that's a good question (and although I've done a lot of work on legacy zones, I don't have one here right now). So I'll just give you my thoughts and you'll have to test them.

If there's a legacy zone (Solaris 8 or 9) running under Solaris 10 (since legacy is not supported under Solaris 11), then it must be whole root since it cannot share the system files with the global. Also, the legacy could be assigned an exclusive network interface for its use, or could share one with the global. I would expect sharing to be indicated by the interface showing as eg, hme0:1, hme0:2, and so on. That might tell you something.

Also, whilst even logged into the legacy as root I would expect commands such as 'format', 'prtdiag', and 'cfgadm' to fail with something like "you don't have the rights to do this" type message.

I would expect:

# uname -v

to output something like 'Generic' if the machine was not a physical box.

Just a few thoughts and pointers. I'll give it a go myself when I can.

Searching the web it seems like

# uname -v

says "Generic_Virtual" if it's not a physical box.

Don't know whether that applies to Sparc, X86 or both.

1 Like

This page from Oracle lists commands that don't work in a non-global zone:

Utilities That Do Not Work or Are Modified in Non-Global Zones (System Administration Guide: Oracle Solaris Containers-Resource Management and Oracle Solaris Zones)

Non-global zones also do not have "files" in /dev/dsk or /dev/rdsk.

The fact that something does not work or returns nothing may not be conclusive unless you are running with privilege - example: zoneadm list simply returns the current zone if you are not in the root zone. Which is ambiguous if you do not know the zone names.

I think we are barking up the wrong tree - there has to be some definitive method to identify the type of zone - why I posted uname - although that falls in the not-so-definitive category. uname gives the "OS" version which shows up as 8 or 9 doesn't it? - for the legacy zone case.

Also the /etc/zones directory would not contain xml files for other zones or even the zone you are in:

ls -ld /etc/zones
drwxr-xr-x   2 root     sys          512 Apr 29  2011 /etc/zones
jmcnama@SNEDAP03 [~] $ ls -l /etc/zones
total 6
-rw-r--r--   1 root     sys           58 Mar 19  2015 index
-r--r--r--   1 root     bin          420 Sep 20  2008 SUNWsolaris8.xml
-r--r--r--   1 root     bin          420 Sep 20  2008 SUNWsolaris9.xml

Depending on the way the zone was built - sparse root or not.