Solved

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

Posted on 1999-01-18
26
1,292 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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.

803 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