Renamed lib directory by mistake

Let's say someone accidentally renamed the lib directory in Solaris 8, and now they cannot get into the terminal or even rename the folder via file manager.What would one do?

Running daemons supporting file activity like ftpd/sshd might be able to do something, but they are dead if they exec().

Maybe boot up from a cd on a ramdisk and mount the device and fix it? Can Solaris do that? Else, install a small system to another disk.

1 Like

Notes:

I do have a copy of the lib directory on a windows machine.

My Sun Enterprise 250 server has a CD drive.

---------- Post updated at 12:37 PM ---------- Previous update was at 12:35 PM ----------

Could you please give me a hint on how to do that, or what I should google for to do that?

If you can boot off a CDROM, then you can mount the filesystem where /lib is missing and then copy the /lib directory structure over from backup.

Remember, when you have physical access to a machine, you simply boot a working OS, mount the disk partitions with problems and go in an make the repairs.

For example, your friend "Joe" accidentally deleted the /lib directory running Solaris 8. You are running Solaris 8 as well. So you say, "Hey Joe, no worries at all". I can get you up and running in no time.

Then, you shutdown Joe's machine, remove his disk, shutdown your machine, install and mount the disk, copy over your /lib directory or copy from CDROM or even install from backup.... the choice is yours.

Joe has to buy you the beers after work.

As long as you have a bootable machine, you can fix it. Even if your machine is Linux. You can still mount the Solaris filesystem (what ever you are using), and repair the injury.

1 Like

I was using WinSCP at the time, now I can no longer log into the server using or, or any other Putty-type program. I get an access denied message.

OH, in your case, it is even easier...

You can simply mount the filesystem and move it over from whatever it was accidentally named, back to /lib.

You can be up and running in a few minutes.

---------- Post updated at 17:47 ---------- Previous update was at 17:45 ----------

Unlikely....

Without /lib very little works on most machines if they use shared libs, like most modern systems do.

You've got my head spinning Neo, thank you so much.

What OS would you recomend I use to put on this disk for my ancient machine?

I have a Sun Enterprise 250 (1998 vintage).

No need for another disk. Just boot a Solaris installation CD, select to run a shell from it, mount your / filesystem and fix the directory name.

1 Like

Running programs have their libs already open and so by inode and mmap(), not path.

If any user has a mounted home dir, you can go elsewhere and add the mistake to LD_LIBRARY_PATH in their .kshrc, .profile, and then maybe their account might log in from the console or something.

If you have a running terminal anywhere, you can export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:mistake_dir. I keep a bunch per server, xterms under VNC Xvnc local desktop. I have used them like sacrificial troops when swap is full, one exec per screen to rm -rf /tmp (not as root).

As jlliagre also suggests, do you have your install CDROM?

Most people I know can't find them in emergencies, and with a 1998 model, I would be surprised if you can find yours.

Do you have an install disk or a bootable version of Solaris 8 anywhere?

If not, do you have another machine handy? If so, what is it?

---------- Post updated at 18:08 ---------- Previous update was at 18:04 ----------

In theory... but when you ssh into a box I believe the exec process will go to disk again to look for libs.

I could be wrong... but I have never got anything to work ever when I did this, and I have done it. I have removed the /lib directory before and I can't even get most commands to work.

And, as the poster confirms, he can't get in that way so the point is moot.

I have three hand-burned discs:

Solaris 8 10/01 Installation Disk
Solaris 8 10/01 Disk 1 of 2
Solaris 8 10/01 Disk 2 of 2

I don't know what 10/01 means...

---------- Post updated at 01:11 PM ---------- Previous update was at 01:11 PM ----------

I've tried getting to the terminal from different machines, no dice.

Great!! You are halfway to geek heaven!

One of the Solaris gurus like jlliagre can "bring you home" from here.

Thanks for stopping by and glad to get you on the road to recovery :smiley:

Thank you so much everyone, this is all brand new to me, I was just trying to instal PHP on the machine and couldn't because I had to update libxml. I thought I read that when I update the libxml, it would create a lib directory, but I allready have a lib directory, and I knew it was important, so I renamed it to "lib_old" and before going any further after unpacking libxml2... and that's how I got where I am.

I did make a copy of lib on my windows machine, but I should have made the copy on the linux machine and called THAT "lib_backup"...

---------- Post updated at 01:18 PM ---------- Previous update was at 01:17 PM ----------

Once I insert the instal CD, and reboot, will it be self-explanatory from there, and give me the option to repair?

It isn't going to simply start installing Solaris 8, is it?

No worries!

We all have done the same thing or even worse at one time or another!

We have a lot of Solaris experts here to help you.

---------- Post updated at 18:21 ---------- Previous update was at 18:19 ----------

Hold your jets, jetjaguar... wait for one of the Solaris gurus to intercept your post and reply.

Thank you, standing by (and googling).

What about the shell where you ran that mv, is it still alive?

He already mentioned that he cannot even login via his terminal console.

If I understand your question, the answer is no.

I renamed the lib directory while I was using WinSCP, then it sit for a few minutes while I did something else, and when I went back, it wouldn't let me do anything. I restarted it and then couldn't log back in.

OK, if nobody logged in on any shell, we just have either

  • attaching the / disk elsewhere by (media-dependent-method-like-moving drives or cables)? or
  • installing a little compatible OS somewhere on exisitng disk (normal swap drive?) or added disk (if possible and available) from some media?

Any others, so far?

If that question is directed towards me, I don't understand what you're asking.

Is "/ disk" a typo, or unix jargon?