您的位置:首页 > 运维架构

OpenSolaris Howto (1)

2007-06-19 08:42 387 查看

1. How to run an OpenSolaris with debugging enabled?

The Solaris Express / Developer Express ISO download images do not contain an OS with debugging enabled; AFAIK it's standard release bits. You would be running a kernel with debug enabled if you had bfu'ed the system using "debug" ON BFU archives, http://dlc.sun.com/osol/on/downloads/b66/ .


2. How to manage SAMBA under OpenSolaris?

Solaris 10 and upwards use a new Service Management Framework (SMF) in preference to the traditional raft of init scripts.
The 2 steps I used to get Samba working on Solaris Nevada:
1). Create /etc/sfw/smb.conf , perhaps based on /etc/sfw/smb.conf-example which Sun helpfully provide.
2). Start the Samba SMF service: "svcadm enable samba".
You can then verify that Samba is running OK using "svcs samba". You'll find the Samba binaries under /usr/sfw, which isn't in the default path. :-(
More info on SMF at http://opensolaris.org/os/project/smf-doc/smf-dev/smf-book.html and of course the man pages for svcs and svcadm.

3. OpenSolaris Howto on x86

You can also try Dennis Clarke's "A Step by Step Guide to Installing Solaris 10": http://www.blastwave.org/docs/s10u3_howto.html I feel guilty for never bothering to send feedback to dclarke@blastwave.org .
There is also a Solaris x86 FAQ at: http://faq.solaris-x86.org/ Of course, one of the things that make Solaris stands head and shoulders above everything else is its superduper (& free) documentation system: http://developers.sun.com/sxde/doc.jsp
There are a couple other good (read, marketing-fluff free) Sun-generated ones too: BigAdmin Articles and Sun Blueprints.
BigAdmin Articles/FAQs http://www.sun.com/bigadmin/collections/recently_updated.html Get updates via the BA newsletter: http://www.sun.com/bigadmin/newsletter Sun Blueprints http://www.sun.com/blueprints/browsedate.html Get updates via the BP newsletter http://www.sun.com/blueprints/subscribe.html

4. Short live process accounting

The question is:

I'm compiling the ON build 65's source code now, using "nightly opensolaris.sh" command.
The prstat reports that system is very idle, but the load average tells me that the system is very busy. -,-
And then I check the vmstat report, it shows the system is busy now, too.
Following are the reports, what's the problem?
ps, My system is a dell workstation with a P4 1.7G CPU and 512MB memory.

PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
6673 root 13M 12M sleep 35 0 0:00:02 2.9% dmake/1
9086 root 5672K 3396K run 35 0 0:00:00 0.5% acomp/1
6634 root 2080K 1344K sleep 59 0 0:00:00 0.2% vmstat/1
9080 root 9640K 6576K run 15 0 0:00:00 0.2% ube/1
8383 root 4320K 2764K cpu0 59 0 0:00:00 0.1% prstat/1
7720 root 8112K 3928K sleep 59 0 0:00:00 0.0% sshd/1
9083 root 1140K 876K sleep 35 0 0:00:00 0.0% sh/1
9071 root 1200K 920K run 15 0 0:00:00 0.0% cc/1
9069 root 1140K 876K sleep 45 0 0:00:00 0.0% sh/1
9085 root 1192K 916K sleep 35 0 0:00:00 0.0% cc/1
9070 root 996K 688K sleep 35 0 0:00:00 0.0% cw/1
9084 root 996K 668K run 25 0 0:00:00 0.0% cw/1
9082 root 13M 1320K sleep 35 0 0:00:00 0.0% dmake/1
9068 root 13M 1316K sleep 45 0 0:00:00 0.0% dmake/1
7979 root 7836K 2040K sleep 59 0 0:00:00 0.0% sshd/1
7984 root 2588K 1820K sleep 59 0 0:00:00 0.0% bash/1
7918 root 7836K 2044K sleep 59 0 0:00:01 0.0% sshd/1
117 daemon 4008K 1972K sleep 59 0 0:00:01 0.0% kcfd/3
9742 root 4012K 2552K sleep 59 0 0:00:11 0.0% nscd/25
5309 root 12M 6428K sleep 59 0 0:10:35 0.0% smbd/1
7598 root 4600K 3860K sleep 59 0 0:00:02 0.0% dmake/1
7597 root 972K 688K sleep 59 0 0:00:00 0.0% time/1
27340 root 3152K 2396K sleep 59 0 0:00:00 0.0% dmake/1
26430 root 3176K 2436K sleep 59 0 0:00:00 0.0% dmake/1

NPROC USERNAME SIZE RSS MEMORY TIME CPU
63 root 289M 138M 27% 0:21:04 4.3%
2 daemon 6332K 2960K 0.6% 0:00:01 0.0%
1 smmsp 6996K 1452K 0.3% 0:00:05 0.0%

Total: 66 processes, 176 lwps, load averages: 2.97, 3.04, 3.03

root@dell:~#vmstat 1

kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr cd f0 s0 -- in sy cs us sy id
0 0 0 1238652 245720 15 22 40 0 0 0 0 2 0 0 0 419 153 155 1 1 97
1 0 0 1201976 225460 1445 6769 0 67 67 0 0 7 0 0 0 317 5544 115 73 27 0
3 0 0 1190896 224480 6842 18811 0 72 72 0 0 10 0 0 0 332 11701 223 35 65 0
7 0 0 1196188 231540 4681 13909 0 99 99 0 0 10 0 0 0 340 10901 292 47 53 0
4 0 0 1196072 230308 4168 11179 0 67 67 0 0 8 0 0 0 329 11525 171 58 42 0
3 0 0 1183820 218020 1415 7525 0 28 28 0 0 6 0 0 0 325 5082 135 74 26 0
2 0 0 1189328 222504 4544 12530 0 139 139 0 0 16 0 0 0 348 10556 309 50 50 0
8 0 0 1194864 229620 5194 15550 0 36 36 0 0 11 0 0 0 333 10805 204 43 57 0
7 0 0 1195228 229536 5172 14077 0 67 67 0 0 13 0 0 0 338 10306 196 50 50 0
7 0 0 1187484 226696 4699 14620 0 115 115 0 0 11 0 0 0 336 10514 205 45 55 0
^C
root@dell:~#

It seems that prstat doesn't report the correct CPU usage percent for some processes.

Answer 1:

I don't know enough about the specifics for Open Solaris so the following is based on the guess that it is the same as regular Solaris (the fact that your vmstat r queue is at values like 7 and that idle CPU is at 0% but prstat shows only about 4% CPU makes this feel like a good guess) . Historically, Solaris used the "pcpu" parameter to display CPU against individual processes in prstat (or as part of ps -ef with the -o option). As pcpu is based on a slowly decaying average (equivalent to exponential weighting over the last minute) it deals poorly with processes with short lives such as the one you have (your example from your snap shot below shows that the CPU times are all very low - suggesting processes which don't stay up for long). Typically, changing the prstat refresh time doesn't change anything because the %cpu it is displaying remains the decaying average over the last minute. Alternatives could be prstat with the -m option if it is supported. The TOP tool changed how it calculates per process CPU% for Solaris (it stopped displaying the pcpu parameter and started to calculate %cpu based on the increases in cpu time) as of version 3.6, so you might want to give that a try. Because TOP calculates CPU% of the processes based on CPU time, going to a shorter refresh rate actually does help to improve accuracy for short processes... but it can't go below 1 second. Many short lived processes live less than one second. I don't know Dtrace that well but look forward to having a good tools to deal with this type of situation.

Hope it helps and others, please correct me if I am saying anything wrong or that doesn't apply to OpenSolaris,
Answer 2:

You have to use accounting to capture short lived processes, there is also the "child CPU" counter that some tools show (e.g. SE toolkit pea.se) however these use the low resolution 10ms cpu tick so to accurate measurements you really need to use extended system accounting, which is based on microstates and which also captures long lived processes at intervals.
There was some discussion of extended system accounting recently, look through the archives or grab my extracct code. http://www.orcaware.com/orca/pub/extracct/extracct-1.1.tar.Z

5. Kernel build error as "Id: fatal: relocation error: R_AMD64_32: file"

Question:
I tried to build the b63, but failed with quite a lot build errors. One error info is like "Id: fatal: relocation error: R_AMD64_32: file ./debug64/unix.o: symbol header_kstat_update: value 0xfffffffffb861a60 does not fit".
The Solaris version on my system is snv_63. I didn't install the Developer edition (which has sunstudio installed by default). I just installed the Sun Studio 12 from Sun's web.
Would appreciate if anyone could give any suggestion on how to make the build pass.

Answer:
You need to add the following line to your environment file:
__SSNEXT=

See usr/src/Makefile.master line 111 for details.

The error was caused by a change in the accepted compiler option for specifying address mode. With Studio 12 only -xmodel=kernel is accepted, while with previous versions of the compiler both
-Wu,-xmodel=kernel and -xmodel=kernel were accepted (even though we should have been using -xmodel=kernel all along).

Question:
Where to get such heads-up information?

Answer from "Sherry Moore [sherry.moore@sun.com]":
Usually here
http://opensolaris.org/os/community/on/flag-days/ However I didn't find a heads-up addressing this particular compiler option issue.

6. How to add and configure a NIC interface

The sequence I would have expected would have been:
# update_drv -a -i '"pci14e4,170c"' bge
# ifconfig -a plumb
# ifconfig -a
One should never edit that file /etc/driver_aliases (or any in /etc), use add_drv instead like:
add_drv -i '"pci14e4,170c"' bfe
this command will also update the /etc/name_to_major file and modload the driver.

7. How to pass kernel command line to solaris kernel?

These need to be set in your boot environment, ie in /boot/solaris/bootenv.rc have the following line:

setprop prom_debug '1'

should do it.

8. Package installed or source-code installed SAMBA?

I found that the packages SUNWsmbac, SUNWsmbau & SUNWsmbar are installed on my system. I found somewhere that to start samba need to run "svcsadm start samba". But when I run "svcs -a | grep samba", i get :
legacy_run 13:10:57 lrc:/etc/rc3_d/S90samba
This means that samba can not managed by svcs.
I don't know if it has happened because I had tried to install samba from source available at samba.org, though I have uninstalled it. How can I get back to default samba of Solaris?

>But when I run "svcs -a | grep samba", i get :
>legacy_run 13:10:57 lrc:/etc/rc3_d/S90samba
>This means that samba can not managed by svcs.
Correct.

>How can I get back to default samba of Solaris?
First: run "pkgchk" on the sambe packages to see if it is indeed still present and uncorrupted. If corrupted, "pkgrm" and then "pkgadd". You will need to edit the configuration file in order to make it start the daemons. If the conf file is not there, the start script will run but not
start the daemons.

I got it working. Done the following:
1) created /etc/sfw/smb.conf ( based on example file /etc/sfw/smb.conf-example).
2)tested it with # testparam
3)created samba user # smbpasswd -a <user>
4) restarted samba service
# /etc/init.d/samba stop
# /etc/init.d/samba start
That’s it ...

9. How to change TIMEZONE under Open Solaris

A couple questions regarding time zones in Solaris 10. I know the time zone can be set via /etc/TIMEZONE which is a link it /etc/default/init, but what I am looking for is a command that can be used to set the time zone without having the user edit any files and also having to go to /usr/shares/lib/zoneinfo to find out what the proper path is for /etc/TIMEZONE. Does any such command exist?
Also, concerning the rtc command; is this a must to run on Soalris x86 and what is the benefit in doing so?
Last thing; once the time zone has been updated, is the only way to apply the update system wide is to reboot the server?

There is no command to set the timezone.

>Also, concerning the rtc command; is this a must to run on Soalris x86 and what is the benefit in doing so?
It sets the hardware clock to the appropriate local time; this is what typical PC OSes expect; useless when all you run on the PC is Solaris.

>Last thing; once the time zone has been updated, is the only way to apply the update system wide is to reboot the server?
When you change the timezone, you will need to reboot because $TZ is inherited from init.
If you feel you need to change the timezone often, I'd suggest setting it to "localtime" and use "zic -l" to change the localtime link.

Well, the current libc code will hardly ever re-read timezone files; but new processes will pick up a changed timezone.

10. IOCTL export up to 4k bytes only

I am using ioctl to get GLDv2 network driver information. I find there is a limitation in Solaris, ie. no matter how big the buffer provided by user application to the network driver, the driver can only use 4k bytes. I analyzed long time ago, and find there is a flag in the OS that set the default max trafer size to 4k. (I forgot the name of that flag now). Since I want to dump all internal registers and ring buffer information which can be well above 4k, is there any easy way to work around this limitation or use another method to let driver dump all the information to file so I can read later?

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: