Jeffrey Chen's Blog

Need To Do More In My Life


Configure Solaris system runtime linking environment。crle

Thursday Apr 16, 2009

There is a Solaris 10 Sparc in the lab which could not be booted. Some critical mysql data needs to be dumped.


Firstly I tried to  boot system into "single user mode". Press "stop+A" to enter openboot, then type "boot -s" under the ok prompt. System was rebooted, but still could not be booted. Failed.


Put a Solaris 10 Sparc installation DVD into the dvdrom. Press "stop+A", then type  "boot cdrom -s". System was rebooted and entered into the single user mode shell.


Now, I can mount the hard disk.


# mount /dev/dsk/c0t0d0s0 /a

# mkdir /tmp/a

# mount /dev/dsk/c0t0d0s7 /tmp/a

mysql was installed under /a/usr/local/mysql directory. 


# cd /a/usr/local/mysql/bin

# ./safemysqld -uroot



It reported that can not find some mysql libraries.


Use crle to check the system linking


-bash-3.2# crle


Default configuration file (/var/ld/ld.config) not found

  Platform:     32-bit MSB SPARC

  Default Library Path (ELF):   /lib:/usr/lib  (system default)

  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure  (system default)

Use "crle" command to add library, crle -u -l /a/usr/local/mysql/lib. Execut safemysqld again, it reported can not find libstdc++...


crle -u -l /a/lib ; crle -u -l /a/usr/lib


Use ldd to check. It's ok now.



--------------------------


有一台Solaris 10 Sparc 的机器今天不能启动了。里面有一些重要的mysql 数据需要dump出来。


首先尝试让系统进入 single user mode。 按stop+A进入boot,在ok提示符下输入boot -s。系统重启,但还是还是不能boot。失败。


找一张Solaris 10 Sparc 安装盘放入光驱。按stop+A进入boot,输入 boot cdrom -s。系统重启,成功进入单用户shell。


mount 系统硬盘,mount /dev/dsk/c0t0d0s0 /a。成功。原系统的根被mount到/a。 然后再mount 源系统 /export, mkdir /tmp/a; mount /dev/dsk/c0t0d0s7 /tmp/a。成功。


原系统的mysql被安装在/a/usr/local/mysql 下,cd /a/usr/local/mysql/bin。执行  ./safemysqld -uroot。出错。错误报告是找不到 mysql 需要的库。查找mysql库文件,在/a/usr/local/mysql/lib下。


用crle查看,


-bash-3.2# crle


Default configuration file (/var/ld/ld.config) not found

  Platform:     32-bit MSB SPARC

  Default Library Path (ELF):   /lib:/usr/lib  (system default)

  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure  (system default)

添加库路径,crle -u -l /a/usr/local/mysql/lib。再次执行safemysqld,出错,找不到libstdc++...。原因是还没有把 mount的原系统库路径添加。


crle -u -l /a/lib ; crle -u -l /a/usr/lib


用ldd检查safemysqld。确认所有库均已链接。再次执行 safemysqld,成功。

Like this post? del.icio.us | furl | slashdot | technorati | digg