LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-18-2011, 06:30 PM   #1
elishac
Member
 
Registered: Nov 2009
Posts: 522

Rep: Reputation: 33
repair linux


hello,

while I was using a live cd, I accidentally deleted some files on the hard drive, including apparently the init file. The fact is that linux doesn't start anymore (kernel panic).
Can you help me to repair the system please ?

Thanks
 
Old 06-18-2011, 06:38 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Quote:
I accidentally deleted some files on the hard drive, including apparently the init file.
I don't think it'll be possible to restore it as you don't actually know which files you deleted.

Which distro are you using? Can you post the exact error you get when booting up (write it down or take a photo of it)?

On a separate note, you really should make regular backups of your system.
 
1 members found this post helpful.
Old 06-18-2011, 06:42 PM   #3
qrange
Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable, amd64
Posts: 805

Rep: Reputation: 32
if its debian(ish), I think you can just install kernel again from livecd with chroot+apt.
 
1 members found this post helpful.
Old 06-19-2011, 11:30 AM   #4
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
It's ubuntu 10.04.
Can you describe in more details how to chroot+apt please ?

Thanks
 
Old 06-19-2011, 05:42 PM   #5
Bapun007
Member
 
Registered: Dec 2010
Location: /home
Distribution: Ubuntu LTS, Slackware stable
Posts: 56

Rep: Reputation: 33
Quote:
Originally Posted by elishac View Post
It's ubuntu 10.04.
Can you describe in more details how to chroot+apt please ?

Thanks
from your live environment do this
Code:
sudo mkdir /mnt/ubuntu
now mount your /proc and /dev by these commands
Code:
sudo mount -t proc none /mnt/ubuntu/proc
Code:
sudo mount mount --rbind /dev /mnt/ubuntu/dev
copy your DNS info of live system
Code:
sudo cp -L /etc/resolv.conf /mnt/ubuntu/etc/
above command copy your DNS info of live system to your ubuntu partision .
now chroot
Code:
sudo chroot /mnt/ubuntu /bin/bash
now you are inside your ubuntu system you can now use apt-get to install kernel .

Last edited by Bapun007; 06-20-2011 at 01:32 PM.
 
1 members found this post helpful.
Old 06-19-2011, 08:29 PM   #6
tailinlinux
Member
 
Registered: Oct 2010
Location: Paudpod, Botolan, Zambales, Philippines
Distribution: Mandriva, Ubuntu, Mint, Open Suse, Meego
Posts: 390
Blog Entries: 3

Rep: Reputation: 25
Quote:
Originally Posted by elishac View Post
hello,

while I was using a live cd, I accidentally deleted some files on the hard drive, including apparently the init file. The fact is that linux doesn't start anymore (kernel panic).
Can you help me to repair the system please ?

Thanks
Maybe this one help.
Maybe you need to reinstall your distribution.

Try this one.
Insert a live cd.
Click live installation.
select Custom partitioning or use the existing partition.
Select sda1 to be formatted and not the home partition.

then finish the installation.
 
0 members found this post helpful.
Old 06-19-2011, 09:40 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,960

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by tailinlinux View Post
Maybe this one help.
Maybe you need to reinstall your distribution.

Try this one.
Insert a live cd.
Click live installation.
select Custom partitioning or use the existing partition.
Select sda1 to be formatted and not the home partition.

then finish the installation.
tailinlinux, did you bother to read the OP's question??
Quote:
Originally Posted by elishac
Can you help me to repair the system please ?
The OP knows how to do an installation, and they're trying to AVOID a format/reinstall...they want to REPAIR the system. Bapun007 posted the soltuion.

Also, you're posting information that may not apply to the OP, namely the fact that their home partition may NOT be separate from their root...they never mentioned their disk name, ID, or partition structure. You may be telling them to format their home partition, since you don't know how their drive is laid out. Please try to avoid posting information based on pure assumption, and address the OP's question.
 
Old 06-20-2011, 01:55 PM   #8
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
Thanks a lot TB0ne it feels really reassuring to know that some people are here to check whether others mislead you into taking the wrong measures.
Thanks to tailinlinux too though, I'm sure you meant well.

This doesn't work though: sudo mount -t proc none /mnt/ubuntu/proc
mount: mount point /mnt/ubuntu/proc does not exist

And anyway, assuming I manage to chroot like you said, how can I "use apt-get to install kernel" ?
 
Old 06-20-2011, 03:53 PM   #9
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
I also have a recovery mode a other kernel versions in the grub window, does that help ?
 
Old 06-20-2011, 04:48 PM   #10
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Quote:
Originally Posted by elishac View Post
...
This doesn't work though: sudo mount -t proc none /mnt/ubuntu/proc
mount: mount point /mnt/ubuntu/proc does not exist
There is a step missing in Bapun007's post, before mounting proc you'll have to mount Ubuntu
Code:
sudo mount /dev/sda? /mnt/ubuntu
where sda? is the partition where your Ubuntu resides.

Markus

Last edited by markush; 06-20-2011 at 04:49 PM.
 
Old 06-20-2011, 04:51 PM   #11
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
I see... So when I get there, how to use apt-get to repair the kernel ?

And this doesn't work either:
sudo chroot /mnt/ubuntu /bin/bash
chroot: cannot run command `/bin/bash': No such file or directory

Last edited by elishac; 06-20-2011 at 04:57 PM.
 
Old 06-20-2011, 05:04 PM   #12
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
referring to an Ubuntu-Wiki in german language the command
Code:
dpkg --get-selections | grep "\binstall" | awk '{print $1}' > /tmp/dpkg.log
should look which packages are/were installed and then
Code:
sudo xargs -n1 apt-get --reinstall install -y < /tmp/dpkg.log
reinstalls them. But I'm not sure, I have no experience with Ubuntu.

good luck

Markus

EDIT: I'll append the link: http://wiki.ubuntuusers.de/apt-get

Last edited by markush; 06-20-2011 at 05:08 PM.
 
Old 06-20-2011, 05:10 PM   #13
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Quote:
Originally Posted by elishac View Post
I see... So when I get there, how to use apt-get to repair the kernel ?

And this doesn't work either:
sudo chroot /mnt/ubuntu /bin/bash
chroot: cannot run command `/bin/bash': No such file or directory
could you please in this situation post the output of
Code:
ls /mnt/ubuntu
ls /mnt/ubuntu/bin
Possibly this are the files which you've deleted by accident.

Markus
 
Old 06-20-2011, 05:15 PM   #14
Bapun007
Member
 
Registered: Dec 2010
Location: /home
Distribution: Ubuntu LTS, Slackware stable
Posts: 56

Rep: Reputation: 33
Quote:
Originally Posted by elishac View Post
I see... So when I get there, how to use apt-get to repair the kernel ?

And this doesn't work either:
sudo chroot /mnt/ubuntu /bin/bash
chroot: cannot run command `/bin/bash': No such file or directory
sorry for that , i dont have much experience in ubuntu , but that works for debian 6 for me .

Last edited by Bapun007; 06-20-2011 at 05:19 PM.
 
Old 06-20-2011, 05:21 PM   #15
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
the chroot command is correct. This should work with every Linux, I've done it often with Slackware. But I suppose the OP has accidentally deleted files in /bin which may cause his problems.

But if this is the case he will indeed have to perform a complete reinstall.

Markus
 
  


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 06: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 08:04 AM
how to repair linux o/s amit.mitu Linux - Newbie 2 12-19-2007 09:29 AM
Repair NTFS partition from linux nyk Linux - Software 3 10-27-2004 04:27 PM
bootable repair linux distribution ViralHex Linux - Distributions 2 08-08-2004 02:31 AM


All times are GMT -5. The time now is 12:57 PM.

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