Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using Gentoo CD to repair a broken system
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
delta407
Bodhisattva
Bodhisattva


Joined: 23 Apr 2002
Posts: 2876
Location: Chicago, IL

PostPosted: Tue Jun 18, 2002 1:45 am    Post subject: Using Gentoo CD to repair a broken system Reply with quote

The Gentoo install CD is very flexible; is is essentially just a Linux boot disk with a lot of useful utilities. So, if you botched your install, deleted /etc/fstab, or did something else preventing your computer from booting up right, just grab your trusty Gentoo disk.

Booting up is relatively easy, just pop it in your CD-ROM, make sure the BIOS is set to boot off of the CD, and wait for the boot: prompt. At this point, you could (if you wanted to) pass custom kernel options, but that's probably not going to be helpful, so just press enter. It will let you select a few things (most of which you can probably press enter at), and you will finally arrive at a prompt.

Now, you have to get access to your computer's filesystem(s). Assuming you know what partition mounts where, reassembling your filesystem can be done without too much trouble either.

Code:
# mkdir /mnt/gentoo                     <-- create a mountpoint for your / filesystem
# mount /dev/hda3 /mnt/gentoo           <-- attach your root partition (substitute hda3)
# mount /dev/hda1 /mnt/gentoo/boot      <-- attach your boot partition (substitute hda1)
# mount -o bind /proc /mnt/gentoo/proc   <-- since you never know when something might need it


At this point, your computer's filesystem should be accessible at /mnt/gentoo. You can use nano, the text editor included on the CD-ROM, to edit your configuration files as necessary (but remember to use "nano -w", otherwise nano will format it improperly). You can chroot into your computer ("chroot /mnt/gentoo /bin/sh"), if necessary, to do things like recompile your kernel (since installing modules will likely put them in /lib) or run Portage.

Once you're all done, run "umount -a" to unmount your filesystems correctly, and reboot.


Last edited by delta407 on Sat Sep 28, 2002 11:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zu`
l33t
l33t


Joined: 26 May 2002
Posts: 716
Location: BE

PostPosted: Tue Jun 18, 2002 11:57 pm    Post subject: Reply with quote

Thanks for these tips, I'm sure they'll come in hand one day :)

Greets
Back to top
View user's profile Send private message
Mike_McCready
n00b
n00b


Joined: 10 Jul 2002
Posts: 43
Location: Massachusetts

PostPosted: Wed Jul 10, 2002 5:17 pm    Post subject: Reply with quote

That day is today.
Back to top
View user's profile Send private message
get sirius
Guru
Guru


Joined: 27 Apr 2002
Posts: 316
Location: Madison, WI

PostPosted: Wed Jul 10, 2002 10:58 pm    Post subject: Reply with quote

After performing the above, it is then necessary to enter "#chroot /mnt/gentoo /bin/bash" in order to finally gain access to files written to one's hard drive (at least, in my quite-recent experience). Then perform the steps listed at code listing 41 in the Gentoo Installation Guide.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20048

PostPosted: Tue Aug 20, 2002 9:37 pm    Post subject: Reply with quote

Made this one sticky. I've run across many occaisions when it would help someone out. Hopefully there aren't too many others in here that need to be sticky.

EDIT: Unsticking as there is a FAQ on this.
_________________
Quis separabit? Quo animo?


Last edited by pjp on Tue Oct 15, 2002 6:34 pm; edited 1 time in total
Back to top
View user's profile Send private message
HamuNaptra
n00b
n00b


Joined: 07 Sep 2002
Posts: 40

PostPosted: Sun Sep 15, 2002 2:49 pm    Post subject: Reply with quote

I get this error:

# mount --bind /proc /mnt/gentoo/proc
mount: invalid option -- -
mount: invalid option -- b
mount: invalid option -- i
mount: invalid option -- d
mount: Mounting /proc on /mnt/gentoo/ptoc failed: Block device required

--------------------------------------
mount -o bind /proc /mnt/gentoo/proc worked :)
Back to top
View user's profile Send private message
pilla
Bodhisattva
Bodhisattva


Joined: 07 Aug 2002
Posts: 7729
Location: Underworld

PostPosted: Sun Sep 15, 2002 4:39 pm    Post subject: Reply with quote

Great, I've seen some lads that have erased their gcc-2.95 before emerging gcc-3.2 in some threads. I hope they'll find their way 8)

kanuslupus wrote:
Made this one sticky. I've run across many occaisions when it would help someone out. Hopefully there aren't too many others in here that need to be sticky.
Back to top
View user's profile Send private message
theneopro
Tux's lil' helper
Tux's lil' helper


Joined: 08 Aug 2002
Posts: 90

PostPosted: Tue Sep 24, 2002 5:30 pm    Post subject: It was the option flag Reply with quote

HamuNaptra wrote:

Quote:
I get this error:

# mount --bind /proc /mnt/gentoo/proc


this is the proper syntax:

# mount -o bind /proc /mnt/gentoo/proc

-Mykey
_________________
___________________________________
- The Rain Forest,
That sounds wet!!!!
Back to top
View user's profile Send private message
RagManX
Apprentice
Apprentice


Joined: 13 Jul 2002
Posts: 220
Location: Tennessee

PostPosted: Fri Sep 27, 2002 7:54 pm    Post subject: Reply with quote

And while you are at it, seems like you should turn on your swap:

Code:
swapon /dev/hda2


RagManX
_________________
http://www.gamingideas.com/ - an open discussion site for game improvement and new game ideas
Back to top
View user's profile Send private message
Ard Righ
Guru
Guru


Joined: 24 Jun 2002
Posts: 337
Location: Wellington, NZ

PostPosted: Sat Sep 28, 2002 10:36 pm    Post subject: Reply with quote

Could I suggest this gets added to the documentation for future Gentoo install ISOs, like for the 1.4 releases.

I just screwed up my kernel install, and without this guide handy, I would have to reinstall from scratch :(
Back to top
View user's profile Send private message
sheepdog
Guru
Guru


Joined: 14 Oct 2002
Posts: 369
Location: Edison Enterprises Inc., Lake Oswego, Oregon, USA

PostPosted: Thu Oct 24, 2002 4:10 am    Post subject: Reply with quote

This is all well and good. But the problem is that I am having the same problem exactly as in

https://forums.gentoo.org/viewtopic.php?p=108169#108169

for which there was apparantly no resolution. So I am trying to go back an rebuild a different kernel. Instead of OpenMosix I want the vanilla kernel. So I emerge sys-kernel/vanilla. That works. But the build is still using th openmosix sources. So i emerge unmerge openmosix. That works. Now I try to build in /usr/src/linux but there is no longer a Makefile there so nothing happens. So I go back and emerge unmerge sys-kernel/vanilla and then emerge sys-kernel/vanilla. Still there is no Makefile for building. How is this done?

-- Michael

P.S. Found my own answer. The /usr/src/linux was still linked to /usr/src/linux-2.4.19-openmosix. This was switched to link to /usr/src/linux-2.4.19 and all is well.


Last edited by sheepdog on Thu Oct 24, 2002 4:45 am; edited 1 time in total
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20048

PostPosted: Thu Oct 24, 2002 4:20 am    Post subject: Reply with quote

You have to link /usr/src/linux to the appropriate directory. For example, on my system:
Code:
# ls -l /usr/src/linux
lrwxrwxrwx    1 root     root           15 Apr 18  2002 /usr/src/linux -> linux-2.4.19-r1/
linux-2.4.19-r1 (or whatever) should be a directory under /usr/src
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
barnaclebarnes
n00b
n00b


Joined: 23 Oct 2002
Posts: 11
Location: London

PostPosted: Fri Oct 25, 2002 2:49 pm    Post subject: Reply with quote

It may also be handy to have the default .config file which the CD sources are built off. That way if the CD booted OK then a kernel built with the same config should as well. You can find the default config here:

Default .config

This should get you up and running. Note that this works with the Vanilla kernel. Not sure about the others.
Back to top
View user's profile Send private message
weeds2001
n00b
n00b


Joined: 23 Oct 2002
Posts: 2
Location: Omaha

PostPosted: Tue Oct 29, 2002 2:19 pm    Post subject: Reply with quote

thank you all for this info!! for some reason my grub.conf file got screwed up.....it was booting, but it was booting to grub> .... so now I'll be able to at least get back and change what I need to!! :D
Back to top
View user's profile Send private message
ckwall
Apprentice
Apprentice


Joined: 31 May 2002
Posts: 163

PostPosted: Fri Nov 01, 2002 2:48 am    Post subject: Reply with quote

Thank you so much for posting this, I was seconds away from reinstalling linux from scratch after jackin up my system. This seems like what I have been praying for.
Back to top
View user's profile Send private message
sephtin
n00b
n00b


Joined: 02 May 2003
Posts: 26

PostPosted: Mon May 12, 2003 7:57 am    Post subject: Reply with quote

From a compilation of this thread, and from the install doc... Here's what I threw together for my personal OH S#!T docs.
;)
Ya never know when you might need such a thing....

Code:

To Fix things using the Gentoo install CD:
1) Boot from the CD
2) swapon /dev/hd??
3) mount /dev/hd?? /mnt/gentoo
4) mount /dev/hd?? /mnt/gentoo/boot
5) mount -t proc proc /mnt/gentoo/proc
6) chroot /mnt/gentoo /bin/bash
7) env-update
8) source /etc/profile
9) --fix whatever and reboot.
Back to top
View user's profile Send private message
clocker
n00b
n00b


Joined: 17 Dec 2002
Posts: 48
Location: Canada

PostPosted: Sun Aug 10, 2003 8:37 pm    Post subject: Reply with quote

[quote="sephtin"]From a compilation of this thread, and from the install doc... Here's what I threw together for my personal OH S#!T docs.
;)
Ya never know when you might need such a thing....

[code]
To Fix things using the Gentoo install CD:
1) Boot from the CD
2) swapon /dev/hd??
3) mount /dev/hd?? /mnt/gentoo
4) mount /dev/hd?? /mnt/gentoo/boot
5) mount -t proc proc /mnt/gentoo/proc
6) chroot /mnt/gentoo /bin/bash
7) env-update
8) source /etc/profile
9) --fix whatever and reboot.
[/code][/quote]
Hi there...

I wish my install had a nice little "--fix" option..heh I have had some trouble with my /boot partition. There was some corruption on it and once that was fixed up with "e2fsck" for it's ext2 formatting most of the information was missing. I still had a /boot/grub but the /boot was otherwise empty.

So.. I'm several attempts into this attempt to live in Gentoo. I've build this system up before over a dial-up from scratch and I'm not too anxious to begin again.

Is there some way to rebuild the contents of the /boot without starting from scratch? I tried putting "bzImage" and the "system.map" in and editing my "/etc/fstab" to reflect my partition scheme and not references like "/dev/BOOT"

linux-2.4.20-gentoo-r5 linux-2.4.21 are both built and all the software is installed and portage is updated and and and... I want this dang thing to boot already!

The "/boot" is ext2fs like I said but the rest are all reiserfs.

I have built this Gentoo install from a "chroot" shell on my Redhat 7.2 box.

Any ideas will be welcomed.

Cheers! Ian.
Back to top
View user's profile Send private message
sephtin
n00b
n00b


Joined: 02 May 2003
Posts: 26

PostPosted: Mon Aug 11, 2003 3:04 am    Post subject: Reply with quote

There may be more that I'm missing.. (but I don't know what it would be)...

But in /boot, all I'm aware of there is the boot loader, it's config file, and the kernel image. Here is what I would try to get things back into running order:

- Rebuild your kernel
(There are a couple different ways listed in the install docs):
http://www.gentoo.org/doc/en/gentoo-x86-install.xml#doc_chap16

Install Grub:
http://www.gentoo.org/doc/en/gentoo-x86-install.xml#doc_chap23

Other than that.. you should be ok. If you have questions.. post them... :)

HTH
John
Back to top
View user's profile Send private message
clocker
n00b
n00b


Joined: 17 Dec 2002
Posts: 48
Location: Canada

PostPosted: Mon Aug 11, 2003 3:14 am    Post subject: rebuild missing /boot files Reply with quote

Thanks for the hand..

I put my copy of a good bzImage and a system.map in and tried to boot but that seems to be a bit short of the mark. I have a ton of other errors screaming at me but I can get to a prompt. I can't log in but I can get to a prompt..ehhe

I am back in my chroot from my redhat box so I can begin to repair what I can. I have moved this to the install forum under a similar topic.

Thanks again.
Ian.
Back to top
View user's profile Send private message
sephtin
n00b
n00b


Joined: 02 May 2003
Posts: 26

PostPosted: Mon Aug 11, 2003 3:50 am    Post subject: Reply with quote

are the errors regarding modules/etc?
Probably making modules again, would help?

What types of errors?
John
Back to top
View user's profile Send private message
clocker
n00b
n00b


Joined: 17 Dec 2002
Posts: 48
Location: Canada

PostPosted: Mon Aug 11, 2003 4:07 am    Post subject: /boot files Reply with quote

sephtin.
I don't believe they were actually.. but your suggestion is a good one.. If I don't hear back from others shortly I'll try to rebuild the kernel and modules before I go and do anything drastic... heh I'm so close I can taste it!
Cheers! Ian.
Back to top
View user's profile Send private message
clocker
n00b
n00b


Joined: 17 Dec 2002
Posts: 48
Location: Canada

PostPosted: Tue Aug 12, 2003 6:08 am    Post subject: /boot files Reply with quote

sephtin.
You did the deed.. thanks.. silly me for not testing with the single bzImage.. I just did not believe it was going to work..

Replacing the kernel image "bzImage" and working on my "/etc/fstab" I"m back in gear. Oh me of little faith.. heh

Thanks. By your clear thought I'm back on the learning curve.. cheers..
Ian.
Back to top
View user's profile Send private message
sephtin
n00b
n00b


Joined: 02 May 2003
Posts: 26

PostPosted: Wed Aug 13, 2003 12:40 am    Post subject: Reply with quote

And may your learning curve go smoothly!

Without knowing the error messages or specifics of what was exactly done to the system, I have to admit that it was simply a guess based on my experiences of trying to get my system back up after Genkernel hosed it.
<ot> I think genkernel has a lot of potential, but it's not quite there yet. ;)
</ot>

Anyway, when I got the "tons of error messages screaming at me", recompiling modules, etc. didn't quite do it for me.. I had to move the config file, make dep, move the config file back, and go through the process again... so I know how you felt... Think of it this way.. rather than detracting you from learning, it was simply another step along the way.. ;)

After all the help I've received on this forum, I'm just glad I could help out. :)
John
Back to top
View user's profile Send private message
clocker
n00b
n00b


Joined: 17 Dec 2002
Posts: 48
Location: Canada

PostPosted: Wed Aug 13, 2003 1:30 am    Post subject: /boot files.. now nOOb help Reply with quote

It seems like a great community.. I'm building a Debian box at the same time and this community seems a little looser all round.. ;^)
gracias.. nice guess... hehe
Back to top
View user's profile Send private message
TecHunter
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2003
Posts: 124

PostPosted: Thu Aug 14, 2003 6:24 am    Post subject: Reply with quote

hehe,i've already used knoppix livecd to repaire grub,very useful.
_________________
Gentoo is GREAT!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum