免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 26599 | 回复: 19
打印 上一主题 下一主题

SUN相关的问题的整理和汇总(1) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-12-28 17:05 |只看该作者 |倒序浏览
1、        solaris 系统下怎么查看磁盘的block size
fstyp -v /dev/rdsk/cxtxdxsx |grep -i bsize
2、怎么配置邮件客户端?solaris做为客户端
1.remove the /etc/mail/submit.cf
2.write the mailhost to /etc/hosts, just like:
   10.10.10.11        aserver        mailhost
3、SunCluster3.1中的Quorum设备如何重置?
先reset一下看看,如果不行需要重新指定:
# scconf -c -q reset

重新指定一个新的把原来删掉即可:
# scconf -a -q globaldev=d4
# scconf -r -q globaldev=d5

或者用scsetup交互式命令指定和删除也可以!
4、如何拷贝SYMBOL LINK FILE
assuming the 2 new file systems are mounted on /mnt/sapmnt, /mnt/sap -
#(cd /; tar -cf - sapmnt) | ( cd /mnt; tar -xf -)
#(cd /usr; tar -cf - sap) | (cd /mnt; tar -xf -)

then, umount /sapmnt, /usr/sap, /mnt/sapmnt, /mnt/sap, and mount the 2 new file systems on /sapmnt, /usr/sap respectively
5、如何修改stack size?
ulimit –s 8192
ulimit -a

core file size (blocks)     unlimited
data seg size (kbytes)      unlimited
file size (blocks)          unlimited
open files                  1024
pipe size (512 bytes)       10
stack size (kbytes)         8192
cpu time (seconds)          unlimited
max user processes          29995
virtual memory (kbytes)     unlimited
6、提示符设置为主机名和登陆当前目录等
在.profile加入
ccd()
{
cd $1
PS1="`id |cut -d '(' -f2|cut -d ')' -f1' '`@`uname -n``pwd`>"
}
alias cd=ccd
或者直接加:PS1='[${UNAME}@${PWD}]'; export PS1
7、VXVM恢复已经RAID5卷
系统崩溃或I/O错误会损坏已经景象卷的一个或多个plex,并使得plex均不处于CLEAN或ACTIVE状态。可以将plex中的一个标记为CLEAN,并指示系统使用该plex作为恢复其他plex的源。步骤如下:
1、        使用以下命令将预定的plex置于CLEAN状态:
vxmend fix clean plex
2、        若要由CLEAN plex恢复卷中的其他plex,必须禁止卷,而这些plex必须处于STALE状态。如有必要,可通过在每个plex上依次运行以下命令,是所有其他的CLEAN或ACTIVE plex的状态变为STALE:
vxmend fix stale plex
3、        若要启用CLEAN plex并倨次恢复STALE plex,使用以下命令:
vxvol start volume
或者:# vxvol -g userdg2 stop v21
# vxprint -g userdg2 -ht
# vxvol -g userdg2 -f start v21
如果不行,就
vxplex -f -o rm dis <log plex>
vxassist -g <dg> addlog <volume>
vxvol -g <dg> start <volume>

8、SOLARIS下有抓图的键或者命令吗?
/usr/dt/bin/sdtimage可以取窗口/屏幕/矩形框截取图片,可存.gif/.jpg等


ASC   - The additional sense code
ASCQ - The additional sense code qualifier

Please get more information about SCSI standards.
9、如何在主机中看HBA卡的WWN号
luxadm -e dump_map {enclosure[,dev]... | pathname...}
Upon startup, the Platform Information and Control Library daemon, loads and
initializes plug-in modules. To get information from the PICL tree, you can
use the prtpicl command interface.

In the output following, I have noted the port & node WWN with this
symbol: <======

To determine the WWN of a Sun[TM] Qlogic HBA, run the following
command(sample output included):

#prtpicl -v -c scsi-fcp
SUNW,qlc (scsi-fcp, 3e00000272)
eviceID      0x1
:UnitAddress   1
:vendor-id     0x1077
:device-id     0x2312
:revision-id   0x2
:subsystem-id  0x10a
:subsystem-vendor-id   0x1077
:min-grant     0x40
:max-latency   0
:interrupts    00  00  00  01
:class-code    0xc0400
:devsel-speed  0x1
:fast-back-to-back
:66mhz-capable
:fcode-rom-offset      0
:version       ISP2312 FC-AL Host Adapter Driver: 1.13.08 04/10/02
:device_type   scsi-fcp
:#address-cells        0x2
:#size-cells   0
:manufacturer  QLGC
:compatible   (3e0000027dTBL)
  | pci1077,2312.1077.10a.2 |
  | pci1077,2312.1077.10a |
  | pci1077,10a |
  | pci1077,2312.2 |
  | pci1077,2312 |
  | pciclass,0c0400 |
  | pciclass,0c04 |
:reg  
00  02  08  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
00  01  02
08  10  00  00  00  00  00  00  00  00  00  00  00  00  00  00  01  00  02
02  08  14
00  00  00  00  00  00  00  00  00  00  00  00  00  00  10  00
:node-wwn      20  00  00  e0  8b  0a  57  77   <====================
:port-wwn      21  00  00  e0  8b  0a  57  77   <====================
:assigned-addresses   
81  02  08  10  00  00  00  00  00  00  20  00  00  00  00  00  00  00  01
00  82  02
08  14  00  00  00  00  00  20  00  00  00  00  00  00  00  00  10  00
:devfs-path    /pci@1f,0/pci@1/SUNW,qlc
:binding-name  SUNW,qlc
:instance      -1

or try this script, it report only the wwn and the device path :

echo
printf "See below the results :\n"
echo
prtpicl -v -c scsi-fcp | grep port-wwn > /tmp/port-wwn
prtpicl -v -c scsi-fcp | grep devfs-path > /tmp/devfs-path
paste -d "\t" /tmp/devfs-path /tmp/port-wwn

To determine the WWN of a Sun JNI HBA, run the following command:

# prtpicl -v -c scsi
SUNW,jfca (scsi, 8e0000023c)
eviceID      0x2
:UnitAddress   2
:vendor-id     0x1242
:device-id     0x1560
:revision-id   0xb2
:subsystem-id  0x656b
:subsystem-vendor-id   0x1242
:min-grant     0x8
:max-latency   0x8
:interrupts    00  00  00  01
:class-code    0xc0400
:devsel-speed  0x1
:66mhz-capable
:fcode-rom-offset      0
:device_type   scsi
:#size-cells   0
:#address-cells        0x2
:manufacturer  JNIC
:copyright     Copyright (c) 2000-2003 by JNIC
:fcode_revision        Version 1.0
:version       Version 1.0
:reg  
00  00  10  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
01  00  10  10  00  00  00  00  00  00  00  00  00  00  00  00  00  00  01  00
03  00  10  14  00  00  00  00  00  00  00  00  00  00  00  00  00  00  10  00
01  00  10  1c  00  00  00  00  00  00  00  00  00  00  00  00  00  00  01  00
02  00  10  30  00  00  00  00  00  00  00  00  00  00  00  00  00  08  00  00
:pci_slot      0x1000
:power-consumption   
00  00  00  00  00  00  00  00  03  30  00  00  03  61  50  00  00  00  00  00
00  00  00  00  00  60  00  00  01  00  00  00  00  00  00  00  00  00  00  00
:model         FCX2-6562-L
:my_wwn_lo     0x7300e0ca
:my_wwn_hi     0x10000001
:board_id      0xe0ca
:board_revision        0x8001
:lport_cfg     0xffffffff
:seq_vers      MIL_32_v4eng9   
:fcode_cksum   0xf16
:sequencer_cksum       0x598a
:boots_wwn_lo  0xffffffff
:boots_wwn_hi  0xffffffff
:bootp_wwn_lo  0xffffffff
:bootp_wwn_hi  0xffffffff
:assigned-addresses   
81  00  10  10  00  00  00  00  00  00  18  00  00  00  00  00  00  00  01  00
83  00  10  14  00  00  00  00  00  11  00  00  00  00  00  00  00  00  10  00
81  00  10  1c  00  00  00  00  00  00  1c  00  00  00  00  00  00  00  01  00
82  00  10  30  00  00  00  00  00  18  00  00  00  00  00  00  00  08  00  00
:cache-line-size       16
:latency-timer         64
:node-wwn      10  00  00  01  73  00  e0  ca  <===============
:port-wwn      20  00  00  01  73  00  e0  ca  <===============
:devfs-path    /pci@1f,4000/SUNW,jfca@2
:driver-name   jfca
:binding-name  SUNW,jfca
:bus-addr      2
:instance      0
:_class        scsi
:name  SUNW,jfca

or try this script, it report only the wwn and the device path :

echo
printf "See below the results :\n"
echo
prtpicl -v -c scsi | grep port-wwn > /tmp/port-wwn
prtpicl -v -c scsi | grep devfs-path > /tmp/devfs-path
paste -d "\t" /tmp/devfs-path /tmp/port-wwn

NOTE: You will not be able to locate a SUN Branded Emulex cards WWN while the system is up and running.

you will need to use .properties command at the ok prompt.

The prtpicl command does not work with SBus Sun Qlogic cards (x6757, Ivory). To
find the WWN of these cards, 'prtconf -vp' can be used instead (reference infodoc 76953:
Sun StorEdge[TM] SAN Software: How to Get the WWN of Sun FiberChannel HBAs for LUN Masking.)
如何查看系统中安装了哪些shell,并且还能支持哪些shell?
# pkginfo | grep -i shell

and,

ls -al /bin/*sh /usr/bin/*sh /usr/local/bin/*sh | egrep -v "hash|remsh|rsh|p.*sh"

论坛徽章:
0
2 [报告]
发表于 2006-12-28 17:06 |只看该作者
solaris怎么样查看一个文件是哪个包安装出来的?
pkgchk -lp yourfilename
如何实现文件的即时监控?
可能徐对文件做校验,并比较,

如用Solaris 10里有cksum,可比较文件变化前后的校验,如校验Solaris 10 DVD光盘media文件:

# cksum solarisdvd.iso                  
3842565141      3133603840      solarisdvd.iso

Solaris 10里还有BART,Basic Auditing and Reporting Tool,校验目录,帮助快速可靠的检查已部署的系统,创建已配置好的系统上的文件列表manifest,在系统上发现文件一级的改变,所以在配置好系统后应尽快建立系统或关键目录的文件列表manifest,并按系统的变化经常更新,如校验/etc目录:

# bart create  -R /etc > etc2005-05-20
# bart create  -R /etc > etc2006-01-16

Solaris 10里算法很多,自己琢磨下,选个速度满意的:

# cryptoadm list

用户级的提供者:
提供者: /usr/lib/security/$ISA/pkcs11_kernel.so
提供者: /usr/lib/security/$ISA/pkcs11_softtoken.so

内核软件提供者:
        des
        aes
        arcfour
        blowfish
        sha1
        md5
        rsa
        swrand
。。。

再如用md5签名校验:

# digest -l
sha1
md5

# digest -a md5 /etc/hosts
6cda1541bb58d86f3d3c9b13cf87aea7

校验越频繁,CPU消耗越大,
solaris下如何把登陆日志全部删除呢?
# cd /var/adm
# /usr/lib/acct/fwtmp < wtmpx > wtmpx.ascii
# vi + wtmpx.ascii

   remove some lines including your login information

# /usr/lib/acct/fwtmp -ic < wtmpx.ascii > wtmpx
# rm wtmpx.ascii
# last | head
scripting crontab 动态修改
Remove #
CODE:
[Copy to clipboard]
#!/bin/sh

EDITOR=/bin/ed; export EDITOR
/bin/crontab -e <<EOF
1,$ s/^#*\([0-9]\)/\1/
w
EOF
Add #
CODE:
[Copy to clipboard]
#!/bin/sh

EDITOR=/bin/ed; export EDITOR
/bin/crontab -e <<EOF
1,$ s/^\([0-9]\)/#\1/
w
EOF

SDS故障盘的更换恢复
System information:
Fire v880 operates on Solaris 8 with 6 disks.disk1 was organized as mirror of root disk disk0 and disk2 disk3 disk4 disk5 were oragnized as a raid 5 volume by disksuite4.2 . 2 replicas were placed at disk0-5 slice 4 so that system can boot correctly in case there is one disk failure .

Error information:
metastat command display that logic devices at disk0 (c1t0d0s2) need maintenace .

solution:
replace the failed disk c1t0d0s2 (disk0)

procedure:
1.        gether system information
check the meta device state
        #metastat
        #metadb –i
check the slice location
        #format
        #more /vfstab
2.        reboot from mirror disk
you can create the alias previously
        ok nvalias disk1 /sbus@1f,0/espdma@e,8400000/esp@e,8800000/sd@1,0:a
        pathname listed here is not in a 880 server but from a test machine Ultra1
        ok setenv boot-device disk disk1
#reboot - - disk1
if there is no sufficient replicas , not in this case , when rebooting system will enter system maintenance due to the replica quorum .You can delete the replicas on the bad disk by:
        #metadb –d –f c1t0d0s4
then you can boot system
3.        replace hard disk (hot plug)
#luxadm remove_device /dev/rdsk/c1t0d0s2
while OK-to-Remove LED is lighting  physically pull up the error disk from disk bay and insert the new disk. Then use command
        #luxadm insert_device FCloop,s0
or
        #devfsadm –C
In the command luxadm enclosure_name can get by command
        #luxadm probe
Identify the new disk by compare the WWN number in the output of belowing command
        #format
        #ls –al /dev/rdsk/c1t0d0s2
4.        repair replica database
#prtvtoc /dev/rdsk/c1t1d0s2 | fmthard - /dev/rdsk/c1t0d0s2
#metadb –a –c 2 /dev/rdsk/c1t0d0s4
5.        resyncing the sub-mirrors
#metadetach d0 d10
#metadetach d1 d11
#metadetach d3 d13
#metadetach d5 d15
#metadetach d6 d16
#metadetach d7 d17
#metaclear d10 d11 d13 d15 d16 d17
#metainit d10 1 1 c1t0d0s0
#metainit d11 1 1 c1t0d0s1
#metainit d13 1 1 c1t0d0s3
#metainit d15 1 1 c1t0d0s5
#metainit d16 1 1 c1t0d0s6
#metainit d17 1 1 c1t0d0s7
#metattach d0 d10
#metattach d1 d11
#metattach d3 d13
#metattach d5 d15
#metattach d6 d16
#metattach d7 d17
#metastat |grep %
#reboot
#metastat

tricks:
1.        sds user guide had mentioned the command metareplace to auto replace error submirror .But we have failed in using this command .You can find the same problem at InfoPartner Document BugReports Doc ID: 4777440.
2.        when you mirror the root disk you must use command installboot bootblk ,but when you replace the root disk you will not need the same procedure.


开机时报warning:pcisch0:in0 0x16 has been blocked
            warning:usba10_ehcio:interrupt #0 has been blocked
Try a workaround.

1. Add a line to /etc/system

set pcisch:pci_unclaimed_intr_max=0x7fffffff

2. reboot
在SUN下用snoop抓包,看到如下内容,只有*** Header ,内部的DD在哪啊?
# snoop -v port 7777
# snoop -v -x 0 port 7777
所有root拥有的文件全部改为ROot,如何快速恢复?
find dir-path -user ROot -exec chown root {} \;

try

# crle -u
# ldd /usr/sbin/vxdg
# crle

If failed

# mv /var/ld/ld.config /var/ld/ld.config.old
# crle -u
# ldd /usr/sbin/vxdg
# crle

论坛徽章:
0
3 [报告]
发表于 2006-12-28 17:07 |只看该作者
SUN做路由器的办法
1.在sunos中设置两块网卡pcn0(168.9.203.239)、pcn1(192.168.9.11)
# ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
pcn0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 168.9.203.239 netmask fffffc00 broadcast 168.9.203.255
        ether 0:c:29:7d:3a:2a
pcn1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.9.11 netmask ffffff00 broadcast 192.168.9.255
        ether 0:c:29:7d:3a:34

2.修改/etc/hosts文件
127.0.0.1       localhost
168.9.203.239   sophia  loghost sophia.partner.com
192.168.9.11    partner

3.增加/etc/hostname.pcn1
partner


4.设置ip包转发
# ndd -set /dev/ip ip_forwarding 1
# ndd -set /dev/ip ip_forward_directed_broadcasts 1
# ndd -set /dev/ip ip_forward_src_routed 1

修复4800CPU的软错误
Please kindly help to check about this:

SC> showcomponent -d a

Component           Status   Pending  POST   Description
---------           ------   -------  ----   -----------
/N0/SB0/P0          enabled  -        pass   UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB0/P1          enabled  -        pass   UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB0/P2          enabled  -        pass   UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB0/P3          enabled  -        pass   UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB0/P0/B0/L0    enabled  -        pass   512M DRAM
/N0/SB0/P0/B0/L2    enabled  -        pass   512M DRAM
/N0/SB0/P0/B1/L1    enabled  -        pass   512M DRAM
/N0/SB0/P0/B1/L3    enabled  -        pass   512M DRAM
/N0/SB0/P1/B0/L0    enabled  -        pass   512M DRAM
/N0/SB0/P1/B0/L2    enabled  -        pass   512M DRAM
/N0/SB0/P1/B1/L1    enabled  -        pass   512M DRAM
/N0/SB0/P1/B1/L3    enabled  -        pass   512M DRAM
/N0/SB0/P2/B0/L0    enabled  -        pass   512M DRAM
/N0/SB0/P2/B0/L2    enabled  -        pass   512M DRAM
/N0/SB0/P2/B1/L1    enabled  -        pass   512M DRAM
/N0/SB0/P2/B1/L3    enabled  -        pass   512M DRAM
/N0/SB0/P3/B0/L0    enabled  -        pass   512M DRAM
/N0/SB0/P3/B0/L2    enabled  -        pass   512M DRAM
/N0/SB0/P3/B1/L1    enabled  -        pass   512M DRAM
/N0/SB0/P3/B1/L3    enabled  -        pass   512M DRAM
/N0/SB2/P0          disabled -        chs    UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB2/P1          disabled -        chs    UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB2/P2          disabled -        chs    UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB2/P3          disabled -        chs    UltraSPARC-III+, 1050MHz,
8M ECache
/N0/SB2/P0/B0/L0    disabled -        chs    512M DRAM
/N0/SB2/P0/B0/L2    disabled -        chs

If the SB4 is disabled, please check the col named POST of SB4, if it is
chs, please help to check:

SC> showcomponent -v SB4
SC> showerrorbuffer

and then enter service mode:
SC> service
The use of service commands can be destructive and destabilize the system.
Use of service mode is authorized only by personnel trained in its use.

Enter Password:        gGmmlHslPK


SC[service]> showchs -b
....
SC[service]> setchs -r "enable brd" -s ok -c  sb4

and then please poweroff domain A by setkeyswitch off, after the domain A power off, please power it on and do max POST.
usb键盘上用STOP+N是没用的,应该按照以下步骤来恢复NVRAM到缺省值:
1. After turning on the power to your system, wait until the front panel power indicator
LED begins to blink and you hear an audible beep.
2. Quickly press the front panel power switch twice (similar to the way you would
double-click a mouse).

1.创建NAFO 组
# pnmset -c nafo-group -o create adapter [adapter ...]
-c nafo-group 对指定的NAFO 组执行配置子命令。必须将NAFO 组命
名为nafoN,其中N 是一个非负的整数,用来标识该组。对每个节点而言,组名都是本地名称。因而,同一NAFO 组名可在多个节点上使用。
-o create 创建新的NAFO 组。
adapter [ adapter ... ] 指定用作备份适配器的公共网络适配器。

2.向NAFO 组添加适配器
# pnmset -c nafo-group -o add adapter
-c nafo-group 指定要添加新适配器的NAFO 组。
-o add adapter 指定要添加到指定的NAFO 组的公共网络适配器。

3.如何删除NAFO 组
要想能够删除NAFO 组,逻辑主机资源组或共享地址资源组不得使用该组。
1. 成为包含要删除的NAFO 组的节点的超级用户。
2. 确定是否有任何逻辑主机资源或共享地址资源正在使用NAFO 组。
# scrgadm -pv
您还可以使用scrgadm-pvv(带有两个v 标志)来确定那些正在使用将要删除的NAFO 组的资源。
3. 切换使用该NAFO 组的逻辑主机资源组和共享地址资源。
# scswitch -z -g resource-group -h nodelist
-z -g resource-group 切换指定的资源组。
-h nodelist 指定要将资源组切换到的节点的名称。
4. 删除NAFO 组。
# pnmset -c nafo-group -o delete
-c nafo-group 指定要删除的NAFO 组。
-o delete 删除NAFO 组。
5. 检验该NAFO 组的状态。
列表中不应出现已删除的NAFO 组。
# pnmstat -l

示例— 切换NAFO 组的活动适配器
以下示例说明了将活动适配器从qfe0 切换到qfe1 的过程。
# pnmstat -l
group adapters status fo_time act_adp
nafo0 qfe0:qfe1 OK NEVER qfe0
# pnmset -c nafo0 -o switch qfe1
# mv /etc/hostname.qfe0 /etc/hostname.qfe1
# pnmstat -l
group adapters status fo_time act_adp
nafo0 qfe0:qfe1 OK 11 qfe
查找NAFO 组的活动适配器
# pnmptor nafo0
查找适配器的NAFO 组
# pnmrtop qfe5

4.如何更改公共网络管理可调参数
/etc/cluster/pnmparams

inactive_time 当前活动适配器的包计数器在连续进行两次探测之间的秒数。缺省值为5。
ping_timeout ALL_HOST_MULTICAST 和子网广播ping 的超时值(以秒为单位)。缺省值为4。
repeat_test 在声明活动适配器有故障并触发故障转移前执行ping 序列的次数。缺省值为3。
slow_network 每次从执行ping 序列之后到检查包计数器以查看是否有任何更改之间所等待的秒数。缺省值为2。
warmup_time 从将故障转移到备份适配器后到恢复故障监视前所等待的秒数。此设置为慢速驱动程序或缓慢的端口初始化过程保留了额外的时间。缺省值为0。
光纤盘DD的恢复办法。
dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2 bs=8192k
     将你做好的DD盘换到原系统盘的位置。
ok boot cdrom –s
     mount /dev/dsk/c0t0d0s0 /mnt
     drvconfig –r /mnt –p /mnt/etc/path_to_inst
     cd /devices
     find . –print |cpio –pduVm /mnt/devices
     disks –r /mnt
     luxadm set_boot_dev /dev/dsk/c0t0d0s0
     init 0
     ok boot -r
ld.so.1文件损坏或丢失后系统怎样恢复正常?
boot cdrom -s first,try to recover the system.
here is a document,may it can help.



实时连接器ld.so.1文件损坏或丢失后系统怎样恢复正常?
前言:看到网上好多人遇到ld.so.1文件损坏或丢失,系统瘫痪询问怎样处理,为此我将这一故障现象进行归纳总结,供各位网友参考,希望从中得到帮助。

一、动态连接库的概念
大家都知道,在WINDOWS系统中有很多的动态链接库(以.DLL为后缀的文件,DLL即Dynamic Link Library)。这种动态链接库,和静态函数库不同,它里面的函数并不是执行程序本身的一部分,而是根据执行程序需要按需装入,同时其执行代码可在多个执行程序间共享,节省了空间,提高了效率,具备很高的灵活性,得到越来越多程序员和用户的青睐。
Solaris系统里面有些库文件,当编译的时候,如果把库文件也编译到文件中,那文件本身就可以执行,但这样的缺点是生成的文件十分大。所以很多情况下使用动态连接库,就是编译出的文件不包含库,而只包含到库的指针,这样在运行的时候会到指定的地方调用这个库,这样就减少了文件的大小。Solaris包含的实时连接器ld.so.1,就是动态对象的运行阶段链接程序。

从下面的的命令中,我们可以列出可执行文件或者共享对象的动态从属关系,这玩意没了,你的什么ls,cd什么的命令就都费了,如果ld.so.1文件被破坏了,系统肯定无法正常启动。

/usr/bin/ldd [filename]
/* List the dynamic dependencies of executable files */

# /usr/bin/ldd /usr/bin/cat
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-1/lib/libc_psr.so.1
# ldd /usr/bin/ls
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-1/lib/libc_psr.so.1
# ldd /usr/bin/cp
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-1/lib/libc_psr.so.1

二、ld.so.1文件损坏或丢失解决的办法

1.如果意外的/usr/lib/ld.so.1损坏或丢失,系统没有正常启动的情况下:
执行命令都会出现错误信息:
#reboot
Reboot :can not find /usr/lib/ld.so.1
#find
Find: /usr/lib/ld.so.1
#ls
Ls: can not find can not find

这时,千万不要重启动,立即用/usr/sbin/static/mv、/usr/sbin/static/cp命令恢复 :

#/sbin/static/cp /etc/lib/ld.so.1 /usr/lib/
经过实验,系统恢复正常!这时,你试试如下命令,就能体会到为什么了。
---------------------------------------------------------------------------
# ls /usr/sbin/static
cp* ln* mv* rcp* tar*
SUN的工程师非常聪明,为了防备了这个情况, 做了以上几个不使用动态连接库的命令
#find / -name ld.so.1 -print
/usr/lib/sparcv9/ld.so.1
/usr/lib/ld.so.1
/etc/lib/ld.so.1
blade% ls -ld /usr/lib/sparcv9/ld.so.1
-rwxr-xr-x 1 root bin 191672 Jul 28 2001 /usr/lib/sparcv9/ld.so.1
blade% ls -ld /usr/lib/ld.so.1
-rwxr-xr-x 1 root bin 196852 Jul 28 2001 /usr/lib/ld.so.1
blade% ls -ld /etc/lib/ld.so.1
-rwxr-xr-x 1 root bin 196852 Jul 28 2001 /etc/lib/ld.so.1
---------------------------------------------------------------------------
从上面的,我们又可以看到,这个库文件,不仅仅在/usr/lib有,在/etc/lib、/usr/lib/sparcv9/下也有,所以你就重新在本机上拷贝一份就行了。这些信息在这个连接库不正常的情况下是看不到的。

2.如果意外的/usr/lib/ld.so.1损坏或丢失,系统启动的情况下:
错误信息:
Uname:can not find /usr/lib/ld.so.1
Loadkeys: can not find /usr/lib/ld.so.1
Killed
Cfsfstype: can not find /usr/lib/ld.so.1
Expr: can not find /usr/lib/ld.so.1
Swap: can not find /usr/lib/ld.so.1
Killed
Fsck: can not find /usr/lib/ld.so.1
Killed

这时,用光盘启动到单用户下:
ok boot cdrom -s (放入启动安装光盘)
#mount /dev/dsk/c0t0d0s0 /mnt (这里指定原usr目录对应的原始设备名)
# cp /mnt/etc/lib/ld.so.1 /mnt/lib/(就是将/usr/etc下的这个文件拷贝到/usr/lib下。)
系统重新启动,一切正常!

3.如果/usr被改名了情况下,怎么办?
假设/usr改名成了/faint,系统没有启动
马上执行
#/faint/sbin/static/mv /faint /usr

假设/usr改名成了/faint,系统重新启动,这时肯定不能正常启动,同样我们启动到单用户下:
ok boot cdrom -s (放入启动安装光盘)
mount /dev/dsk/c0t0d0s0 /mnt (这里指定原usr目录对应的原始设备名)
mv /mnt/faint /mnt/usr

建议把/usr/sbin/static下的东西拷一份到/sbin下或者其它比较可信的跟/在同一个文件系统下的目录下。以备系统不测.

之后,我又进行了多次实验,各个版本系统下的/usr/lib/ld.so.1文件互相兼容。所以也可以从其他机器拷贝过来。

论坛徽章:
0
4 [报告]
发表于 2006-12-28 17:17 |只看该作者
总结的不错.收藏了.希望楼主可以帮更多的发出来.

论坛徽章:
2
双鱼座
日期:2014-02-23 12:10:03操作系统版块每日发帖之星
日期:2015-12-17 06:20:00
5 [报告]
发表于 2006-12-28 21:37 |只看该作者
不错,收藏啦!

论坛徽章:
0
6 [报告]
发表于 2006-12-28 21:45 |只看该作者
留下了

论坛徽章:
0
7 [报告]
发表于 2006-12-29 10:29 |只看该作者
路过`````捡走了`````

论坛徽章:
0
8 [报告]
发表于 2006-12-29 10:38 |只看该作者
收藏了再看,顶顶

论坛徽章:
0
9 [报告]
发表于 2006-12-29 14:44 |只看该作者
收藏,先。看标题是“SUN相关的问题的整理和汇总(1)”,关注2、3、……

论坛徽章:
0
10 [报告]
发表于 2006-12-29 15:02 |只看该作者
这个贴发的确实有水平呀  。 很经典 。也是收下了 。嘿嘿。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP