Solaris 問答集

1. Q: Solaris 的系統配置文件一般在什麼地方?
A: 可以查看/etc/system文件,裏面有一些solaris啓動時默認加載的選項,包括
共享內存大小等的設置。

2. Q: 在solaris中,用戶默認的Shell在什麼文件中規定?
A: 可以查看/etc/passwd中,用戶默認的shell在這裏規定。

3. Q: 如果solaris不幸忘記了root密碼,如何解決?
A: 可以有如下兩種情況
1. 工作站只有root用戶,無其他用戶。
2. 工作站除了root用戶以外,還有其他的用戶

1. 如果連接了網絡,我們可以採用遠程緩衝溢出的方法,但是這樣的方法不屬
於“經典”方法,且有的遠程緩衝溢出具有一定的破壞性,不建議使用。還
有一種方法就是採用SUN公司自帶的光盤採取引導,建議採取這種方法:
1. boot cdrom -s
2. fsck /dev/dsk/c0t0d0s0 (取決於根分區的設備)
3. mount -F ufs /dev/dsk/c0t0d0s0 /mnt
4. TERM=ansi; export TERM
5. 編輯/mnt/etc shadow文件,把root對應的口令去掉。
6. 重啓後的root的口令爲空。

2. 如果還有普通用戶,方法可以採用本地緩衝溢出,這種方法雖然破壞性小,
但是也有損毀硬盤引導區的危險,建議採用“文件連接”錯誤是獲得root權
限,這種方法沒有什麼危險性。

4. Q: 有時候用vi編輯器的時候,顯示窗口過大,如何處理?
A: 只需要用鼠標拖曳終端窗口,使其縮小,即可解決。

5. Q: 共享內存大小如何設置?
A: 在system文件的最後一行加入Set shmsys:shminfo_shmmax=XXX
/etc/set shmsys:shminfo_shmmin=XXX
這裏的XXX是代表共享內存的大小。單位:字節
共享內存一般爲內存的一半
例如內存爲512M
設置應爲512/2*1024*1000=262144000

6. Q: root用戶的配置文件在什麼地方?
A: root用戶的配置文件和其他用戶的配置文件有些不同,它在/etc/profile文件
中規定。

7. Q: SUN solaris 在遠程X-win pro下無法以root進行登陸,如何解決?
A: 直接以root在終端上登錄的時候,執行/etc/default/login腳本。在這個腳本
中限制了在遠程終端上不能直接以用戶root登錄,如果想這樣,修改此腳本,
將下面這一行註釋掉即可
CONSOLE=/dev/console

8. Q: 在solaris下,如何查看網絡是否配置成功?
A: 可以採用命令Ifconfig -a來查看,如果網卡綁定ip成功,而不是顯示0.0.0.0
就證明網卡配置基本無誤,主要檢查網絡介質(網線,RJ45插頭...)是否損壞。

9. Q: 如果敲錯一個命令如何結束它呢?
A: solaris和SCO有少許不一樣,solaris可以採用ctrl+C來結束,而不是SCO的
ctrl+Del

10.Q: solaris的聯網中,網關如何配置?
A: solaris的網關設置和SCO的設置不一樣

SCO:
/etc/gateways
name1 gateway name2 metric value 
所有中間的很長的空均爲TAB
Net,host 表示路由指向是網絡還是主機,net和host是關鍵字
Name1 目的網絡名或主機名
Gateway 關鍵字
Name2 網關名或網關ip地址
Metric 關鍵字
Value 跳數
Passive 關鍵字,表示被動方式,路由器不叫換路由信息
Active 關鍵字,表示主動方式,路由器交換路由信息
External 關鍵字,表示外部方式,其他進程已安裝了路由
例如:
net 129.9 gateways 129.6.0.1 metric 1 passive
host 129.7.10.21 gateway 129.6.0.2 metric 1 passive

Solaris
爲defautrouter,只需要在裏面填入網關。

11.Q: 如何在網上安裝Solaris?
A: 假設SERVER IP爲10.11.41.10,hostname爲inssvr;CLIENT IP爲10.11.41.11
,hostname爲inscli。

在SERVER端執行以下步驟
條件:有340M的剩餘空間
1. 將Solaris 2.6的安裝盤插入CD-ROM
2. 將Solaris 2.6 CD-ROM的slice 0拷貝到硬盤
# cd /cdrom/sol_2_6_sparc_smcc_svr/s0/solaris_2.6/Tools
# ./setup_install_server /export/install
3. 編輯文件/export/autocfg/sysidcfg,以下是它的內容
#Sample sysidcfg file for SPARC systems
system_locale=en_US
timezone=GMT-8
timeserver=10.11.41.10
terminal=dtterm
name_service=NONE
root_password=...(取自/etc/shadow文件)
4. 編輯文件/etc/hosts,以下是它的內容
10.11.41.10 inssvr loghost
10.11.41.11 inscli
5. 增加安裝客戶
# cd /export/install
#./add_install_client -e CLIENT的以太網地址 -i CLIENT的IP地址 -s inssvr:/export/install -c inssvr:/export/autocfg -p inssvr:/export/autocfg inscli sun4u
在CLIENT端的OK提示符下執行
OK boot net - install
Solaris 7 for sparc與2.6的區別,7沒有默認的sysidcfg和autocfg目錄,需要自
己建立,而且OK boot net即可

12.Q: DHCP in Solaris8?
A: 1. # touch /etc/dhcp.hme0,hme0:請用相應的網卡設備名;
2. 修改/etc/init.d/network,/etc/init.d/inetsvc
先備份
# cp /etc/init.d/network /etc/init.d/network.org
# cp /etc/init.d/inetsvc /etc/init.d/inetsvc.org
修改/etc/init.d/network第278行:
/"dhcp/") #hostname=`/sbin/dhcpinfo Hostname`
hostname=`cat /etc/nodename`
修改/etc/init.d/inetsvc第168行:
hostname=`/sbin/dhcpinfo Hostname`
if [ -z /"$hostname/" ]; then
#hostname=/"unknown/"
hostname=`cat /etc/nodename`
fi

修改/etc/init.d/inetsvc第82行:

if [ /"$_INIT_NET_STRATEGY/" = /"dhcp/" ]; then
#dnsdomain=`/sbin/dhcpinfo DNSdmain`
dnsdomain=`cat /etc/defaultdomain`
else
dnsdomain=
fi

if [ -n /"$dnsdomain/" ]; then
#dnsservers=`/sbin/dhcpinfo DNSserv`
dnsservers=`cat /etc/dnsservers`

修改/etc/init.d/inetsvc第220行:
/usr/bin/mv /tmp/hosts_clear.$$ /tmp/hosts.$$
mydomain=`cat /etc/defaultdomain`
echo /"${ipaddr}//t${hostname}//t${hostname}.${mydomain}//t# Added by DHCP/" >>/tmp/hosts.$$

在/etc/init.d/inetsvc第一行加入如下語句:

if [ -f /etc/dhcp.*[0-9] ]; then
_INIT_NET_STRATEGY=/"dhcp/"
export _INIT_NET_STRATEGY
fi

3. 創建/etc/defaultdomain,內容爲huawei.com.cn
4. 創建/etc/nodename,內容爲你的機器名
5. 創建/etc/dnsservers:129.9.111.100 10.15.1.3

之所以要修改,究其原因我們的DHCP服務器支持的協議可能比較老,不能返回給
客戶端DNSdomain,DNSServer,Nodename;

13. Q:SUN上如何編譯動態庫?
A:
CC=cc
C++=CC +w
.SUFFIXES:.cpp
.cpp.o:
$(C++) -g -c -Kpic $<
liberrlog.so:ErrLog.o
ld -o liberrlog.so -G ErrLog.o

14. Q: 在sun工作站上安裝solaris軟件時沒有安裝網卡,安裝完成後應該修改那些文
件添加網卡?
A:

1. #reboot --r 或者ok boot -r
2. 在1.成功找到你新加的硬件之後,再執行相應的硬件設置命令,對網卡執行:
ifconfig hme0 [ipmask],其中hme0是你網卡的設備名,可以通過dmesg知
道你的網卡設備名.

15. Q: 如何設置DNS?
A: (1)/etc/nsswitch.conf的hosts解析加上nis或/和dns,內容如下
hosts: files dns
(2)設置到DNS服務器網關於/etc/defaultrouter,內容如下
10.11.43.254
(3)設置DNS服務器的IP地址/etc/resolv.conf,內容如下
nameserver 10.15.1.3
nameserver 129.9.111.100
domain huawei.com

16. Q: Ultra60工作站從外掛光驅啓動?
A: Ultra60 工作站缺省配置是內置光驅,用外掛光驅重新安裝Solars時,用boot
cdrom命令則不能從光驅啓動,屏幕上打印錯誤信息:Drive not found.
原因如下:由於Ultra60工作站缺省支持內置光驅,cdrom的缺省配置是內置光
驅的物理設備名。當使用外掛光驅時,當使用boot cdrom命令時,cdrom的替
換爲內置光驅的物理設備名。這就是不能從光驅啓動的原因。

解決辦法如下:
(1)stop+a命令

(2)在ok提示符下輸入:probe-scsi-all
則出現硬盤、光驅、磁帶機等設備的實際物理名。
如:/pci@1f,4000/scsi@3,1
cdrom

(3)在ok提示符下輸入:devalias
則出現硬盤、光驅、磁帶機等設備的缺省設置。
如:cdrom /pci@1f,4000/scsi@3/disk6,0:f
這是缺省配置,用boot cdorm命令時,cdrom被解釋爲
/pci@1f,4000/scsi@3/disk6,0:f
而/pci@1f,4000/scsi@3/disk6,0:f指示的是內置光驅的設備名,
因此不能從外掛光驅啓動!

(4)在ok提示符下輸入:boot /pci@1f,4000/scsi@3,1/disk6,0:f
說明:[boot後的參數參看(2)和(3)中的cdrom的設備名,由兩者組合而來
即可正確的從外掛光驅啓動。

17. Q: 一臺Sun Ultra80工作站安裝SunOS 5.6失敗,請問其原因以及如何避免?
A: 硬件環境爲Ultra-80/2CPU(450M)/1harddisk(18G)/2G Memory,從網絡啓動安
裝SunOS 5.6。安裝過程中途中斷並出現以下提示:
panic[CPU3]/thread=0x301bde80: CPU3 privileged UE Error: AFSR 0x00000000 80200000
AFAR 0x00000000 7c5e0190 SIMM U1302 U0302 U1301 U0301
syning file systems... [27[ 406 136 done
12535 static and sysmap kernel pages
50 dynamic kernel data pages
205 kernel pageable pages
0 segkmap kernel pages
0 segvn kernel pages
0 current user process pages
12790 total pages (12790 chunks)

dumping to vp 6145608c, offset: 3989467
panic[CPU3]/thread=0x30043e80: panic dump timeout
Dump Aborted
Type /'go/' to resume{3} ok
隨後輸入‘go/'或者‘boot -r’都無法使系統啓動,提示如下:

Can not open Kernel/unix
input filename [Kernel/unix]:

只有重新從網絡啓動。這是由於CPU硬件結構與Solaris系統不兼容造成的,
需要補丁。這個問題不僅僅是在Ultra80的機器上,如果Ultra60使用了SUN的
新推出的高速CPU(400M以上,一般爲450M)且操作系統爲Solaris 2.6或者
Solaris 2.5.1,也會出現類似問題。如果工作站使用的是這種高速CPU,在
隨新機器一起的附件中會有一本手冊:Installing Solaris 2.5.1 or 
Solaris 2.6 Software on 419+ MHz Systems,其中詳細描述瞭如何解決這
個問題(在zh-6頁)。另外,附件中還有一張補丁光盤,名字叫做:
Operating Environment Installation CD May 1999,此光盤專門用於解決
此問題.

18. Q :在solaris上如何進行數據的備份和恢復?
A: 備份整個文件系統,也稱作完全備份(full dump);在完全備份的基礎上備
份修改過的文件,稱作漸進備份(incremental dump);

ufsdump

ufsdump命令用於備份文件系統,可以完全備份也可以漸進備份。ufsdump命令的格式
爲:/usr/sbin/ufsdump [options] dump_device files_to_dump
options包括:
0-9:指定備份的級別。0爲最低,即完全備份;9爲最高。假設當前備份級別爲i,那
麼ufsdump命令在執行時將尋找最近一次級別等於i或小於i的備份,將以前備份過後修
改過的文件備份下來。例如,星期一執行了一次級別爲2的備份, 星期二執行了一次
級別爲4的備份,那麼當星期三執行級別爲3的備份時備份文件中將包括自星期一備份
以來所有修改過或新創建的文件。如果星期三執行級別爲4的備份,那麼備份文件中將
包括自星期二備份以來所有修改過或新創建的文件。
f:指定備份的設備,例如/dev/rmt/0;
u:更新備份記錄(/etc/dumpdates)。使用這一選項後ufsdump將創建或更新
/etc/dumpdates文件,文件內容包括文件系統名、備份級別、和備份時間,例如:
pioneer# ufsdump 0uf /tmp/ddd /dev/dsk/c0t0d0s0
DUMP: Writing 32 Kilobyte records
DUMP: Date of this level 0 dump: Mon Sep 07 22:37:16 1998
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t0d0s0 (pioneer:/) to /tmp/ddd.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 25234 blocks (12.32MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: 25214 blocks (12.31MB) on 1 volume at 1599 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Mon Sep 07 22:37:16 1998
pioneer# more /etc/dumpdates
/dev/rdsk/c0t0d0s0 0 Mon Sep 7 22:37:16 1998

備份前的準備工作

重新啓動系統到單用戶狀態,或將要備份的文件系統卸載下來。
通知所有用戶該文件系統不可用。
#wall
/export/home will be unavailable in two minutes, please log out
Press ctrl-D
對文件系統進行檢查(fsck)。

ufsdump

如前例所示。
如果使用漸進的備份方法,最後實現建立備份計劃,例如:

Sun Mon Tue Wed Thu Fri
Week1: Full 5 5 5 5 3
Week2: 5 5 5 5 3
Week3: 5 5 5 5 3
Week4: 5 5 5 5 3

上例中,每個月作一次完全備份,每個週末對每一週的改動作一次備份,每天的備份
只對當天的改動作備份。這樣作的目的是節省備份所用的空間。

ufsrestore

ufsrestore用於恢復使用ufsdump命令備份的文件系統。命令格式爲:
/usr/lib/fs/ufs/ufsrestore options [arguments] [filename ...]
options包括:
t:備份列表;
x:只恢復命令行中指定的文件;
r:恢復整個備份;
f:指定備份文件所在的設備或目錄;
v:verbose mode,列出備份文件的路徑。
例如:
對備份文件進行列表:
pioneer# ufsrestore tvf ddd
Verify volume and initialize maps
Media block size is 126
Extract directories from tape
Initialize symbol table.
Dump date: Mon Sep 07 22:37:16 1998
Dumped from: the epoch
Level 0 dump of / on pioneer:/dev/dsk/c0t0d0s0
Label: none
dir 2 .
dir 3 ./lost+found
dir 5696 ./usr
dir 11392 ./var
dir 5697 ./export
dir 11393 ./export/home
dir 5698 ./opt
leaf 4 ./bin
dir 11394 ./dev
dir 5699 ./dev/sad
leaf 5879 ./dev/sad/admin
leaf 5825 ./dev/sad/user
leaf 11592 ./dev/be
leaf 11496 ./dev/conslog
...
從備份中恢復指定文件:
pioneer# cd /tmp
pioneer# ufsrestore xvf ddd ./etc/passwd
Verify volume and initialize maps
Media block size is 126
Dump date: Mon Sep 07 22:37:16 1998
Dumped from: the epoch
Level 0 dump of / on pioneer:/dev/dsk/c0t0d0s0
Label: none
Extract directories from tape
Initialize symbol table.
Make node ./etc
Extract requested files
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume #: 1
extract file ./etc/passwd
Add links
Set directory mode, owner, and times.
set owner/mode for /'./'? [yn] n
執行該操作需要指定所要恢復的文件在備份文件中的位置。由於備份文件從卷1開始,
所以可以指定從卷1開始搜索。恢復整個文件系統下例將一個老的文件系統(/opt)移
到一個新的磁盤分區(/dev/rdsk/c0t3d0s5)中。首先,卸載老的文件系統並實施備
份:
#umount /opt
#fsck /opt
#ufsdump 0uf /dev/rmt/0 /opt
其次,生成新的文件系統,將其安裝到一個臨時目錄(/mnt),並實施恢復:
#newfs /dev/rdsk/c0t3d0s5
#fsck /dev/rdsk/c0t3d0s5
#mount /dev/dsk/c0t3d0s5 /mnt
#cd /mnt
#ufsrestore rvf /dev/rmt/0
#rm restoresymtable
最後,卸載新的文件系統,用fsck檢查其一致性。
#cd /
umount /mnt
#fsck /dev/rdsk/c0t3d0s5

選擇性備份,備份指定的文件和目錄;

tar

系統備份:tar -cvf 目標文件名/設備名 備份文件,例如:
tar -cvf backup.tar *
命令將當前目錄下的所有文件(包括各級子目錄)都打包在backup.tar文件中。
tar -cvf /dev/rmt/0 *
命令將當前目錄下的所有文件(包括各級子目錄)都打包到磁帶上。查看tar文件的內
容:tar tvf 目標文件名/設備名,例如:
tar -tvf backup.tar
tar -tvf /dev/rmt/0
將tar文件中的內容恢復到指定目錄中去:tar xvf 目標文件名/設備名 [目錄名],例
如:
tar -xvf backup.tar /home
tar -xvf /dev/rmt/0 /home
如果不指定目錄名則表示當前目錄。

19. Q: 如何在Soraris下面安裝ATM網卡?
A: 網卡型號:FORE PCA-200EUX/OC3
操作系統:Solaris 2.7
工作站:SUN Ultra60

一、硬件安裝
1、工作站關電後,將網卡妥善安裝在一個PCI插槽中;
2、工作站上電,按STOP and A中斷boot process,到ok提示符;
3、輸入命令show-devs,顯示系統配置,FORE網卡的device-pathname應出現在
配置列表中,形式可能如下:
/pci@1f,2000/FORE,PCA-200E@2
4、設備提供光口自環測試(media loopback)和內部自環測試(internal loopback),
供檢查設備及安裝是否完好。根據經驗用內部自環測試即可,方法:
輸入命令 test /pci@1f,2000/FORE,PCA-200E@2
待出現:pass 0 說明硬件及安裝都正確;
5、輸入boot命令 ,啓動系統。
二、軟件安裝
1、軟件安裝需要root權限;
2、網卡支撐軟件一般是一個.tar文件提供,解開後在其目錄下有8個子目錄,分
別爲:
FORECore ForeThought ATM Core Software
FOREDrv ForeThought ATM Card Drivers
FORESpans ForeThought SPANS Signalling Software
FOREUni ForeThought UNI Signalling Software
FOREclip ForeThought Classical IP Software
FOREip ForeThought FORE IP Software
FOREmpoa ForeThought MPOA / LAN Emulation Software
FORExti ForeThought XTI Application Programming Interface
3、例如.tar文件解開後在/home/FORE下,則該目錄下就有上述8個子目錄,我們要
用的程序在FOREDrv、FOREip下,但各個模塊之間有一定的依賴關係,需要安裝的模塊
有6個: FORECore、FORESpans、FOREDrv、FOREip、FOREUni、FOREclip。安裝過程:

> pkgadd -d /home/FORE
The following packages are available:
1 FORECore ForeThought ATM Core Software
.........(sparc) 5.1
2 FOREDrv ForeThought ATM Card Drivers
.........(sparc) 5.1
3 FORESpans ForeThought SPANS Signalling Software
.........(sparc) 5.1
4 FOREUni ForeThought UNI Signalling Software
.........(sparc) 5.1
5 FOREclip ForeThought Classical IP Software
.........(sparc) 5.1
6 FOREip ForeThought FORE IP Software
.........(sparc) 5.1
7 FOREmpoa ForeThought MPOA / LAN Emulation Software
.........(sparc) 5.1
8 FORExti ForeThought XTI Application Programming Interface

Select package(s) you wish to process (or /'all/' to process all packages).
(default: all) [?,??,q]:
選擇要安裝的模塊,根據提示安裝。
4、安裝後的軟件在/opt/FOREatm /bin (使用的配置命令所在目錄)
/conf
/examples
/include
/lib
/man
三、網卡配置
1、網絡接口名配置
>configure_atm
選擇配置ip模塊,得到一個ip interface名,默認爲fa0。重啓工作站,可以看到在
/dev下有fa0接口,而網卡的設備名爲fatm0。
2、>adinfo fatm0 可查詢設備硬件信息
>adconfig fatm0 可進行設備配置
>adstat fatm0 可查詢設備狀態
這三個命令較少用到。
3、接口ip地址配置
ifconfig fa0 netmask broadcast up
4、IPOA配置
atmarp -s hostname device vpi vci aal encapsulation(outgoing PVC配置)
atmarp -l device vpi vci aal encapsulation (incoming PVC配置)
例:分配給工作站的pvc爲 vpi 0 vci 150
工作站的IPOA地址爲200.200.200.101
MUSA設備的IPOA地址爲201.200.200.100
AAL類型爲5
encapsulation 爲llc_routed
>atmarp -s 201.200.200.100 fa0 0 150 5 llc_routed
>atmarp -l fa0 0 150 5 llc_routed
[在MUSA設備上要做:add nms、act nms、add route、add atm arp、add ipaccess]
>ping 200.200.200.101 如果ping通,則已配置成功。

20. Q: 在哪裏能得到有關Solaris的較全面的文檔?
A: http://docs.sun.com

21 .Q: 請教sun小型機上的路由跟蹤命令是什麼?(HP上是traceroute)謝謝!
A:這個命令也是traceroute.在/usr/sbin目錄下.

22. Q: 一個GUI程序,在換個不同的SUN環境時界面就變的難看了,主要是字體影響
(還有其它影響麼?)SUN 的字體都有哪些,如
-sun-screen-bold-r-normal--14-140-72-72-m-90-iso8859-1
都有哪些可選?
A: If a font can not be found in the system, the system will select 
another font which might be not so elegent as you expect. The 
correct way is to insure the font you want is correctly installed in 
system. In solaris answer book, there is a perfect reference talking 
about the font administration /"font administration/" in System 
Administration Vol1. You can get solaris answer book by accessing 
sunlibrary.huawei.com. Chen Zhexue(4924)is responsible for maintain. 
it.

23 Q: Solaris啓動過程是如何的?啓動的時候讀那些文件啓動一些服務比如我要在系
統啓動的時候自動啓動Apache(httpd)服務,應該在哪個文件裏面配?
A: Solaris的啓動是典型的ATT UNIX啓動過程, 在普通的UNIX書記和SUN公司的文
檔中都有詳細的介紹,這裏就不詳談了. 要點室內核引導後啓動init進程, init
按照/etc/inittab 的控制加載各子系統, 一般是執行 /etc/rc* 之類的腳本.
這些腳本再執行 /etc/rc*.d/ 下的腳本,其中 /etc/rc2.d/S72inetsvc 運行
inetd, 該後臺進程根據/etc/inetd.conf 控制網絡服務,所以要自動啓動
Apache,需要在inetd.conf 中修改或增加 80 端口的啓動命令。(如果不是用80
,還要修改/etc/services文件)

24 Q: 有一個問題要請教一下,謝謝!
一臺SUN服務器,更換IP地址。
原來地址爲10.11.43.137,現在更換爲10.108.22.247

我的操作步驟如下:
1:修改/etc/hosts文件,修改後的文件內容如下:
127.0.0.1 localhost
10.108.22.247 westsnow loghost SYBASE
10.109.22.247 eastsnow
/etc/hostname.hme0文件內容:
westsnow
/etc/hostname.hme0:1文件內容:
eastsnow
2:修改/etc/netmasks文件,修改後的文件內容如下:
10.0.0.0 255.255.0.0
3:修改網關/etc/defaultrouter文件,修改後的文件內容如下:
10.108.22.1

按照上面步驟修改完後REBOOT機器,啓動過程中沒有任何異常,但是機器啓動
後和別的機器連不上,而且連網關都 PING 不通,請問是什麼原因?謝謝!
A: /etc/hostname.hme0:1 中應當寫你想用的IP地址,而不是機器名. 如果只改IP
地址,就不需要這個文件.

25 Q: UTF-8和US-ASCII之間的區別在那裏?請舉例說明。
A: UTF-8 包括 US-ASCII 和多字節編碼。與普通的多字節編碼不同,UTF-8的字節
長度不固定,對於ASCII, 字節長度爲1, 對於中文,阿拉伯文等,可以是2,3或更
多字節,這樣能有效節省存儲空間. 它還與很多傳統編碼標準兼容,所以很受歡
迎.

26 Q: 如何在腳本里實現修改用戶口令?
A: 由於修改口令需要從終端讀取用戶口令,所以不能用重定向的辦法,但可以採用 
expect 之類的工具,這些工具建立一個僞終端來模擬輸入, 所以起到用腳本控
制終端的效果.

27 Q: 我在用EXCEED連到工作站時,開了一個root權限term,網絡突然中斷,請問如
何能夠kill該term的進程?
A: 用xkill 連dtterm 一起殺掉。在桌面上是可以的,在exceed 中不知是否可以。

28 Q: 在Solaris下可用什麼命令查看system software info?
A: 用/usr/bin/pkginfo .
或者 /usr/bin/prodreg,有圖形界面將註冊過的產品顯示成樹的形狀.

29 Q: 請問:在SOLARIS 8 中,用什麼命令看port id?
A: 我曾就這個問題問過不少人, 有的說 fuser 可以做,但我查 fuser 的手冊
沒有見到相關選項。lsof 是一個比較理想的工具,可以從sunfreeware.com下
載。還有一個簡單的辦法是這樣的:
/usr/proc/bin/pfiles /proc/* > result.txt
在到result.txt 中搜索相應 socket port. 也可以自己用awk 過濾 pfiles 的
結果

30 Q: 使用FTP時,不能以root用戶登錄系統,應修改什麼配置文件?
A: 看一下 /etc/ftpusers ,如果有root, 刪掉就可以了。

31 Q: 我們的系統需要計算solaris的負載,可以使用uptime輸出的load average嗎,
如果不用uptime,使用libkstat的load average可以嗎?
A: 可以.

32 Q: 請問uptime的load average 是如何計算出來的?
A: 這個問題滿複雜的,我們知道, unix內核裏有許多種結構,如 user,proc等,
有的還mount到 文件系統中 ,比如 /proc /dev/kstat /dev/ksysm, uptime,
kstat,sar ,vmstat, prstat 等命令都是通過分析這些結構來進行計算的有
一個系統函數叫getloadavg ,uptime 就是直接調用這個函數的,你也可以試試.

33 Q: 如何得到和設置操作系統內核參數。
A: 通常,這些參數在 /etc/system 中配置。

34 Q: 如何得到系統當前動態運行指標,如CPU佔有率、IO量、硬盤剩餘空間等。
A: 檢查的命令則有許多,可用 vmstat 和 sar 命令,還有iostat ,df ,du 用
於檢查磁盤的情況。

35 Q: How can I get a Workshop6/'s licence?
A: get a new one from www.sun.com and install it again.
URL is http://www.sun.com/forte/cplusplus/buy.html
cp licence-file install_dir/SUNWspro/licencse_dir/sunpro.lic,node

36 Q: 請問能否在一個slice裏掛兩個文件系統?
A: 不可以.

37 Q: 請問修改了/etc/nodename後,UNIX工作站啓動不了,該如何是好?
A: 單純修改nodename 不夠,還應修改 /etc/net/*/hosts

38 Q: Solaris的/usr/lib/dmi/snmpXdmid是幹什麼用的?
A: Sun Solstice Enterprise SNMP-DMI mapper subagent
man snmpXdmid 可得.

39 Q: 我的工作站上沒有光驅,想通過遠程安裝,可否?
A: 可以,有兩種方式:
1。 將 solaris 光盤內容以 ftp 上傳,本地安裝
2。 做一個install server ,遠程直接安裝。
3. 用remote光驅安裝

(在remote機器)
# ps -ef | grep nfsd
# mkdir /dummy
# vi /etc/dfs/dfstab (share -F nfs -o ro /dummy)
# eject cdrom0
# chmod 644 /etc/rmmount.conf
# vi /etc/rmmount (share cdrom*)
# chmod 444 /etc/rmmount.conf
# (Load a CD.) share
- /dummy ro /"/"
- /cdrom/sol_7_sparc/s5 ro /"/"

(在本地)
$ showmount -e starbug
# mount -F nfs -o ro starbug:/cdrom/sol_8_sparc /cdrom
$ ls /cdrom



40 Q: 我們想了解一下SUN公司年機器在並行程序運算方面的能力和相應的平臺。
A: 您知道,SUN公司在SMP技術上居於領導地位,所設計的體系結構具有良好的可
擴展性。只對硬件升級,不改動代碼,往往就可以得到接近線性增長的性能,
如果有開發工具的幫助,會取得更好的效果,sun公司提供的 Forte C/C++ 
workshop 包含許多工具幫助開發者分析軟件性能病進行優化,Solaris也包含專
門的庫函數以提高計算效率,SUN公司有一本白皮書專門介紹高性能計算 您可
以從 docs.sun.com 得到.書的名字叫: UltraConputing:How to Achieve Peak 
Performance from Solaris Applications..

41 Q: 我在/etc/skel/local.profile作的環境變量的修改但沒有在新增用戶時候得到
驗證,爲什麼?這不是一個模板嗎?(用EXIT退出窗口, 再用新用戶登錄)
A: 如果是從終端登錄,.profile 會起作用,但如果從CDE 登錄,則系統執行 
.dtprofile,要想執行 .profile, 還要修改 .dtprofile一般情況下,如果想設
置一個環境變量使其對所有用戶生效,可以修改 /etc/profile

42 Q: /etc/system 文件中的namespace指的是什麼,與Modules有何關係?system文
件中哪些參數將對機器性能有較大影響?
A: 所有的手冊都警告說修改system文件應當慎重,事實上,也只有在安裝數據庫,
增加新的設備時,纔有可能需要修改此文件.所改的參數,也就是你附件中改過的
那幾個線程數,信號量之類的. 修改參數值,會影響整個系統的開銷,因爲這些值
所涉及的空間分配是在系統啓動時進行的namespace用於對modules分類, 說明
中指出了目前支持的幾種namespace,用戶不能增加新的種類.

43 Q: I am a programer work with SUN C++. Can I use STL(stand template 
library) in program. I can/'t find any help in SUN C++/'s 
document.Thank you.
A: Sun 的 C/C++ WorkShop 中的C++ 類庫好像包含 STL, 可以參考一下.
docs.sun.com 上有完整的文檔,可以參考一下.

44 Q: 原來的系統中/usr與 / 在同一個硬盤分區上,由於安裝了許多軟件,此分區已滿
,現在系統增加了硬盤,如何將/usr 目錄挪到新的硬盤上?
A: 1.在新的硬盤上將文件系統建好,
2.mv /usr /usr.bak
3.mkdir /usr
4.mount newdriverpath /usr
5.cp -r /usr.bak /usr
6.修改/etc/vfstab 文件.

45 Q: 運行下面這段程序並用vmstat觀察內存的使用情況:
int main(){
int *p[100];
int c;
printf(/"before new!/");
c=getc(stdin);
for(int i=0;i<100;i++)
p[i]=(int *)malloc(sizeof(int)*32000);
printf(/"after new!/");
//1.....
c=getc(stdin);
for(int i=0;i<100;i++)
free((void *)p[i]);
printf(/"after delete!/");
//2......
c=getc(stdin);
return 0;
}
發現在 2 處系統的空閒內存塊並沒有增加,free調用到底有沒有釋放內存?
A: malloc 調用引起進程堆空間增長,但free調用不會導致該堆空間立即縮小,
系統只是簡單記錄這一變化,就繼續運行程序,只有系統出現內存短缺時,
系統才收集這些內存塊重新分配,這樣實現是爲了減少系統開銷,提高效率.

46 Q: 請問在kstat的輸出中,類似avenrun_15min這種內核動態參數有沒有介紹材料?
A: 通常, kstat輸出的是內核模塊中的一些鏈表或數組,按照SUN公司的文檔,這些
輸出結果是自解釋型的,根據他們的名字就可以猜到其含義.但實際上並不是這
樣.這些鏈表中包含的結構是在下的一些頭文件中定義的,比如
kmem_cache模塊的結構由kmem_impl.h定義,hme模塊的結構由hme.h定義,等等.
翻看這些頭文件,可以得到稍微詳細一點的資料. 參數名字通常與某結構的成員
變量同名,頭文件中由簡單的註釋指出其作用. 比如:hme模塊輸出中包含如下字
段:
brdcstrcv 1094670
我們就可以查hme.h,hme.h中有一個很大的結構:hme, 其中有:
uint32_t hme_brdcstrcv; /* # broadcast packets received */


47 Q: 1.問題描述:Router&LanSwitch的日誌管理依賴系統的syslogd進程來實現。
通過設置/etc/syslog.conf文件, 可以控制syslogd把日誌存入特定的文本
文件中。然後日誌後臺就可以週期性的輪詢這些文件並導入數據庫。按照sun
的man頁說明,當向syslogd進程發HUP信號時,進程將重讀配置文件
/etc/syslog.conf,然後繼續運行。 但在Solaris2.7以下實際的效果是:發
HUP信號將導致syslogd進程不能正常工作(有的試驗結果是,信號導致進程
終止),後續設備日誌全部丟失。
2.解決建議:
我們的建議是,修改系統的腳本文件/usr/lib/newsyslog,不讓其向syslogd
發HUP信號,而是TERM(終止信號),然後重啓。此種方法的弊端是,如果用
戶主動向進程發HUP信號,仍然存在問題。而且也不能解決syslogd意外退出
的情況。第二種建議是由綜合統一做一個檢測進程,這樣各項目就不會產生
衝突。但仍然存在用戶主動向進程發HUP信號使syslogd失效的問題。由上述
可以看出,無論何種方法,都不能徹底解決問題。
A: 問題的產生可能是由於程序員定義了新的日誌文件並企圖 使用newsyslog 腳
本來處理,這個腳本備份日誌文件再發送 HUP信號。newsyslog 腳本在處理系
統文件時不會有問題,很可能是由於syslogd對這些文件做過專門的處理。但
不能認爲我們自己的文件也會得到同樣的照顧,事實上,這樣做通常是危險
的。 我認爲建議2 是可行的, 因syslogd打開的是新的日誌文件,不會發
生異常。而用戶發送的 HUP 命令只是使 syslogd重讀 syslog.conf 文件
,也不會發生意外.爲了比較好的定位問題,建議在一個比較乾淨的系統上進
行測試,在測試之前最好停掉自己的程序,

簡化/etc/syslog.conf,我是這樣測試的:

# /usr/lib/newsyslog
# logger -p deamon.notice /"12345/"
# cat /var/adm/messages

# kill -HUP `cat /etc/syslog.id`
# logger -p deamon.notice /"aaaa/"
# cat /var/adm/messages

結果正常.

48 Q: Solaris 8中,爲什麼不可以用如下命令給網卡增加邏輯地址?
ifconfig hme0:1 xxx.xxx.xxx.xxx up
A: Solaris 8 對ifconfig 作了一些改動,在這個命令之前,先執行下面的命令就可
以了: ifconfig hme0:1 plumb

49 Q: 爲什麼Solaris 中的多個網卡顯示的以太網地址都是一樣的?
A: 缺省情況下,系統使用本機的MAC地址作爲各網卡的MAC地址,可以用如下
OpenBoot 命令讓系統使用網卡自帶的MAC地址.
ok setenv local-mac-address? true

50 Q: 如何在一臺機器裏如何實現用多塊網卡容錯?
A: Solaris8 新增了一個daemon叫mpathd將網卡管理分組管理來完成這樣的功能.
原理是給每個網卡分配兩個地址,多出的一個邏輯IP地址由mpathd用來檢查個網
卡的工作情況.下面一兩塊網卡爲例介紹配置過程,這裏兩塊網卡分別是hme0和
hme1,
1. ifconfig hme0 group test
ifconfig hme1 group test
2. ifconfig hme0 addif 19.16.85.21 netmask + broadcast + -failover deprecated up
ifconfig hme1 addif 19.16.85.22 netmask + broadcast + -failover deprecated up
3. 檢查hme0:1和hme1:1看是否有邏輯IP
ifconfig hme0:1
ifconfig hme1:1
這裏要注意,給網卡增加的邏輯IP應當與實際分配的IP地址在同一個網段並
且不能與網上其他主機IP地址衝突.

51 Q: 一個進程裏最多可以打開多少文件?
A: 操作系統爲每個進程維護一個所打開文件的數組,進程能夠打開的文件與此數組
的大小有關.此數組的大小由兩個系統變量限制: rlim_fd_max , rlim_fd_cur,
這兩個變量可以用limit或ulimit 命令察看和修改,要擴大rlim_fd_max需要
root權限,rlim_fd_cur不能超過rlim_fd_max. 編程時則有庫函數 getrlimit 
和 setrlimit 可以使用. 另外一種改法是在 /etc/system文件中修改. 如果是
調用stdio函數打開文件,則還有另外一種限制,32位內核Solaris 的 FILE 結構
中的 文件句柄是一個字節,所以同時打開文件的上限是256

52 Q: 如何改變登錄CDE時的語言環境?
A: 修改/usr/dt/config/Xconfig文件中的變量 Dtlogin*language即可.

53 Q: 如何防止用戶通過CDE 環境中的 suspend 菜單關閉計算機?
A: 修改 /usr/openwin/bin/sys-suspend的執行權限就可以了.

54 Q: 我安裝完solaris5.7之後(安裝時選擇簡體中文),運行C語言編譯器cc不成功
,提示“language optional software package not installed.”。請問這是
怎麼回事,該如何解決?
A: Solaris本身帶有adb,mdb,make工具,但不帶C語言編譯器.若要使用需要單獨購
買軟件包及license.

55 Q: 想修改ROOT的缺省PATH,在哪改?不要告訴我LOCAL.PROFILE,不管用.
A: 如果以root用戶身份登錄或者用 su - 命令進行切換,則修改 home目錄下
.profile是管用的. 如果是簡單的 用 su 進行切換, 則系統保留除 PATH之外
的所有環境變量, PATH被設爲 /etc/default/su 中的 SUPATH ,缺省時爲
/usr/sbin:/usr/bin

56 Q: 問一下,現在在Solaris下有什麼比較好的測試程序語句以及條件覆蓋率的工具
A: prof 和 gprof 都有. 如果您使用workshop 或者 Forte 6.0,則其中有
performence analysis tools 可以使用.

57 Q: 怎麼樣讓系統啓動時就自動在一個網卡上綁定兩個IP地址
A: 創建文件 /etc/hostname.hme0:1,其中寫上第二個ip地址.

58 Q: Sun solaris7系統中有一下幾種SHELL,sh,csh,ksh,另外還有一個jsh.
我的問題是:jsh是什麼SHELL?另外有bash SHELL嗎?
A: jsh 就是 sh, 只不過是激活了job control 模式. 但現在 sh 本身就有job
control 功能,所以只用 sh 就可以了. bash 是 sh 的增強, 如果你的系統沒
有這個shell, 可以到 www.sunfreeware.com 下載.
ls /bin/*sh 可以看到系統所有存在的shell.

59 Q: 我的光驅無法讀取光盤?且總是顯示設備忙,如何搞定?mount顯示沒有被
mount.
A: 查找進程 vold 並將其殺死,就可以手工打開光驅.

60 Q: 如何將root用戶的shell改掉,我知道一般用戶可在admintool下修改,但root
用戶不能。
A: 1. chmod 666 /etc/passwd (一定要讓普通用戶有些權限,切記!)
2. vi /etc/passwd(最後一個字段試root 的 shell,要確保該程序存在方可改
掉它. 

61 Q: 我在安裝Solaris 8時啓用了DHCP,現在我的主機名是unknown,在啓動時工作
站啓用DHCP並分配IP,主機名也自動改爲unknow。請問怎樣改主機名?
A: DHCP in Solaris8
1. # touch /etc/dhcp.hme0,hme0:請用相應的網卡設備名;
2. 修改/etc/init.d/network,/etc/init.d/inetsvc
先備份
# cp /etc/init.d/network /etc/init.d/network.org
# cp /etc/init.d/inetsvc /etc/init.d/inetsvc.org
修改/etc/init.d/network第278行:
/"dhcp/") #hostname=`/sbin/dhcpinfo Hostname`
hostname=`cat /etc/nodename`
修改/etc/init.d/inetsvc第168行:
hostname=`/sbin/dhcpinfo Hostname`
if [ -z /"$hostname/" ]; then
#hostname=/"unknown/"
hostname=`cat /etc/nodename`
fi
修改/etc/init.d/inetsvc第82行:
if [ /"$_INIT_NET_STRATEGY/" = /"dhcp/" ]; then
#dnsdomain=`/sbin/dhcpinfo DNSdmain`
dnsdomain=`cat /etc/defaultdomain`
else
dnsdomain=
fi
if [ -n /"$dnsdomain/" ]; then
#dnsservers=`/sbin/dhcpinfo DNSserv`
dnsservers=`cat /etc/dnsservers`
修改/etc/init.d/inetsvc第220行:
/usr/bin/mv /tmp/hosts_clear.$$ /tmp/hosts.$$
mydomain=`cat /etc/defaultdomain`
echo /"${ipaddr}//t${hostname}//t${hostname}.${mydomain}//t# Added by DHCP/" >>/tmp/hosts.$$
在/etc/init.d/inetsvc第一行加入如下語句:
if [ -f /etc/dhcp.*[0-9] ]; then
_INIT_NET_STRATEGY=/"dhcp/"
export _INIT_NET_STRATEGY
fi
3.創建/etc/defaultdomain,內容爲huawei.com.cn
4.創建/etc/nodename,內容爲你的機器名
5.創建/etc/dnsservers:129.9.111.100 10.15.1.3

62 Q: 我用msgget建一消息隊列:
ret = msgget(IPC_PRIVATE, (0660)|IPC_CREAT);
在一個線程用msgsnd發消息,另一個msgrcv收:
ulReturnCode = msgsnd( QueueID, pBufferAddr, 8 ,IPC_NOWAIT);
當消息隊列中的消息個數等於40時(每個消息尺寸爲8字節),msgsnd函數返
回-1,errno= 11,請問是什麼原因。是消息隊列滿嗎?怎樣調整系統參數,使
消息隊列能大些。
A: msgmap : 100 maximum size of resource map for messages
msgmax : 2048 maximum size ,in byte, of a massages
msgmnb: 4096 maximum number of bytes on a message queue.
msgmni: 50 maximum size of message queue identifiers.
msgssi: 8 message segment size.
msgtql: 40 maximum number of message headers
msgseg: 1024 maximum number of message segments.

msgseg 最大爲 32k, 其他參數最大值都是 2 billion.

63 Q: license server 如何啓動?
A: run /opt/SUNWste/bin/lmgrd.ste 可啓動 license server

64 Q: 在Solaris8下,如何修改一個目錄的大小。安裝時系統自動的設置
/export/home目錄空間很大,而其他目錄空間很小。
A: 1, 備份 /export/home,
2. umount /export/home,
3. 用 format 修改盤片大小,
4. 備份要增大的目錄,
5, umount
5. 用 format 增加盤片大小.
6. 重新mount.

65 Q: 請問用什麼命令可以確定是否有磁帶設備?多謝。
A: 看一下 /dev/rmt 如果是空就沒有.
.
66 Q: 在solaris 8下安裝Forte Developer 6 到達:
installing Forte C++ Entep Ed 6/SPARC
installing Forte Developer 6
時死掉應如何解決
A: 在安裝之前,應當清除所有以前安裝時添加進系統的package.
另外,不用缺省目錄 /opt , 換一個新建的空目錄也有效.

67 Q: Forte c/c++版本可以用在solaris2.6操作系統上嗎?
A: 可以

68 Q: 在輸入用戶名後啓動很慢,有時甚至進不了,停在啓動畫面,不知如何解決(我用
過fsck,也不好使,有沒有更好的辦法)!能否重裝操作系統,而不影響現有的已裝
軟件.謝謝!
A: 一般說來, 這與家目錄下配置文件有關.新建一個用戶試一試.

69 Q: 現在遠程維護的解決方式是通過Modem撥號,建立連接,通過我們自己編寫的IP
代理轉發程序,完成對傳輸設備遠程維護。在PC機上的撥號網絡,撥號程序運
行都比較正常,對連接速度,穩定性方面目前使用還算可以。但是在設置Sun工
作站的撥號程序的時候,我常常會遇到一些“奇怪”的問題, 比如Modem不握
手,沒有撥號音等。現在我們的撥號設置是自己編寫的腳本文件方式。可能對
各種情況考慮的不全面,因此請問是否有相應的軟件包(程序)可以幫助我們
機型撥號設置,保證撥號成功?
A. 連接失敗通常與配置參數有關,由於硬件種類繁多,很難保證一個程序在所有的
硬件環境下都能順利配置成功.我們只能針對具體情況進行分析.但我們發現,改
變串口的流倥方式經常有助於問題的解決.Sun solstice 中有一個撥號軟件據
說比aspppd 更容易使用,我沒有用過,或許您願意試一試?

70 Q: 我這多線程程序,我用ftime得到函數的調用時間,發現在一個線程中,增加一
個printf後,調用時間爲5毫秒。去掉這個printf,調用時間卻爲15毫秒。增加
了一個printf爲什麼後使該函數的執行更快了?
A: ftime 得到系統當前時間,但具體到線程的執行時間,是和系統的調度情況有關
的, 請用調試工具來檢查準確的執行時間.

71 Q: 我們的技術支持人員遇到一個問題,向您請教:在安裝時沒有選擇安裝網絡,
現在需要安裝網絡,怎樣增加一個interface。目前只有lo0,沒有hme0。
A: 在 /etc 下 touch 一個空文件 hostname.hme0, 用 boot -r 命令重起.

72 Q: 在Sun Ultra 5工作站(安裝SOLARIS 2.6),每次開機時,都出現以下問題:
Restoring the system.Please Wait ... cpr_read_bitmap:Can/'t
cpr_alloc bitmap0
Can/'t read statefile bitmap,please reboot
Program terminated
{0} OK

每次開機都需要boot才能進入。
請問如何解決?
A: 首先, 在 ok 狀態下檢查 boot-file 參數:
printenv boot-file
如果是 boot-file = -F cprboot 之類, 用如下命令:
set-default boot-file
再檢查一下.應該是空纔對.
如果不是, 則需要設置:
setenv boot-file -F ufsboot
重新啓動.

73 Q: 經實驗,兩臺Sun工作站之間通過網絡發Syslog日誌,也不支持漢字,該問題可
能是syslogd的問題。
A: 估計是由於syslogd在望上傳輸時丟掉了字節的最高位.

74 Q: 如果需要ID:105181-15的patch,請問ID:105181-19可以代替嗎?ID毫最好兩位
是不是patch的版本號,如果是版本號有沒有前項兼容性?
A: 可以, 後兩位表示同一patch的版本號.

75 Q: 以下代碼在Forte C++下導致編譯錯誤,請問如何解決?

template
void testimpl(int i1, int i2, p1* n1 = 0, p2* n2 = 0)
{
p1* pReq = new p1;
p2* pRsp = new p2;
}
void test()
{
int i = 0;
int j = 0;
testimpl( i, j);
}
A: 請下載新的patch更新Forte C++

76 Q: 請問:如何設置工作站的最大客戶端數?現有一臺測試用機,使用人較多,經
常出現“無法得到pty”的提示。
A: 在/etc/system ,可以用參數 maxusers 設置,最大2048,如果這裏沒有設置,默
認爲與系統內存容量相同(以M記,最大爲1024),

77 Q: I install visibroker into my solaris 2.7.
When I execute a example program,it cannot execute and tell me:
ld.so.1: Server: 致命的: liborb64r_so:打開失敗:無此文件或目錄
被殺掉

(Server is my program)
Can you tell me how to settle it?

A: you should set this envirnment variable: LD_LIBRARY_PATH

78 Q: 貴處有無磁帶機的使用手冊或指導說明?
A: answerbook 中系統管理員手冊 I 有使用說明.
answerbook 的文檔不是html格式,需要一個服務器程序轉換, 察看本機http進
程看有沒有下面這個:

# ps -ef |grep http
# /usr/lib/ab2/dweb/sunos5/bin/dwhttpd /usr/lib/ab2/dweb/data

79 Q: 在 solaris 2.5.1 上 把 系統時間 改爲 2004 年,無問題,然後把時間再改回
來後,整個UNIX 死機,請SUN工程師答覆. 具體操作爲: 將操作系統時間設爲
2004年3月1日,然後再將操作系統時間改回當前的時間,則系統的cpu資源被兩個
進程dtwm,dtfile嚴重佔用,X Window反應非常緩慢,在低配置的系統上導致系統
不可操作.同時顯示 /"Warning:selected failed;error code 22.
A: 在窗口環境下或多用戶模式下來回切換時間,會導致不可預測的結果,所以,
如果當真要執行此類操作,請在單用戶模式下進行.

80 Q: shell 文件中如何從文件中讀參數?
A: cat yourfile`

81 Q: 如何分析網絡負載,在SUN上面有沒有相應的工具
A: netstat -i

82 Q: 請問目前SUN E250,E450,E3500支持的CPU主頻和緩存分別是多少?您能將這
些配置列表發給我嗎?
A: docs.sun.com 有 硬件的answerbook ,可以參考一下。
現在支持的CPU到400M, 480M 產品已有.but still have not released

83 Q: mt -f /dev/rmt/0 有個參數:retension中文爲“拉緊”,在磁帶操作中具體
做什麼?
A: the man page of this command said it clearly:
Rewind the cartridge tape completely, then wind it
forward to the end of the reel and back to beginning-
of-tape to smooth out tape tension.
so ,it is not 拉緊, but 放鬆 instead.

84 Q: 具體問題是:有一個進程不停的向該文件增加內容,同時另外一個進程建立了
與該文件的管道,從該文件中讀取一行記錄進行處理。然後刪除該行記錄。因
此需要保持該文件i-node不能改變,否則,向該文件寫的進程就不能將信息寫
入該文件了。有沒有解決方法,請指教。
A: I don/'t know if I have understood you :
If you want save this file for later use, you should not remove its/'
content,if you don/'t need these content, you don/'t need this file as 
well, you can use pipe only, or other interprocess communication 
methods.

85 Q: 我用dos2unix轉換一文件,卻不成功,提示信息如下:(我用PC機通過rexec遠
程登陸的)
$dos2unix filename1 filename2
could not open /dev/kbd to get keyboard type US keyboard assumed
could not get keyboard tyep US keyboard assumed

請問此問題是怎麼回事?如何解決?
A: 權限問題, 檢查一下 /dev/kbd 讀寫權限

86 Q: 我希望在一臺ultra機器爲以下網絡配置路由
子網:10.1.0.0
掩碼:255.255.0.0
網關:10.220.10.113
應該如何配置?
用以下命令可以嗎?如果永久配置需要修改那些文件?
%route add 10.1.0.0 10.220.10.113
A: no,try this commond:
#route add default 10.220.10.113

87 Q: 有個patch 107311-09,能解決CC4.2不能處理#pragma pack()的問題嗎?
A: the right patch is 104631, but you should add all related patch
to avoid other problem,find them at: sunsolve.sun.com

88 Q: 在CSH下我輸入以下命令?
$setenv IWAVE /'pwd/'
$echo $IWAVE
結果顯示爲:pwd
在我的理解中應該是將pwd的輸出(如/tmp)賦值給變量IWAVE,所以我想象的
輸出是/tmp
A: use ` instead /' apparently,they are different. read some unix books
for reference

89 Q: 爲什麼有時普通用戶不能登錄CDE?
A: 這個錯誤可能是由於CDE的不正確設置造成的。在每一個用戶的home目錄下有一
個.dt子目錄.在此目錄下有一個errorlog文件記錄了CDE登錄失敗的原因.查
看此文件可以找到失敗的原因.一個可行的方法是:使用root登錄並且刪除對
應用戶home目錄下的.dt目錄,同時可以刪除/.dtprofile文件, 然後使用
用戶口令登錄即可.外檢查/usr/dt/bin/dtsessoin的使用權限.正確的權限應
當是-r-sr-xr-x

90 Q: 關於Solaris8上DHCP的配置問題安裝Solaris8後,進程dhcpagent的CPU佔用率一
直都超過88%, 請問有什麼方法可以解決.謝謝.
A: I solve this program by going to the field sit.
The update period parameter can not be set longer than 2 weeks in the 
DHCP server side.

91 Q(1)能否在Ultra60上只安裝64位的Solaris8?
(2) Solaris8安裝在Ultra60上,內核是32位還是64位?
(3)在其上安裝的Oracle 8是安裝的32位版本還是64位版本?
A: Solaris8 的內核是64位的, 但是,它同時帶有32位程序的解釋器,也就是說32位
的程序也可以在Solaris8上面運行。事實上Solaris8上面有一些系統命令就是
32位的程序,如link等。所有的Solaris8都是64位的,但是都帶有32位的解釋
器。(就現在的情況而言,32位的解釋器是必 須的)。在Solairs 8上面運行
的應用程序可以是64位,也可以是32位的,包括Oracle 8在內

92 Q: 很感謝你的答覆。原來不能創建用戶的原因應該是文件系統已滿,我刪除了一
些用戶賬號後,創建正常。現在的問題是c0d0t0s0文件系統的容量太小,現在
已經達到100%,如何擴展這個文件系統,是否只有重裝系統這一個辦法?
A: 在系統安裝時,各個分區劃分的有些不太合理。/ 目錄和 /usr 太小
/export/home和/tmp 太大。實際上在安裝時,比較合理的辦法是隻設置 / 和
/tmp,/tmp最多 500M即可。然後在 / 上面建立/usr,/opt 和/export/home。
現在補救的辦法是利用軟link的辦法:首先將一些在/或/usr中不太是系統直接
使用的目錄(一定不可以包含/usr/sbin,/sbin, /etc,等等)轉移到有空間的分
區上面,然後使用ln建立軟連接。關於ln的使用可以man.這種辦法是不得已而
爲之。不是很好把握,搞不好就會死機,並且啓動不起來。所以在進行此項活
動時,首先要備份數據,以免發生以上情況時丟失。如果您在下午下班的時間
可以抽出一點時間,最好還是將系統重新安裝一遍的好。因爲,每一個目錄都
有一定的用意,一些軟件的安裝不是地方會讓人感到很彆扭。而使用軟連接又
會降低系統的運行速度。

93 Q: 求助--請教一個多線程編程問題。關於我們發現的問題具體現象如下:
函數 void* A(void *pInput)
{
char szBuf[30000]; //this buffer maybe larger than 30,000
...
...
}
在多線程程序中,該函數在main中運行(此時相當於在主線程中運行)正常。
如果使用pthread_create創建一個線程,以A作爲線程入口函數,用內存測試工
具purify可以觀察到該線程運行過程中出現Beyond Stack Read、Beyond Stack 
Write錯誤。如果把szBuf改爲堆中分配的內存,則無此問題。據此,我們判斷
是線程的棧空間溢出造成該問題。按資料描述,主線程的缺省棧空間大小爲8M
,子線程缺省棧空間爲2M;我們使用pthread_attr_setstack函數將子線程的棧
空間設置爲8M,但仍未解決問題。後又將線程屬 性設置爲
PTHREAD_SCOPE_SYSTEM, 問題仍然存在。函數A以靜態庫方式由第三方提供,
我們現需要使之在一個子線程中運行,因此希望能夠提供主線程與子線程差異
的資料,除堆棧空間、調度方式外,是否還有其他差別,造成以上錯誤的發生
A: In fact, there is no problem in the program. I think there is a bug 
in their debug tool: purify. You can use dbx to debug your program.

94 Q: 請問一塊硬盤上可以有兩個Solaris分區嗎?在一塊硬盤上分了兩個solaris分
區,一個是active的系統安裝分區,另一個是後來用fdisk創建的,請問怎樣把
第二個分區加入到solaris系統中使用。謝謝。
A: Yes, There can be up to six partitions in a disk. you can see the 
partition using utility format. Command list:
#format
Then you will see the disks installed in you system.then select the 
disks you are interested in. then print /"partition/" and then /"print/"
to see the partition information. The partition you want to add to 
the system can be identified as c#t#d#s#. Make sure the mount point( 
a empty directory in file system). such as /disk1.then run the 
command:
#mount /dev/dsk/c#t#d#s# /disk1

run the command
#df -k
to verify the slice(partition) is properly installed.
95 Q: 請問在Solaris 2.7上,可以動態改變分區大小嗎? 我的工作站劃分分區不合理,
根分區太小,已經滿了,可以使用工具動態改變嗎?
A: No, If you want to modify it, the whole disk data will be lost.
In fact, I think it high time for you to re-instal the solaris 
system. In the new installation. You really need just two partitions 
swap and root. Leave no more than 1G to swap partition and all the 
left to root.Don/'t forget to backup all you data before re-installation.

96 Q: 用CC編譯器如何實現結構成員按字節對齊,類似於其他編譯器的#pragma pack(1)
功能。
A: It is a standard compilation option(#pragma pack). It is also 
supported in Solaris C.You can get documents about SC options from 
http://sunlibray under workshop directory.

97 Q: 爲什麼SUN的本地界面有時候會出現死掉的情況,此時kill掉用戶的dtsession
是否就可以恢復正常。如不能恢復正常還需要做那些操作。
A: In my experince, the interface dying, may be caused by other 
application other than dtsession. You should determine which 
program/'s interface causes the interface dying. This situation is not 
often happens, and most of them happened when you are manipulating a 
program/'s interface by mouse. When it happen, login the system from
network as /"root/" or the account which cause the dying, kill the 
program.

98 Q: 系統不能啓動, 任何二級目錄都沒有了,但用戶下,所有命令都不能用,怎麼
安裝Solaris,能直接從光盤啓動嗎?
A: You harddisk is damaged. It may be salvaged manually, or can not.
You should restall the system. Or even worse, you should change your 
harddisk.

99 Q: Can you tell me if I want to add a new CPU chip to a only one CPU 
chip machine on solaris system,Can the application run continually in 
the old cpu chip without interruption on solaris system ?
A: Please tell me the machine/'s type. If your machine is a workstation. 
CPU chips can not be added without turning down the power. I don/'t 
know so much in this field. But, I have forwarded this message to the 
specitest in our company. You will get much more detailed answers. 
But you should wait several days. Another way for you is to consult 
the vender who sell you the machine directly.

100 Q: what/'s deference between the processor_bind() and pset_bind()?
A: You can get the differences between two functions by seeing the
manual:
# man processor_bind
# man pset_bind

101 Q: 我們有一個產品在移植到SOLARIS的過程中出現了大量難以理解的問題,請給
我們現場支援一下,非常感謝!使用Forte Develop6編譯C++程序的時候出現
以下信息:

/"mit/../teglobal.h/", line 39: Warning (Anachronism): Attempt to redefine TRUE without using #undef.
/"mit/../teglobal.h/", line 40: Warning (Anachronism): Attempt to redefine FALSE without using #undef.
>> Assertion: (../links/prepexpression.cc, line 65)
while processing mit/multilock.cpp at line 0.

請問是什麼意思,難道編譯器還要assert嗎?
A: CC 編譯器要求被編譯的文件以兩個新行結束,請在相關頭文件末尾加上新行。

102 Q: solaris的問題:激活小鍵盤上的Numlock,激活中文輸入法,按小鍵盤上的0
鍵,中文輸入法自行關閉,請問是何原因?
A: You can solve the problem you metioned by trying the following three 
ways:
1. Make sure using GB locale, instead of GBK.
2. Visit http://sunsolve.sun.com to get the /"recommended patches/"
package for the your solaris platform, and add it.
3. If possible, you can change the solaris platform from solaris 2.7 
to solaris 2.8

103 Q: 有關在SOLARIS上使用NETSCAPE問題
問題描述:
1.在SOLARIS2.6上安裝NETSCAP4.04後,安裝提示成功後,運行netscape,出現以
下錯誤信息:
xlib:connection to /"0.0/" refused by server
xlib:client is not authorized to server
can/'t open display : :0.0
2.在SOLARIS2.6上安裝Acroread後,如何設置能直接點擊打開.pdf文件,而無需
每次要先啓動Acroread,然後再打開? 請問上述問題如何解決?
A: 1. You run the command:
#xhost :0.0
and then, you can use NETSCAPE In the terminal, in which the 
netscape is launched, please set the envrionment DISPLAY as :0.0
2. Actually, I don/'t know how to configure it. If you are interested
in it. You can read some topics in AnswerBook2 User Collection.

104 Q: syslogd 如何支持漢字? syslogd 好像會把漢字拆分成兩個字節,並去掉高位
如何解決?
A: How the background service provider syslogd supports character set 
depends on the locale environment it starts. So, if you want Chinese 
characters transferring by syslog. You can restart syslogd in 
Chinese environment by issuing the following commands:
# LANG=zh; export LANG # set the locale environment in Chinese.
# kill -9 `cat /etc/syslog.pid` # to kill the former syslogd
# /usr/sbin/syslogd

If you want syslogd to support Chinese characters whenever the 
machine boot. Put the attacted file in the /etc/rc3.d directory.Make 
sure this file/'s mode is /"rwxr-xr-x/" and the owner is root.

105 Q: 我的工作站的交換分區分的太小了,除重裝系統外,是否有其它辦法將空間調
整一下。
A: You can extend your swap region by issueing the following command:
#mkfile -m 
#swap -a 
Note: the should be the full path name.

106 Q: 用vi打開一個script文件,發現裏面有非法字符^M,在vi命令行如何全程替代
掉該字符?我試了一下用以下命令來做,卻不行:0,$s/^M//
A: 1,$s/^M//g ,其中,^M是 ctrl+V ,ctrl+M,或者,用下面這個命令。
%unix2dos $filename > $newfilename

107 Q: How to add space to a filesystem in solaris2.5.7 ? When I patchadd a 
patch,It tell me that there is no sufficient filesystem capacity.
A: It seems like your root partition too small. Please check it 
availiable size. If it is small, I think you would better to 
reinstall the system. Please store all the data in the disk.
In the new installation, you need really to partitions, one is for 
swap, and another is for /. The swap partition /tmp needs about 200M 
to 500M. Then all the left should be given to /.

108 Q: 請教關於Solaris Patch的問題。我們在安裝一些軟件時,經常需要先安裝一
些Patch,有一事不明,向您請教一下,比如某個軟件需要Patch : 107546-02,
現在我的機器上已經安裝107546-08,是不是就不用再安裝107546-02了Patch
後面的那部分是什麼意思?是不是大的數字可以包含小的數字的功能了? 同一
個Patch的不同版本之間會不會有衝突?
A: You are right. If you have installed a bigger version of the same 
patch, it not necessary for you to install the smaller one. The 
bigger version will override the earlier one if it installed before. 
You need not worry about any collision.

109 Q: 關於sun的SunNet 我目前想了解關於sun的SunNet。我從sun的網站上瞭解到
SunNet已經被合併入到Solstice裏了,我目前想試着把我做得程序集成到
SunNet或Solstice裏,我看了Slostice得White Paper,但裏邊只提到了一點點
相關得Api,我從哪裏,怎麼才能到比較完全得文檔呢?

A: To my knowledge, you can go to the following for a detailed info:
http://www.sun.com/software/solstice/em-products/network/sunnetmgr.html.

110 Q: 關於SUN機器root口令丟失問題,如何解決?
A: 辦法如下:
利用SOLARIS的啓動盤來啓動,然後把硬盤mount上去,修改硬盤上原etc目錄
下的shadow文件,將root項裏的password域內容刪除,變成無密碼。然後重新
啓動主機,以無密碼的root登陸後,重新設置root口令。具體步驟如下:
1.把你的solaris光盤放進cdrom
2.鍵入stop+a
3.當出現/'ok/'字樣時,鍵入boot cdrom -s
4.cd /tmp/root
5.mkdir /tmp/root/xxx (xxx是什麼鬼東西就無關緊要了)
6.mount /dev/dsk/c0t0d0s0 /tmp/root/xxx (在這裏c0t0d0s0是你的root盤)
7.運行csh
8.setenv TERM vt220
9.cp /tmp/root/xxx/etc/shadow /tmp/root/xxx/shadow/shadow.bak
10.vi /tmp/root/xxx/shadow,並且將root項裏的password域刪除即可。
11.重啓動,你就可以以無密碼的root登陸了,登錄後,更改root的密碼。

111 Q: In solaris 2.6. when i use command /"killall/" ,all process started in 
CDE will be killed and the eviroment will change to CDE login. I 
looked up the man manual about /"killall/" ,it told me that /"only root 
can use the command/".But I really use it with common id.In 
solaris7 and solairs 8, with common id,i can/'t use the common.can 
you tell me why i can execute /"killall/" successfully in solaris 2.6?
A: Just see the access mode of /usr/sbin/killall. If you can use it 
with a common account identity, the access mode should be x-rsx-rx-r.
If you can not use it in a common account identity, the mode should 
be x-r--r--r. You can change the mode as you like, whenever in 2.6, 
or 2.7 or 2.8.

112 Q: I downloaded the SDM2.3 from the Download Center of /"www.sun.com/" 
,read the White Paper and web detailed describing.But it is only the 
outlook of the software. I need the detailed document about how to 
integrated my own network management application to Solstice.
A: I transfer this messag to Sun Service in Guangdong.

113 Q: 請問有沒有磁盤管理工具。我們有一臺E450,有5塊硬盤,想做RAID,但是沒有工
具.
A: If the machine/'s OS is solaris 2.8, the storage management software 
is also installed in you machine. You can make the RAID by issuing 
the command family: /usr/sbin/meta*; If you are not so familiar with 
these commands. I can do it for you. or you can use solstice 
disksuite, it is a GUI tool.

114 Q: 怎樣強制更改NIS客戶端的本地NIS數據表?有時候NIS客戶端和NIS服務器端有
時會出現不一致的情況.NIS服務器和NIS slave 服務器也會出現這種情況。
A: 你可以用yppush和 ypxfr 來做這種工作,更常見的方法是把它們寫進cron,定
期更新,具體步驟請查閱Answerbook.


115 Q: 爲了將工作站設爲從DHCP動態分配IP,並且將主機名由/"unknown/"改爲原名
修改了/etc/init.d/rootusr,將dhcpinfo後面三行(不是四行)註釋掉;
hostname=`/sbin/dhcpinfo Hostname`
# case $? in
# 0) [ -z /"$hostname/" ] && hostname=/'unknown/' ;;
# 2) try_dhcp=no ;;
esac
重啓後,提示:
/sbin/rcs:ysntax error at line 143 : /'esac/' unexpected
INIT:cannot creat /var/adm/utmp or /var/adm/utmpx
INIT:SINGLE USER MODE
輸入root口令後,只能運行在單用戶模式,且vi、ls等都不能用(#vi:not found)
如何才能打開/etc/init.d/rootusr文件進行修改,恢復正常狀態。
A: 請找一個SOLARIS的安裝啓動盤,使用以下方法可以修改rootusr文件,步驟如
下:
1.把你的solaris光盤放進cdrom
2.鍵入stop+a
3.當出現/'ok/'字樣時,鍵入boot cdrom -s
4.cd /tmp
5.mkdir /tmp/xxx (xxx是什麼東西無關緊要,隨便取一個名字,如test)
6.mount /dev/dsk/c0t0d0s0 /tmp/xxx (在這裏c0t0d0s0是你的root盤)
7.運行csh
8.setenv TERM vt220
9.vi /tmp/xxx/etc/init.d/rootusr,把esac那行也註釋掉即可。
10.把solaris光盤拿出,reboot,重啓動即可。

116 Q: 一臺Ultra60工作站,其固定IP爲10.11.105.247,用ifconfig hme0 dhcp 
start總是失敗,如下所示。
# netstat -a|grep 4999
# ifconfig hme0 dhcp start
May 7 20:11:11 hwMusa01 dhcpagent[478]: ERROR! Address 10.11.105.147 
is already in use ifconfig: internal error in DHCP agent
# netstat -a|grep 4999
localhost.4999 *.* 0 0 0 0 LISTEN
localhost.4999 localhost.1023 32768 0 32768 0 TIME_WAIT

抓包發現是dhcp服務器offer的IP地址10.11.105.147被decline了。手工運行
dhcpagent,提示4999端口被使用了。以前此工作站曾配置爲固定IP:
10.11.105.147,但現在已改爲10.11.105.247並重啓過多次。請問,可能是什
麼原因導致dhcp失敗??

A: 導致問題出現的原因是,由於客戶機在申請原來的被保留分配的IP時,服務器
發現這個IP不能夠被使用(已經有其它機器使用了這個IP地址)。使客戶機申
請失敗,並且使其中的某些進程不能正常退出,繼續佔用了端口4999而使後面
的申請不能進行。辦法是找到佔用端口4999的進程,殺掉即可。找到這個進程
的辦法是,這個申請進程是帶有dhcp字樣的。
# ps -e | grep dhcp
會出現一到兩個進程號。驗證這些進程是否佔用了4999是看進程打開的文件:
# /usr/proc/bin/pfiles #pid
早到進程然後殺掉。這樣就可以繼續啓動Client 端的dhcp申請。注意,修改
服務器的設置使新的申請可以成功。

117 Q: 我們有一臺Natra T1,它的/tmp目錄已經長到90%,如果目錄滿了是否會使系統
運行異常.(因爲我們運行的業務不能停,故不能重啓SUN機器來讓系統清空該目
錄,也不能直接清空該目錄,應爲應用程序正在運行.)下面是一些數據:

# df -k
Filesystem kbytes used avail capacity Mounted on
/proc 0 0 0 0% /proc
/dev/dsk/c0t0d0s0 1258491 51942 1143625 5% /
/dev/dsk/c0t0d0s6 1612343 500741 1063232 33% /usr
fd 0 0 0 0% /dev/fd
/dev/dsk/c0t0d0s3 33099 9211 20579 31% /var
/dev/dsk/c0t0d0s7 13550703 838475 12576721 7% /export/home
/dev/dsk/c0t0d0s5 30743 10319 17350 38% /opt
/dev/dsk/c0t0d0s1 548687 369368 124451 75% /usr/openwin
swap 627864 563360 64504 90% /tmp
# cd tmp
# ls
ps_data
# ls -a -l
total 98
drwxrwxrwt 6 sys sys 443 May 7 15:29 .
drwxr-xr-x 22 root root 512 Mar 20 17:45 ..
drwxrwxr-x 2 root root 176 Feb 27 23:18 .X11-pipe
drwxrwxr-x 2 root root 176 Feb 27 23:18 .X11-unix
drwxrwxrwx 2 root root 179 Feb 27 23:18 .pcmcia
drwxrwxrwt 2 root root 327 Feb 27 23:18 .rpc_door
-rw-rw-r-- 1 root sys 5056 Feb 27 23:18 ps_data
# cd .pcmcia
# ls -a -l
total 32
drwxrwxrwx 2 root root 179 Feb 27 23:18 .
drwxrwxrwt 6 sys sys 443 May 7 15:35 ..
prw-rw-rw- 1 root root 0 Feb 27 23:18 pcram
# cd ..
# pwd
/tmp
# cd .rpc_door
# ls -a -l
total 32
drwxrwxrwt 2 root root 327 Feb 27 23:18 .
drwxrwxrwt 6 sys sys 443 May 7 15:36 ..
Drw-r--r-- 1 root root 0 Feb 27 23:18 .rpc_100029.1
Drw-r--r-- 1 root root 0 Feb 27 23:18 .rpc_100029.2
Drw-r--r-- 1 root root 0 Feb 27 23:18 .rpc_100029.3
# cd ..
# cd .X11-pipe
# ls -a -l
total 32
drwxrwxr-x 2 root root 176 Feb 27 23:18 .
drwxrwxrwt 6 sys sys 443 May 7 15:37 ..
-rw-rw-rw- 1 root root 0 Feb 27 23:18 X0
# cd ..
# ls
ps_data
# cd .X11-unix
# ls -al
total 32
drwxrwxr-x 2 root root 176 Feb 27 23:18 .
drwxrwxrwt 6 sys sys 443 May 7 15:38 ..
srwxrwxrwx 1 root root 0 Feb 27 23:18 X0
等待您的回答,謝謝

A: 我認爲是系統統計信息錯誤的, 本人的經驗是當/tmp的使用率超過10%時,系統就
變的很慢了。出現這種情況,首先,要檢查系統中運行的程序有沒有不停分配內存,
卻沒有釋放(指自己開發的程序)。另外看一下系統對/tmp的swap交換情況。使用工
具sar 和iostat 都可以看到。關於sar和iostat的用法, 可以看man即可。

118 Q: 有一用MOTIF 寫的程序,運行之後不能顯示中文(亂碼),由於顯示的信息是
不固定的,故不能使用資源文件.懷疑程序中與創建字體時使用了以下的函數
有關,但註釋掉後也一樣:
font1=XLoadQueryFont(XtDisplay(toplevel), /"-*-screen-bold-r-normal--12-*/");
font2=XLoadQueryFont(XtDisplay(toplevel), /"-*-screen-bold-r-normal--14-*/");
font3=XLoadQueryFont(XtDisplay(toplevel), /"-*-screen-bold-r-normal--16-*/");
fontlist=XmFontListCreate(font1, /"charset1/");
fontlist=XmFontListAdd(fontlist, font2, /"charset2/");
fontlist=XmFontListAdd(fontlist, font3, /"charset3/");
運行環境是ULTRA 60 ,Solaris 2.6 ,安裝了中文環境。編譯環境是SUN C++ 4.0 。
還懷疑與LANG 相關,曾試過設置爲zh ,chinese 等也不行,請教此問題如何解決?

A: 實際上,關於選擇字體和字符集可以看這個資料,使
用系統提供的標準工具來從中間找到系統中存在的字體和字體的名稱。這個資料在
Answer Book 的System Administration Collection 中。 實際上,上面的問題不
出現在字體的選擇上面, 而是在MOTIF中在選擇框的使用設置中還要設置一次字體

119 Q: 請問SUN的E250以上機器支持“雙機熱備+磁盤陣列”的使用方式嗎?Ultra系
列的機器是否也能支持呢?
A: SUN的E250以上機器支持“雙機熱備+磁盤陣列”的使用方式,可以使用
SunCluster軟件實現;Netrat系列電信服務器也支持;Ultra系列的機器,不
在支持的列表中。但是,“雙機熱備+磁盤陣列”的具體含義應該搞清楚。推
薦的文檔在sun cluster collection 中。

120 Q: 我在一個JAVA程序中打開50個SOCKET端口,結果出現異常:
java.net.SocketException:Too many open files
請問如何解決此問題?謝謝!另外,請問在一個JAVA進程中可以同時啓動的線
程數是多少?最大線程數受什麼限制?能否達到240個線程?謝謝!如上問題
如果可以通過修改配置來解決的話,會有什麼樣的負面影響?
A: You have two ways to modify the limit number of files that a process 
can open simutanously.
One: modify the /etc/system file add the following entry:
set rlim_fd_cur = #n
#n is the number you want. Should be no more than 1024.
You should reboot the machine.
Two: Use the system command: ulimit
$ulimit -n #n
Note: You should use B-shell.
And using the same terminal session(in the same terminal 
window) to run the your application program( to guarantee your 
application process is a child process of the setting 
terminal.)You can man ulimit to see the detailed usaged.
The disadvantage brought by incread the file limite for a 
process or the whole system is increasing the system memory 
usage. But, for today/'s machine, this disadvantage is not too
expensive. (William said There is no limit for max open 
socket number in Java. But the operating system has a limit for 
max open file descriptors.A socket resource is treated as a 
file descriptor in Unix. The previous email answered your 
question. You can try as said.

121 Q: 我想把一個HP平臺上運行的B SHELL 腳本在SOLARIS 2。6上運行,但是出現了
問題:要運行的腳本部分:
command_count = 0
command_item[$command_count]=check_AutoRaid
command_count=`expr $command_count + 1`
command_item[$command_count] = check_system_resource
command_count=`expr $command_count + 1`
command_item[$command_count]= check_diskspace
command_count=`expr $command_count + 1`
command_item[$command_count]= check_bill_record
command_count=`expr $command_count + 1`
command_item[$command_count]= get_max_CAPS
command_count=`expr $command_count + 1`
command_item[$command_count]= check_DataBase
command_count=`expr $command_count + 1`
command_item[$command_count]= check_netstate_SMP
command_count=`expr $command_count + 1`
command_item[$command_count]= check_work_dir
command_count=`expr $command_count + 1`
command_item[$command_count]= check_dir_OAM
command_count=`expr $command_count + 1`
command_item[$command_count]= check_dir_others
command_count=`expr $command_count + 1`
command_item[$command_count]= check_files_informix
command_count=`expr $command_count + 1`
command_item[$command_count]= check_crontab
command_count=`expr $command_count + 1`
出現的問題:
./scp.sh: command_item[0]: not found
./scp.sh: command_item[1]: not found
./scp.sh: command_item[2]=: not found
./scp.sh: command_item[3]=: not found
./scp.sh: command_item[4]=: not found
./scp.sh: command_item[5]=: not found
./scp.sh: command_item[6]=: not found
./scp.sh: command_item[7]=: not found
./scp.sh: command_item[8]=: not found
./scp.sh: command_item[9]=: not found
./scp.sh: command_item[10]=: not found
./scp.sh: command_item[11]=: not found
./scp.sh: bad substitution

請問這是否因爲平臺的問題引起的

A: I have looked up several documents about B Shell. There is no array 
definition and usage in original B-shell. It seems like B-shell is 
expended in HP platform. I think you should modify the source script to 
make it pure B-shell and then can run in Solaris.

122 Q: 現在我們有一個特殊的需求,需要在編譯時,指定一字節對齊(缺省好象是八
字節對齊的),請問我們使用哪一個編譯選項能達到這個目的?
A: There are some differences between different c/c++ compiler in their 
options. Actually, I don/'t know so much about the options used in 
gcc, but I think you can get some documents from the web site 
http://www.gnu.org. We have detailed document about Solaris C. If 
you want these documents, you can contact me or get from 
http://docs.sun.com, in which site you find workshop collection.

123 Q: 有如下幾個問題請幫助解決:
1、solaris用戶登錄以後,總是彈出很多控制檯窗口和瀏覽器窗口等,請問:
如何定製用戶的登錄界面和環境,讓其登錄後只彈出一個窗口。
2、請問如何再solaris上設置dns?
3、如果想再solaris上將固定ip方式改爲自動獲取ip的dhcp方式,需要修改哪
些文件?而如果將工作站設爲dhcp服務器,又如何設置?最好是能發一份
solaris這方面的配置資料,謝謝
A: 1. 刪掉不想要的窗口,選擇 exit 退出桌面環境,系統提示是否保存當前桌
面,回答是。.
2. 手邊剛好有一本教程,請參照進行配置.
dnsconfig
3. You can create a empty file dhcp.hme0 in /etc directory. If you 
don/'t want to reboot your machine, run the command:
# ifconfig hme0 dhcp start

124 Q: 我們用一臺Netra T1,操作系統爲solaris7,運行一個應用程序。
用df -k /tmp查看swap空間,發現一些奇怪的現象:
應用程序啓動時:
文件系統 千字節 用了 可用 容量 掛接在
swap 1158400 8 1156392 1% /tmp
運行1小時後:
文件系統 千字節 用了 可用 容量 掛接在
swap 1158392 8 1158384 1% /tmp
再過一段時間:
文件系統 千字節 用了 可用 容量 掛接在
swap 1158276 8 1158268 1% /tmp
再過一段時間:
文件系統 千字節 用了 可用 容量 掛接在
swap 1158392 8 1158384 1% /tmp
其中,1158400爲swap的總空間大小,爲什麼總的swap空間會變化。如果swap不斷減少
,總有一天會用完,該怎麼辦。帶着疑惑向您請教

A: Actually, the sample data in your table look very healthy. Don/'t 
trust so much about these statistics numbers. In fact, if the gloss 
number of swap file system reduced not big, the system can run well. 
If the number decrease much, it means a process use a lot of swap 
space. If you kill the process, the number will increase some.

125 Q: 在WinNT中有任務管理器, 在Linux上面有top程序, 可以查看一個進程佔用
的CPU時間,內存,當前運行的線程數等,但是在Solaris上面如何查詢這些信
息呢?
A: There are two ways to see a process/'s cpu occuptation.
1. run the command in a terminal or console: #ps -elf
2. In cde interface, there is a graphic utility which you can find 
in tool(or 工具) column

126 Q: 請問: 設置了一個普通用戶,該用戶設置有相應的$PATH環境變量,用su命令(不
是su 切換到超級用戶以後,原來的$PATH變量的值發生了改變,導致了應用有
些不正常,請問這如何解決?
A: 實際上,使用su命令切換到超級用戶,環境變量$PATH只受文件
/etc/default/su中SUPATH條目的控制。現在,你可以參照此文件對SUPATH條
目進行修改即可滿足你的要求。

127 Q: 如果採用“Cluster”機制進行雙機熱備,兩臺機器之間需要通過心跳線相連
,請問這些心跳線是如何連接的?也就是說,每臺機器有兩個網口做心跳偵聽,
兩臺機器間的心跳網線是交叉直接相連,還是可以通過“Lanswitch”或“Hubor”間接相連?
A: 交叉568a-568b

128 Q: 我們的程序需要建立很多socket連接,但因爲操作系統的限制,只能建立有限
的連接。如何修改系統參數,提高操作系統對文件描述符數量的限制。
A: You have two ways to modify the limit number of files that a process 
can open simutanously.
One: modify the /etc/system file add the following entry:
set rlim_fd_cur = #n
#n is the number you want. Should be no more than 1024.
You should reboot the machine.
Two: Use the system command: ulimit
$ulimit -n #n
Note: You should use B-shell.
And using the same terminal session(in the same terminal 
window) to run the your application program( to guarantee your 
application process is a child process of the setting 
terminal.)You can man ulimit to see the detailed usaged.

129 Q: ipcs命令有沒有功能來刪除一個共享內存
A: No, ipcs can only print some usage information about shared memory, 
locks, and semaphores.

130 Q: 我們的程序需要建立很多socket連接,但因爲操作系統的限制,只能建立有限
的連接。如何修改系統參數,提高操作系統對文件描述符數量的限制。
A: You have two ways to modify the limit number of files that a process 
can open simutanously.
One: modify the /etc/system file add the following entry:
set rlim_fd_cur = #n
#n is the number you want. Should be no more than 1024.
You should reboot the machine.
Two: Use the system command: ulimit
$ulimit -n #n
Note: You should use B-shell.
And using the same terminal session(in the same terminal 
window) to run the your application program( to guarantee your 
application process is a child process of the setting 
terminal.) You can man ulimit to see the detailed usaged.

131 Q: 請解釋一下solaris 8有沒有dynamic partition的概念.是否可以向windows一
樣動態分區而不用format原來的文件系統,謝謝.
A: There is no dynamic partition in Solaris 8. Let/'s make the 
conception /"dynamic partition/" clear first. /"dynamic partition/" 
means
gzip

gzip[選項]要壓縮(或解壓縮)的文件名
-c將輸出寫到標準輸出上,並保留原有文件。
-d將壓縮文件壓縮。
-l對每個壓縮文件,顯示下列字段:壓縮文件的大小,未壓縮文件的大小、壓縮比、未壓縮文件的名字
-r遞歸式地查找指定目錄並壓縮或壓縮其中的所有文件。
-t測試壓縮文件是正完整。
-v對每一個壓縮和解壓縮的文件,顯示其文件名和壓縮比。
-num-用指定的數字調整壓縮的速度。
舉例:
把/usr目錄幷包括它的子目錄在內的全部文件做一備份,備份文件名爲usr.tar
tar cvf usr.tar /home
把/usr 目錄幷包括它的子目錄在內的全部文件做一備份並進行壓縮,備份文件名是usr.tar.gz
tar czvf usr.tar.gz /usr
壓縮一組文件,文件的後綴爲tar.gz
#tar cvf back.tar /back/
#gzip -q back.tar
or 
#tar cvfz back.tar.gz /back/
釋放一個後綴爲tar.gz的文件。
#tar zxvf back.tar.gz
#gzip back.tar.gz
#tar xvf back.tar


RPM的使用
安裝一個rpm包
rpm -ivh  <rpm  package name>
升級一個包
rpm -Uvh  <rpm  package name>
移走一個RPM包
rpm -e <rpm  package name>
查詢一個包是否被安裝
rpm -q <rpm  package name>
得到被安裝的包的信息
rpm -qi <rpm  package name>
列出該包中有哪些文件
rpm -ql <rpm  package name>
列出所有被安裝的包
rpm -qa <rpm  package name>
列出一個未被安裝進系統的RPM包的文件中包含哪些文件
rpm -qilp <rpm  package name>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章