Results 1 to 9 of 9

Thread: I deleted /opt/lib from my system

  1. #1
    Join Date
    Aug 2012
    Beans
    601

    I deleted /opt/lib from my system

    Hey,
    I deleted /opt/lib from my system
    I was doing some copying and instead of doing
    Code:
    $cp file /opt/lib/, I did
    $cp file /opt/lib
    But as of now, everything seems to work ok.

    What do I do now ?
    Is there a command to restore it or something, or should I manually create a mkdir /opt/lib and copy the contents from /opt/lib on another machine ?

    Thanks.

  2. #2
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,571
    Distro
    Xubuntu 14.10 Utopic Unicorn

    Re: I deleted /opt/lib from my system

    I assume you were trying to copy a file to a folder /opt/lib to create /opt/lib/file, but the directory didn't exists so you ended up creating a file called /opt/lib instead. If this guess is wrong, ignore this post.

    I would be inclined to give the file its original name, create the directory and then move the file to the directory, like this:
    Code:
    mv /opt/lib /opt/file
    mkdir /opt/lib
    mv /opt/file /opt/lib/
    although if the original file still exists, deleting the copy, making the directory and then copying would be OK too:
    Code:
    rm /opt/lib
    mkdir /opt/lib
    cp file /opt/lib/

  3. #3
    Join Date
    Aug 2012
    Beans
    601

    Re: I deleted /opt/lib from my system

    Quote Originally Posted by The Cog View Post
    I assume you were trying to copy a file to a folder /opt/lib to create /opt/lib/file, but the directory didn't exists so you ended up creating a file called /opt/lib instead. If this guess is wrong, ignore this post.
    Sir, you understood my scenario perfectly, but I think /opt/lib existed.
    I am more worried about the data within /opt/lib which I have deleted. Is it some important data in /opt/lib. Is there a way to restore it at some point.

  4. #4
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,571
    Distro
    Xubuntu 14.10 Utopic Unicorn

    Re: I deleted /opt/lib from my system

    I don't think there is a way to restore deleted data. But I don't see anything in your post that would have deleted data, other than perhaps overwriting a pre-existing file called /opt/lib.

  5. #5
    Join Date
    Aug 2012
    Beans
    601

    Re: I deleted /opt/lib from my system

    Quote Originally Posted by The Cog View Post
    I don't think there is a way to restore deleted data. But I don't see anything in your post that would have deleted data, other than perhaps overwriting a pre-existing file called /opt/lib.
    Yes sir, I rewrote the file, means I basically deleted the file and replaced the system file with my file which is of no significance right ?
    I was thinking if I should copy this folder from a different system and paste it on my system.

  6. #6
    Join Date
    Aug 2011
    Location
    52° N 6° E
    Beans
    2,610
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: I deleted /opt/lib from my system

    As far as I know, there is no system file called /opt/lib nor a system directory called /opt/lib/. Of course, you can create a file or directory named so, but it would only contain what you put in it yourself. The only thing that could have gone wrong in your case is that you may have replaced the file /opt/lib, which you would have installed yourself, by a new file or that you have replaced the file /opt/lib/file, which you also would have installed yourself, by a new file. I'm quite sure you haven't damaged your system.

    The only difference between
    Code:
    1$ cp file /opt/lib/
    2$ cp file /opt/lib
    is that (1) would give you an error message if the directory /opt/lib/ didn't exist and (2) would copy to the file /opt/lib if the directory /opt/lib/ didn't exist.

  7. #7
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    8,570
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: I deleted /opt/lib from my system

    Normally, user-installed, or 3rd party applications get put in /opt, like flash player, firefox, googleearth, etc. So those apps will definitely be broken. Good thing you didn't delete /usr/lib. I assume /opt/lib exists on your system, otherwise why would you want to put a file there? I don't see it on mine (12.10). Linux should work to put the file into the /opt/lib directory in either case. If /opt/lib did not exist, then it exists now as a file, but not a directory.

    Just keep a list of things that don't work anymore and reinstall them using apt-get, synaptic, or the software center. Over time, you will get /opt/lib repopulated.

    Be careful with your typing in linux. Your computer will do exactly what you tell it to, no more and no less.
    Last edited by tgalati4; January 16th, 2013 at 08:09 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  8. #8
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,571
    Distro
    Xubuntu 14.10 Utopic Unicorn

    Re: I deleted /opt/lib from my system

    Agreed, on normal install of Ubuntu, /opt is an empty folder. It contains neither a file or folder called lib. So the only thing you might have overwritten is something else non-standard that you installed earlier.

    I think probably you did not overwrite anything, which is why you cannot now detect anything broken.

  9. #9
    Join Date
    Aug 2012
    Beans
    601

    Re: I deleted /opt/lib from my system

    Quote Originally Posted by Impavidus View Post
    As far as I know, there is no system file called /opt/lib nor a system directory called /opt/lib/.
    Quote Originally Posted by The Cog View Post
    I think probably you did not overwrite anything, which is why you cannot now detect anything broken.
    Impavidus, The Cog , you were right.
    There was no such file in my system.
    I think when I did cp file /opt/lib. It created a file, not directory called lib under /opt. And I deleted it on panicking. Thanks a lot for your replies. Marking the thread as solved.

    Quote Originally Posted by tgalati4 View Post
    Be careful with your typing in linux. Your computer will do exactly what you tell it to, no more and no less.
    tgalati4, sure Sir. I'm glad I did not have to learn it the hard way.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •