GRUB : Grand Unified Boot Loader

REINSTALL

update-grub
 /usr/sbin/update-initramfs -u

help

GRUB_CONFIG=/boot/grub/grub.cfg
sudo grep 'menuentry ' $GRUB_CONFIG | cut -f 2 -d "'" | nl -v 0
sudo grub-reboot $index # wont work
sudo grub-reboot $name # will raise warning
sudo grub-set-default  0
sudo grub-reboot   'Advanced options for Debian GNU/Linux>Debian GNU/Linux, with Linux 4.9.0-9-amd64'
sudo update-grub
sudo reboot

TODO

grub screw syslinux or is it gag ?

"Welcome to GRUB!"

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=463081

mv /etc/default/grub /etc/default/grub.orig

sudo os-prober 
/dev/sda2:Microsoft Windows XP Professional:Windows:chain
  
cat<<EOF > /root/reboot.sh
#! /bin/sh

#TODO: update that one ie 0=l 1=r 2=w
MENU_ENTRY=2

sudo grub-reboot $MENU_ENTRY 
sync
sync
sync
echo "About to reboot : Press control+C to cancel"
sleep 10
sudo reboot 
EOF

RESCUE

RESCUE

http://forum.ubuntu-fr.org/viewtopic.php?id=358656


GRUB loading.
error: no such disk
grub rescue> set
prefix=(UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)/boot/grub
root=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
grub rescue> ls
(hd0) (hd0,6) (hd0,5)
grub rescue> ls (hd0,5)/
error: unknown filesystem
grub rescue> ls (hd0,6)/
./ ../ lost+found/ boot/
grub rescue> set prefix=(hd0,6)/boot/grub
grub rescue> insmod sh
...//...
rescue:grub> ls (hd0,6)/boot
./ ../ vmcoreinfo-2.6.31-20-generic System.map-2.6.31-20-generic initrd.img-2.6.31-20-generic
vmlinuz-2.6.31-20-generic config-2.6.31-20-generic grub/ memtest86+.bin abi-2.6.31-20-generic
rescue:grub> set root=hd0,6
rescue:grub> insmod linux
rescue:grub> linux /boot/vmlinuz-2.6.31-20-generic root=/dev/sda6 quiet
   [Linux-bzImage, setup=0x3400, size=0x3c400]
rescue:grub> initrd /boot/initrd.img-2.6.31-20-generic
   [Initrd, addr=0x177fb000, size=0x83874e]
rescue:grub> boot
...//...

GRUB SHELL

drivemap
error: no such partition.
root=(hd0,5)
search.file device.map

GRUB CHAINLOAD

cat /etc/grub.d/90_sda7 
#!/bin/sh
exec tail -n +3 $0

menuentry "sda7" {
        set root=(hd0,msdos6)
#       search --no-floppy --fs-uuid --set 147e39c87e39a400
        chainloader +1
}

GRUB NTLDR

Did not work from me :

root@nrv:/home/rzr# cat /etc/grub.d/WXHOEM_FR
#! /bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Windows XP installer" {
insmod part_msdos 
insmod ntfs 
insmod ntldr 
insmod fat
set root='(hd0,msdos1)'
search -f /i386/setupldr.bin -s root 
ntldr /i386/setupldr.bin
} 

Errors

lts ubuntu 18

https://askubuntu.com/questions/254491/failed-to-get-canonical-path-of-cow

root@kubuntu:/mnt/tmp# echo 'GRUB_ENABLE_CRYPTODISK=y' >> /etc/default/grub
root@kubuntu:/mnt/tmp# grub-install --recheck --root-directory=/mnt/tmp/ /dev/sdb
Installing for i386-pc platform.

dev/ mising sd?

MD

"Welcome to Grub"

Hang

Warnings

df: Warning: cannot read table of mounted file systems: No such file or directory

"error: no such device"

sudo grub-install $disk

Error : "error: no such partition"

Context: Disk was installed on SatA and then relocated to UsB :

grub rescue> ls 
(hd0) (hd0,msdos5) ...

Solution:

Possible fix, I installed DebiaN-9 to 1st part (800M < 1GB, DebiaN-10 did not fit in) disk is attached as USB.

Grub boots fine from UsB now:

fdisk -l 
Partition 4 does not start on physical sector boundary

Resources:

Error 2 : Not found or not a block device.

root@nrv:/# grub-install  /dev/sda10
Could not find device for /boot: Not found or not a block device.
tar cvfz /root/grub.tar.gz /boot/grub
sudo aptitude reinstall grub
grub-install --recheck /dev/sda10
grub --batch
find /boot/grub/stage1
root (hd1,9)
#  Filesystem type is ext2fs, partition type 0x83
setup (hd1,9)
# Checking if "/boot/grub/stage1" exists... no
# Checking if "/grub/stage1" exists... no
# Error 2: Bad file or directory type

https://bugs.launchpad.net/ubuntu/+source/grub/+bug/207001

 /mnt/parent/usr/sbin/grub --version
grub (GNU GRUB 0.97)


grub> setup (hd1,9)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd1,9)"... failed (this is not fatal)
 Running "embed /boot/grub/e2fs_stage1_5 (hd1,9)"... failed (this is not fatal)
 Running "install /boot/grub/stage1 (hd1,9) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.

grub : Error 15 : File not found

grub> find /boot/grub/menu.lst
find /boot/grub/menu.lst
 (hd0,5)
 (hd1,0)
grub> root (hd1,0)
root (hd1,0)
grub> setup (hd1,0)
setup (hd1,0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... no

Error 15: File not found
find /boot/grub/devices.map

also check for devices.map

grub-install --recheck /dev/sda1

error : "failed to get canonical path of" "devtmpfs"

Failed on deb install,

update-grub

solution

parted show no parts while /proc/partitions is there

chroot to install testdisk to recreate the partition table

grub : error ...

External Disk : USB

fdisk -l /dev/sdb
| Disk /dev/sdb: 250 GB, 250056737280 bytes
| 255 heads, 63 sectors/track, 30401 cylinders
| Units = cylinders of 16065 * 512 = 8225280 bytes
| Device Boot      Start         End      Blocks   Id  System 
| /dev/sdb1               1         130     1044193   82  Linux swap
mkfs.ext3  /dev/sdb1 
mount /mnt/sdb1 
cp -rfa /boot /mnt/sdb1/
grep root /mnt/sdb1/boot/grub/menu.lst
| root            (hd0,0)
cat  /mnt/sdb1/boot/grub/device.map
| (hd0)   /dev/sdb
| (hd1)   /dev/hda
grub-install /dev/sdb --root-directory=/mnt/sdb1/

error: "invalid magic number" grub

sudo $(which grub-install) --version
/usr/sbin/grub-install (GRUB) 2.04-1ubuntu12.1

External Disk : SD (/dev/mmcblk0)

"GRUB" black screen

error: invalid arch-independent ELF magic"

error: fd1 cannot get C/H/S values on every boot

On PentiuM with grub-pc-bin (2.02+dfsg1-20+deb10u2) ?

[[GRUB]]

sudo apt-get remove --purge grub 
mv /boot/grub /boot/grub.mine
sudo apt-get install grub 
grub-install /dev/sda

http://www.gnu.org/software/grub/manual/html_node/Command-line-and-menu-entry-commands.html

au boot presser 'c' :

title Windows XP
rootnoverify (hd0,0)
makeactive
chainloader  +1

evidemment, faut adapter le hd0,0

chroot: cannot run command `/bin/bash': Permission denied

remount with exec param

sudo grub-install /dev/sda
/dev/sda: Not found or not a block device.

Copy /dev/* with mc

mknod  /dev/sda b 8 0
mknod  /dev/sda2 b 8 2
sudo grub-install /dev/sda
/dev/sda does not have any corresponding BIOS drive.
# cat /boot/grub/device.map
(hd0)   /dev/hda
(hd1)   /dev/sda
# EOF file:///boot/grub/device.map
LANG=C grub-install /dev/sda
/sbin/grub-install: line 485: /dev/null: Permission denied
# mount --bind /dev /mnt/sda8/dev && chroot /mnt/sda8
# http://www.knoppix.net/wiki/Dev_null_permission_denied
# yaird error: can't open directory /sys/block (fatal)
mount --bind /sys /mnt/sda8/sys

Errors :

Error 22: No such Partition

http://forum.ubuntu-fr.org/viewtopic.php?id=47546

The file /boot/grub/stage1 is not read correctly.

http://www.ubuntuforums.org/showthread.php?t=24113&page=7

error : grub : stage1

sudo grub-install /dev/sda
# Searching for GRUB installation directory ... found: /boot/grub
# The file /boot/grub/stage1 not read correctly.

http://wiki.linuxquestions.org/wiki/Booting_from_USB#The_file_.2Fboot.2Fgrub.2Fstage1_not_read_correctly

fdisk /dev/sda << EOF t 1 83 w

error : grub : stage2

grub-install  /dev/sda
Searching for GRUB installation directory ... found: /boot/grub
The file /boot/grub/stage2 not read correctly.

Happened while :

cd  /mnt/sda8 
mount | grep $(pwd)
mount --bind /dev ./dev
mount --bind /proc ./proc
chroot .
grub-install  /dev/sda

Solution :

sudo update-grub 

Did not help

This happed when I used chroot :

grub --batch
root (hd1,7)
setup (hd1,7)

Error 15

Happended after i deleted /boot/grub and installed , plus update-grub

I missed install-grub

Solution: boot on other medium …

GRUB loading : Error 18

GRUB loading : Error 17 : Cannot mount selected partition

misc

Probing devices to guess BIOS drives. This may take a long time.

Error 21 : remove grub

Grub Loading Stage 1.5 Grub Loading please wait…. Error 21

$ ms-sys -m /dev/sda
Windows 2000/XP/2003 master boot record successfully written to /dev/sda

MBR FA:

$ install-grub /dev/sdaX  
$ mkfs.vfat -nv sdaX

http://lists.debian.org/debian-user/2001/05/msg00581.html

usb

  fdisk -l /dev/sda   Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x12345678   Device Boot Start End Blocks Id System /dev/sda1 1 130 1044193+ 82 Linux swap / Solaris /dev/sda2 1175 30401 234765877+ 5 Extended /dev/sda3 131 652 4192965 b W95 FAT32 /dev/sda4 653 1174 4192965 83 Linux /dev/sda5 1175 28707 221158791 83 Linux /dev/sda6 30272 30401 1044193+ 82 Linux swap / Solaris /dev/sda7 28708 29229 4192933+ b W95 FAT32 /dev/sda8 * 29230 30271 8369833+ 83 Linux   Partition table entries are not in disk order   cat /boot/grub/device.map # file:///boot/grub/device.map (hd0) /dev/hda (hd1) /dev/sda grub --batch root (hd1,7) setup (hd1,7)

ToDo : test

Error

This appends w/ Kernel 2.6.14 :

Busybox Alert /dev/hda5 does not exist! Dropping into a shell....

http://www.livejournal.com/community/evan_tech/148768.html?nc=7

grep ROOT /etc/mkinitrd/mkinitrd.conf
ROOT=probe
# grub-install  /dev/hda
The file /boot/grub/stage1 not read correctly.

MISC

MORE

@TaG: Boot loader chroot lilo MBR ntldr gag install

<iframe width="420" height="315" src="//www.youtube-nocookie.com/embed/A6nOKoC_cj4" frameborder="0" allowfullscreen></iframe>

www.mcplusplus.com_images_cover-large.jpg

grub.txt · Last modified: 2022/04/16 12:23 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki