2 Replies Latest reply on Aug 4, 2006 7:59 PM by 807559

    First bad root shell, now can't mount /dev/dsk/c0t0d0s0 from CDROM boot

    807559
      Machine: Netra 240
      OS: Solaris 8
      Original Problem: Root Shell damaged in /etc/passwd
      Current Problem: Can't mount /dev/dsk/c0t0d0s0 from CDROM single-user boot

      I accidentally changed the root shell in /etc/passwd to /sbin/bash (a non-existent shell) and now I cannot log in as root.

      Following the advice here to fix the problem (http://forum.sun.com/jive/thread.jspa?forumID=292&threadID=78298), I booted from CD in single-user mode, but I was unable to mount the file system.

      Specifically, I tried:
         mount /dev/dsk/c0t0d0s0
      and I get the response:
                  
        mount: /dev/dsk/c0t0d0s0 is already mounted
        or allowable number of mount points exceeded
      Following advice I found elsewhere, I tried:
      fsck /dev/rdsk/c0t0d0s0
      and got:
        BAD SUPER BLOCK: MAGIC NUMBER WRONG
        USE AN ALTERNATE SUPER-BLOCK TO SUPPLY NEEDED IN
        eg. fsck [-F ufs] -o b=# [special ...]
        where # is the alternate super block. SEE fsck_ufs(1M).
      Trying to use newfs to find alternate super-block locations:
      newfs -N /dev/dsk/c0t0d0s0
      results in:
        mkfs: bad value for size: 640 must be between 1024 and 640
        mkfs: size reset to default 640
        Warning: inode blocks/cyl group (42) >= data blocks (40) in last
          cylinder group. This implies 640 sector(s) cannot be allocated.
        Too many cylinder groups with 0 sectors;
          try increasing cgsize, or decreasing fssize to 18446744073489350656
      Now from what I see in the Solaris troubleshooting guide, the BAD SUPER BLOCK error means the disk is hopelessly corrupted and my only choice is to reformat it.

      However, this cannot be the case since I can boot normally, and log in as any user other than root and all the files appear fine.

      Is there a way out of this without formatting the drive and re-installing the OS?
        • 1. Re: First bad root shell, now can't mount /dev/dsk/c0t0d0s0 from CDROM boot
          abrante
          boot up the system from the cdrom again, then run "df -k" to see what mounts there are, there is a slight chance that your cd-rom uses the scsi target associated with /dev/dsk/c0t0d0s0, or that it for some reason already has been mounted.

          Alternativly, you could use the following proceedure to determine the path to your root disk;

          run "format", this will show the disks available on your system, if you only have one disk, the output could look like this:

          AVAILABLE DISK SELECTIONS:
          0. c0t0d0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>
          /pci@1f,0/pci@1,1/scsi@2/sd@0,0
          Specify disk (enter its number):

          .. in this case the root partition is most likely on c0t0d0s0 (where s0 -> slice (or partition) 0 and is the most common place for your root partition).

          If you cant find it there, go back to format, select the disk by typing "0", then view the partition table by first typing "part" then "print". The root partition normally have the tag "root" written to it. Once you see the partion number you mount it using:

          mount /dev/dsk/<cXtXdX number as given by format>sX

          If you have multiple disks, you have to view their different partition tables to find your "root" partition..

          7/M.
          • 2. Re: First bad root shell, now can't mount /dev/dsk/c0t0d0s0 from CDROM boot
            807559
            That was it!

            When booting from CD, the device was named /c1/t0/d0 rather than /c0/t0/d0.

            I found this by using the 'format' command, as recommended.

            I was able to mount /dev/dsk/c1/t0/d0/s0 and fix the original problem in /etc/passwd.

            Thank you very much for your help!