Forgot your root password? Made a silly mistake in the file system table? It will happen, rather sooner than later. Here is what you can do in such situations. In the example below, we have a problem with /etc/system which is on the /dev/dsk/c0t0d0s0 device.
Find Solaris installation media, e.g. the CD's.
Boot from Software CD 1 of 2 in single user mode:
OK boot cdrom -s
Do a file system check on the troubled device before mounting it:
# fsck /dev/rdsk/c0t0d0s0
Mount the device onto a temporary directory on the CD:
# mount -F ufs /dev/dsk/c0t0d0s0 /a
Set your terminal variable so editing files won't have to be done on a single line:
TERM can be any one of your favorite terminal emulations, e.g. TERM=vt100 will also work.
Don't forget to export TERM, this is plain sh, not bash or some other more advanced shell:
# export TERM
Edit the erroneous file:
# vi /a/etc/system
Take out the errors, write and quit.
Note that you cannot edit /etc/vfstab, because this is the virtual file system table from the CD-ROM, which is read-only as you know. We need to repair the vfstab from our boot disk, which we just mounted on a temporary directory on the CD.
Change back to a directory on the CD-ROM, e.g. with the cd command with no options.
Unmount your boot disk from the CD:
# umount /a
Reboot the system. Use the init 6 command, not the reboot command!