You are on page 1of 33

GRUB2

Troubleshooting Ubuntu & Arch Linux


grub> | grub rescue>

ANTFRA
2014

..

. .

. )>.(grub

+ .

. )>.(grub rescue

) (GRUB ) (.

).(Busybox / Initramfs

) + (Busybox / Initramfs .

) ( .

. .

. )(GRUB 2

..

..

..

. ..

..

. :

. ..

..

..

).(grub rescue / rescue mode

)( . )) .(Fallback (.

..

) (GRUB 2 ) (C ..

) (SHIFT . ) (Esc ) (.

) (set .

) (set pager=1 ) (.

) ( .

) (TAB .

) (.

).(help

).(set color_normal=white/blue

. ) (
.

. .
" ." . .

.) (.

) (.

" GRUB ) (.

) (.

) (.

>grub
>grub rescue
GRUB
)Busybox - (Initramfs
)(splash screen

:
) ( . . . ) (/grub.
.
) .( grub.cfg ) .(prefix
-:
) 1 (2
4 # sudo update-grub

1 # configfile /boot/grub/grub.cfg

2 # configfile (hd0,4)/boot/grub/grub.cfg

.(prefix, root, Linux, initrd ) :


:
)) .(/boot/grub/ (.
.1

).(cfg

.2

..

.3

.4

).(update-grub

. . .). (.

-:
) (grub.cfg .
) (file not found ) (X,Y .
) ( .
)1 # set root=(hdX,Y
2 # linux /vmlinuz root=/dev/sdXY ro
3 # initrd /initrd.img
4 # boot
) (Wubi ) 1 (2:
)1 # set root=(loop0
2 # linux /vmlinuz root=/dev/sdXY loop=/Ubuntu/disks/root.disk ro

) ( :
)(Busybox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash
Enter 'help' for a list of built-in commands.
)(initramfs

:
) :( Ubuntu
)1 # set root=(hd0,5

) .(sda5

2 # linux /vmlinuz root=/dev/sda5 ro

# linux (hd0,5)/boot/vmlinuz-3.0.2-14 root=/dev/sda5 ro

... .
.
... .

3 # initrd /initrd.img
# initrd(hd0,5)/boot/initrd.img-3.8.0-25-generic
4 # boot

. .
):( Arch Linux

)1 # set root=(hd0,5
2 # linux /boot/vmlinuz26 root=/dev/sda5 ro
3 # initrd /boot/kernel26.img
4 # boot
):( Fedora
)1 # set root=(hd0,3
2 # linux (hd0,1)/vmlinuz-3.0.0-1.fc16.i686 root=/dev/sda3 rhgb quiet selinux=0
3 # initrd (hd0,1)/initramfs-3.0.0-1.fc16.i686.img
4 # boot
).( BSD
):( FreeBSD
.FreeBSD

)1 # set root=(/dev/ad4,msdos1

2 # kfreebsd /boot/kernel/kernel

. .
.

3 # kfreebsd_loadenv /boot/device.hints
4 # set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ad4s1a

.
..
. ) .(FreeBSD ) (kfreebsd. .
) (kfreebsd ) (kfreebsd help ).(GRUB

5 # vfs.root.mountfrom.options=rw
6 # boot

):( NetBSD
) . (.
.

)1 # set root=(hd0,msdos1
2 # knetbsd /netbsd --root=wd0a
3 # boot

..
. ) (NetBSD ) (knetbsd.
) (knetbsd ) (knetbsd help ).(GRUB
):( Windows XP
. ) (
.

)1 set root=(hd0,msdos1
}2 drivemap -s (hd0) $ {root

. ..

3 chainloader +1
4 boot

.
. /

) (grub.cfg ).(cfg

) (set ) (prefix ) .(root ).(ls

) (GRUB 2 ) (/GRUB .

)= ( root . ) (ls /
.

) ( ) (.

) (/ ) (initrd ) .(vmlinuz ) (/boot/ ).(grub.cfg

)
(selinux=0 ) . (.

. . ).(grub rescue
) ( ) . .(GRUB 2
. /
. ) ( ) . .(GRUB 2

:
) ( . :

. )). (/grub (.

) (/grub .

).(grub.cfg

. ).(normal

) (GRUB 2 .

) (vmlinuz ) (initrd.img ).(/

) (/grub . .

) . (.
) . (error: file not found

.

) .(error: unknown command

) ( Linux ) .(Linux
) (Linux ).(normal

) (initrd .

) .(/boot/grub ).(/usr/lib/grub/i386-pc
.(insmod (hd0,5)/usr/lib/grub/i386-pc/normal.mod) :
--------------------------------------------------------------------------------

) (set .

) (unset ..(unset prefix) :

) .(prefix, root, Linux, initrd ) ( ) (.

:
) (:
.1

. ).(sda5

.2

).* (sda5

.3

).(normal

.4

.5

) (normal .

.6

)) (Linux .(normal

.7

*.

.8

) (/ ).(/boot

.9

) (initrd .

.10 ) (initrd ) (/ ).(/boot


.11 ) . (.
.12. .
:

) (normal ) (Tab ).(help

. .
# set prefix=(hd0,5)/boot/grub

)# set root=(hd0,5

# insmod normal

# insmod (hd0,5)/boot/grub/normal.mod

# normal

# insmod Linux

# linux /vmlinuz root=/dev/sda5 ro

# linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda5 ro

# initrd /initrd.img

) (Linux )(normal

10 # initrd /boot/initrd.img-3.2.0-14-generic
11 # set
12 # boot
) .(Wubi ) 2 (7 ) 13 (14.
)13 # set root=(loop0
14 # linux /vmlinuz root=/dev/sdXY loop=/ubuntu/disks/root.disk ro
. /
. .
) ( ) . .(GRUB 2
. /
. ) ( ) . .(GRUB 2

) (GRUB ) (

:
) ( GRUB ) ( .
. ) (MBR ). .(.
. ) ( ) (core.img ) /boot .(/grub
) (:
) (.
.
. ) (Chroot ) (GRUB2 . ).(MBR
) ( . ) (Chroot ) . ..(GRUB 2

) (

) ( Busybox
) (UNIX ) (POSIX
) (Linux )
( embedded operating systems
.

:
) ( ) (Busybox Initramfs . .
!!.
) :(Busybox Initramfs

) (UUID )= (root ).(Linux

/ ).(Graphics Driver

).(HDD

).(HDD

).(DVD/CD

) (ISO ) (.

) ) (NTFS (.

..

)(
:
.1

. ) (ls ) (GRUB 2 ) (sudo fdisk -l ).(Gparted

.2

) . .(sda2
) ( ) (Gparted ) .(/

.3

.4

. ) (e ). (.
) (UUID=xxxx ) (TAB ) (.

.5

) (Ctrl+x..

.6

# Gparted

1 # sudo fdisk -l
# ls

. ) (

2 # /dev/sda2 6 1918 15360000 83 Linux


3 # reboot
4 # linux /boot/vmlinuz-3.5.30-14-generic root=UUID=xxxxxxxxxxxxxxxx ro quiet splash
# linux /boot/vmlinuz-3.5.30-14-generic root=/dev/sda2 ro quiet splash
5 Ctrl+x
6 # sudo update-grub
) (:
) .(NTFS /.
.1

).(CMD
) (chkdsk .

.2

.3

) .(chkdsk )( . ).(Shutdown

.4

. )(.
3 # shutdown .....

4 # restart

2 # reboot

1 # chkdsk c: /f

. .
) .(NTFS
) (Busybox .
# mount -t ntfs-3g /dev/sda1 /root -o force
/:

) (mount . . / ).(recovery

:
.1

) (Busybox .
)) (Graphics Driver (.

.2

# exec startx
:
.1

) (mount ) (umount ) (.

.2

).(GsmartControl

.3

) .(S.M.A.R.T

.4

. :

) (/ ) (umount ) (.
.
) .e2fsck .(fsck

.sda1

) (e2fsck ).(ext2/ext3/ext4

) (fsck ).(ext2/ext3/ext4

: ) (umount . ) e2fsck .(fsck

.....
. /
. .
) ( . ) . .(GRUB 2

1 # sudo umount /dev/sda1


2 # sudo fdisk -l
3 # sudo e2fsck /dev/sda1
# sudo fsck /dev/sda1

) (
:
) (splash screen .
.
. . .
. .) . ) (Linux (

) (e ..
) .(.
.
.1

. ) (GRUB 2 ).(Advanced options


) (SHIFT ) (Esc .

.2

) (Advanced options / ).(recovery mode

.3

/ ) (recovery mode ).(root

.4

.5

.6

.
) (drivers ) ( .

.7

] .[name_of_the_driver_from_the_list.(kmod:fglrx) :

.8

) .(init 2 . ).(init 1

.9

).(reboot
GRUB 2 Menu > Advanced options > Recovery mode > Root

1 2 3

4 # sudo init 1
5 # root@[name_of_PC] login:
6 # jockey-text --list
7 # sudo jockey-text enable=kmod:fglrx

]7 # sudo jockey-text enable=[name_of_the_driver_from_the_list


8 # sudo init 1

8 # sudo init 2
9 # sudo reboot

) . )((GRUB 2

. ) (MSDOS ) .(GPT

).(root

..

. .. UUID

).(initrd.img

)(/boot

) vmlinuz ) (initrd.img (.

)(/grub

) (grub.cfg )) .(mod. (.

# ls
# ls /
)# ls (hdX,Y
# ls (hdX,Y)/
# ls (hdX,Y)/boot/

(hdX,Y)/boot/grub/

# ls (hd0,5)/boot/grub/

grub.cfg

/boot/grub/
(hdX,Y)/

# ls /boot/grub/
# ls (hd0,5)/

vmlinuz

/
(hdX,Y)/boot/

# ls /
# ls (hd0,5)/boot/

vmlinuz-3.2.0-57-generic

/boot/
(hdX,Y)/

# ls /boot/
# ls (hd0,5)/

initrd.img

/
(hdX,Y)/boot/

# ls /
# ls (hd0,5)/boot/

initrd.img-3.2.0-57-generic

/boot/

# ls (hdX,Y)/boot/grub/

# ls /boot/

).(grub

)(normal
)(normal

) (

).(/

.
./

# set prefix=(hdX,Y)/boot/grub
*

)# set root=(hdX,Y

# insmod normal

# normal

# linux /vmlinuz root=/dev/sda1 ro

# linux (hdX,Y)/boot/vmlinuz-3.0.2-14 root=/dev/sda1 ro


# initrd /initrd.img

)(/

# initrd (hdX,Y)/boot/initrd.img-3.0.2-14

) (.

# boot

. .

) (Wubi ) 1 (2 ) 1 :(2
)1 # set root=(loop0

>----

)1 # set root=(hdX,Y

2 # Linux /vmlinuz root=/dev/sdXY loop=/ubuntu/disks/root.disk ro

>----

2 # linux /vmlinuz root=/dev/sdXY ro

* :

. ) ( ) (ro ) (selinux=0 )
(enforcing=0 . )... (rhgb.

) (normal ) (Linux ).(initrd

. ) ( X ) (Y .

. ).(GRUB 2
) (Bugs .
:

) (GRUB 2 ).(GRUB legacy

) (GRUB legacy ).(GRUB 2

) (GRUB 2 )> (grub )> (grub rescue ) (GRUB


.

..
).(grub-pc

. ) (grub-install
) (sda, sdb ... ) .(UUIDs ) (grub-pc
.

..
" 496435 ).(Launchpad

. ).(MBR

. ) (USB ) (GRUB 2 ) (MBR )


(HDD ) .(USB ).(USB

..
. ) (Advanced .
" 414996 ).(Launchpad

. ) ( ) (Logical Volume ) (Volume Group


) ( ).(snapshot
. ) (/boot . ) (LV ) (snapshot ).(VG

. . ).(error: no such disk


).(lvm
. ) ( ) (snapshot
) (VG ..
)( .

. .

grub rescue>.

) (563895 ).(Launchpad

. ) (/boot ) (LVM
) (snapshot ) .(LVM
) (LVM ) (

) (insmod (error: no such disk) :


) (GRUB 2 ) (linux-module .
.
) (prefix$ . . ).(set prefix=/boot/grub

(file not found) : ).(unknown command


.
.
) (X,Y .

. ( Win 7) .7 . ) (GRUB 2 .
A disk read error occurred

Press Ctrl+Alt+Del to restart

.7 ..
:
.1

. 7 ).(e

.2

) . (.

.3

) (Ctrl+X. ..7
insmod part_msdos
')set root='(hd0,msdos1

:7
.1

) (grub.cfg 7 ) (custom_40
) 7 . (.

.2

).(update-grub
# gksudo gedit /etc/grub.d/40_custom

1 # gksudo gedit /boot/grub/grub.cfg.


2 # sudo update-grub

):(custom_40
#!/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 7 (customized entry
insmod part_msdos
insmod ntfs
')set root='(hd0,msdos1
chainloader +1
}

) (UUID . ) .(grub.cfg
) (sudo blkid .
) (7 ).(UUID
) (7 .
1 # sudo blkid

2 # sudo dd if=/dev/urandom of=/dev/sda5 bs=8 count=1 seek=9


3 # sudo update-grub
4 # reboot
(ntfspartition) : ) (ntfs ):(sdaX
# sudo dd if=/dev/urandom of=/dev/[ntfspartition] bs=8 count=1 seek=9
) (UUID :
#sudo dd if=/dev/urandom of=/dev/sda1 bs=8 count=1 seek=9
:

: . ...

. sda1) : sda2(.

) (sudo blkid .

) (sda . ) (MBR .

)( ) (ntfs :
1 # sudo aptitiude install ntfsprogs

.
) (X .

2 # sudo ntfslabel /dev/sdaX LABELNAME

) (fstab ) (sdaX ) (UUID=1234 ... ) (LABELNAME :


LABEL=LABELNAME

..


!Warning: This GPT partition label has no BIOS boot partition; embedding won't be possible
) (BIOS boot partition ) GPT .(EFI
. ) .(BIOS boot partition ) . .(GRUB 2

grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding won't be possible! grub2

bios-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists.
However, blocklists are UNRELIABLE and its use is discouraged. grub2-bios-setup: error: If you really want
blocklists, use --force.
. ) (GRUB 2 . ) (MBR

. )
.(USB . ) (1 . ).(2048
: . .

Attempting to install GRUB to a partition disk or to a partition. This is a BAD idea.


Embedding is not possible. GRUB can only be installed in this setup by using blocklists.
However, blocklists are UNRELIABLE and their use is discouraged.

.
) (GRUB 2 .

:
.1

).(/boot

.2

) (GRUB 2 ) (BIOS/GPT ) (EF02 )


(bios_boot ).(core.img

.3

) (GRUB 2 ) (/dev/sdXY ).(BIOS/MBR

.4

) (grub-install .

.1

) (/boot .

.2

/ ) 1 : ( . ) .(.

.3

) (--force ) .(grub-install .
) (chattr ) . .(GRUB 2

)....(BIOS/MBR ) (LUKS
)) (LVM2 (.
.4

)= (platform ) (/sbin/grub-install .
) (x86/amd64 ) .(platform=pc

grub-install: warn: Your embedding area is unusually small. core.img won't fit in it.
grub-install: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists.
However, blocklists are UNRELIABLE and their use is discouraged.

grub-install: error: will not proceed with blocklists.


Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are
unreliable and their use is discouraged.
.
.1

) Stage 2 .(core.img

. :

.2

. . ).(VBR

.3

. ) (BIOS ).(MBR

.4

) (BIOS ) .(GPT

.5

) (UEFI ) .(GPT

.1

. .
) (alignment ).(SSD

.2

) (configfile ) (grub.cfg ) (GRUB 2 ) ( .


) (GRUB 2 ) ( .

.3

. . ) (.

.4

) .(GPT ) (BIOS boot partition:

.5

.(ef02) :

.(BIOS boot partition) :

) :/ .(FAT32

2 ~ 1) :(.

) (GRUB 2 ) .(EFI ) (EFI- system partition:

.(ef00) :

.(EFI System) :

.(FAT-32) :

512) : ~ 1(.

: ) (custom_40 . ).(/dev/sdb1
#! /bin/sh -e
echo "Adding precise testing menuentry" > &2
cat << EOF
{ "menuentry "reload precise grub.cfg file from /dev/sdb1
insmod ext2
')set root= (hd1,1
search --no-floppy --FS-uuid --set=root 11992CDE-b1d9-4392-bcc4-13c2ce8702AA
configfile /boot/grub/grub.cfg
}
EOF

..
Fatal: No bootable medium found! System halted.

) (BIOS ..
. ) (BIOS ).(MBR

) .(virtual box
:

) (BIOS ).(boot

) (BIOS . .

) (.

. ).(BIOS

) (GRUB 2 ) (MBR . ).(BIOS

) .(chroot ) . .(GRUB 2

. ) . GParted (.

) .(VM ) (try Ubuntu ) (dpkg-reconfigure grub-pc


) ( ) ".(sda

. .

GRUB.

) (GRUB ) (.

. .

grub> _.

. . .

. .
. ..

rescue> _.

Error 15

Error 11

) (GRUB 2 . ) .(MBR ) (GRUB Legacy ).(GRUB 2


) (GRUB Legacy ).(MBR


: ) (Error 15: File not found ) (GRUB Legacy
.

. ) (GRUB 2 . ) (MBR .
) .(chroot ) . .(GRUB 2

. ..

Error: no such device: UUID

. ) (UUID . .

. ) (windows XP ) (SATA )
(IDE )) .(AHCI " SATA ".("WindowsXP

. ) .(GRUB 2 ).(grub.cfg

) (UUID ).(grub.cfg

. ) (MBR
.

) . .(GRUB 2

Error: No such disk.


) (HDX,Y . .

. ) (GRUB 2 ).(grub.cfg

. ) (MBR
) .(sda

) . .(GRUB 2

Error: No such partition.


) (HDX,Y . .
(set root=) : ) (set ).(GRUB 2

. ) (GRUB 2 ).(grub.cfg

. ) (MBR
) .(sda

) . .(GRUB 2

.) (.
)= (root ).(Linux

. ) (GRUB 2 ).(grub.cfg

. ) (MBR
) .(sda

) . .(GRUB 2

. ) (btrfs .

) (GRUB 2 ) .(btrfs ).(launchpad


. .

error: no suitable mode found

Error: sparse file not allowed

'error: unknown command 'terminal


45 . . ).(Lucid
):(/etc/default/grub
.1

.2

.3

.4

.5

# gksudo gedit /etc/default/grub


GRUB_TERMINAL=console

2.

#GRUB_TERMINAL=console

1.

#GRUB_HIDDEN_TIMEOUT=0

4.

GRUB_HIDDEN_TIMEOUT=0

3.

sudo update-grub

5.

..

. .
) (GRUB_HIDDEN_TIMEOUT=0 ).(/etc/default/grub

):(/etc/default/grub

) (# ).(GRUB_HIDDEN_TIMEOUT=0

. ).(sudo update-grub

. ) .(Shift ) (Esc ..

. ) (Windows .
.1

) (GRUB_HIDDEN_TIMEOUT=0 ) .(/etc/default/grub )(Windows


. ).(Ubuntu


.2

) (Windows . ) (GRUB 2 . ).(MBR

.1

):(/etc/default/grub

.2

) (# ).(GRUB_HIDDEN_TIMEOUT=0

. ).(sudo update-grub

. ) .(Shift ) (Esc ..

) .(GRUB 2 ) (GRUB 2 . ).(MBR

. :

) (Intel BIOS ) .(GPT


) (Intel BIOS ) (MBR . .
) (GPT ..
) (fdisk ) (GPT ) (MBR . )) (bootable flag
" 1007 .(GRUB 2
:

.1

).(fdisk /dev/sda

.2

) (A . ) (#1

.3

) (W . ).(MBR

) (fdisk ) (Gparted .

error: no suitable mode found

Booting however
) (gfxterm ) (GRUB 2 ).(gfxmode

) (GRUB 2 ).(gfxpayload
) ( UEFI . )
.(KMS
. ..
.1

) .(/usr/share/grub/unicode.pf2

.2

)} (${GRUB_PREFIX_DIR ) (/boot/grub ) UEFI .(BIOS

.3

) (GRUB UEFI ) .(--boot-directory=$esp/EFI

.4

).($esp/EFI/grub/

:
}# cp /usr/share/grub/unicode.pf2 ${GRUB_PREFIX_DIR
) (/usr/share/grub/unicode.pf2 .

.1

)(bdf-unifont

.2

) (unifont.pf2

.3

)} :(${GRUB_PREFIX_DIR
# grub-mkfont -o unicode.pf2 /usr/share/fonts/misc/unifont.bdf
}# cp /usr/share/grub/unicode.pf2 ${GRUB_PREFIX_DIR

) (grub.cfg ) (GRUB 2
. .
):(BIOS
insmod vbe
):(UEFI
insmod efi_gop
insmod efi_uga
) (UEFI ):(BIOS

insmod font
if loadfont ${prefix}/fonts/unicode.pf2
then
insmod gfxterm
set gfxmode=auto
set gfxpayload=keep
terminal_output gfxterm
fi
) (gfxterm ) (unicode.pf2 )}
.(${GRUB_PREFIX_DIR

!grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding will not be possible

grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists.
However, blocklists are UNRELIABLE and its use is discouraged.
grub-setup: error: If you really want blocklists, use force.
.

) (GRUB 2 ).(Vmware
. )) (MBR (63 1
" ) 2048( .

. ".MBR

).(GRUB 2
) (GRUB 2 . . ).(grub.cfg

) (GRUB 2 ) (UEFI ) (--boot-directory ) (grub.cfg .


. ) .(grubx64.efi

) . ).((grub rescue / rescue mode

) (GRUB 2 ).(UEFI
) (UEFI . .
) (EFI:
# efibootmgr -v
-------------------BootCurrent: 0000

Timeout: 3 seconds
BootOrder: 0000,0001,0002
)Boot0000* Grub HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\efi\grub\grub.efi
)Boot0001* Shell HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\EfiShell.efi
Boot0002* Festplatte BIOS(2,0,00)P0: SAMSUNG HD204UI

) (UEFI ..
) (GRUB 2 ) .(root . .
..

) (GRUB 2 :
)HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\grub.efi

: " .

"invalid signature" error

. ) (Windows
:
)(GRUB 2

Boot0000* Grub

1 # mv /boot/grub/device.map /boot/grub/device.map-old
2 # grub-mkconfig -o /boot/grub/grub.cfg

3 # rm /boot/grub/device.map-old.

) (grub-mkconfig . ).(Windows

. ) . . (.
. ) (GRUB 2

)(initial ramdisk
.(add_efi_memmap) :

).(Arch Linux
) (os-prober .
) (/etc/lsb-release .
) (lsb-release .

Out of memory/Syntax error running grub-mkconfig


.
) (GRUB_DISABLE_SUBMENU=y ) (/etc/default/grub ).(grub.cfg

. ) (UEFI .
) ( ) (UEFI )(Intel Z77

) (efibootmgr ) (bcfg ) (EFI


. ).(NVRAM
) ( .
) (efi .
) (bootx64.efi ) (FSO: ) (Microsoft )(ESP
).(FS1:
. ) (EFI :
FS1:

cd EFI
mkdir Microsoft
cd Microsoft
mkdir Boot
cp FS0:\EFI\BOOT\bootx64.efi FS1:\EFI\Microsoft\Boot\bootmgfw.efi
. ) (NVRAM ..

):(Arch Linux

) (.
. ):(grub.cfg

set pager=1
set debug=all

. . :
# dpkg --list | grep grub

)GRUB Legacy (version 1

Grand Unified Bootloader

GRUB 2

Grand Unified Bootloader, version 2

. .
. ).(GRUB 2
/ /

menu mode

. .
) (C . . ).(grub.cfg

CLI mode, command line

. .

rescue mode

edit mode

" "E .
..

..

UP/DN

Enter

. .
.

..

C
Ctrl + Alt + Delete

.
) ( . )(GRUB 2

UP/DN/Left/Right

/ .

TAB

. . .

Esc

/ .

HOME

) (.
.

END
Enter

F10

) (.

Ctrl + X
Space bar

. )(GRUB 2

.
.

UP/DN

Left/Right

/ .

TAB

. ) (C

Esc

..
) (.
.

Help + Enter
Space bar
Ctrl + Alt + Delete

).(GRUB2
. . . ) (.
. " . .
) (server .
) ( GRUB 2 .
. .
) .(.
:
.

.:

. ) (ENTER ..

. ) .(SHIFT ) (Esc .

)( ) (e / .

)) .(UP/DN/Left/Right .(ENTER

) (TAB .
.

) (CTRL-X ) (F10. )(.

) (CTRL-C ) (F2 ) (GRUB 2 )


(module ... ..

) ) (GRUB 2 ) (initrd (.

) (Esc .

. .

. ).(sudo update-grub

) .(:

) (TAB ) (vmlinuz )) (initrd (.


" ls ) (.

. ) (ro )..(selinux=0

/ ) .(Linux ) .(.

) (quiet ..

. ) (splash quiet ) (nomodeset .

. / )) (recovery ( . ) (Linux
) .(single ) (S ) .(CTRL-X ) .(.

) (Linux ) (root=UUID=xxx ) .(root=/dev/sdXY ) X (Y .

..
. ) (GRUB 2 ..

>grub
>grub rescue

) (C ..

. ) (SHIFT . ) (Esc .

. . .
) ( . ) ( .
.:

menuentry

)(

submenu

) . (.
) . (:

serial

terminal_input

terminal_output
terminfo

.
. :

)(ACPI

acpi

/ )(RAM

badram

)( block list

blocklist


.
/ . .
.
) ( configuration file ...
)( ).(CPU
. ).(CRC32
/ .
.
) (.
) (.
/

boot
cat
chainloader
cmp
configfile
cpuid
crc
date
drivemap
echo
export
false

)(.
. ) (MBR ).(GPT

gettext
gptsync

halt

help

).(initrd

initrd

)) (initrd 16(.

initrd16

).(module

insmod

.
).(Linux kernel

keystatus
Linux

))) .(Linux kernel 16(.

linux16

list_env

load_env

)( .

loopback

.
. ) . . (.
. .

ls
normal
normal_exit

)/( .

parttool

) ( ) (.

password

) ( .
.
).(PXE
) (.

) .( .
.
/ ) (label ).(UUID
)( .
.
/
.
.
(GNU GRUB Manual 2.00 ) :

password_pbkdf2
play
pxe_unload
read
reboot
save_env
search
sendkey
set
true
unset
uppermem

.
.

boot

. ) (F10 ).(CTRL-x

cat

* configfile

).(grub.cfg

initrd

) (initrd.img . .
. .

* insmod

* Linux
loop

) ( .

ls

/ .
.

lsmod

) (normal .

normal

search
set

....

vbeinfo

)( . .
).(help
.
/

# cat (hd0,1)/boot/grub/grub.cfg

cat

# configfile (hd0,5)/boot/grub/grub.cfg

configfile

# initrd (hd0,5)/initrd.img

initrd

# insmod (hd0,5)/boot/grub/normal.mod

insmod

# insmod normal

linux

# linux /vmlinuz root=(hd0,5) ro

loop

# loopback loop (hd0,2)/iso/my.iso

ls

# ls /boot/grub # ls (hd0,5)/

# ls /

# ls (hd0,5)/boot/grub/

# ls
# ls (hd0,5)/boot

* :
.1

) (configfile . ) (grub.cfg . )(ls


. ) (.cfg ) (.

.2

. . . ).(sudo update-grub

.3

. ) (.

.4

) (/boot/grub )) .(/usr/lib/grub/i386-pc (.

.5

) .(5
) .(5

.6

) (normal ) (Linux )) .(initrd


) (root ) (ro (.

.7

) (search ).(help search

# configfile (hd0,1)/boot/grub/grub.cfg

1 # configfile /boot/grub/grub.cfg

# sudo update-grub

2 # sudo cp xxx/xxx/grub.cfg /boot/grub/grub.cfg


3

) (

4 # insmod normal

# insmod (hd0,1)/usr/lib/grub/i386-pc/normal.mod
file not found error

unknown command error

4 # insmod Linux
6 # linux /vmlinuz root=/dev/sda1 ro
7 # help search
).(grub rescue / rescue mode
:

dump

exit

)) (<grub (.

normal

):(grub rescue
unset

set

search

normal

multiboot

ls

linux

insmod

help

chain

cat

boot

. ) (.
. :

) (/grub .

)) .(set ) (root, prefix, linux, initrd (.

) (/grub ) (/boot/grub/ unknown command) .(file not found

).(linux
.

) (initrd.img .

).(Fallback
)) (script ( . ). (.
1 # /etc/grub.d/ gksudo leafpad 01_fallback

)). (fallback_01 "01 (.

)2 (script

) (script .
.
. ) .(/etc/default/grub:

3 # /etc/grub.d/ sudo chmod +x 01_fallback


"4 # gksudo leafpad /etc/default/grub GRUB_FALLBACK="1

).(/boot/grub/grub.cfg

5 # sudo update-grub

) (.

(script):
#! /bin/sh -e
if [ ! "x${GRUB_DEFAULT}" = "xsaved" ] ; then
if [ "x${GRUB_FALLBACK}" = "x" ] ; then
export GRUB_FALLBACK=""
GRUB_FALLBACK=$(ls /boot | grep -c 'initrd.img')
[ ${GRUB_DISABLE_LINUX_RECOVERY} ] || GRUB_FALLBACK = $((${GRUB_FALLBACK} * 2))
fi
echo "fallback set to menuentry=${GRUB_FALLBACK}" >&2
cat << EOF
set fallback="${GRUB_FALLBACK}"
EOF
fi

https://help.ubuntu.com

https://www.gnu.org/software/grub/

https://wiki.archlinux.org/

http://wiki.ubuntuusers.de/ (Deutsch)

()

Antfra81 [AT] yahoo [DOT] com

ANTFRA
2014

You might also like