solaris基礎和常用知識 (2)


 
   
solaris基礎和常用知識 (2)

 
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<typename p1, typename p2>
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<int, int>( 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目錄,同時可以刪除<home>/.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 <hostname> :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 <filename> -m <size in million>
#swap -a <filename>
Note: the <filename> 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: 實際上,關於選擇字體和字符集可以看<Font Administrator Guide>這個資料,使
用系統提供的標準工具來從中間找到系統中存在的字體和字體的名稱。這個資料在
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`
 
 
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章