[buug] Corrupt root entry in passwd file - Solaris

Michael Paoli mp at rawbw.com
Mon Jan 3 23:13:52 PST 2005


As I said on USENET not too horribly long ago (2004-07-17)[1]:
"
Follow standard procedure for recovering a lost root password - except
 instead of altering /etc/shadow, fix your /etc/passwd file.
"

In short, you've a few possibilities:
get access to ID (e.g. root) or control of process that can alter and
fix the /etc/passwd file.
If that can't be done, bring the system down -
graceful shutdown if that can be managed, if not, crash the system.
Then boot from recovery media (or alternative means, e.g. network),
clean and mount the filesystem with the problem file (e.g. root filesystem
for /etc/passwd) and fix the file.  sync the filesystem, then proceed to
do a normal boot.
Taking the disk (e.g. hard disk or SAN LUN presentation) to another system
to modify it there, may be an alternative approach.

If you don't have the relevant bootable media (e.g. Solaris install CDs),
it would probably be advisable to obtain them.  In certain situations, it
is highly advantageous to have them readily available.  Note also, that
depending on hardware and filesystem types, you may be able to use a
substantially different version of Solaris for boot CD and still be able
to successfully fix the problem.

If the system does have functioning bootable properly configured CD(/DVD)
drive, then it may be worth checking if you could even borrow the relevant
CD(s) from someone.  If you have support contract with the vendor, you may
want to check if they'll cover this for you (e.g. as software issue).

Quoting Stefan Lasiewski <mailinglists at stefanco.com>:

> I have a machine running Solaris 8.
> The top two lines of the /etc/passwd (root and daemon)
> file somehow got wrapped together in one long
> continuous line, like this: 
> root:x:0:1:Root User:/:/usr/bin/ksh
> daemon:x:1:1::/:/sbin/noshell
> (If that line got wrapped, ksh and daemon don't have a
> end-of-line character. Like '.../bin/ksh
> daemon:x:...')
> As a result, I cannot log in as root.
>     % su -
>     su: Unknown id: root
> When I boot into single-user mode or connect via the
> console, I get this [1]:
>     missing or bad passwd entry for <root>
> Any ideas on how I could recover from this? I cannot
> log in as root to edit /etc/passwd, and I cannot find
> any CD-bootable Linuxus which can use a Sparc, or a
> "Bootable Solaris" recovery disk, etc.

Footnoes:
1.  Bleh - I'm not so fond of Google's new "groups"(/Usenet) interface ...
much less useful for tracking down details on a Usenet article.



More information about the buug mailing list