A-A+

SUN M5000 SOLARIS10 root密码重置

2017年06月02日 Solaris运维 暂无评论 阅读 6,830 次

root密码居然不对了!各种登陆不进去啊。

OS 信息:

more /etc/release
Solaris 10 8/07 s10s_u4wos_12b SPARC
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 16 August 2007
uname -a
SunOS wzapp 5.10 Generic_144488-04 sun4u sparc SUNW,SPARC-Enterprise

 

遇到这种事情,简单点的情况,光盘启动,救援模式,清除密码就OK了,但是,遇到了复杂点的。

不在客户现场,无法使用光盘模式,不过,好在系统版本是solaris 10,而且scxf管理口也配置了网络管理,那么现在就开始处理吧。

1.使用failsafe模式启动系统内存镜像。

root登陆不进去还想正常关机吗?

使用xscf 管理命令 poweroff -d 0 进行关机,会调用系统关机指令,如果加上-f 那就相当于直接拔电源了,不推荐。

关闭domain0之后,设置域启动参数 setdomainmode -d 0 -m autoboot=off,这样好处在于自动启动关了就可以停留在ok模式下面。手动启动比较适合问题的解决。

在ok模式下,使用boot -F failsafe 启动。

启动结束后,如果简单点呢就是系统自动搜索存在的系统并挂载在/a下,此时只要清楚/a/etc/shadow中的密码,重启后即可正常已空密码进入系统,问题到此结束了。

然而生活处处充满意外,下面是网上找的例子,实际和这差不多

Executing last command: boot -F failsafe
Boot device: /pci@1f,0/pci@1/scsi@8/disk@1,0:a  File and args: -F failsafe
SunOS Release 5.10 Version Generic_141444-09 64-bit
Copyright 1983-2009 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Configuring devices.
Searching for installed OS instances...
/dev/dsk/c0t0d0s0 is under md control, skipping.
To manually recover the boot archive on a root mirror, please refer
to procedure written in this section of the Solaris Administration Guide.
        How to Manually Update the Boot Archive on a RAID-1 (Mirror) Volume
The section is located at URL :
        http://docs.sun.com/app/docs/doc/817-1985/ghgnq?a=view

No installed OS instance found.

Starting shell.
#

由于使用了系统盘镜像,所以啊,不能简单修改,可以参考这篇文章

http://www.geoffroydoucet.com/blog/2009/10/recover-boot_archive-with-solaris-volume-manager/

我是用了传统方式,解除系统镜像,修改密码文件,登录系统,重新镜像。

mount /dev/dsk/c0t0d0s0 /a

修改 /a/etc/vfstab ,如果直接vi的话,又会报错,首先要执行

TERM=vt100;export TERM;

然后在vi /a/etc/vfstab

修改对应的映射关系

修改/etc/system

* Begin MDD root info (do not edit)

#rootdev:/pseudo/md@0:0,100,blk  

* End MDD root info (do not edit)

#set md:mirrored_root_flag=1 

umont /a

此时可以fsck 检查下文件系统有没有问题

关闭系统,进入ok模式,使用devalias查看启动设备,

使用 boot 启动名进行启动

进入系统后设置密码。

metastat -p 查看对应关系

prtvtoc /dev/rdsk/c0t0d0s2 > /tmp/c0t1d0s2 生成分区文件

metadetach -f d10 d12

metaclear d12

fmthard -s /tmp/c0t1d0s2 /dev/rdsk/c0t1d0s2

metadb -d c0t1d0s7

metadb -a -c3 c0t1d0s7

metainit d12 1 1 c0t1d0s0

metattach d10 d12

metastat

metaroot d0

lockfs -fa

reboot

bash-2.03# while true
> do
> metastat |grep sync
> sleep 3
> clear
> done

重启后完成其他分区镜像同步

给我留言