No ls nor vi under system maintenance
Hello,
I have a SPARCstation 20 running SunOS release 5.7 and I messed up the S30rootuser.sh and now the system would not start. It gave a prompt "Type ctrl-d to proceed with normal startup (or give root password for system ad\\maintenance):". If I pressed "ctrl-d", it ask for "ENTER RUN LEVEL (0-6, s or S):", and does not matter what I typed, I got back the prompt "Type ctrl-d to proceed...". If I typed in the root password, I got in "System Maintenance Mode" with "#" prompt. Once I in "System Maintenance Mode", most of the commands will not work, like 'ls', 'vi', 'cp', 'cat'..... The question is what can I do in "System Maintenance Mode"? Can I edit the S30rootuser.sh file? And why is the regular command does not work? Any help will be appreciate!
Regards,
Norman
[808 byte] By [
ns_kwok] at [2007-11-26 10:09:22]

# 1
Depending on how you've configured your machine, not all the filesystems may be mounted (like if you have a separate /usr).
You may need to force mount them. You may need to remount the root filesystem r/w to modify it.
In some cases it is easier to boot from cdrom to a single user shell (with vi and friends easily available), then mount the hard drive and modify it.
Good luck!
--
Darren
# 2
Darren,Thanks for the reply! I don't have the cdrom since this is a very old machine and I am not sure if I can locate one neither. Will any solaris cdrom work?How do I do "force mount"?Regards,Norman
# 3
> Darren,
>
> Thanks for the reply! I don't have the cdrom since
> this is a very old machine and I am not sure if I can
> locate one neither. Will any solaris cdrom work?
Yes. Basically any Solaris installation media that supports the hardware you have will work.
> How do I do "force mount"?
The best way is to understand what filesystems you need and where they are. You'll probably at least have a valid /etc/vfstab when you log in.
Try to remount root r/w.
mount -o remount,rw /dev/dsk/c0t0d0s0 /
Once done, try mounting /usr.
mount /dev/dsk/c0t0d0s4 /usr
Mount up /var as well if it's separate.
Obviously the exact device you give depends on your system. If that fails, you might have to fsck one or the other. More complex...
--
Darren
# 4
Did you check your $PATH ?
# 5
yes, the path showed "/usr/sbin:/usr/bin" but when I cd to those path, I got "/usr/sbin does not exist". Again, this is in System Maintenance Mode, and most of the commands do not work, like "ls, vi, mount, uname....", so far, only "cd, echo & pwd" work.Thanks,Norman
# 6
Darren,
Thanks again!
Here is what I have when I execute "mount":
/proc on /proc read/write/setuid on ...
/ on /dev/dsk/c0t3d0s0 read/write/setuid/largefiles on ...
/dev/fd on fd read/write/setuid on ...
/var on /dev/dsk/c0t3d0s3 read/write/setuid/largefiles on ...
/export/home on /dev/dsk/c0t3d0s7 setuid/read/write/largefiles on ...
/opt on /dev/dsk/c0t3d0s5 setuid/read/write/largefiles on ...
/usr/openwin on /dev/dsk/c0t3d0s1 setuid/read/write/ar\argefiles on...
/tmp on swap read/write on ....
When I did "./mount -o remount,rw /dev/dsk/c0t3d0s0 /" and I got the following error message:
mount: the sate of /dev/dsk/c0t3d0s0 is not okay and it was attemped to be mounted read/write
mount: Please run fsck and try again
and I could not locate fsck. Am I doing the right thing?
Wonder where is "vi" ? It is hard without "ls" to see what I have in my directory.
Thanks,
Norman
# 7
#1 The mount command just shows you the output of the /etc/mnttab file. But since root isn't mounted read/write, that file just reflects the mounts during the last successful boot. It doesn't reflect reality (this changes with Solaris 8 and higher).
#2 While fixing this is possible when still booted from the disk, there's still a lot more work to do. You have to figure out what's really mounted. Is /usr present. If so, you need to get fsck running and fsck the disks. (Not to mention figure out why it's not doing that at boot.... perhaps you have other more serious problems).
My first choice would be to boot from CD, then run fsck on the hard drive partitions. Once done, you can mount them up and examine them to see if anything looks odd (like the contents of /etc/vfstab).
Good luck.
--
Darren
# 8
Darren,Thanks! I returned the workstation and someone else is taking care of the problem. Thanks for all your help and suggestion!Regards,Norman
# 9
If people are still visiting this thread for help, here is why Mr. Norman was having problems launching vi from single user mode: the TERM variable was not set to sun, oh yeah and it needs exporting too...here is what to do: boot into single user mode from cdrom
Hopefully you are at the ok prompt type:
ok boot cdrom -s (with the cdrom in)
Then, check the root fs or any other fs if corrupted
#fsck /dev/rdsk/c0t0d0s0 (ofcourse the root fs can be on a different partition then what is mentioned here)
if all goes well with fsck, mount the root fs on the /a dir
# mount /dev/dsk/c0t0d0s0 /a
Now set the TERM varaible
# TERM=sun
# export TERM
(now you can launch your little vi and edit the /etc/vfstab file)
# vi /a/etc/vfstab
:x!
After making the corrections, unmount the fs
# cd /
# umount /a
Finally, reboot the system
#init 6
I know, I know..don't worry..you'll be okay
You are most welcome,
Faraz