Grub

De gacq wiki
Saltar a: navegación, buscar

Recuperar password de root

Cuando aparezca el menu de grub, tras encender la máquina, situate con los cursores en la línea del kernel que quieres usar. Pulsa 'e' para editar la entrada y edita la línea kernel (pulsando 'e' de nuevo). Añade al final de la línea lo siguiente:

init=/bin/bash

Esto hace que el sistema arranque una shell root sin pedir password. Es posible que el teclado esté en inglés y no puedas escribir el '=' y la '/', prueba '¡' y '-'. Pulsa 'b' para comenzar el arranque del kernel.

La partición raíz suele montarse como sólo lectura, asi que si olvidaste la clave de root y quieres cambiarla primero deberás remontarla como lectura/escritura. Para ello:

# mount -o remount,rw /dev/hda3

suponiendo que /dev/hda3 es tu partición raíz. Puedes averiguarlo ejecutando simplemente mount.

Por último, cambia la clave de root ejecutando:

# passwd root

Reinstall grub

/sbin/grub-install /dev/hda

Recuperar el grub despues de instalar el XP

Many Debian newbies often have to reinstall Windows on the same machine on where Debian is installed. Usually the Windows installation does not take care of our Debian system booting process, overwriting the master boot record with Windows.

To get back our grub first stage boot, here a procedure you can use.

  • Boot from debian CD choosing linux2.4 kernel (default)
  • Change to console 2 with alt + F2 keystrokes
  • Make a new dir to mount the boot partition, for example /disk
  • mount the root partition on /disk.
  • Do a chroot to the root partition: issuing chroot /disk
  • Run grub command to enter grub shell
  • Type in the root disk for grub, for example root (hd0,1). This is /dev/hda2 on my system
  • Type the following command to install grub on /dev/hda: setup (hd0).
  • Last step, type quit, exit from chroot, unmount all disks and reboot

Some notes:

The boot partition is where you put the boot files, normally newbies use only one partition that is mounted on /. Some advanced users store boot files in a separate partition and mount it under /boot. In that case, is the partition that is mounted under /boot the known-to-grub root partition.

Trubleshoting

Impossible to install grub

Installing Red Hat 5.4 on HP Blade server to boot from SAN disk failed to install Grub on MBR. When booting into linux rescue and trying to install Grub manually I got the following error:

# grub-install /dev/sdat
expr: non-numeric argument
/dev/sdat does not have any corresponding BIOS drive

The problem happens because of a Grub limitation, we have too many LUNs published to this server and Grub is unable to be instaled on MBR when you have more than 16 disk defined, I found a bug reported for Ubuntu package. https://bugs.launchpad.net/ubuntu/+source/grub/+bug/335174 After removing these disk its works.