10.5.1.5. Installing GRUB's boot record from a GRUB DVD or floppy disk

Sometimes the GRUB boot record gets damaged, making it impossible to boot the system normally. It may be necessary to boot from a GRUB DVD or floppy disk to fix this type of problem.

To create a GRUB DVD on a Fedora system (obviously not the one that won't boot!), enter these commands:

# cd /usr/share/grub/

# growisofs -Z /dev/cdrom -R -b stage2_eltorito -no-emul-boot -boot-load-size 4 -boot- info-table i386-redhat

Type the entire growisofs command on one continuous line. 

To create a bootable floppy instead of a DVD:

# cd /usr/share/grub/i386-redhat

# cat stage1 stage2 >/dev/fd0  

It's worthwhile keeping a GRUB DVD or floppy with your system manuals just in case you ever find that you can't boot your system due to bootloader problems. 

Boot your system with this disc or floppy. A GRUB command prompt will appear, as shown in Figure 10-23 .

Figure 10-23. GRUB command prompt from a CD/DVD boot  

At this prompt, search for your stage1 file:

grub> find /boot/grub/stage1

Error 15: File not found

grub> find /grub/stage1

 (hd0,0)

If your boot files are in your root filesystem, GRUB will find /boot/grub/stage1 , but if you have a separate /boot partition, GRUB will find /grub/stage1 . In the previous example, the partition (hd0,0) contains the stage1 file.

Make this partition your root partition:

grub> root (hd0,0)

 Filesystem type is ext2fs, partition type 0x83

Now instruct GRUB to set up the boot record on that drive:

grub> setup (hd0)

 Checking if '/boot/grub/stage1' exists... no

 Checking if '/grub/stage1' exists... yes

 Checking if '/grub/stage2' exists... yes

 Checking if '/grub/e2fs_stage1_5' exists... yes

 Running 'embed /grub/e2fs_stage1_5 (hd0)'... 15 sectors are embedded.

succeeded

 Running 'install /grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/grub/stage2 /grub/grub

.conf'... succeeded.

Done 

Note that the setup command was given the drive (hd0) instead of the partition (hd0,0) to install the boot record at the start of the drive instead of the start of the boot partition.

You can now remove the GRUB disc/floppy and boot directly from the hard drive.

10.5.1.6. Editing boot options

To temporarily override a GRUB menu option, select a menu option on the boot menu using the up/down arrow keys, and then press E (for edit). The screen shown in Figure 10-24 will be displayed.

If you have a bootloader password configured, you will be prompted for it at this point. 

Figure 10-24. Selecting a menu-entry line to edit  

Use the arrow keys to select the line you wish to edit, and then press E again. You can now move across the line using the arrow keys, as shown in Figure 10-25 . Type new text to insert it into the line, or use the Backspace/Delete keys to remove text. Press Enter when done.

Figure 10-25. Edit a line in a menu entry  

Press Enter to accept your changes or Esc to undo them. In either case you will return to the menu-entry display shown in Figure 10-24 ; press B to boot, or press Esc to return to the boot menu.

As a shortcut, if you are adding boot options only to an existing menu entry, select the entry using the up/down arrow keys, then press A (for append). You can then type the additional option(s), such as a runlevel. Press Enter to proceed with booting or Esc to cancel and return to the boot menu.

10.5.1.7. Installing or changing a GRUB password

To protect against the unauthorized use of runlevel S or other boot options, it's a good idea to add a password entry to the boot menu. If you didn't do this during the installation, you can add the password at any time by following these steps:

Generate an encrypted password with the grub-md5-crypt command:

$ grub-md5-crypt

Password:

 bigsecret

Retype password:

 bigsecret

$1$f1z061$j/UEYyBn0e0996w0gjq4k/

Вы читаете Fedora Linux
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату
×