Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1303
  • Last Modified:

HELP! issued mv /usr /usrbk: nothing works.

I issued the following command on Solaris:
mv /usr /usrbk
(I moved the /usr dir to /usrbk)..
Now, I can't issue any real commands.. they all say "cannot find /usr/lib/ld.so.1"
I thought I could rename it back when the problem started.. I was just going to mount a copy of /usr that I had copied to another partition.
I can fix this problem if anyone can tell me HOW to execute "mkdir" or "mv" (or equilivent programs) without /usr/lib/ld.so.1
I can't figure out a way to tell solaris that it has been moved to /usrbk/lib/ld.so.1

PLEASE HELP!

Will offer even more points for a speedy response!.. This is all the points I have at the moment.
0
jlove1
Asked:
jlove1
  • 10
  • 7
  • 4
  • +2
1 Solution
 
jlove1Author Commented:
Something else that WOULD work is if I could mount a partition to a mount point that doesn't exist..

like mounting /usr
when there is no empty dir /usr ...

0
 
n0thingCommented:
All the commands under /usr are dynamically linked. You can't do much, the only way is to boot from the CD in single user mode. Then mount your /usr on /abc and issue the mv, mkdir .. etc from there and put the whole thing back in its original places & reboot.
0
 
jlove1Author Commented:
Something else that WOULD work is if I could mount a partition to a mount point that doesn't exist..

like mounting /usr
when there is no empty dir /usr ...

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
n0thingCommented:
Here are the complete steps by step.
1- Ctrl-Stop-A
2- Insert your CD
3- From the > command line issue " boot cdrom -s"
4- At the # promt do mkdir /tmp/abc
5- mount /dev/dsk/c0t0d0sx /tmp/abc
    the /dev/dsk/c0t0t0sx is where your /usr is
6- mount the disk where /usrbk is on to /tmp/aaa
7- cd /tmp/aaa
8- mv * /tmp/abc

7- mv
0
 
jlove1Author Commented:
Something else that WOULD work is if I could mount a partition to a mount point that doesn't exist..

like mounting /usr
when there is no empty dir /usr ...

0
 
n0thingCommented:
jlove,

    No .. the mount command is dynamically linked ... you cannot use it and any others dynamically linked command without the libc.so. The only way you could use any of those commands is booting from CD.
0
 
jlove1Author Commented:
Something else that WOULD work is if I could mount a partition to a mount point that doesn't exist..

like mounting /usr
when there is no empty dir /usr ...

0
 
jlove1Author Commented:
I want to see if anyone has a better answer than this. The reason: my sparc has no cd-rom drive.... (long story)...
I do know that there must be a better way..

I DO have many other servers, some with NFS shares.. I was even wondering if I could share / on another server and mount it as / here... weird..
Well, I do know that there's got to be some hack to fix this one.. let me know.
Thanx

0
 
ozoCommented:
Can you do:
/usrbk/bin/ln -s /usrbk /usr
0
 
n0thingCommented:
ozo,
 
    Also thought of that .. but all binaries under /usr is dynamically linked ... therefore ln won't work. The only other way is to compile a static mv command ... if some directory is already sharedor mounted on/from other servers and was then you could use that command to move /usrbk back. Otherwise you can't, since you can't use the mount commands or any other basic commands. Cannot even ftp, mail ... etc the thing in or even copy from floppy, since the inetd will start some of the dinamically linked deamon or the system will try to automount the floppy and will failed.
0
 
n0thingCommented:
ozo,
 
    Also thought of that .. but all binaries under /usr is dynamically linked ... therefore ln won't work. The only other way is to compile a static mv command ... if some directory is already sharedor mounted on/from other servers and was then you could use that command to move /usrbk back. Otherwise you can't, since you can't use the mount commands or any other basic commands. Cannot even ftp, mail ... etc the thing in or even copy from floppy, since the inetd will start some of the dinamically linked deamon or the system will try to automount the floppy and will failed.
0
 
ozoCommented:
Would there happen to be a statically linked perl on the system?
Any built in commands in the shell you're using?
Anything already mounted on another machine?
0
 
n0thingCommented:
ozo,
 
    Also thought of that .. but all binaries under /usr is dynamically linked ... therefore ln won't work. The only other way is to compile a static mv command ... if some directory is already sharedor mounted on/from other servers and was then you could use that command to move /usrbk back. Otherwise you can't, since you can't use the mount commands or any other basic commands. Cannot even ftp, mail ... etc the thing in or even copy from floppy, since the inetd will start some of the dinamically linked deamon or the system will try to automount the floppy and will failed.
0
 
jlove1Author Commented:
I want to see if anyone has a better answer than this. The reason: my sparc has no cd-rom drive.... (long story)...
I do know that there must be a better way..

I DO have many other servers, some with NFS shares.. I was even wondering if I could share / on another server and mount it as / here... weird..
Well, I do know that there's got to be some hack to fix this one.. let me know.
Thanx

0
 
jlove1Author Commented:
Actually, repost that answer again.. somehow it was deleted.. I think it may be of some help after all..

I also tried something kinda cool.. I HEX edited "mkdir" and changed the reference in the file from /usr/lib to /tmp/lib.. then I tried mounting a NFS share to /tmp in order to make that work... I'll get back to you if I have any better results.. this looks promising..

Repost the answer about booting from the CD.

0
 
ahoffmannCommented:
depending on your shell set the LD_LIBRARY_PATH:

sh, ksh, bash#  LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usrbk:/usrbk/lib"; export LD_LIBRARY_PATH
csh, tcsh#        setenv LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/usrbk:/usrbk/lib"

Then you should be able to call all commands from  /usrbk/bin
0
 
jjiCommented:
You could try: '/usrbk/lib/ld.so.1 /usr/bin/mv foo bar'
(or where ever your stuff is..).
0
 
ahoffmannCommented:
jji, using a library as command?
What's that, did I/you miss something?
0
 
jjiCommented:
Hmm, what's strange with that? (I did 'mv /lib/ld-linux.so.2
 /lib/ld-linux.so.2.temp')
 
[jji:/home/jji]$ /bin/ls
zsh: no such file or directory: /bin/ls
[jji:/home/jji]$ /lib/ld-linux.so.2.temp /bin/ls
Desktop              icctrlhu.dbc         rootstg.scs

backup               mupad                useradmin
bcp.txt              mupad.map            vastatut
bin                  nsmail               vastatut.se

[jji:/home/jji]$

  As I see libraries are normal executables (well, a kind of executables:) what one needs in order to use commands..

0
 
ahoffmannCommented:
hmm, nice to see it working on linux, my Solaris core-dumps :-(
Anyway, you're right that shared libs are just a kind of executables.
0
 
jjiCommented:
In Linux there is env.variable 'LD_PRELOAD' which can be used in situations like this. If you miss '/lib/libc.so.6' you can 'export LD_PRELOAD=/lib/libc.so.6', or setenv in (t)csh, and get things working (I mean 'the program won't find the library'-problem ).
  Hmm, it seems to be same situation in Solaris, try it.
0
 
jlove1Author Commented:
ThanX all,
My Hexedited command worked!... I downloaded mkdir and mv, and hexedited the references from /usr/lib to /tmp/lib, then I mounted an NFS share from another system to /tmp/lib, and ran the mkdir from /tmp/lib (also had the libraries in that dir)...

That worked FINE.

I also tried booting from the CD (once I found the media)... that would have worked also,
so if you'll resubmit the answer, I'll give the points..

but this Hex-editing of the binaries is a REAL shortcut.. I was trying to find the source code to mkdir and mv, but was unsuccessfull.. this way didn't require the source.

Thx all!

0
 
jlove1Author Commented:
ThanX all,
My Hexedited command worked!... I downloaded mkdir and mv, and hexedited the references from /usr/lib to /tmp/lib, then I mounted an NFS share from another system to /tmp/lib, and ran the mkdir from /tmp/lib (also had the libraries in that dir)...

That worked FINE.

I also tried booting from the CD (once I found the media)... that would have worked also,
so if you'll resubmit the answer, I'll give the points..

but this Hex-editing of the binaries is a REAL shortcut.. I was trying to find the source code to mkdir and mv, but was unsuccessfull.. this way didn't require the source.

Thx all!

0
 
n0thingCommented:
Answer above ....
0
 
ahoffmannCommented:
n0thing, could you please tell which one is the answer?
jlove1, would please just grade the right and working answer?
0
 
jlove1Author Commented:
Great.. the correct answer was (either of the following):

1: N0thing's answer in regard to booting from the CD, then mounting root.

2: My answer about hex editing the binary. IF you need more info, contact me at
jlove1@primoweb.com

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 10
  • 7
  • 4
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now