Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-23-2007, 07:30 AM   #1
LQ Newbie
Registered: Mar 2006
Distribution: openSUSE 10.2
Posts: 17

Rep: Reputation: 0

Sorry, not the most descriptive title, but sums up what happened, which was this:

I was viewing the file system with Nautilus as root, (not yet comfortable doing complex stuff with the line editor) and my laptop cursor (thanks to laptop mouse-pad) must have dragged and dropped /usr/bin into another directory. Nautilus didn't check I wanted that, and after I logged out of root, nothing works.

I assume this is what happened, because when I go into rescue mode, I can the /usr/bin is missing and I had a check set up to confirm deletion.

I'm using openSUSE 10.2, and I'm not familar with the correct file structure, can someone let me know how the best way to find where the binaries are now, and how to put them back (from the rescue system).

Trying not panic, many thanks,

Old 04-23-2007, 08:25 AM   #2
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257

Rep: Reputation: 34
Go to to see where your files are supposed to be. Look through your existing system to see if you can spot anything that is in the wrong place. Linux has lots of directories and files, so it can get tedious.

As an alternative, with your rescue disk running, do a search for something you know should be under /usr/bin to see where it really is.
Old 04-23-2007, 08:29 AM   #3
Registered: Apr 2007
Location: Adelaide, Australia
Distribution: Ubuntu 8.10 and 7.10 server
Posts: 95

Rep: Reputation: 15
RE:OOPS <-- too right mate :)

As printed on the front cover of the hitch hikers guide to the galaxy, in bold red letters Don't Panic

Ok the first thing you need to do is change root of rescue to the root of your file system (basically make all paths relative to /, by:

root@mech_client ~]# chroot /path/to/your/filesystem/root

The rescue disc should tell you where it has mounted your file system (usually under /mnt somewhere), then see if find works in rescue mode by typing

root@mech_client ~]# find / -name usr

this should find all files with usr in them and print them to the screen. If this works it is a relatively easy thing to restore your /usr directory. Then once you have found your /usr/and/everything/else directory tree back it up just in case. If you have a memory stick (size of 1G or more should do), mount it

root@mech_client ~]# mount -t vfat /dev/memstick_device /mnt

Substitute the /dev/memstick_device with the actual device file that the kernel attaches to the memorystick (dmesg will tell you what it is),and do a

root@mech_client ~]# cp /path/to/usr /path/to/mounted/memory/stick/

then cd to the directory where your usr directory is and then type

root@mech_client ~]# mv /path/to/usr /

then do a

root@mech_client ~]# ls -la /

to make sure everything is back where it should be. Once everything is back to where it should be, reboot and see if it all boots again. If not something else may be amiss as well!

If it boots ok, make yourself a non privileged account where you can't do this again

btw the unix root file system looks like this (FC 6, but yours should be basically the same):

[root@mech_client ~]# ls /
bin dev home lost+found misc net proc sbin srv tmp var
boot etc lib media mnt opt root selinux sys usr

Good luck, hope this helps
Old 04-23-2007, 08:51 AM   #4
Registered: Sep 2006
Location: Durham, NC
Distribution: Slackware, Ubuntu (yes, both)
Posts: 463

Rep: Reputation: 31
man hier

Old 04-23-2007, 09:04 AM   #5
LQ Newbie
Registered: Mar 2006
Distribution: openSUSE 10.2
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks for your replies, you've at least reassured me that things are recoverable.

One point of clarification, it was /usr/bin (not /usr) that got moved, probably to another subdirectory within /usr.

Using chroot will be the most practical, but could its use be explained a bit further? I've not ever used it before - will I know the path to my file system with ls ? The partition is /dev/sda2.

Old 04-23-2007, 01:41 PM   #6
LQ Newbie
Registered: Mar 2006
Distribution: openSUSE 10.2
Posts: 17

Original Poster
Rep: Reputation: 0
OK solved. Used mount /dev/sda2 /mnt, found it all under /mnt/tmp/bin using find /mnt -name bin.

Opensuse doesn't have /usr/etc which was a relief.

Thanks to the forum but as for Nautilus! I think I'll change to Konqueror.
Old 04-23-2007, 08:20 PM   #7
Senior Member
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 163Reputation: 163
That one should have been a fun exersize and learning experience! I've been lucky enough not to do that one yet!

I recommend you get in touch with your inner CLI user, as it's a wonderful part of Linux. I also recommend that you don't root yourself unless you really need to.
Old 04-23-2007, 11:44 PM   #8
Senior Member
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Originally Posted by PhilK
OK solved. Used mount /dev/sda2 /mnt, found it all under /mnt/tmp/bin using find /mnt -name bin.
Consider yourself lucky that you weren't using a distro such Ubuntu, which, to the best of my knowledge (I haven't actually pored through the init scripts for it), deletes everything in /tmp when it boots. So if you made the mistake of rebooting -- and it actually could get this far -- it would have bye bye /usr/bin!

Seriously, as others have suggested, you might want to consider learning CLI to use when running as root. While it's still possible to type something stupid, at least the slip of the hand won't move a major portion of the file system! I don't know if Konquerer would have given you some protection in this case or not.
Old 04-24-2007, 12:03 AM   #9
Registered: Mar 2007
Distribution: OpenBSD-CURRENT
Posts: 485
Blog Entries: 173

Rep: Reputation: 74
Originally Posted by PhilK
Sorry, not the most descriptive title, but sums up what happened
I do believe you nailed the problem description with that title =)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Oops!!! bigoli MEPIS 1 06-12-2005 04:36 PM
Oops !! bejiita Slackware 6 12-22-2004 01:54 PM
Oops! I think I did something I shouldn't have trumpetgirl Linux - Hardware 1 05-13-2003 02:21 PM
oops! nerdboy Linux - Networking 1 09-13-2002 03:29 AM
oops!!!! help_me Linux - Newbie 12 07-12-2001 10:49 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration