Solved

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

Posted on 1999-01-18
26
1,284 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Can you do:
/usrbk/bin/ln -s /usrbk /usr
0
 
LVL 5

Expert Comment

by:n0thing
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 3

Author Comment

by:jlove1
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
jji, using a library as command?
What's that, did I/you miss something?
0
 

Expert Comment

by:jji
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Answer above ....
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now