grub

Boot Loader

See real documentation at https://www.gnu.org/software/grub/manual

graphical terminal and a graphical menu system are available. grub-mkconfig


update-grub

sudo update-grub 
ourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-84-generic
Found initrd image: /boot/initrd.img-5.4.0-84-generic
Found linux image: /boot/vmlinuz-5.4.0-81-generic
Found initrd image: /boot/initrd.img-5.4.0-81-generic
Found linux image: /boot/vmlinuz-5.4.0-74-generic
Found initrd image: /boot/initrd.img-5.4.0-74-generic
Found linux image: /boot/vmlinuz-5.4.0-72-generic
Found linux image: /boot/vmlinuz-5.4.0-58-generic
Found initrd image: /boot/initrd.img-5.4.0-58-generic
Found Windows 7 on /dev/sda1
done
/dev/sda8  523,248  /boot/efi


ls -l /boot
drwx------ 3     4096 Dec 31 969 efi
drwxr-xr-x 4     4096 Sep 248:26 grub
l   27 Sep  7 16:24 initrd.img      -> initrd.img-5.4.0-84-generic
l   27 Sep  7 16:24 initrd.img.old  -> initrd.img-5.4.0-81-generic
l   24 Sep  7 16:24 vmlinuz         -> vmlinuz-5.4.0-84-generic
l   24 Sep  7 16:24 vmlinuz.old     -> vmlinuz-5.4.0-81-generic

-rw-------  4744612 Dec  9  2020 System.map-5.4.0-58-generic
-rw-------  4750202 Apr 12 11:12 System.map-5.4.0-72-generic
-rw-------  4751152 May  7 20:45 System.map-5.4.0-74-generic
-rw-------  4752515 Jul 15 14:01 System.map-5.4.0-81-generic
-rw-------  4753288 Aug 26 14:48 System.map-5.4.0-84-generic
-rw-r--r--   237764 Dec  9  2020 config-5.4.0-58-generic
-rw-r--r--   237851 Apr 12 11:12 config-5.4.0-72-generic
-rw-r--r--   237851 May  7 20:45 config-5.4.0-74-generic
-rw-r--r--   237851 Jul 15 14:01 config-5.4.0-81-generic
-rw-r--r--   237883 Aug 26 14:48 config-5.4.0-84-generic
-rw-r--r-- 86990631 Aug 22 18:28 initrd.img-5.4.0-58-generic
-rw-r--r-- 88012631 Aug 22 18:27 initrd.img-5.4.0-74-generic
-rw-r--r-- 88024648 Sep  7 16:25 initrd.img-5.4.0-81-generic
-rw-r--r-- 88025799 Sep 15 18:14 initrd.img-5.4.0-84-generic
-rw-r--r-- 11682560 Jan  3  2021 vmlinuz-5.4.0-58-generic
-rw------- 11760384 Apr 12 12:56 vmlinuz-5.4.0-72-generic
-rw------- 11763968 May  7 21:42 vmlinuz-5.4.0-74-generic
-rw------- 11772160 Jul 15 14:05 vmlinuz-5.4.0-81-generic
-rw------- 11776256 Aug 26 14:54 vmlinuz-5.4.0-84-generic

/boot/grub
drwxr-xr-x   4096 Apr 19 18:00 fonts
drwxr-xr-x  12288 Apr 19 18:00 i386-pc
-rw-r--r--    712 Jan  3  2021 gfxblacklist.txt
-r--r--r--  14905 Sep 24 18:26 grub.cfg
-rw-r--r--   1024 Sep 24 07:14 grubenv
-rw-r--r--2395475 Aug 22 18:29 unicode.pf2

/boot/grub/i386-pc
-rw-r--r--  12 Apr 19 18:00 

  512 boot.img  DOS/MBR boot sector
 3887 command.lst text
26243 core.img
  936 crypto.lst text 
 7800 efiemu32.o
10288 efiemu64.o ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=c60b2ccf22148a768c4ed138458ebd71e174bf6a, not stripped

  219 fs.lst
  111 partmap.lst
   17 parttool.lst
  202 terminal.lst
   33 video.lst

and 250 +/- .mod files.
ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

      modinfo.sh
 User-controllable options
grub_modinfo_target_cpu=i386
grub_modinfo_platform=pc
grub_disk_cache_stats=0
grub_boot_time_stats=0
grub_have_font_source=1

# Autodetected config
grub_have_asm_uscore=0
grub_bss_start_symbol="__bss_start"
grub_end_symbol="end"

# Build environment
grub_target_cc='gcc-8'
grub_target_cc_version='gcc-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.0'
grub_target_cflags=' -Os -Wall -W   …
grub_target_cppflags='-Wno-unused-but-set-variable -Wall -W  -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -m32 -nostdinc
                     -isystem /usr/lib/gcc/x86_64-linux-gnu/8/include -I$(top_srcdir)/include -I$(top_builddir)/include'
grub_target_ccasflags=' -g  -m32 -msoft-float'
grub_target_ldflags='-no-pie -m32 -Wl,-melf_i386 -no-pie -Wl,--build-id=none'
grub_cflags=''
grub_cppflags=' -D_FILE_OFFSET_BITS=64'
grub_ccasflags=''
grub_ldflags=''
grub_target_strip='strip'
grub_target_nm='nm'
grub_target_ranlib='ranlib'
grub_target_objconf=''
grub_target_obj2elf=''
grub_target_img_base_ldopt='-Wl,-Ttext'
grub_target_img_ldflags='@TARGET_IMG_BASE_LDFLAGS@'

# Version
grub_version="2.04"
grub_package="grub"
grub_package_string="GRUB 2.04-1ubuntu26.7"
grub_package_version="2.04-1ubuntu26.7"
grub_package_name="GRUB"
grub_package_bugreport="bug-grub@gnu.org"



Command line permits completion via [TAB].

For example : ((hd0,msdos1)/vmlinuz

grub-probe

grub-probe [OPTION...] [OPTION]... [PATH|DEVICE]

Probe device information for a given path (or device, if the -d option is given).

       -0     separate items in output using ASCII NUL characters

       -d, --device given argument is a system device, not a path

       -m, --device-map=FILE use FILE as the device map [default=/boot/grub/device.map]

       -t, --target=TARGET print  TARGET  available  targets: 
abstraction
arc_hints
baremetal_hints
 bios_hints
 compatibility_hint
 cryptodisk_uuid
 device
 disk 
              drive
 efi_hints
 fs
 fs_label
 fs_uuid
 gpt_parttype
 hints_string
  ieee1275_hints
  msdos_parttype
  partmap
  partuuid
  zero_check  [de- fault=fs]

       -v, --verbose print verbose messages.  
       -?, --help give this help list 
       --usage give a short usage message
-V, --version print program version


grub-fstest

grub-fstest(1) The full documentation for grub-probe is maintained as a Texinfo manual. If the info and grub-probe programs are properly installed at your site, the command info grub-probe should give you access to the complete manual. mmmmmmmmmmmmmmmmmmmmmmmmmde>

image directory (/usr/lib/grub/-)
boot directory (/boot)

MBR format : grub is in the area between the MBR and the first partition
GPT format : grub installed to a BIOS Boot Partition of 1MB and no user files should be there.

Command line

Command line editing with begining of line:[HOME], [END], previous line[UP], name completion [TAB]

menu

Grub presents a menu when booting

invoke command line c , return to menui [esc] .
menu editor : abort changes [ESC], boot an entry: ^x Menu setup:
comments begin with #
menuentry title { command; …} submenu title {menu entries …} chain-loading on PC BIOS and EFI

menuentry "Windows" {
    insmod chain
    insmod ntfs
    set root=(hd0,1)
    chainloader +1
}
grub> linux /vmlinuz root=/dev/sda1 
boot


grub rescue>
    entered when partition grub expects is gone

    ls
    ls (xxx)
    set root=(hd0,msdos2)
    set prefix=(hd0,msdos2)/boot/grub # or wherever grub is installed
    insmod normal # if this produced an error, reset and prefix to something else 
    normal



sudo update-grub
sudo grub-install /dev/sdX