Solaris 10 – Recover from Moving Everything Under Root to /old

solarissystem-recovery

As the headline says everything or almost everything important as root under root (/) was moved to /old on a Solaris 10 machine. So now the typical fault when trying when running commands are Cannot find /usr/lib/ld.so.1 (changed $PATH and also tried changing $LD_LIBRARY_PATH, $LD_LIBRARY_PATH_64 and $LD_RUN_PATH and exporting them but nothing of that seems to change the real library path). Tried pretty much yesterday to find something that might help but found nothing that will actually change the library path for Solaris 10 other than maybe crle but can't run that since Cannot find /usr/lib/ld.so.1.

Found a lot of root or /usr/bin recovery tips and so on for Linux but the that information for that regarding Solaris 10/Unix is not rife and very sparse.

Can't run cp, ln, mkdir or mv since Cannot find /usr/lib/ld.so.1. Can't neither log in with other sessions to the machine. Though one session is still up which can be used and that window's being stalled with while true; do date; echo hej 1234567; done. We've discussed the solution to use a Solaris boot CD and also a Linux dist on a USB drive. We've discussed the solution to switch the hard drive disks to another rack.

The /.../static/.../mv solution has been tested but it didn't work.

The commands that still can be used are (there might be more commands that can be used): echo, <, >, >>, |, pwd, cd.

Is there a way to create a directory or folder without mkdir? Is there any way to use echo and > or echo and >> to restore /usr/lib/ld.so.1? I know that more than /usr/lib/ld.so.1 will probably need to be restored in order for commands to work.

Thank you very much for reading and have a very nice day =)

Best Answer

If you no longer have a shell running as root, you'll have to reboot into rescue media. Anything will do as long as it's capable of mounting the root filesystem read-write.

If you can still run commands as root, everything's copacetic. Set the environment variable LD_LIBRARY_PATH to point to the directories containing libraries used by the basic system tools. That's at least /usr/lib on a 32-bit Solaris, /usr/lib/64 on a 64-bit Solaris, possibly other directories (I don't have access to Solaris 10 now to check). To run an executable, prefix it with the runtime linker: /usr/lib/ld.so.1 (for a 32-bit executable) or /usr/lib/64/ld.so.1 (for a 64-bit executable) — now moved to /old. Thus you should be able to recover with something like:

LD_LIBRARY_PATH=/old/usr/lib
export LD_LIBRARY_PATH
/old/usr/lib/ld.so.1 /old/usr/bin/mv /old/* /
Related Question