How to detect if solaris is running as a guest machine

  • Follow


Hello,

Is there a way to know if solaris operating system is running as a
guest virtual machine on
a physical host ?

There is a utility "virt-what" from redhat that does the above job for
linux. Is there any
similar utility for solaris ?

Thanks and Regards,
Manish Singh.
0
Reply manishsinghhyb (7) 4/22/2010 12:21:49 PM

On Apr 22, 8:21=A0am, mannu <manishsingh...@gmail.com> wrote:
> Hello,
>
> Is there a way to know if solaris operating system is running as a
> guest virtual machine on
> a physical host ?
>
> There is a utility "virt-what" from redhat that does the above job for
> linux. Is there any
> similar utility for solaris ?
>
> Thanks and Regards,
> Manish Singh.

There are several ways but the easiest is to log into the virtual (aka
Solaris Zone) and run:

# /usr/bin/zonename

If you get "global" then you are obviously on a global zone (physical
machine).  If you get a hostname back, then you are on a virtual.
Keep in mind that the virtual (non-global) was purposely designed to
not know anything about the global.

juan martinez
0
Reply webjuan 4/22/2010 12:44:27 PM


On Apr 22, 5:44=A0pm, webjuan <webj...@gmail.com> wrote:
> On Apr 22, 8:21=A0am, mannu <manishsingh...@gmail.com> wrote:
>
> > Hello,
>
> > Is there a way to know if solaris operating system is running as a
> > guest virtual machine on
> > a physical host ?
>
> > There is a utility "virt-what" from redhat that does the above job for
> > linux. Is there any
> > similar utility for solaris ?
>
> > Thanks and Regards,
> > Manish Singh.
>
> There are several ways but the easiest is to log into the virtual (aka
> Solaris Zone) and run:
>
> # /usr/bin/zonename
>
> If you get "global" then you are obviously on a global zone (physical
> machine). =A0If you get a hostname back, then you are on a virtual.
> Keep in mind that the virtual (non-global) was purposely designed to
> not know anything about the global.
>
> juan martinez

Hello juan,

Thankyou for the reply.

There are certain things that are not clear still:

1. In my solaris 8 non global zone (virtual machine), zonename command
is not present.
   zonename command is present in the global zone (physical machine).
Hence there will
   be difficulty to run zonename from virtual machine.

2. I need to know in general (not just confined to solaris zones),
regardless of any
    virtualization software like vmware, xen, virtual pc, qemu,
solaris zones etc,...
    whether operating system is running as a virtual machine on top of
a physical host.

Thanks and Regards,
Manish Singh.
0
Reply mannu 4/22/2010 1:38:44 PM

mannu <manishsinghhyb@gmail.com> wrote:
> 1. In my solaris 8 non global zone (virtual machine), zonename command
> is not present.

Because Solaris 8 existed before virtualization became fashionable.  You
might be able to write a command to emulate zonename's functionality, but
I don't know how you'd go about it.

> 2. I need to know in general (not just confined to solaris zones),
> regardless of any

Why?  What does this gain you?

You're in for a very rough ride.  I don't believe the redhat command you
gave would even work for all the scenarios you're trying to work with.

-- 
Brandon Hume    - hume -> BOFH.Ca, http://WWW.BOFH.Ca/
0
Reply hume 4/22/2010 3:20:27 PM

On Apr 22, 9:38=A0am, mannu <manishsingh...@gmail.com> wrote:
> On Apr 22, 5:44=A0pm, webjuan <webj...@gmail.com> wrote:
>
>
>
> > On Apr 22, 8:21=A0am, mannu <manishsingh...@gmail.com> wrote:
>
> > > Hello,
>
> > > Is there a way to know if solaris operating system is running as a
> > > guest virtual machine on
> > > a physical host ?
>
> > > There is a utility "virt-what" from redhat that does the above job fo=
r
> > > linux. Is there any
> > > similar utility for solaris ?
>
> > > Thanks and Regards,
> > > Manish Singh.
>
> > There are several ways but the easiest is to log into the virtual (aka
> > Solaris Zone) and run:
>
> > # /usr/bin/zonename
>
> > If you get "global" then you are obviously on a global zone (physical
> > machine). =A0If you get a hostname back, then you are on a virtual.
> > Keep in mind that the virtual (non-global) was purposely designed to
> > not know anything about the global.
>
> > juan martinez
>
> Hello juan,
>
> Thankyou for the reply.
>
> There are certain things that are not clear still:
>
> 1. In my solaris 8 non global zone (virtual machine), zonename command
> is not present.
> =A0 =A0zonename command is present in the global zone (physical machine).
> Hence there will
> =A0 =A0be difficulty to run zonename from virtual machine.
>
> 2. I need to know in general (not just confined to solaris zones),
> regardless of any
> =A0 =A0 virtualization software like vmware, xen, virtual pc, qemu,
> solaris zones etc,...
> =A0 =A0 whether operating system is running as a virtual machine on top o=
f
> a physical host.
>
> Thanks and Regards,
> Manish Singh.

I dont have much experience with branded zones but here is my attempt
at #2.

1. You can no longer use SVM commands

    non-global-zone# metastat -p
    metastat: zonename: Volume administration unavailable within non-
global zones

2. If only using lofs devices, the format command returns nothing

    non-global-zone# format
    Searching for disks=85done
    No disks found!

3. lsof no longer works, see lsof FAQ at
http://www.mirrorservice.org/sites/vic.cc.purdue.edu/pub/tools/unix/lsof/FA=
Q

    non-global-zone# lsof
    lsof: can=92t stat(/devices): No such file or directory

4. A Solaris zone has a "zsched" process as apposed to a =93sched=94

    non-global-zone# ps -ef | grep sched

5. A Solaris zone will not show any global processes when running a ps
with a =93-Z=94 option

    non-global-zone# ps -ef -Z | grep global
    non-global-zone root 25463 29042 0 03:53:04 pts/60 0:00 grep
global

6. mknod no longer works because it cant write to /dev/

    non-global-zone# mknod /dev/testing c 4 64
    mknod: Not owner

7. zonecfg can only be run from the global zone

    non-global-zone# zonecfg -z test
    zonecfg can only be run from the global zone.

8. zoneadm will only print you the non-global zone

    non-global-zone# zoneadm list
    non-global-zone

9. zlogin can only be run from the global zone

    non-global-zone# zlogin other-non-global-zone
    zlogin: =91zlogin=92 may only be used from the global zone

10. prstat does not show you =93global=94 zone usage, just hostname when
using =93-Z=94 option

    non-global-zone# prstat -Z

11. Missing /etc/ethers

    non-global-zone# ls -la /etc/ethers
    /etc/ethers: No such file or directory

12. dispadmin does not work

    non-global-zone# dispadmin -d
    dispadmin: Operation not supported in non-global zones

13. prtdiag does not work

     non-global-zone# prtdiag
     prtdiag can only be run in the global zone

14. dumpadm no longer works

    non-global-zone# dumpadm
    dumpadm: failed to open /dev/dump: No such file or directory

Keep in mind that this is not a complete list.  Its just things that
I've personally come across.  Let us know what works for you, if
anything.

juan martinez
0
Reply webjuan 4/22/2010 4:12:50 PM

hume.spamfilter@bofh.ca writes:
>You're in for a very rough ride.  I don't believe the redhat command you
>gave would even work for all the scenarios you're trying to work with.

It'd probably work on x86 PC's pretty easily by just scanning the ACPI
strings presented to the OS. Each of the VM solutions tend to put
their own brand of ACPI strings in to identify it back to the OS
drivers for specific things. 

But beyond that, would fail pretty hard on most of the other virtual
technologies that others have been discussing in this thread (let
alone domains and other setups on the really big iron). 
0
Reply Doug 4/22/2010 7:25:02 PM

The most portable and reliable way I have found to determine whether
or not a process is in the global zone is to look for process 1 (with
ps or in /proc).  If you can see PID 1 then you are in the global
zone; if not you are in a non-global zone.

                             :: Jeff Makey
                                jeff@sdsc.edu

Department of Tautological Pleonasms and Superfluous Redundancies Department
0
Reply jeff 4/22/2010 10:07:38 PM

On Apr 23, 3:07=A0am, j...@sdsc.edu (Jeff Makey) wrote:
> The most portable and reliable way I have found to determine whether
> or not a process is in the global zone is to look for process 1 (with
> ps or in /proc). =A0If you can see PID 1 then you are in the global
> zone; if not you are in a non-global zone.
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0:: Jeff Makey
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 j...@sdsc=
..edu
>
> Department of Tautological Pleonasms and Superfluous Redundancies Departm=
ent

Hello,

Thankyou all for helpful insights.

I am not aware what is ACPI strings and how to get that ?

One of the ways as already been discussed is to get manufacturer list
of
hardwares of computer and grep for the virtual machine organization
names.

Issue is that how we can get list of manufacturers for hardwares of
computer
like cpu, disk, memory, and so on ?

One more possible way  is  if scsi inquiry on disk gives vendor
details including
name of manufacturer having virtual machine organization name. I have
verified this
on solaris x86 virtual machine running on vm ware ESX  using format
command's
"inquiry" menu:

format> inquiry
Vendor:   VMware
Product:  Virtual disk
Revision: 1.0
format>


This brings up another issue, if disk is not scsi, let us say IDE,
SATA or other, then we cannot do inquiry to
get vendor information. Here in these cases, how to get vendor
information?


0
Reply mannu 4/23/2010 4:25:25 AM

On 2010-04-23 05:25:25 +0100, mannu said:

> On Apr 23, 3:07�am, j...@sdsc.edu (Jeff Makey) wrote:
>> The most portable and reliable way I have found to determine whether
>> or not a process is in the global zone is to look for process 1 (with
>> ps or in /proc). �If you can see PID 1 then you are in the global
>> zone; if not you are in a non-global zone.
>> 
>> � � � � � � � � � � � � � � �:: Jeff Makey
>> � � � � � � � � � � � � � � � � j...@sdsc.edu
>> 
>> Department of Tautological Pleonasms and Superfluous Redundancies Department
> 
> Hello,
> 
> Thankyou all for helpful insights.
> 
> I am not aware what is ACPI strings and how to get that ?

On Solaris 10 and OpenSolaris you can run smbios to get this info. At 
least it *looks* like this info; certainly it tells you about all the 
manufacturer/product strings that are embedded in the BIOS. eg Solaris 
10 inside VMware:

% smbios|grep VMware
  Manufacturer: VMware, Inc.
  Product: VMware Virtual Platform
  Serial Number: VMware-56 4d 6d f3 ac d3 e0 20-df 74 70 9e 16 cf da bd
  VMware SVGA II

-- 
Chris

0
Reply Chris 4/23/2010 5:27:17 AM

On Apr 22, 1:21=A0pm, mannu <manishsingh...@gmail.com> wrote:
> Hello,
>
> Is there a way to know if solaris operating system is running as a
> guest virtual machine on
> a physical host ?
>
> There is a utility "virt-what" from redhat that does the above job for
> linux. Is there any
> similar utility for solaris ?
>
> Thanks and Regards,
> Manish Singh.

Run prtdiag.

If you are in a non-global zone it will tell you that this command can
only be run in the global zone.

e.g.

root@non-global# prtdiag
prtdiag can only be run in the global zone
0
Reply Zfs 4/23/2010 2:57:14 PM

"mannu" <manishsinghhyb@gmail.com> wrote in message 
news:48d2d884-139a-4ecc-86d7-10e5a4d2655c@n20g2000prh.googlegroups.com...
On Apr 22, 5:44 pm, webjuan <webj...@gmail.com> wrote:
> On Apr 22, 8:21 am, mannu <manishsingh...@gmail.com> wrote:
>
> > Hello,
>
> > Is there a way to know if solaris operating system is running as a
> > guest virtual machine on
> > a physical host ?
>
> > There is a utility "virt-what" from redhat that does the above job for
> > linux. Is there any
> > similar utility for solaris ?
>
> > Thanks and Regards,
> > Manish Singh.
>
> There are several ways but the easiest is to log into the virtual (aka
> Solaris Zone) and run:
>
> # /usr/bin/zonename
>
> If you get "global" then you are obviously on a global zone (physical
> machine). If you get a hostname back, then you are on a virtual.
> Keep in mind that the virtual (non-global) was purposely designed to
> not know anything about the global.
>
> juan martinez

Hello juan,

Thankyou for the reply.

There are certain things that are not clear still:

1. In my solaris 8 non global zone (virtual machine), zonename command
is not present.
   zonename command is present in the global zone (physical machine).
Hence there will
   be difficulty to run zonename from virtual machine.

2. I need to know in general (not just confined to solaris zones),
regardless of any
    virtualization software like vmware, xen, virtual pc, qemu,
solaris zones etc,...
    whether operating system is running as a virtual machine on top of
a physical host.

Thanks and Regards,
Manish Singh.





Uname -a or uname -m should give you all you ned in a Solaris 8 contrainer 
to know that it's is in fact a container versus a physical machine. 


0
Reply CH 4/25/2010 12:38:04 AM

On 04/25/10 12:38 PM, CH wrote:
>
> There are certain things that are not clear still:
>
> 1. In my solaris 8 non global zone (virtual machine), zonename command
> is not present.
>     zonename command is present in the global zone (physical machine).
> Hence there will
>     be difficulty to run zonename from virtual machine.

Solaris 8 pre-dates most virtualisation technologies, so it isn't aware 
of them.  So you can't expect a Solaris 8 system to have a direct means 
of determining this.

> 2. I need to know in general (not just confined to solaris zones),
> regardless of any
>      virtualization software like vmware, xen, virtual pc, qemu,
> solaris zones etc,...
>      whether operating system is running as a virtual machine on top of
> a physical host.

Obvious question: why?


-- 
Ian Collins
0
Reply Ian 4/25/2010 12:59:11 AM

In article <7b9362a1-4431-44ce-b7d7-7ee22f21afe6@c21g2000yqk.googlegroups.com>,
	webjuan <webjuan@gmail.com> writes:
> On Apr 22, 8:21=A0am, mannu <manishsingh...@gmail.com> wrote:
>> Hello,
>>
>> Is there a way to know if solaris operating system is running as a
>> guest virtual machine on
>> a physical host ?
>>
>> There is a utility "virt-what" from redhat that does the above job for
>> linux. Is there any
>> similar utility for solaris ?
>>
>> Thanks and Regards,
>> Manish Singh.
> 
> There are several ways but the easiest is to log into the virtual (aka
> Solaris Zone) and run:
> 
> # /usr/bin/zonename
> 
> If you get "global" then you are obviously on a global zone (physical
> machine).  If you get a hostname back, then you are on a virtual.
> Keep in mind that the virtual (non-global) was purposely designed to
> not know anything about the global.
> 
> juan martinez

That's just a zone though - a lightweight thing, not full virtualization.

One could also be running an LDOM on a CoolThreads box.  Or on x86, running
under Xen, VirtualBox, VMware, and probably others.

In zones and paravirtualized environments, there would be something about the
environment itself that would clearly give it away.  Everything else, one
would have to look at details of device attributes and such, on a pretty
much case-by-case basis, I would think.

So there's probably a separate way to tell for each different way of doing
the virtualization, but no one way to answer that question for all of them.
0
Reply rlhamil 5/3/2010 9:25:49 AM

12 Replies
1647 Views

(page loaded in 0.165 seconds)

Similiar Articles:


















7/19/2012 4:17:21 PM


Reply: