But it <EM>was</EM> possible …

The other day Rob [1] comes into my room. “I need some help,” he said. “I made a mistake on my Sun box and I'm wondering if you could help me.”

Turns out Rob renamed a critical directory (/usr) and not only were most of the commonly used programs stored under it, but so were all the runtime libraries used by these commands, so nothing would run except for a few statically compiled programs (programs that contained the libraries they needed inside themselves). Nothing but the shell, mount, umount and fdisk were available.

Now, I'm used to recovering with minimal commands [2] but there was no way to rename a file, or change its permissions.

Heck, we were worse off than those in the classical Unix horror story [3]. Had I known SPARC assembly and how to call the kernel for Solaris 7, then yes, we might have had a chance. Create the smallest binary to either create a directory, or to rename a directory, and we'd be set. While it seems hard to create a file without the normal commands one usually uses for such a task, echo is a shell built-in, and using that with redirection and the ability to specify arbitrary octal constants (with the “\nnn” notation supported by the shell) and you have your program.

Okay, so you can't change the permissions on it, so pick some file you no longer need with execute permissions and write over that, then you'll be able to execute the hand-written program to get back into business.

Granted, that's if either of us new SPARC assembly and the executable format.

Since neither of us did, there wasn't much that could be done.

Well, maybe mounting the drives on another Solaris box, but Rob really didn't care all that much since we was planning on reinstalling Solaris on that system anyway.

But it was possible …

[1] http://www.tragic-smurfs.com/

[2] /boston/1999/12/13.4

[3] /boston/2002/06/25/horror.txt

Gemini Mention this post

Contact the author