Search:  
Gentoo Wiki

HOWTO_Rescue_chroot


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

We all had problems with gentoo once. Some were minor, like a blocking package, some where huge, like not being able to load your kernel (or grub at all) anymore. This guide will provide you with a shell to fix problems of the latter type.

Booting the LiveCD

Get a LiveCD and boot it. This should be pretty straightforward and is explained in the Gentoo Handbook.

Getting an environment

To get back into the chroot, the commands are

mount -t <fstype> /dev/ROOT /mnt/gentoo
mount -t <fstype> /dev/BOOT /mnt/gentoo/boot
swapon /dev/...
mount -t proc /proc /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev

You need to fill in the <fstype> for your filesystems and the actual devices for ROOT and BOOT. IDE devices are knows as /dev/hd... SATA, SCSI and USB will be /dev/sd... If you don't have a separate partition for /boot, omit that command - there is nothing to mount.

Getting the chroot

Now you have everything mounted you are ready to chroot with the following commands:

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile

And if you want a pretty prompt:

export PS1="(chroot) $PS1"


Now, your own Gentoo system is running on the kernel provided by the liveCD. Its like you had never left the chroot. You can continue the install or fix a broken one.

Note that grub is not like lilo. After grub is installed on the MBR and working, new kernels are added to grub.conf. There is no need to reinstall grub. This is because grub reads grub.conf at boot time to know what to do but lilo loads a block list (it cannot read the filesystem at boot) which is created when /sbin/lilo is ran.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Rescue_chroot"

Last modified: Fri, 05 Sep 2008 10:26:00 +0000 Hits: 2,696