GRUB : Grand Unified Boot Loader
* http://packages.qa.debian.org/grub
* http://www.gnu.org/software/grub/manual/grub.html
* ftp://alpha.gnu.org/gnu/grub/?C=M;O=D
* http://grub.enbug.org
* https://launchpad.net/ubuntu/+ppas?name_filter=grub2
* https://launchpad.net/ubuntu/+source/grub2
===== REINSTALL =====
update-grub
/usr/sbin/update-initramfs -u
===== help =====
* https://www.digitalocean.com/docs/droplets/how-to/kernel/use-non-default/#
* https://statusq.org/archives/2012/10/24/4584/
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 ====
* http://forums.lenovo.com/t5/Lenovo-3000-and-Essential/Replacing-G570-fan/m-p/749575#M37157 #DsdT
* http://www.dedoimedo.com/computers/grub-2.html
grub screw syslinux or is it gag ?
"Welcome to GRUB!"
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=463081
* http://sidvind.com/wiki/GRUB:_Boot_another_OS_once# WiN
* http://ubuntuforums.org/showthread.php?t=1377754
mv /etc/default/grub /etc/default/grub.orig
sudo os-prober
/dev/sda2:Microsoft Windows XP Professional:Windows:chain
cat< /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 ====
* http://www.chrissearle.org/node/322
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 =====
* http://unix.stackexchange.com/questions/38469/where-can-i-learn-more-about-how-to-use-the-grub-ntldr-command-module#
* https://www.gnu.org/software/grub/manual/html_node/Multi_002dboot-manual-config.html#
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? ====
* https://askubuntu.com/questions/484042/boot-grub-device-map-is-missing-on-ubuntu-14-04#
sudo grub-mkdevicemap
WARNING: Failed to connect to lvmetad.
* https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1768230
==== MD ====
* https://www.debian-fr.org/t/warning-lors-du-demarrage-failed-to-connect-to-lvmetad/75575/2
==== "Welcome to Grub" ====
Hang
==== Warnings ====
df: Warning: cannot read table of mounted file systems: No such file or directory
* http://daemonkeeper.net/668/how-to-bootstrap-debian-over-another-running-linux-system/
==== "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: ===
* https://askubuntu.com/questions/491604/grub-rescue-no-such-partition
* https://help.ubuntu.com/community/Grub2
* https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/960092# BuG
==== 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.
* http://ubuntuforums.org/showthread.php?t=504678
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 ... ====
invalid arch independent ELF magic
sudo apt-get install --reinstall grub-pc-bin grub-pc
@TaG: EfI
* http://askubuntu.com/questions/94511/dual-boot-efi-error-invalid-arch-independent-elf-magic
* https://lists.gnu.org/archive/html/help-grub/2011-04/msg00030.html
* http://stackoverflow.com/questions/18120835/debian-grub-rescue-invalid-arch-independent-elf-magic
==== 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/
* http://wiki.linuxquestions.org/wiki/Booting_from_USB
==== error: "invalid magic number" grub ====
sudo $(which grub-install) --version
/usr/sbin/grub-install (GRUB) 2.04-1ubuntu12.1
* https://bugzilla.redhat.com/show_bug.cgi?id=1601578#
==== External Disk : SD (/dev/mmcblk0) ====
* https://bugs.launchpad.net/ubuntu/+source/grub/+bug/263654
==== "GRUB" black screen ====
* http://ubuntuforums.org/showthread.php?t=272354
* http://ubuntuforums.org/showthread.php?t=224351&highlight=live+cd+grub
==== error: invalid arch-independent ELF magic" ====
* https://askubuntu.com/questions/72003/how-do-i-resolve-a-grub-invalid-arch-independent-elf-magic-error#
==== 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]] :
* http://unixadmintalk.com/f11/grub-install-chroot-not-respected-96741/
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 ===
* http://wiki.linuxquestions.org/wiki/GRUB
=== GRUB loading : Error 17 : Cannot mount selected partition ===
* http://www.gnu.org/software/grub/manual/html_node/Stage2-errors.html#Stage2-errors
* http://www.users.bigpond.net.au/hermanzone/p1.htm
check fs
=== misc ===
Probing devices to guess BIOS drives. This may take a long time.
* http://www.gentoo.org/doc/en/grub-error-guide.xml
=== Error 21 : remove grub ===
Grub Loading Stage 1.5 Grub Loading please wait.... Error 21
* http://ubuntuforums.org/showthread.php?t=652189
* http://en.opensuse.org/SDB:Uninstalling_the_Boot_Manager_GRUB_from_the_MBR
$ 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 =====
@tag: [[GRUB]] [[French]] [[Boot.fr]]
* http://www.cepcasa.info/blog/?p=138
* dd, reconf : http://forum.ubuntu-fr.org/viewtopic.php?pid=3028727#p3028727
===== MORE =====
@TaG: [[Boot]] [[loader]] [[chroot]] [[lilo]] [[MBR]] [[ntldr]] [[gag]] [[install]]
{{http://www.mcplusplus.com/images/cover-large.jpg}}