Solved

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

Posted on 1999-01-18
26
1,295 Views
Last Modified: 2013-12-27
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
Comment
Question by:jlove1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
  • 4
  • +2
26 Comments
 
LVL 3

Author Comment

by:jlove1
ID: 2009260
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
 
LVL 5

Expert Comment

by:n0thing
ID: 2009261
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009262
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
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!

 
LVL 5

Expert Comment

by:n0thing
ID: 2009263
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009264
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
 
LVL 5

Expert Comment

by:n0thing
ID: 2009265
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009266
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009267
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
 
LVL 84

Expert Comment

by:ozo
ID: 2009268
Can you do:
/usrbk/bin/ln -s /usrbk /usr
0
 
LVL 5

Expert Comment

by:n0thing
ID: 2009269
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
 
LVL 5

Expert Comment

by:n0thing
ID: 2009270
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
 
LVL 84

Expert Comment

by:ozo
ID: 2009271
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
 
LVL 5

Expert Comment

by:n0thing
ID: 2009272
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009273
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009274
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2009275
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
 

Expert Comment

by:jji
ID: 2009276
You could try: '/usrbk/lib/ld.so.1 /usr/bin/mv foo bar'
(or where ever your stuff is..).
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2009277
jji, using a library as command?
What's that, did I/you miss something?
0
 

Expert Comment

by:jji
ID: 2009278
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2009279
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
 

Expert Comment

by:jji
ID: 2009280
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009281
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
 
LVL 3

Author Comment

by:jlove1
ID: 2009282
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
 
LVL 5

Accepted Solution

by:
n0thing earned 940 total points
ID: 2009283
Answer above ....
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2009284
n0thing, could you please tell which one is the answer?
jlove1, would please just grade the right and working answer?
0
 
LVL 3

Author Comment

by:jlove1
ID: 2009285
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linux :how to provide sudo access to the user 13 130
How to Change Interface on Cisco IOU 11 129
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 136
unix solaris snoop command 6 139
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question