LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-20-2011, 04:44 PM   #16
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33

Well I don't know exactly which files I've accidentally deleted. I was running a livecd and mounted the ubuntu system in a file called mp. When I was done accessing the content of the hard drive, I stupidly thought I'd close it using rm mp. I had forgotten the correct way was using umount. It took me a second or maybe two to realize my error (perhaps the time it took me was the time for me to understand that this command was taking too long to return), and I then urgently pressed ctrl c.
If rm works in a deterministic and sorted way, maybe there's a way to know where it started and where it stopped (since I obviously haven't made any modifications to the system ever since). /home/me doesn't seem affected.

The results of the ls's you asked are:

root@bt:~# ls /mnt/ubuntu/
bin dev initrd.img lost+found opt sbin sys var
boot etc initrd.img.old media proc selinux tmp vmlinuz
cdrom home lib mnt root srv usr vmlinuz.old
root@bt:~# ls /mnt/ubuntu/bin/
bash dumpkeys mountpoint sh
bunzip2 echo mt sh.distrib
busybox ed mt-gnu sleep
bzcat egrep mv static-sh
bzcmp false nano stty
bzdiff fgconsole nc su
bzegrep fgrep nc.openbsd sync
bzexe fuser nc.traditional tailf
bzfgrep fusermount netcat tar
bzgrep grep netstat tempfile
bzip2 gunzip nisdomainname touch
bzip2recover gzexe ntfs-3g true
bzless gzip ntfs-3g.probe ulockmgr_server
bzmore hostname ntfs-3g.secaudit umount
cat ip ntfs-3g.usermap uname
chgrp kbd_mode open uncompress
chmod kill openvt unicode_start
chown less pidof vdir
chvt lessecho ping which
cp lessfile ping6 ypdomainname
cpio lesskey plymouth zcat
dash lesspipe ps zcmp
date ln pwd zdiff
dbus-cleanup-sockets loadkeys rbash zegrep
dbus-daemon login readlink zfgrep
dbus-uuidgen ls rm zforce
dd lsmod rmdir zgrep
df mkdir rnano zless
dir mknod run-parts zmore
dmesg mktemp sed znew
dnsdomainname more setfont
domainname mount setupcon
 
Old 06-20-2011, 05:00 PM   #17
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
looks like in /bin are all files deleted which alphabetically come before bash. In my /bin there is: arch, ash, awk, base64, basename. Where awk is a symlink.

But this is only possible if you either were within the /bin directory when it happened or you used the rm -r command.

I've sorted your output of "ls /bin" and append the file to this post.

Markus
Attached Files
File Type: txt files.txt (901 Bytes, 8 views)

Last edited by markush; 06-20-2011 at 05:04 PM.
 
Old 06-21-2011, 01:07 AM   #18
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
I don't remember exactly, but yeah it's possible I used the -r parameter.
So what should I do from here ? This chroot command doesn't work...
 
Old 06-21-2011, 11:06 AM   #19
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
Is the syntax that was given regarding chroot at least correct ? Maybe it's just a typo ?
 
Old 06-21-2011, 11:23 AM   #20
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Look here: http://www.gentoo.org/doc/en/handboo...?part=1&chap=6
chroot is very well explained in the Gentoo-Handbook

Markus
 
Old 06-21-2011, 11:59 AM   #21
Bapun007
Member
 
Registered: Dec 2010
Location: /home
Distribution: Ubuntu LTS, Slackware stable
Posts: 57

Rep: Reputation: 33
Quote:
Originally Posted by elishac View Post
Is the syntax that was given regarding chroot at least correct ? Maybe it's just a typo ?
yes the syntax is correct , by using that syntax i install gentoo so i am sure that the syntax is correct . see the link given by senior member . chroot command is well described in gentoo handbook .
 
Old 06-21-2011, 12:14 PM   #22
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
So what could be the reason for me to receive the error
chroot: cannot run command `/bin/bash': No such file or directory
and how can I find a way around it ?
 
Old 06-21-2011, 12:24 PM   #23
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
I think after one day of trials to repair your system you should consider a complete new install. I think you don't have enough experience to repair the system. Do you have a separate partition for your /home directory? do you have packages installed which are not from the repository? would it be much efford for you to configure your system after a reinstallation?

Think about this questions, a complete new install is done within 10 Minutes plus the time for the configuration.

Well, don't forget to backup your data.

Markus
 
Old 06-21-2011, 12:32 PM   #24
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
I don't have a separate partition for the /home directory. From what I could explore after the incident, I have no reason to believe that any personal file was deleted (the /rm really just lasted a second or two, and it's a slow computer). I don't quite remember if I have packages that are not from the main repository, but I do remember spending a lot of time installing and configuring some of them. So yes, it would be a huge effort to reconfigure my system.

On the other hand, I hope that professionals like you will be able to help me to repair the system and at least boot from it.
 
Old 06-21-2011, 12:51 PM   #25
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
The question about the separate /home partition was because if you do a complete new install, you'll have to save your personal data anywhere outside the partition since it will be reformatted.

One thing you can do is to perform an installation to the same partition where you Linux resides now but without formatting the partition. I don't have any experience with the Ubuntu-installer, so I don't know if this will be possible (it surely is possible, but you'll have to find your way around it).

If you do a reinstallation in the same partition without reformatting you'll have a similar situation as was described above when you wanted to do a chroot into your system and then use apt-get. The things which are there are overwritten with the same data and the things which you have deleted will be newly installed.

One other thing you could try is to do a chroot, but without the "/bin/bash" command at the end of the chroot commandline. Maybe that works.

Markus
 
Old 06-21-2011, 01:16 PM   #26
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
No it doesn't work either without /bin/bash. But it does autocomplete to /bin/ba..sh, isn't that weird, given the error displayed ?
 
Old 06-21-2011, 02:18 PM   #27
qrange
Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable, amd64
Posts: 819

Rep: Reputation: 32
hm, good thing /home isn't named /a_home
but moving it to separate partition is easy, just copy it..


I am not sure, but maybe simply copying some commands (from LiveCD or similar) to damaged /bin/ would work.
I once managed to run few simple binaries/commands from Debian in DamnSmallLinux and they run great (as long as they were 32bit, of course).

Last edited by qrange; 06-21-2011 at 02:20 PM.
 
Old 06-21-2011, 02:45 PM   #28
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
Forgive me but I still don't understand why sudo chroot /mnt/ubuntu/ /bin/bash returns:
chroot: cannot run command `/bin/bash': No such file or directory
There is a /bin/bash directory in the live cd, and "bash" is autocompleted. So how come I receive this error, and how come this chroot command doesn't work ? Maybe if we fixed that we could fix the whole issue ?
 
Old 06-21-2011, 02:52 PM   #29
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
I don't also understand this issue, your output of ls /mnt/ubuntu/bin showed that bash is there. You could mount your partition (as above to /mnt/ubuntu) and then change into the directory /mnt/ubuntu/bin and then execute
Code:
./bash
which is the same bash-shell which doesn't work when you want to chroot. Maybe you get some errormessages which point you to the real problem.

Markus
 
Old 06-21-2011, 02:55 PM   #30
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
Nope, no errors:
root@bt:/mnt/ubuntu/bin# ./bash
root@bt:/mnt/ubuntu/bin#
 
  


Reply


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
Tried to repair - lost Linux davholla Linux - Newbie 5 08-24-2011 05:51 AM
I need a Linux OS other than Ubuntu which has a repair disk or repair software jhmac77 Linux - Newbie 1 03-17-2008 07:04 AM
how to repair linux o/s amit.mitu Linux - Newbie 2 12-19-2007 08:29 AM
Repair NTFS partition from linux nyk Linux - Software 3 10-27-2004 03:27 PM
bootable repair linux distribution ViralHex Linux - Distributions 2 08-08-2004 01:31 AM


All times are GMT -5. The time now is 08:21 AM.

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