29.03.2024, 05:21 UhrDeutsch | English
Hallo Gast [ Registrierung | Anmelden ]

Grub2 recovery with chroot environment



It may happen that grub breaks during an update and the system can not start anymore.
Here you can start the Kanotix-live-cd and repair grub with the Acritox-Installer.
But there is another alternative. You may try to repair grub with a chroot.

#### IMPORTANT! ####

The architecture of the live-system should to be the same as the architecture of your hd installed system! To rescue a 32-bit system a 32-bit live-system is recommended, 64 bit would work too (just update-grub in chroot detects Kanotix64 then), to rescue a 64-bit-system you need a 64 bit live system.
--> All commands are executed as root

sudo -i


* Boot with the Kanotix Live-CD.
* Open a terminal and execute the following commands. By typing

fdisk -l

you will find out on which partition the system is installed and where grub needs repair.


From now on i will write /dev/sdXY , you have to replace sdXY with the right term of your partition.

* The filesystem will be mounted on /mnt

mount /dev/sdXY /mnt


* Now the important devices of the filesystem /dev /proc /sys have to be mounted.

for x in proc sys dev; do mount --bind /$x /mnt/$x; done


* Changing into the installes system now:

chroot /mnt 


* If needed Grub2 config files could be changed now like edit the /etc/default/grub for other vga modes or add custom scripts to /etc/grub.d for extra boot entries. The /boot/grub/device.map file can be optimized to match the correct boot device - the one that is select in the bios to boot from should be (hd0). You usally only need change this if you do not boot from /dev/sda. After that run

update-grub



* Now grub can be written in the MBR using this command

grub-install /dev/sda


* When errors appear, then try to run

grub-install --recheck /dev/sda


This rewrites the /boot/grub/devices.map with default values - which by default lists all available hds in default order. It does not write the grub.cfg - this is done by update-grub.

* The chroot is left by the command

exit

and /dev and the root filesystem will be unmounted by executing the following command

for x in proc sys dev; do umount /mnt/$x; done
umount /mnt


* Reboot and your system should start again.
XML Revisions of $tag
Seiten-History :: Letzter Editor : Kano :: Eigentümer : caillean ::
Powered by pnWikka 1.0
 
 
Deutsch | English
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2004 - 2006 by Jörg Schirottke (Kano).
Consult Impressum and Legal Terms for details. Kanotix is Free Software released under the GNU/GPL license.
This CMS is powered by PostNuke, all themes used at this site are released under the GNU/GPL license. designed and hosted by w3you. Our web server is running on Kanotix64-2006.