Sei sulla pagina 1di 26

ewd6qhca

Grub 2
???????? ?? ????????????
GRUB (Grand Unified Bootloader)
????????? ??, ??????????? ??? ???????? ???? Linu
x, OpenSolaris, BSD ? Hurd (StartUp Manager). GRUB 2 ??? ????? ?????? GRUB, ????
?? ???????????? ?? ????????????.
?????? Grub ? ?????????
?????????? [??????]
1 ??? ??????????, ????? ????????? ? ??? ?????
2 GRUB2 - ?????? ????.
2.1 /etc/default/grub
2.1.1 ??? ??????, ???? ????? /etc/default/grub ???
2.1.2 ????????? ???????????? ?????? ????????
2.1.2.1 ??????
2.1.3 ????????? ??????? ??????????? ????
2.1.4 "???????" ????
2.1.5 ????????? ??????????? ?????????? ???????? ????
2.1.5.1 ??????
2.1.6 ????????? ????????? ????? /etc/default/grub
2.2 /etc/grub.d
2.2.1 ??????
2.3 ?????????? ?????????
2.4 ????? ? ?????????? ?????? ? ????????
2.5 ????????? ?????
3 ??????????
3.1 ????????? ???????? ???????????
3.1.1 ?????? ?2:
3.2 ????????? ????? ??????? ????
3.2.1 ??????
4 ?????????????? GRUB2
4.1 ?????????????? GRUB2 ? LiveCD
4.2 ?????????????? GRUB2 ? LiveCD. ?????? 2 (??? chroot)
4.3 ?????????????? GRUB2 ? LiveCD. ?????? 3 (?????? ???????)
4.4 ??????????? ???????? GRUB 2 ? ?????? ??????[1]
4.5 ???????? ??????? ??? ????????? ??????????????????? GRUB2
4.6 ?????
4.7 ???????? Windows ??????????? ???????
5 Advanced
5.1 ???????? ????????-????????????? GRUB2-liveUSB
5.2 ??????? grub2 - ??????? ? ????????
5.2.1 ls
5.2.2 cat
5.2.3 linux
5.2.4 initrd
5.2.5 chainloader
5.2.6 boot
5.2.7 root
5.2.8 set
5.2.9 search
5.2.10 lsfonts
5.2.11 help
5.2.12 halt
5.2.13 reboot
5.2.14 background_image
5.2.15 vbeinfo
5.2.16 configfile
5.2.17 terminal_output.console
5.3 ??????????? ;)

5.4 ???????? ??????? grub2 ?? ????????


5.5 ???????? ?????????????? ???? ????????
5.5.1 ?????? ????? "custom.cfg"
5.6 MBR
?????, ?????????????? ? ???????? ????? ?????
5.7 ???????? LiveCD ? GRUB2
5.7.1 ?????? ????? "grub.cfg"
5.8 ???????? LiveCD ? GRUB2 ?? ???? ?????????? ????????????
5.9 ?????????? ? ???? ?????? ???????? ? CD/DVD & USB
5.9.1 ?????? 1. ???????? ? CD & USB ??????????? Plop Boot Manager
5.9.2 ?????? 2. ???????? ? CD ??????????? Smart Boot Manager
5.10 ??????????
??? ??????????, ????? ????????? ? ??? ?????[???????]
?????????? ????????? ???????????? ????? ?? ?????, ?????????? ?? ? ??? GRUB2 ???
?????-?? ?????? ?????????. ? ???? ??????? ????? ???????, ??? ??????????, ????? ?
???????? ? ??? ?????.
SUSE: ????? ? "?????????/???????? ????????", ???? "grub". ???? ?? ????? ????? ??
???, ?? ?????? < 1 - ??? GRUB 1 (??? ??? ??????? GRUB Legacy)
UBUNTU: ????? ??????????, ???? "grub". ????????? ??????? ????????. ??????? ?????
???????? ??????.
?????? ?? ????????? ?????? ????? ?????? ??????? (??? ???????): "grub-install --v
ersion" ??? "grub-terminfo --version".
GRUB2 - ?????? ????.[???????]
??? ?????? ????????? grub2 ?? ?????? grub ????? ??????? ????????? ??????????? ??
???????? ????????? ?????? ????????????. ????????? grub2 ???????????? ?????? ????
????????? ???? ????????. ?????? ??, ??? ????????? ? ????? - ?????????? ?????????
? ?????? "/boot/grub/menu.lst", ? ??????? ???? ????????? ?????? ????????, ??????
? ???? ? ?????? ?????????. ??? ??? ??????? ? grub2 ???????? ?????? ????????????
???????? "/boot/grub/grub.cfg". ?????? ??, ?? ?????????? ??????? ??? ???, ??? ??
?????? ??? ?????? ? "menu.lst". ??? ???????????? ????????? ?? ????? ? ?????? ???
?? "grub.cfg" ????? ??????:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
? ?? ???? ??? ????????????? ?? ?????? ???. ???? "grub.cfg" ???????????? ????????
????? ? ?????????????? ?????????? ????????, ??????? ????? ?????????? ??????????
grub2 ??? "grub.cfg" ????? ?????? ??????, ? ??? ???? ?????? ????? ????????, ?? ?
?? ?? ????????? ?????????? ???? ????. ???????? ? ???????? ?????? ???????????? gr
ub2. ??? ? ????????? ????, ??????? ??????, ??????????, ?????????? ?? ???????????
????, ???????? "/boot/grub/grub.cfg"; ????? ???? ??????? ???? "/etc/default/gru
b" ? ?????????? "/etc/grub.d". ?????????? ?? ?????????.
/etc/default/grub[???????]
?????? ???? ???????? ? ???? ???????? ????????? ??? grub2. ????? ????, ??????????
, ??? ? ??????????. ??? ??????????? ???? ?????????? ????????? ?????????? ????? ?
????:
GRUB_DEFAULT=6
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT="2"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

GRUB_CMDLINE_LINUX=""
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"
?? ?????, ??? ???? ???????????? ????? ????? ????? ? ???????????????? ??????? ???
??=????????. ?? ?? ????? ????? ????????????? ??? ?????????????? ?????????, ?????
???? ???????? ???????????? ?????? ?????????? ????????? ????-?????? ???????? ????
??????. ???????? ????? ????????????? ??????????? ??? ????????? grub
????????? ??
?????????? ?????? ???????? ?/??? ??????? ?????? ????. ?????????? ??, ??? ??? ???
?????.
??? ??????, ???? ????? /etc/default/grub ???[???????]
?????????? ???????????? ??????????? ?????? ???? ????????????? ???????, ? ???????
? ????????? ????????? ????? ?????????. ?????? ??? ?? ?????????? ?? ??????: ?????
/etc/default/grub ???. 1) ? ??? ?????? Grub1 2) ?????????, ???? ?? ???? /etc/sy
sconfig/grub2. ??????? ??? ??????????? ???????. ? ???? ??????? ????? ????????, ?
????? ????? ????? ??? ? ??? ??????????? ????????? ? ???? ??????.
????????? ???????????? ?????? ????????[???????]
?? ????????? ??????????? ????? (?????????? ??? ?????? ????) ??????? ? ??????. ??
??? ????????? Ubuntu ??? ???????? ???????, ? Windows, ????????, ????? ?????????
???????. ????? ?????????? ???? ?????? ??????? ?????? ?????????? ???????? ? ?????
?????. ??? ?????????? ??????, ??? ?????? ?????? ????? ???????? ???????? ???????
???? ?? ?????????. ?? ???, ??????????, ???????? ???????? "GRUB_DEFAULT". ???????
?? ??? ???????? ????? ?????? ? ???? ????????, ??????? ?????? ???? ?????? ???????
????, ?????? ????????? ?????????? ? ????. ???????? ?? ????????? - 0, ??????? ? ?
????????? ?????? ?????. ??? ????, ????? ??????? ?????? ?????, ??? ????? ??????,
????? ?? ????? ?? ????? ? ??????. ??? ???? ??? ????????: ??????????? ??????????
"/boot/grub/grub.cfg" ? ?????????, ????? ?? ????? ???????? ?????? ??????, ??? ??
??????????????? ? ????? ???????? ?????????? ?? ?? ????? ? ???? ???????? (?????
???? ????????? ??????????? ?? ????, ????? ?????????? ??????). ?????? ??????? ???
??????? ????? ????????? ??????????????, ??? ????? ??? ?????????? ????????????. ?
????? ??????? ?? ????????? ? ??????? ????????? 0, 1, 2, 3 ? ??? ?????, ?? ????
?????? ?????? ?????? ????? ??????????????? ???????? 4, ??????? 1, ???????
0. ? ?
?????????????? ??????? ??????????? ???????? 6, ?? ???? ??????????? ????? ???????
????? ????. ????? ??????? ??????????? ?????? ???? ??? ?????? ?????????? ???????
?. ????????, ???? ? ???????? ???????? ??????? "saved"(??? ???????) ? ???????? ??
???? GRUB_SAVEDEFAULT=true - ????? ??? ???????? ????? ?????? ??? ?????, ???????
??? ???????? ? ??????? ???. ??? ?? ????? ??????? ?????? ???????? ??????. ? ?????
? ?????? ??? ?????? ???? ?????? ?????, ????? ?? ??? ????? ? "/boot/grub/grub.cfg
". ??? ???? ???????? ?????? ??????????? ? ????????. ?????? ?????? ?????? ???, ??
? ????? ?????????? ???? ?? ???????? ???????? ????????? ??-?? ????????? ?????????
.
??????[???????]
???? ? "grub.cfg" ????? ???? ???????? ???:
menuentry "Ubuntu, Linux 2.6.32-020632rc6-generic" {
recordfail=1

....
}
?? ? ???????? ????????? "GRUB_DEFAULT" ?????? ??????????? ?????? ? ????
GRUB_DEFAULT="Ubuntu, Linux 2.6.32-020632rc6-generic"
????????? ??????? ??????????? ????[???????]
?? ????????? ???? ???????? ???????????? 10 ??????, ????? ???? ??????????? ??????
????? ????? (???? ?????? ?? ????? enter ? ?? ?????? ?????? ?????, ??? ??????????
??? ??????). ? ?????????? ???????? ??? ?????? ??????. ?? ??? ???????? ???????? ?
??????? "GRUB_TIMEOUT" (?? ??????? ? "GRUB_HIDDEN_TIMEOUT"!). ???????? ????????
? ????????. ???????? ????????, ??? ????? ??????????? ? ????????. ? ????? ???????
??? ????????
2, ?? ???? ???? ???????????? ??? ???????. ????? ????, ???? ???? ??
??????. ???? ????????? ???????? "-1", ?? ???? ????? ???????????? ?? ??? ???, ???
? ???????????? ?? ??????? ?????-???? ?????. ?? ???? ??? ?????? ???????? ? ??????
??? ??????.
"???????" ????[???????]
? ??????, ???? ?? ?????????? ??????????? ?????? Ubuntu, ???? ???????? ?? ???????
?? ?? ????? ????????????, ? grub2 ????? ????????? ??? ???????? ? ???????. ??????
??, ?????? ????? ?????????? ????????????? ??????????? ? ?????? ????? ??? ?? ???
?????? ???????? ??????. ??? ????? ????????????? "??????? ????". ?? ???? ????????
???????? "GRUB_HIDDEN_TIMEOUT". ? ??????, ????? ??????????? ?????? ??, ???? ???
????? ??????????????? (# ? ?????? ??????).???? ? ???? ???????? ???????????? Wind
ows, ???? ???????? ????????????, ???? ???? ?? ????????????????, ?.?. ???????????
? ??????? ???? ??????????. ? ?????? ? ???????????? ?? ?? ????? ???????. ????????
??? ?????? ???????? ? ????????. Grub2 ???????????? ???????? ?? ???????? ???????
??? ??????, ????? ???????????? ??????????? ??????? ???? ????????, ????? Escape.
???? ???????? ??????????? ? 0, ?? ???????? ?? ?????. ??????, ???????????? ??? ??
??? ?????? ??????? ??????????? ????, ????????? ??? ???????? shift. ???????? "GRU
B_HIDDEN_TIMEOUT_QUIET" ???????? ?? ??????????? ??????? ?? ????? ?????. ??? ????
???? "true" ?????? ??????? ?? ?????. ??? ?????? "false" - ????? ????????????.
????????? ??????????? ?????????? ???????? ????[???????]
?????? ?????? ?????????? ????????? ???? ??????? ? ??????-???? ??????? ??????????
?. ????????, ??? ?????????? ?????? ?????????????? ????????????. ? ???? ?????? ??
???? ??????? ????? ???????? "GRUB_CMDLINE_LINUX_DEFAULT". ?? ???????? ?? ?? ????
?????, ? ???????? ??????????? linux-???? ??? ????????. ???????? ??? ?? ?????????
- "quiet splash", ??? ???????? ? ?????? ??????????? ???????? ??? ??????? ??????
?, ? ?????????? ??????????? ?????-???? ????????? ??????????. ?? ?????? ????????
??????????? ??? ????????? ??????? ????, ??????? ??? ???????? ? ???? "quiet splas
h your_param1 your_param2", ?? ???? ??????? ????? ?????? ?????? ?????????.
??????[???????]
?????? ????, ????? ????????? ????? ?????????, ?? ?????? ???????????. ???????? ??
????????? ???????? ? "?????????? ?????". ???????
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
??
GRUB_CMDLINE_LINUX_DEFAULT=""
?????? ??? ???? ?????? ???????? linux-???? ????? ????????????? ? verbose mode, ?
? ???? ????? ???????? ??? ??????????? ???????? ? ? ??????? ?? ????? ????????? ??
???????? ? ???????? ??????????? ???????, ??? ????????? ??????? ?? ????????? ????
???? ? ???????? ?????????.
???????? ????????, ????? ???? ?? ???????????? ?????? ????????? ????? GRUB_CMDLIN
E_LINUX, ???? ?? ?? ??????. ??? ????????????? ???????? ???
GRUB_CMDLINE_LINUX=""
????????? ????????? ????? /etc/default/grub[???????]

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`


- ?????? ?????? ???????? ?? ???????? ????????????, ??????? ????? ???????????? ?
???? GRUB2 (Ubuntu, Xubuntu, Debian, ? ?.?.)
GRUB_TERMINAL=console
- ???????????????? ?????? ??????, ? ??? ???????? ????????? ??????????? ????????
(grub-pc only). ?????? ????? ????? ??????? ???, ??? ?????????? ???????????? ????
?? ????? ??????????? ????????? ???????? ?????? ???? (?????????, ????????????).
GRUB_DISABLE_LINUX_UUID=true
- ????????????????, ???? ?? ?? ??????, ????? GRUB ????????? ????? ??????? ??????
?? "root=UUID=xxx".
GRUB_GFXMODE=640x480
- ???? ????? ???????? ?? ?????????? ???????????? ???? GRUB2. ?????? ???????? ???
?????????? ??????????, ??????? ?????????????? ??????????? ???????????? (????????
: 640x480, 800x600, 1024x768, 16001200 - ??? ??????????? ?????? 4:3. ? 640x400, 8
00x500, 1024x640, 1280x800, 1680x1050 - ??? ??????????????? ????????? ? ????????
???? ?????? 16:10). ????????? ????????? ?????? ??? ???? ????????. ??? ?? ? ??? ?
??? ??????????? ??????? ??? ????????? ?????????? ??? ?????? ?? ???? GRUB2. ??? ?
????, ???????? ? ????, ???? "?", ????? ? ?????? grub> ????? vbeinfo.
???? ?????? GRUB_GFXMODE=640x480 ???????????????? ??? ????????? ?????????? ?????
?????, ????? GRUB2 ?????????? ????????? ?? ?????????, ???????????? ???????? /etc
/grub.d/00_header.
????????? ???????: - ????????? ??????????? ?????????? ? ???? GRUB2 ? ????? ?????
??????? ???????, ???????? ??????? ????????? ????? ????????. - ? ???????? ???????
??????? ????? ???????????? ????? ?????? ???????? ???????????, ?????? ??????? ???
???????? ?????? ? ????????? ??????????. ???????? ???: 1280x1024x24 ??? 640x480x3
2. - ???????????? ????? ???????? ???????????? ????????? ??????????. ??? ??? ????
????? ? ??? ???, ???? GRUB2 ?? ????? ???????????? ?????? ???????? ??????????, ??
??? ?? ????? ????????? ????????? ? ?.?. ???????? ?????????? ?????????? ?????????
????????. ??????: 1280x1024x16,800x600x24,640x480. - ???? ???????????? ?????? G
RUB_GFXMODE= ? ??? ?????????? ??????? sudo update-grub ??? ???????? ????????? no
t found, ?????? ?????????? ??? ???????? ??? ???????? ???????? ???????????.
GRUB_DISABLE_LINUX_RECOVERY=true
- ??? ????, ????? ???????? ????????? ? ???? ?????? Recovery, ???????? (???? ????
???????) ??? ???????????????? ?????? ??????. ???? ??? ????? ????? Recovery ?????
? ??? ????????? ??????? ???? - ??? ????? ????? ??????? ??????????? ?????? ? ????
?? /etc/grub.d/40_custom.
GRUB_DISABLE_OS_PROBER="true"
- ????????/????????? ???????? ???????? /etc/grub.d/30_os-prober ??????? ?? ?????
? ???????? ???????????? ??????, ??????? ????? ??? Windows, Linux, OSX ? Hurd.
/etc/grub.d[???????]
???? ??????? ???????? ? ???? ???????, ??????? ???????????? ??? ???????? "grub.cf
g". ??? ?????????? grub2 ??? ??????? ??? ????????????? ?? ?????????? ??????? ? ?
??? ? ????????? ? "grub.cfg" ???? ????????, ??????? ?? ? ?????. ??? ???????? ??
??? - "10_linux" ? "30_os-prober" ???????? ?? ????? linux-???? ? ????????? ?? ??
?????? ???????? ??????????????. ???? "40_custom" ????????? ????????? ???? ?????
? ????????. ??? ????? ???? ???????, ???? ??, ????????, ?????? ???????? ?????-??
?????? ???????? ???????? ???????.
??????????: ???? "40_custom" ?????? ????????????? ?????? ???????, ????? ????????
? ????? ?? ????? ???????????? ? ????!
??????[???????]

????????? verbose-mode (????? ???????? ??? ??????????? ????????, ? ????????? ???


????????? ???????? ????????), ??????????? ?????????????? ??????? ???????? ??????
?. ??? ????? ?? ??????? ????????????? ??????? ????? ????????. ????????, ?? ?????
??? ??? (? "/boot/grub/grub.cfg"):
menuentry "Ubuntu, Linux 2.6.32-020632rc6-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 0e717c2a-24bd-4abe-acfe-ecf98fc814f8
linux /boot/vmlinuz-2.6.32-020632rc6-generic root=UUID=0e717c2a-24bd-4
abe-acfe-ecf98fc814f8 ro quiet splash
initrd /boot/initrd.img-2.6.32-020632rc6-generic
}
??? ????, ????? ??????? ?? ????? verbose-mode, ??? ????? ?????? ????? quiet ? sp
lash ?? ?????? "linux". ??, ? ??? ?????????? ??????? ???????? ?????? ??????. ? ?
???? ????????:
echo "adding verbose mode" >&2
menuentry "Ubuntu, Linux 2.6.32.rc6 verbose-mode" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 0e717c2a-24bd-4abe-acfe-ecf98fc814f8
linux /boot/vmlinuz-2.6.32-020632rc6-generic root=UUID=0e717c2a-24bd-4
abe-acfe-ecf98fc814f8 ro
initrd /boot/initrd.img-2.6.32-020632rc6-generic
}
??? ??? ? ????????? ? "40_custom" ? ????? ?????. ?????? ? echo ?? ???????? ?????
???????, ??? ???? ????? ??????????????? ??? ? ???, ??? ??? ????? ?????? ? ??????
?? ??? ?????????? grub2
?????????? ?????????[???????]
????? ????, ??? ?? ??????????????? ? ????????? ???? ?????, ?????????? ??? ????.
?????? ????? ????????? ????, ??????? ??? "/boot/grub/grub.cfg". ??? ???????? ???
??? - ????? ????? ???? ????????? ???????
49a075052093.png
sudo update-grub
??? ???????? ??????? ? ???????? "/etc/grub.d" ? ???????? ???????? ? "/etc/defaul
t/grub" ?????????. ????? ????? ????? ??????????????? ? ?????, ??? ??? ???????? ?
?? ????. ?? ??? ?? ????????... ???? ??? ?????? ???????, ?? ? ?????? ??????? ?? ?
?????? ?????? ????????? grub2 ?? ? linux-????. ???????? ??? ??? ???????? ???, ??
? ?? ????????? ??????.
??? ?? ????? ?????? ??????????? ? ??? ?????????? ????.
????? ? ?????????? ?????? ? ????????[???????]
? grub2 ??????? ??? ???? ?????? ??????? ?? ??????? grub. ??????? ??? ? ?????????
? ??????? ?????? ? ?? ????????. ? grub ????????? ?????????? ?????? ? ????????? ?
??????? ?????????? ????????? - ? ????. ?????? ?????????? ???? (sda ? ???????) ??
????????? "hd0", ?????? (sdb) - "hd1", ? ??? ?????. ??? ?? ???????? ? ? grub2. ?
???????? ?? ???????? ????? ??????????. ???? ? grub ?????? ?????? ??????? ????? (
sda1) ?????????? "hd0,0", ????????? (sda4) - "hd0,3", ?? ??????, ? grub2, ?????
??????? ????????????? ????? ??????? ? ???????. ?? ????, sda1 ?????? ????? "hd0,1
" (? ?? "hd0,0"), sdb4 - "hd1,4". ????? ??????, ????????? ?????? ???? ? ????, ?

????????? ???????? - ? ???????!


????????? ?????[???????]
????? ?????-???? ??????????????? ??????????? ???????? ????? ?????? ????????????.
????????, ???????? ??????????????? ??? ??????:
datev=$(date +%Y_%m_%d)
mkdir -p ~/.grub.bak/$datev
cd ~/.grub.bak/$datev
mkdir -p boot/grub etc/default
cp /boot/grub/grub.cfg boot/grub
cp -Rp /etc/grub.d etc
cp /etc/default/grub etc/default
(????? ????????? ?????? ?????? ? /usr/bin, ???????, ? ???????, "grub-backup" ? ?
??? ????? 755. ?????? ??? ?????????? ??????????? grub2 ?????????? ????? ????????
? ??????? "grub-backup")
??????????[???????]
????????? ???????? ???????????[???????]
?? ?????? ??????? ? ?????????? ???????????? ??????????? ? ???????? ???? ? ???? ?
??????? grub2. ?????? ??????????? ?????? ??????????????? ?????????? grub2 (?? ??
??????? - 640x480, ???????? ? "/etc/default/grub"), ?????? ????? - png ??? tga.
?? ?????? ?????????? ??????? ????? ?? ?????????? ?????????? ??? grub2 ??????????
?, ???????? ???????
sudo apt-get install grub2-splashimages
(?? ??????? ????? grub2-splashimages ? ??????? grub-splashimages, ??????? ?? ???
?????? ? grub2!). ??? ??????????? ????? ???????? ? ??????? "/usr/share/images/gr
ub", ??????? ????? ????? ???????? ? ???? ???????????? (??. ????). ??????? ??????
????? ???????? ? ????? "/etc/grub.d/05_debian_theme". ??????? ? ??? ?????? ?????
? ????:
for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tg
a} ; do
??, ??? ?????-????? ?????? ? bash, ?????? ????? ? ????????????? ? ???????? ?????
??. ??? ?????????: ??? ?? ??? ??????, ??? ????? ??????????. ? ?????? ???????? ??
????? (? ????? ??????? - "{/boot/grub,/usr/share/images/desktop-base}") ????????
??? ????????, ? ??????? grub2 ????? ?????? ?????????? ??? ????????? ???????????.
????? (????? ?????) ??????? ??? ????? ??????????? (??? ??????????!), ??????? ??
????? ?????????? ? ???????? ???? (????? - "moreblue-orbit-grub"). ?????? ??????
?? ?????? ("{png,tga}") ?????????? ?????????? ??????, ??????? grub2 ????? ??????
?? ???????????? ? ???????? ????. ????????, ??? ?????? ? ???????? ??????? ???????
?????? ????? ??????? ? ?? ??????????? ?????????! ?? ????????? ??????????? ??????
? ????????? "/boot/grub" ? "/usr/share/images/desktop-base". ??????????? ?? ???
??? grub2-splashimages ? ??? ????????????? ? "/usr/share/images/grub", ??????? ?
? ?????? ???????? ???? ??????? ? ?????? ????, ??? grub2 ????? ?????? ???????????
. ??????? ??? ???? ????? ? ?????? ???????? ??????. ????? ?? ??????????? ? ??????
? ????????. ? ?????? ?????????, ???????????? ???? ??? ???????? ? "winter.tga". ?
?????? ??? ("moreblue-orbit-grub") ?? ??? ????????? ???????? (? ???? ?????? - "w
inter"). ? ????? ??????? ????? ??????:
for i in {/boot/grub,/usr/share/images/desktop-base,/usr/share/images/grub}/wint
er.{png,tga} ; do
????????, ??? ????? ?????? ????? ? ??????? ????????? ???????? ?????? ?????? ????
?! ??? ??? ????????: grub2 ??????????????? ????????????? ???????? ???????? ? ???
? ? ??? ???? ? ???????? ?????? ? ????? ?? ????????????? ??????????. ???? ???????
????? ??? ?????? ??????? ?????? ?????????? ???????????. ????? ???????, ???? ? ??
???????? ?????? ???????????? ? ?????????? ?????????, ????? ???? ???? ?? ???? ???
?????, ??????? ?????? ?????? ?????? ? ??????. ??????????, ???? ??????????? ?????
??????? ? ?????? ???????? (????????, "image.png" ? "image.tga") - ?????? ????? ?

??? ? ??? ???????????, ??????? ?????? ??????? ?? ?????? ???????? ???????. ??????
??????: ?? ?????? ???????? ????? ??????? ? ?????????????, ?????????? ??????? ??
?????????. ??? ???????? ??????????/????????? ???????????. ??????, ????????: ???
???? root ?????? ????? ??? ??????? ????? r-x ?? ???? ???????. ????? ?? ????? ???
?????? ???????? ? ???????????? home-???????, ?.?. ?? ?????? ???????? ?? ??? ?? ?
????????????. ????? ?????? ???????? ???? ?????????? ???????? "/usr/share/images/
grub" ? ??????? ??? ???????? ???. ?????? PNG ? TGA ?????????????? ????? ?????? J
PEG. ?? ?? ??????? ?????? ??????????? ?????? ????????? jpeg ? 8-?????? ??????. ?
?????? ??????????? jpeg-????? ?????? ???? ?? ?????????, ??? ????? ??????? ?????
? ??? ????????? ??????????? ? 8-?????? ?????. ??? ????, ????? ???????? ?????????
jpeg-??????, ????????? ?????? ???????? ?????? ? ?????? ????: "{png,tga,jpg,jpeg
}".
???????? ????????, ??? ? ?????????, ?? ?????? ?????? (23.10.2010), ??????? GRUB,
????????? ???????? ??????????? ??????????? ??? ??????. ?????? ??? ????????? ???
????? ??????????? ?????????? ? ??????:
WALLPAPER="/usr/share/images/desktop-base/moreblue-orbit-grub.png"
??????? ? ???????? ???? ? ????? ? ????? ?? ????????????? ???? ?????????? (.png,.
tga,.jpg) ? ??????????? 640x480. ????? ???? ???????? ????????????:
sudo update-grub
?????? ?2:[???????]
? ????? /etc/default/grub ?????????? ????????? GRUB_BACKGROUND ? ???????? ?? ???
? ? ????? ? ?????????.
????????? ????? ??????? ????[???????]
????? ??????? ???? ????? ???????? ? ????? "/etc/grub.d/05_debian_theme". ? ?????
?????? ????? ????? ?????-??????? ???????? ???????? ??????????:
COLOR_NORMAL=
COLOR_HIGHLIGHT=
????? ? ????????????? ????? ??? ??????? ???? ????????. ?????????? "color_normal"
???????? ?? ????? ???????? (?????????????) ?????? ????. "color_highlight" - ??
????? ??????????? ??????. ??? ??? ??? ?????????? ?? ? ????? ????????. ???????? ?
????? ?? ???? ????? ???????????? ????? ??? ?????, ??????????? ??????. ?????? ???
? - ??? ???? ??????. ?????? ???? - ???? ???? ??????. ??? ?????? ????????? ??????
:
black - ??????; blue - ?????; brown - ??????????; cyan - ???????; dark-gray - ??
???-?????; green - ???????; light-cyan - ??????-???????; light-blue - ??????-???
??; light-green - ????-???????; light-gray - ?????; light-magenta - ???????; lig
ht-red - ??????-???????; magenta - ?????????; red - ???????; white - ?????; yell
ow - ??????.
????????, ??? black (??????) ??? ????????????? ? ???????? ??????? ????????? (?.?
. ????? ????) ? ?????????? ???? ?????????? ???, ??? ?????-???? ???????, ????? ??
??? ?????? ????????. ????????????? black ? ???????? ????? ?????? ???? ?????? ???
??.
??????[???????]
COLOR_NORMAL=black/black
COLOR_HIGHLIGHT=black/light-gray
? ???? ?????? ?????? ????????? ?????????: ??????? ????? - ?????? ?????, ????????
?? ???; ?????????? ????? - ?????? ?????, ????? ????????? ??????.
?????????????? GRUB2[???????]
?????, ????????, ????????? Windows, ?? ?????? ??????????? ? ???, ??? ??? ???????
? ????? ???????????? ?????? ???? ???????? Windows, ? ???? grub2 ?? ?? ??????? ??
???, ??? ???????? ? ????????????? ????????? ???-???? ????? Windows. ????? ??????

???? ??-?? ????, ??? Windows ??? ????????? ???????? ??????????? ??????? ????????
????? (??? ?????????? MBR-??????), ?????? ?????? ??? ?????????? grub2. ??? ????
?????????? grub2 ??? ??????????? liveCD Ubuntu 10.04 ??? ????? ?????? ??????????
? ???????, ?????????? grub2 ? ???? ???????????.
?????????????? GRUB2 ? LiveCD[???????]
??????????? ? ?????? LiveCD (?????????????? ???????? ???? ????????? ???????? ???
??????? ???????? ??? ?? ?????????? cd-?????? ?????? boot device ? BIOS). ??????
??? ???????. ??? ?????? ??? ????? ????? ??????, ?? ????? ????? ? ?? ????? ??????
? ??????????? Ubuntu. ???? ?? ?? ??????? ????? - ?????????????? ????????
sudo fdisk -l
??? ?????? ??? ??????????? /-?????? (root). ????????????? ??? ????????
sudo mount /dev/sda5 /mnt
? ???? ?????? ???????? ?????? ??????? - /dev/sda5, ?? ?? ??????????? ???? ??????
??. ???? ? ??? /boot ?????? ????????? ????????, ??? ????? ???? ????? ???????????
???. ? ?? ????????? ????????? boot-??????, ?? ???????????, ??? sda3 ??????? ???
/boot. ????????? ???:
sudo mount /dev/sda3 /mnt/boot
????? ????????? ??????? /dev ????? live-??????? ??? /dev ?????? root-???????:
sudo mount --bind /dev /mnt/dev
? /proc live-??????? ??? /proc root-???????:
sudo mount --bind /proc /mnt/proc
?????? ????????? ????????? ???????:
sudo chroot /mnt
???? ?? ?????????????? GRUB ??? Gentoo:
sudo mount sysfs /sys -t sysfs
?????? ?? - root-???????????? ? ???????, ???????? ???????? ??????? ????????? /mn
t, ?? ???? ???????? ?????? ????? ????????? ???????. ? ??? ?? ?????? ???????? MBR
-?????? ???????? ?????, ????????????? grub2. ?? ??? ?????? ??? ????? ???????????
?, ? ?????? ??????????? ????? ??????????? ??? ?????????. ???? ? ??? ???? ???????
????, ???????? ?? ??????? - ?? ????? ??????????? sda. ???? ????????? - ?????? ?
? ??? - sda, ?????? - sdb, ? ??? ?????. ?????????? ??????????? ???? ????? ??????
? ???????
sudo fdisk -l
? ?????????? ??????? ???? ??????? "???????????". ? ???? ?????? ???????? ???????
sda1 ????? ?????????, ??????????, ??? ? ???? ??????????? ???????? ?????? ???????
????, ?? ???? sda. ????????????? ? ??????????? ??????, ?????? ?? ???? grub2:
grub-install /dev/sda
???? ?? ??????????? ? ??????-???? ???????? - ?????????? ????????????? ??????? ?
?????? --recheck:
grub-install --recheck /dev/sda
????? ? ????????? ??????? ????? ?????? ???????
grub-install --recheck --no-floppy /dev/sda
???????? ????????: ?? ????????????? grub2 ?? ?????????? ???? (sda, sdb...) ?.?.
? mbr, ? ?? ?? ?????? (sda3, sdb1...)! ???? ??? ?????? ???????, ??????? ?? chroo
t ????????
exit
??????????? ???? ????? ? ????????: /dev ????? live-???????:

sudo umount /mnt/dev


/proc:
sudo umount /mnt/proc
boot-??????, ???? ??????? ???????????? ????????:
sudo umount /mnt/boot
? ??????????, ???????? ??????:
sudo umount /mnt
???! ???????????????, ??????????????? ??????? ???????? ? BIOS (?????? ??????? ??
?? ?? ?????? ?????) ? ??????? ?????????.
?????????????? GRUB2 ? LiveCD. ?????? 2 (??? chroot)[???????]
??? ????? ?? ??????????? LiveCD Ubuntu 9.10 ??? ?????? ??????? ? ?????????? grub
2. ? ??????? ?? ??????????? ???????, ?? ?? ????? ????????? ?????????? ????? chro
ot, ??? ???????? ????????? ?????????? ????????? ????????. ????, ??????????? ? ??
???????? LiveCD, ????????? ???????. ?????? ????????????? chroot ?? ?????????????
?????? "--root-directory". ?? ??? ?????? ????????, ??? ?????? ????? ???????????
??? ????? live-????????. ???? ?? ????????? ? Ubuntu 9.10 Desktop, ????? ?? ?????
??????. ? ???? ?????? ?????????
man grub-install
???? ? ???????? ????? ???????????? ?????????????? ???? "--root-directory" - ???
? ???????. ?????? ??? ????? ?????????????? ???????? ?????? ???????. ???? ?? ?? ?
??????, ?? ????? ??????? ????? ???????, ??? ???????
sudo fdisk -l
??? ?? ????? ???????
sudo blkid
??????? ???? ? ????? ?????? ??????????. ????????????? ? ???????? ????????, ?????
???? ???. ????? ? ????? ??????? ??? ????? sda5:
sudo mount /dev/sda5 /mnt
???? ? ??? ??????? ????????? boot-??????, ????????????? ? ???. ???????? ??? sda2
sudo mount /dev/sda2 /mnt/boot
?????? ????????? ?????????? ? ????????? grub2. ???? "--root-directory" ?????????
???????, ??? ???????????? ? ???????? ???????? ??????????. ??? ????? ???????? ??
???? ????? ???????, ??????? ????????????? ? /mnt. ??????? ?????????:
sudo grub-install --root-directory=/mnt /dev/sda
??? ? ? ?????????? ???????, grub2 ??????????????? ?? ?????????? ????, ? ?? ?? ??
????! ? ???????? ????? ????? ??????? ??? ????, ??????? ?????????? ??????????? ?
bios. ???? ??? ??????? ???????, ?????????? ??????? ????????? ?? ???????? ???????
??? ? ?????? ???????????? ????????, ??????? ???? ????????? ? "device.map". ????
??? ??? ???? - ??????????? ????? ? ???????????????. ???? ????? ??????? ????????
?????? ???????? - ?????????????? ???? "device.map" ? ???????? ???????? ?????????
???? ??????? (? ????????? ??????? - "/mnt/boot/grub/device.map") ?????????? ???,
??????? ????????? ????? ? ?????????????? ?????????. ???? ?????? ????? ???
(hd0) /dev/sda
(hd1) /dev/sdb
??? ????????????? ????????? ???????? ??? ???? ??????? ??????. ????????? ???? ? ?
??????? ????????? ??????? grub-install, ??? ??????? ????. ?????? ?????? ????????
???? ?????????? ?????? ??????. ??????????? ????? ? ???????????????.
?????????????? GRUB2 ? LiveCD. ?????? 3 (?????? ???????)[???????]

? ??????, ???? ????? ?????? ???????????? MBR ????? (????????, ????? (????)??????
??? Windows), ??? ????? ??????? ??? ?????, ?????? ?????? ?? ????????. ???????? ?
LiveCD. ?????????? ?????? ??????? ???? ? ??????? "sudo fdisk -l". ???? ?? ?????
??????? - ??????, sda. ?????? ???????
sudo grub-install --root-directory=/tmp /dev/sda
??????? /dev/sda ?? ?????? ????. ????? ????? ????????? ? ????? ?????.
??????????? ???????? GRUB 2 ? ?????? ??????[1][???????]
????? ?????? ????????????? ????????? ????????? ?????????? GRUB 2 ?? ?????? ?????
? (?????? ???????? ?????? ?????). ??? ????? ????? ??????????? ? LiveCD ??? ?????
??????? ??? ????????????? ??????? (?????? ? ??? ????? ? ??? ????????? GRUB 2 ??
??????? ??????, ? ???????? ????????? ?????????? ???????). ??? ?????? ???????????
? ???? Linux ?????????? ????????? ? ?????????:
grub-setup -d /.../boot/grub /dev/sdX
?? ????? root (?????????????????) ????????:
sudo grub-setup -d /.../boot/grub /dev/sdX
???:
/.../boot/grub
?????? ???? ?? ?????? GRUB 2, ??????? ?????????? ????????????,
/dev/sdX ???????? ?????? ????? ? ??????? ??????????? ?????? (MBR) ???????? ?????
????? ?????????? GRUB 2, ? X
????? ????????? ??????? ?????, ?? ????? ???????? ??
???????????, ???????? ??????? ????? ????????, ???????? ? ?????????:
sudo fdisk -l
????? ???? ????????? ??????????????? ??????????? GRUB 2 ?? ????????? ????? ?????
? ???????? ????????? update-grub, ????????:
sudo update-grub
??? ???? ????????? ??????????? ?????? ? ????????? ??????????????? ?????? ???????
? ???? ??????????? ?? ?????????????? Multiboot ???????????? ?????? ?, ????????,
??????????? ?????? ???????????? ?????? (???????? Windows, OS/2 ? ?.?.).
???????? ??????? ??? ????????? ??????????????????? GRUB2[???????]
? ????????? ??????? ????? ????????? ???, ??? ????????? ????? grub2 ????? ???????
??? (????????, ? ?????????? ???? ??? ?????????? "update-grub"). ??????, ?????? ?
??? ???? ??????????? ? ???? ??????? ? ???????????? grub2 ?? ??? ??? ????????????
? ?????? ????????????? ?????. ???? ??? ???????? grub2 ?? ?????? ????????? ?? ???
???? - ?? ??????? ??????????? ??????. ??? ????? ???? ??? ?????? ?????????. ?? ??
???? ?????? ???? ??????? ???? - ??????? ? ??????? grub2. ?? ?????? ????? ???????
?? ?? ??????, ??? ?? ????? ?????????? ???-???? ?????? ??? ??????? ??? ??????? ?
??????. ? ????? ??????, ???? ??? ??????? ????????? ??????? - ?????????, ????? ??
???????? ?????????! ??????? grub2 ?????? ?? ????? ????????? ???????? bash. ????
? ????? ?????????????? ?????????????? ?????? ?? ??????? tab. ???? ?? ?????? tab
? ?????? ?????? - ?? ?????? ?????? ?????? ????????? ??????. ??? ?, ????????? ? ?
???????? ??????? ???????. ??? ?????? ??? ????? ?????? root-??????, ?? ???? ?????
?, ?? ??????? ??????????? ???? ???????. ? ???? ?????? ??? "/dev/sda5" (? grub2 ?
?????? ???????? ? ???? "hd*,*". ???? ?? ???? ??????? ? ?????????? ???????? ? gru
b2 - ????????? ????? "????? ? ?????????? ?????? ? ????????" ? I ?????). root-???
??? ???????? ????????
set root=(hd0,5)
? ???? ?????? ??? "hd0,5", ?? ?? "/dev/sda5", ?? ???? ????? ?????? ??????? ?????
. ?????? ?????? ????????? ???????? ????? ???????? ??? ???????? ?????? ???????? "
ls". ??? ?????? ???-?? ?????
(hd0,1) (hd0,2) (hd1.1) (hd2,1)
????? ????, ??? ?? ?????? root-??????, ????? ?????????????? ? ???, ??? ??? ?????
?????, ???????? ??????? "root". ??? ?????? ????????? ?????????? ????:

(hd0,5): filesystem is ext2


?????????, ???????, ?????? ?????????? ext2. ?? ??????????, ??? ? ?????? ????. ??
? ?? ?????????? ?????? ??? ??? ?????????? ???????? ???????. ????? ????, ??? ????
? root-??????, ?? ?????? ???????, ????? ???? ??????? ?????????. ??? ???????? ???
????? "linux". ??????? ?? ????, ? ??????? ?? ?????? ????????????. ? ???? ??????
??????? ????? ????????? ???:
linux /boot/vmlinuz-2.6.32-020632rc6-generic root=/dev/sda5
?? ?????????, ???? ?? ?? ??????? ????? ?????? ????. ?????? ???????? "linux /boot
/vmlinuz" ? ??????? tab. ?? ????? ????? ??????? ?????? ????????? ????. ???? ?? ?
?? ?? ????? ????? ???? ?????????, ??????????? ?????? vmlinuz - ? ????????? ?????
?? ?????? ??? ?????????? ?????? ?? ????? ????? ????????????? ????. ????? ???????
??? ????? ????????? ??:
linux /boot/vmlinuz root=/dev/sda5
???????? ???????? ?? ???????? "root=/dev/sda5" ? ????? ??????! ????? ????? ?????
??????? ??? root-??????, ?? ??? ? ????? ????????? ???????. ??? ????? ??????? ??
??? ?? ???????????. ?????? ???? ? ???????? ??????, ?? ?????? ? ???????? ???????.
??? ????? ????????? ???????
boot
????????????????? ???????? ?????? ??????? ??? ???????? ???????. ???? ???????? ??
???????, ?????????? ????? ??????????? "boot" ????????? ??? ??????? "initrd" (??
?????, ??????-??, ??????????? ??? ?????????? ????????). ???????? "initrd /boot/i
nitrd" ? ??????? tab. ???????? ???????, ??????????????? ???????????? ????. ? ???
? ?????? ??????? ????? ????????? ???:
initrd /boot/initrd.img-2.6.32-020632rc6-generic
??? ??????:
initrd /boot/initrd
?? ???????? ? ????? ????????? ?????????? ?????? ?? ????????? ?????? initrd.
? ??? ????? ????? ?????????? "boot". ? ?????????? ???? ??????????? ?? ?????? ???
???? ??????????? ? ?????? ???????, ? ??? ??? ????? ????????? "update-grub" ? ???
????????????? ???????????? ?????? ????? ?? ????????? ????? (??????? ??, ???????
, ??????).
?????[???????]
?? ?????? ????? ? ?????? ??????? ???? ?????????? ?? ?????????? ??????? ???????.
???????? ??? "/boot/grub/grub.cfg", ??????? ??? ?????, ??????? ?? ?????? ???????
???, ? ?????????? ??? ??????. ????????, ?? ???????? ???:
menuentry "Ubuntu, Linux 2.6.32-020632rc6-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 0e717c2a-24bd-4abe-acfe-ecf98fc814f8
linux /boot/vmlinuz-2.6.32-020632rc6-generic root=UUID=0e717c2a-24bd-4
abe-acfe-ecf98fc814f8 ro quiet splash
initrd /boot/initrd.img-2.6.32-020632rc6-generic
}
??? ????? ???????? ?????? ??? ??????: "set root", "linux" ? "initrd". ????? ?? ?
?????, ??????? ? ????? ??????? "boot". ? ?????? linux ??????? "UUID=...." ?? ???
???????? ?????? ? ?????? ?????? ?????????. ? ????? ??????? ????? ??????:
set root=(hd0,5)

linux /boot/vmlinuz-2.6.32-020632rc6-generic root=/dev/sda5


initrd /boot/initrd.img-2.6.32-020632rc6-generic
boot
???????? ??????????? ??? ?? ??????? ? ????????? ???? ? ???????? ?????. ?????? ?
??? ?????? ??? ????? ?????????? ?? ???????? ?? ?????? ?????-???? ?????????!
???? ?? ??????????????? ????? ?? ???????? (???? ?? ??????????? ??? ?? ?? ????? ?
? ?????? ??????? ? ??????? grub2) ? ?????? ?? ??????????? - ??? ?? ???? ???? ? ?
???????????? grub2, ??? ??????? ????.
???????? Windows ??????????? ???????[???????]
? ?????? ??????????????????? Ubuntu ?? ?????? ????????? ?????? ????????????? ???
???? ??? ??????? ???????. ??? linux-?????? ????? ????? ??? ??: set root - linux
- initrd - boot. ??? Windows ?? ??? ????? ???? ?????. ??? ?????? ??? ?? ?????? ?
??????? ??????. ?? ???? ??? ??? ???, ?? ??????? ??????????? Windows. ? ???? ????
?? ??? "/dev/sda1", ? ??????? ????? ????? ????? ???:
set root=(hd0,1)
????? ????? ?? ?????????? grub2 ???????? ?????????? ????????? Windows-??????????
NTLDR. ??? ????? ?????? ????????
chainloader +1
? ??????? ????? ??????? ?? ??????:
boot
???? ??? ?????? ??????? - ???????????? ????????? Windows. ? ??????, ???? ?? ????
?? ???????? ??????????? ????? ????? ?????? Windows, ??? ????? ??????, ?? ????? ?
? ???????? ????????? NTLDR-?????????. ??? ????? ??????? ???????, ????????? ?????
? "set root" ? ?????? ???????? Windows ????? "/boot/grub/grub.cfg"
Advanced[???????]
????????? ?? grub-legacy (??????? ?????? ??????). ? ??????, ???? ???? ?????? ? g
rub2 ??? ? ?? ??????????, ?? ?????? ???????? ??? ?? ?????? grub (???? ?????????
??? grub-legacy), ??????? ?? ??????? ?????? ????? ???????? ? ???????? ??? ??????
. ??? ??????, ??????? ??, ??????? ????? ?????? ??????. ???????? ????????? ?????
?????? ???????????? ??? ??????? ? ????? I-?? ?????. ????? ?????????? ??????????
??????? "/boot/grub". ??? ????? ?????????
sudo cp -R /boot/grub{,.bak}
?????? ?? ????? ?????????? ? ???????? grub2. ??? ????? ??????? ?????? "grub-pc"
? "grub2" (????????? ????? ???? ?? ??????????):
sudo apt-get purge grub2 grub-pc
????????: ???????? ??????? ?? ???????? ? ?????? ??????? ???????? "boot/grub". ??
???? ????????? grub ?????? 0.97:
sudo apt-get install grub
?? ????? ????????? ??? ?????????? ??????? ???? menu.lst ? ?????? ????? ?????????
?. ??? ????? ????? ????????? ??? ??? ???????:
sudo update-grub
??? ??????? ??????? ???? ???? ????????. ?? ???????? ?? ??????? ????????? "yes".
sudo grub-install /dev/sda
??????? ????????? ????? ?????????? ? ??????? ?????????? ? ??????????? ?????? ???
?? (MBR). ?????? "/dev/sda" ? ????? ??????? ??? ??????? ????, ??????? ??????????
?? ? ???????? ???????????? (?????????? ??????????? ? bios) ???? ????????? ??????
??????? - ??????????????? ? ????? ?????? ?????? grub ? ??? menu.lst ? ??? ?????
? ?????????

?? ????????????? ??????????? ?? ???????, ??? ?????? ? ??????? "grub-common". ???


??? ????? ???????? ???????????? ?????? "grub-pc", ?? ?????? ? ????????? ?? ?????
????. ?????? ??, ????????????? ??? ?????? ?? ?????? ??????? grub - ?? ?????? ???
????. ???????? ?????????? ??????? - ????? ???????? "grub-pc" ?????????
sudo apt-get autoremove
???? ????? ?????????? ??????? "grub-common" ??? ???????? - ??????, ????? ???????
.
???????? ????????-????????????? GRUB2-liveUSB[???????]
????? ?? ??????????, ??? ??????? ??????????? ?????? ? ????????????? ?? ??? grub2
, ????? ??????? ????? ????? ??????????? ? ??????, ???? grub2 ?? ??????? ????? ??
??????. ???????? ??? ????? ????? ????????? (? ??????? /dev/sdb - ??????, ? ?????
??????? ?????????????? ???????? ?????, ????? /dev/sd* ????????????? ??????, ???
??? fdisk -l):
sudo mount /dev/sdb1 /mnt
sudo grub-install --root-directory=/mnt /dev/sdb
sudo grub-mkconfig -o /mnt/boot/grub/grub.cfg
?? ????????? ??????? (/dev/sdb1) ????? ??????? ???????? ? ??????????? ?????, ???
???????? ??? ??????????, ? MBR ????? ????? ??????? ???, ?????????? ?????????? ??
????????? ??????. ???????????? ? ????-?????, ???????? ? ???? grub2. ??? ??? ???
?????? ?????????? ??????? ??????? ???? ???????????? grub.cfg.
??????? grub2 - ??????? ? ????????[???????]
????? ?? ?????????? ????????? ??????? ??????? grub2. ??? ?? ????????? ?? ?????,
? ?????? ???? ????? ??????????? ? ????????. ???????, ????? ??????? ? ???????, ??
??? ?????? "c" ?? ????? ??????????? ???? ????????. ????, ??????!
ls[???????]
???????? ????????????? ???????. ??? ????????????? ? ?????? ???? ?????? ?????? ??
????? ?????? ? ????????. ????? ??? ????? ???? ???????????? ??? ??????????? ?????
?? ? linux - ??? ?????? ??????????? ????????. ????????,
ls /boot/grub
??????? ?????????? ???????? "/boot/grub" ?? ???????, ??????? ?????? ?????? ? ???
????? ????????? (?? ???? ???? ????). ??? ???? ???????? ???????? ??????? "ls" - ?
?? ???????? ???????? ?????????? ? ????? ???????:
ls (hd0,5)
??????? ??? ??? ???????? ??????? ?? ???????, ????? ??????? (???? ??????? ???????
), UUID ? ???? ?????????? ????????? ?????? ?? ??????? (? ??????? UTC).
cat[???????]
?????? ??????? ?????????? ????? ????? ? linux - ??? ??????? ?????????? ?????????
?????. ???????????? ? ???????
cat /????/???_????
linux[???????]
????????? ????????? linux-????. ?????? ??????? "kernel" ? grub-legacy. ?????????
??? ? ???????
linux ????_???? ?????1=???????? ?????2 ?????3
????????, ???:
linux /boot/vmlinuz-2.6.32-020632-generic root=/dev/sda5 single
initrd[???????]
????????? ????????? initrd-?????. ???????????? ???:
initrd /boot/initrd.img-2.6.32-020632-generic

???????? ????????: ?????? initrd ?????? ??????????????? ?????? ???????????? ????


!
chainloader[???????]
???????? ?????????? ????????? ?? ??????? ??????? ?????????? (????????? ?????? ??
???????? ? ???????? root ???????). ? ????? ?????? ??????? ???????? ????? ??? ??
??????:
chainloader /????/???_?????
??????, ??? NTLDR (?????????? Windows) ????? ????????????
chainloader +1
boot[???????]
?????????? ???????? ?????????? ???? (????????? ? "linux" ? "initrd") ??? ?? ????
??? ?????????? (????????? ????? "chainloader"). ???????????? ??? ??????????
root[???????]
??? ????????????? ??? ?????????? ????????, ????? ?????? ?????? ???????????? ? ??
?????? ????????? (?? ????????? - ???????? ?????? ???????, ?? ??????? ??????????
??????? grub2) ? ??? ???????? ??????? ?? ???? ??????? (??? ext3/4 ??? ????? ????
?? ??? ext2, ??? ?????????). ????? ??????? ????? ???? ???????????? ??? ??????? ?
?????? root-???????. ?????? ???????? ? "grub device" ???????, ?? ???? "(hd*,*)".
????????:
root (hd0,5)
????? ??????? ??????? ??????? ??????? ????? root-?????? ? ??? ???????? ???????.
??????????: "root (hd*,*)" ?? ?????? ????????? ???????????. ????? ??????????????
?? ????????? ???????? "set root" (??. ????)
set[???????]
?????? ????????????? ??????? ??? ????????? ????????? ??????????. ?????? ??? ????
??? ???????? ?????????? ? ???????????? ? ???????
set ??????????=????????
???????? ??????????? ?? ?????????? - ??? ??????? root-???????. ??? ????? ???????
??? ?????????? "root", ? ???????? ???????? ???????? ??????????? ??????, ????????
:
set root=(hd0,5)
(?????? ????? ?????????? ???????????? ? "grub.cfg") ????? ? ?? ??????? ?????, ??
??????, "?? ????" ???????? ???? ?????? ? ???? ? ???????, ??? ????????? ?????????
? ???????? ????? ????? ?????????? ?? ? ???????? ????????. ??? ????? ???????? ???
??????? "color_normal" ? "color_highlight" ??? ???????? ?????? (? ?????? ? ?????
??) ? ??????????? ?????? ??????????????. ????????, ????????? ????? ???????:
set color_normal=magenta/green
set color_highlight=light-blue/black
(????????? ? ?????? ??????? ? ????? II, ?????? "????????? ????? ??????? ????").
search[???????]
???????, ???? ?? ????? ???????? ??????. ??????? "find" ? "uuid" ?? grub-legacy.
?????? ??? ?????? ??????? ?? UUID, ????? ??? ????????? ?????. ????? ????????? ??
???:
-u (??? --fs-uuid) - ????? ??????? ?? UUID;
-l (??? --label) - ????? ?? ????? ???????;
-f (??? --file) - ????? ?? ?????????? ?????;

-n (??? --no-floppy) - ?? ????????? ??????-???????? (???? ?? ??????);


-s (??? --set) - ?????????? ????????? ?????? ? ???????? ???????? ???????? ??????
????.
????? ??? ?????? ???? ? ???, ??? ??? ???????????/?????????? ??????? ?????? (? ?
????????? ?????? ???????) ????????? ?????? ? ???????? ????? "???????", ? ????? ?
??? ??????? "set root=(hd0,5)" ? "grub.cfg" ????? ????? ??? ? ?????? ??? ?? ????
?? ?? ???? ?????. ??????? ? "grub.cfg" ?? ??????? ??????? ? "search". ??? ??????
??????? ? ????????? ??? uuid ???????? "search" ? ?????? -"u":
search -u uuid_???????_???????
??????? ??????? ???, ????? ?????? ????????????? ????????? UUID. ??????, UUID ???
????, ? ???? ??? ? ????? ??????, ??????? ??????? ????? ?????????? ???????? ?????
????????, ? ?????????? ??????? ???? ??????? ??????. ?????? ????? ?? ????????????
? ??????? ?? ?????, ??????? ????? ??????? ?? ?????? ???????. ????????, ?? ???? ?
????? boot-?????? ????? ???????. ?????? ??? ?? ????? "grub.cfg":
search -f /grub/grub.cfg
???????? ????????, ??? ??? ????????????? ?????? ??????? ????????? ???? ?????? ??
????? ?????? ?? ????? ???????! ??????? ???????, ????? ??????? ?????? ?????? ????
?? ? ???????? root-???????, ?? ??????? ????? ??????????????? ?????? "-s". ???? ?
???? ???? ?? ??????? ??????????, ????? ???????????? "root", ?? ???? ????????? ??
???? ??? ??? ? ????? ????? ? ???????? ?????????. ????????, ?????? ? Windows ????
? ????? "C_drive". ????????? ??? ? ???????? ????????? ??? ???????? ? ????:
search -l C_drive -s
? ???????? ??????????? ??????, ??? ???????? ???????, ????? ???????????? ????????
?? ? "grub.cfg" ?????? ? "set root", ???? ?????? ????? ???????? "search ...".
"search ..." ????? ?? ??????? ???? ??????? ???? ?????? ?????????? ??? ????????.
lsfonts[???????]
??? ??????? ????????? ?????? ??????????? ? ????????? ?????? ??????? (??????? ???
???, ??? ???-???? ????? ???????????? ? ?????????? ??????? ? grub2, ????????????
?? ? .pf-?????? ? ??????).
help[???????]
??? ????????????? ? ?????? ???? ??????? ?????? ????????? ??????. ? ???????
help r
??????? ??????? ?? ???? ????????, ???????????? ?? "r".
help search
????????? ??????? ?? ??????? "search".
halt[???????]
???????? ????????? (? ??????) ??? ?????? ??? ? ?????? (? ???? ).
reboot[???????]
???????????? ?????????
background_image[???????]
????????? "?? ????" ???????? ??????? ???????????. ???????????? ? ???????
background_image /????/???_?????
???? ????????????? ??????????? ?????????? ?? ????????? ???????? ? ????????, ????
??? ?????? ????????????. ? ????????? ? ??????? ?????? ????? "set" ???????? ?????
??? ?????? ????????? ?????????? ??????? ??????????. ??? ????????????? ??? ??????
???? ??????? ??????? ??????? ???????????. ??????, ???????? ????? ?????????, ???

??? ???? ? ??? ?????? ???? ?????? - ?? ?????? ???? ?? ??? ?? ???????. ??????????
: ?????? ??????? ?? ??????? ???? ????????? ??????????, ??? ????? ??????? ???? ??
??????? ?????.
vbeinfo[???????]
??????? ?????? ?????????????? ????????????. ???? ???????? ??????? ????? ????????
??????? ????? ?????????? ?????????? ? "/etc/default/grub".
configfile[???????]
??????? ??????????? ??????? ? grub-legacy. ????????? ????????? ?????? ???? ?????
??????? ? ?????? ???? ?????? ???????? "grub.cfg". ?????? ????? ????, ?? ?????? ?
?????? ?????? ???? ? ??????? ???????????, ??????????? ? ????????, ?? ??????????
???????? ????. ???????????? ???:
configfile /????/??????_????_????
???????? ? ????????????? ????? ???? ????? ????? ??????????? ????????.
terminal_output.console[???????]
????????? ????????????? ?? ??????? ?????-????? ???????? ?????. ?????? ??????? ??
? ?????? ? ???????? ? ??? ??????, ???? ? ??? ??????????? ??????? ???????????. ??
?????? ?? ???? - ???, ???????, ???????, ?? ?? ????????? ???????? ???? ????? ????
?? ????? ????? (???? ???????? ?? ????? ??????????). ???????? ??? ???????, ?? ??
?????? ??????????? ????? (????? ????? ?? ?????? ????) ? ??????? ??????? ?????. ?
??? ?? ????? ??????????? ??????? grub2, ????? ????? ???????? ? 40_custom ????? ?
???? ????????, ????????:
menuentry "black&white mode"{
terminal_output.console
}
??????????? ;)[???????]
?? ? ??? ??????? ??????? ???? ? ??????? ????????? ?????? ????????????, ??????? ?
?????? ??? ????????? ?????? ? ???????: ??? ?????????? ?????????????? ?????? (???
? bash) ?? ??????? tab. tab ? ?????? ?????? ??????? ?????? ?????? ????????? ???
???. ??? ????? ?????????????? ????? ????????????? ?????? ?????????????. ???? ??
?? ???????, ????? ?????? ??? ?????, ???????? "root (hd0," (??? "root (hd1." ? ??
??? ?? ??????) ? ??????? tab. ????? ??????? ?????? ???????? ????????? ????? ? ??
??????? ???????? ??????, UUID ? ??????? ?????????? ?????????. ??? ??????? ???? "
(hd*,*)" ????? ???????????? ? ?????? ???? ? ?????, ????????, ??? ???:
cat (hd0,6)/home/username/???????/????
??? ???? ???????? ??????
ls (hd0,3)/
????????? ??????????? ?????????? ????????? ??????? ??? ???????????? root.
???????? ??????? grub2 ?? ????????[???????]
??? ?????????? ? ???? ?????????????, ??? ?????? ??????. ??????????? ? grub2, ???
?????? ? ??????? ???????? "c". ???????? ??????? grub2 ?????????? ?? ?????? "set
root - chainloader - boot". ??? ?????? ??????????? ? ??????, ? MBR ???????? ????
???? grub2, ??????? ?? ?????????? ?????????. ????????? ???????
ls
????? ??????? ?????? ??????? ?????? ? ????????. ????, ? ???????? ???????????? ??
?????? ????? ??????????? (hd0). ? ????? ??????? ?? ???????? ? ?????? ???????? gr
ub2 ?? ??????? ?????. ???? ?????? - (hd0), ?? ??????? ???? ????? (hd1). ????????
?
set root=(hd1)
??? ??

root (hd1)
?? ?????? ?????? ????? ?????????, ??? ???????? ??????? ??????????. ??? ?????????
. ???????? ?????????? ?? ???????
chainloader +1
? ???? ??????? ?? ??????
boot
? ???????? ? ??????? ?????????.
???????? ?????????????? ???? ????????[???????]
? ???? ??????? ?? ?????????? ???????? ????? ??????????? ??????????? ???? ?? ????
? ?????????????. ???? ? ???, ??? ?????? ??? ????????? ??? "grub.cfg" ????? ?????
???? ?????? ???? ????????????. ??? ????????? ??????? ?????????????? ????, ??????
???? ??????
? ??????? ????????, ???????????. ???????????. ??, ??? ???? ???? ? ??
???????? ArchLinux, ????? ???????? ????????? ??????? ? grub ????????????? ?????.
???????? ????? ????? ?? ? ????? ????????????. ????, ???????? ??? ????? ???? ???
?????????. ?????? ? ???? ?? ???, ??????? ??, ?? ?????, ? ???????? ?? ?????? ????
?????? "grub.cfg". ??? ???? ????????? ?????????, ??? ????? ???, ????????:
sudo cp /boot/grub/{grub,custom}.cfg
????????? ???? ??????????? ? ??????? 444, ???????? ??? ????? ?? ??????:
sudo chmod 744 /boot/grub/custom.cfg
?????? ????????? ??? ? ??????? ????????? ????????? ? ???????? ????????. ???? ??
? ??????????? ???? ?????? ????????? "grub.cfg" ? ?????????, ????? ?????? ??? ???
???, ????? ??????????? ????????? ???? ????, ??????? ??????, ? ???????? ??? ? ???
?? ?????????????? ????. ?????? ??, ????? ? ?? ??????? ?????? ??? ??????, ? ?????
??? ???? ???????????? ?????????, ??? ?? ? ?????????. ??? ?????? ?????? ?????? "s
et default=...." (? ???? ??? 13-? ??????). ????? ????? ?????? ????? ???? ?? ????
?????, ?????? ??? ??? ????? ??? ?????? ????????. ????? ?????? ?????? "set gfxmod
e...." (24-? ? ???? ??????). ????? ???????? ?????????? ?????? ? ????????? ??????
? WxH. ????? ????? ??????? ??????? ?????, ???????? "1024x768x32". ????? ???????
????????? ?????????, ??? ???? ???? ?????? ?? ?????? ???? ??????????, ????? ?????
??? ??????, ???? ? ?? ?? ????????? - ?????? ? ?.?. ???????? ????????????? ?????
??????? ? ??? ????????:
set gfxmode=1024x768x32,1024x768x24,1024x768
?????? ??????? ????? ??????????? ????. ??? ????? ???? ?????? "set timeout", ?? ?
????? ??, ??????? ???? ????? "else" (36). ????? ? ???????? ???????? ? ????????.
?????????? -1 ??? ?????????? ???????. ???????? ?????????? ?????? ????. ??? ?????
?? ???????? ??????????? ?????? ?????? ? "if background_image....." (45). (?????
???????????????, ??? ? ????? grub.cfg ???????????? ??????? ???????????. ???? ???
- ???????? ?????? ????? ? ????? ????? ???????). ????? ??????? background_image
???????? ???? ? ????? ????????. ????????? ??? ?? ?????? ???? (???????? ????????,
??? ?????????? ???????? ?????? ??????????????? ????????? ???? ?????????? ??????
!). ??????? ???? ?? ????? ?????? ????? ??????. ???????? ??? ????? ??? ??, ??? ?
? "/etc/grub.d/05_debian_theme" (????????? ? ?????? ??????? ? ????? II, ?????? "
????????? ????? ??????? ????"). ??? ????? ????????? ???? ?????????? ????: ??????
? ?????? ? "set color_highlight" ? "else". ?????? ????????? ????? ?????: color_n
ormal ?????? ????/??? ?????? ?????? ? ????? (?????? grub ? ???????????) ? ??????
? ??????? menu_color_normal ???????? ?? ???? ??????? ???? ? ??? ??????????????,
? ??????? ??? ????????? menu_color_higlight ?????? ????/??? ??????????? ??????
????. ???????? ? ??????????, ???????? ?????????? ? ???????. ???? ???? ?????? ??
?????? "grub.cfg". ???????? ??, ??????? ???????? ? ???????? ?????, ?????????????
? ?? ???? ????. ???? ????? ???????? ?????? ? ??????? ?????????????????? ????? ??
?????? ????????. ???????? ???? ????, ????????? ???. ?????? ??? ????? ???????? ??
????????? ????????? ??? ?????? "grub.cfg". ??? ????? ? ????????? ????? ????? ???
????? ??? ???? ?????, ??? ?? ??????? ????? "/etc/grub.d/40_custom". ??? ????? ??
??? ???????????? ? grub2 ???????????? ??????? "configfile". ?? ?? ? ????????????

?, ??????? ? "40_custom" ?????? ?????? ????:


menuentry "my very custom menu"{
configfile /boot/grub/custom.cfg
}
???? ??? ???? ? ????? ?????????? - ????????? ???. ???? ?? ??????????? ?????????
boot-??????, ???? ????? ?????: "/grub/custom.cfg". ????? ??????, ??? "40_custom"
?????? ????????????? ?????? ???????! ???? ?? ??????, ????? ???? ????? ???? ????
??????? ?????? ???????????? "grub.cfg", ?????????? ????? ????? ? ???????? ??????
?? ?????????. ????? ?????? ?????????? ??????? ??? "grub.cfg" ? 0 (? "/etc/defau
lt/grub"), ?? ????? ???? ?????????? ?????????????? ??????????????? ???? ?? ?????
????????????. ???????? ???? "grub.cfg" ????????
sudo update-grub
?????? ????? ???????? ? ????? ???? ???????? ? ???????. ??? ???? ????? ????? ????
??? ? ?????? ????, ?????????? ?????? escape. ???, ? ????????, ? ??? ???????????.
????? ?????? ?????? ??????????? ???? ???? ?????? ????, ??? ?? ??????? ?? ??????
??????.
?????? ????? "custom.cfg"[???????]
???? ? ??????? ? ???????? ??????? ??, ??? ?????????? ? ???? (???? ?????? ??????
?? ???????????? ????????):
have_grubenv=true
load_env
###
set
###
set
###
set

????????? ????? ?? ?????????


default=0
??????? ????
timeout=2
??????????
gfxmode=800x600x32,800x600x24,800x600

insmod ext2
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else terminal gfxterm; fi
insmod png
### ??????? ???????????
background_image /usr/share/images/grub/yellow.png
### ????????? ??????
set color_normal=black/black
set menu_color_normal=green/light-blue
set menu_color_highlight=red/blue
menuentry "9.10 @ 2.6.32" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.32-020632-generic root=UUID=0e717c2a-24bd-4abe-acfe-ecf9
8fc814f8 ro quiet splash
initrd /boot/initrd.img-2.6.32-020632-generic
}
menuentry "9.10 @ 2.6.32 (recovery)" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.32-020632-generic root=UUID=0e717c2a-24bd-4abe-acfe-ecf9
8fc814f8 ro single
initrd /boot/initrd.img-2.6.32-020632-generic
}
menuentry "windooz"{

search -u AC9C75E59C75AA8A -s
chainloader +1
}
MBR
?????, ?????????????? ? ???????? ????? ?????[???????]
??? ???, ??? ?? ?????, ??????: MBR
???????? ??????? ??????? ???????? ?????, ? ??
?????, ? ??? ?????, ???????? ???, ??????????? ?????????. ??? ???????? ? ????? ??
???? ??????????? ?????????? ? ???, ??? ????????? ?????????. grub2 ??????????? ??
?? ??? ? MBR ??? ????????? (? ??? ?? ?? ??????, ???????? grub-install
/dev/sda). ?
? ?????? ??????????? MBR (??????? ?????? ???????) ? ??? ??????????? ???????? ???
??????????? ????????????????? grub2 ??????? ????? ????? ????????? ????? MBR ????
???? ?????. ????? ??????? ??, ??????? ????? ????????????, ? ?????? ?? ??????? ??
???? ???????????? ???????? (????? ?????????? ? ??????? sudo fdisk -l). ????? ?????
????????? ?????? ?????? (?????? 512 ????) ????? ? ???? ? ??????? ??????? dd:
sudo dd if=/dev/sda of=mbr.bin bs=512 count=1
???? ??? ??????????? ????
?? sda, ????????? ???????? ?? ???? (?? ????? ????, ???
?????????? ???????? ?????? 446 ????, ? ?????? ???????? ??????? ????????, ?? ???
???????? ?????? ?????? ?? ?????? ???? ?? ?????? 512 ????). ??? ????? ?????! ???
??? ????????? ? ???? mbr.bin ? ????? ???????? ??????????. ????????? ?????????? ???
??, ????? ????????? ???????? grub2 ??-??? ??????? ??? ???????????? MBR ?????. ??
?? ? ??? ???? ?????? ????????????? linux-??????? ? grub2 ?? ?????? ??????? ?????
??? ??????????? ?????? ? grub2 (???????? ??????? ??????? ????)
?????? ?????????
?? ?? ???????? ??????????????? ?????. ????, ? ???? ??????? ? ?????????? ?? ?????
???????????? ?????? ? grub2, ?? ??????? ? ?????????????? ??????? ????? MBR ????
?? ???????? ?????. ???????????? ? grub2, ??????? ? ??????? (????? c). ????????? ?
???????? ????????? ??????? ??? ??????? ????, ?? ??????? ?? ???????? ???????? MBR
, ? ? ???????? ?? ????? ????????? grub2. ????? ??????? ??? ???? ??? ????? ?? ???
????????, ???????? ???:
set root=(hd1)
???????? ????????? ????????
root
???? ??? ????? ????????? ??? ????? ? ??????? chainloader. ????? ????? ??????? ??
???? ????, ??????? ? ???????, ?? ??????? ????? ??? ????. ??????, ? ??????? ? ???
????? ????????? (hd0), ??? ??? ??????? ????? ????????? ???:
chainloader (hd0,1)/mbr.bin
???? ??? ????
???? ??????? ?? ??????:
boot
? ???????????? ?????? grub2.
??????????: ? MBR (?, ??????????????, ? ?????????? ??????) ??? ??????? ????????
???????? ?????, ??????? ????? ??? ????? ?????????? grub2 ? ???? ???????, ???????
??? ?????? ? ???????? ????????? (root) ? ??????? grub2. ???????? ?????? ???????
, ?? ????? ???????????? ??-??? ??? MBR ?????. ?? ???? ??????? grub2 ? ??? ??? ??
??? ???, ??????????? ?? ????? ? LiveCD.
???????? ? LiveCD ????? linux-??????? (? ?????? ?????? ????????? grub2 ???? ?? ?
?????). ??? ?????????????? MBR ??? ????? ????? ????????? ????? ????????? ????? ???
???? ? ?????? ?????? ?????. ?? ??? ?????? ???????? ??????? ????????, ???? ??????
????????, ??? grub2 ?? ???????? ? ??-?? ???. ??? ????? ?????????
sudo fdisk -l
???? fdisk ????? ??????? - ??????? ???????? ??????? ?? ?????, ? ??????????? ????
?? ??? ??????????. ? ???? ?????? ??? ????? ???????????? ???? ?????? 446 ????. ??
?? ?? "?????" ? ??????? ???????? - ??? 512. ?????????????, ??? ?????? ?? ??????,
???????? ?????? ?????????? ???? ?? ?????? ? ?????? ?????? ?????. ? ??????? ????
??????? ???????? ? ???????, ??????????????? ?????? grub2:
sudo dd if=/mnt/mbr.bin of=/dev/sda bs=446 count=1

???? ????? ???????????? ? ??????? ????????


??????? 512 ?????? 446. ? ???????? ??
?????? if ????????? ???? ? ????? ??????, ? of
??? ????, ??????????? ?????? ?????
??? ?? ???????????????. ???? ??? ?????? ??????? ???????????????, ???????? ? ????
??????? ????? ? ????????.
??? ???? ???????? ??????????? ?????????? ????? ????? ???????????? ??? ???????? g
rub2 ????? NTLDR (? ??????, ???? grub2 ?? ????????? ????????? Windows, ? ?? ????
?? ??????? NTLDR ???????? ???????????). ?? ?? ???? ???-?????? ?????.
???????? LiveCD ? GRUB2[???????]
? ??????, ???? ??? ????????? ?? ???????????? ???????? ? usb, ????? ??????? cd-??
?? ? grub2, ????? ??????? ????? ????? ????????? ???? ??????? ??? ????????????? ?
???????? grub2. ??? ?????? ???????? ? ??????? ????? ???????, ? ??????? ????? ???
????? ??? ????, ? ? ??? ????????? ???????? "/boot" ? "/boot/grub":
mkdir -p tmp/iso/boot/grub
?????? ????? ?? ??????????? ? ???????????. ???? ??? ????? ??????? ?????-????? ??
????????? ???? - ????????? ???????? ????? ??????????. ???? ?? ?? ?????? ????????
???? ? ????????????? ???????????, ????? ?????? ?????????? ?????? ? ???? ?? ????
??? ??????? ???????????? - ??? ????? ????? ???????? ?? ???? ?????, ??????? ?????
??????? ??? ??????????? ???????????? ????. ????????? ???:
cp /usr/share/grub/unicode.pf2 tmp/iso/boot/grub
?????? ??? ????? ???????? ???? ???????????? "grub.cfg", ?????????? ??????????? ?
??? ? ?????????. ?? ?????? ????? ?? ?????? ??? "/boot/grub/grub.cfg" ? ????????
??? ??? ??????? ?????, ? ?????? ???????? ??? ? ???? - ??? ???????? ???????? ????
?? ????????? ????????? "grub.cfg". ? ????????? ?????? ?? ?????? ????? ??????? ?
?????, ?????????? ? ????? ????? ??????? ? ??????????????? ???. ??? ??? ??, ??? ?
????? "???? ???????" - ????????? ? ???????? ???????????? "grub.cfg" ?? ?????? ??
?????? ????, ? ??????? "???????? ?????????????? ???? ????????". ????? ?? ????? ?
??? ????????? ??????????? ??? LiveCD ????. ???? ?? ?????? ?? ?????? "/boot/grub/
grub.cfg" - ??????? ?? ???? ??????, ???????? ??? ???-?????? ??????? ? ???????? r
oot ("search.... uuid_???????...."). ???????? ???????? ?????? ???? cd-????! ????
?? ??????? ??????? ? ??????????? ???? - ????? ??????????? ?????????? ??????????
??? ????? ?????. ????? ????, ???????, ??????????, ???????? ??????????? ?????. ??
? ????? ???????? ????? ??????:
loadfont /boot/grub/unicode.pf2
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else terminal gfxterm; fi
? ??? ???? ????? ?????? ??????: ? ?????? ????? ?????? ??????? ????? ??????: insm
od part_msdos ???????? ??????? ?????? ???????????! ??? ???? ?????????? grub2 ???
??? ?????? ??????? ????, ?? ?? ?????? ??????? ???????? ?? ???, ? ????? LiveCD ??
??? ??????????. ??? ????????? ??????/?????????? ? ????? ??????? ??????? ? ??????
???????? ???????. ? ?????? ?? ???????? ? ???????? ?????? ????. ?? ?????? ???????
???? ?????? ?????? ?? "/boot/grub/grub.cfg", ?? ? ?????????? ???????? ?? ? ????,
??? ??? ?????????? ?????? ???????? ??????? ??????????? ???????? ??????????????
???????. ? ???????? ?? ????????, ??? Linux-??????? ????? ???? ?????? ????? ?????
???:
menuentry "9.10 @ 2.6.32" {
search -u uuid_??????? -s
linux /boot/vmlinuz-xxxxxxx root=/dev/sdXY quiet splash single ???_???_???_???
initrd /boot/initrd.img-xxxxxx
}
? ???????? uuid ????? ?????? ??? ??????, ??? ????????? ??? /boot (???? ? ??? ???
?? / - ?????? ???, ???? ????????? /boot-?????? - ?????? ??? ? ?????????, ? ?? /.
? ?????? ? ????????? /boot ???? ????? ????????? ??? "/vmlinuz...." ? "/initrd..
..") ??? Windows ????? ???-?? ?????:

menuentry "winxp" {
sear?h -u uuid_???????_?_win -s
chainloader +1
}
???????? ? ??????, ????????? ??? ??? "grub.cfg" ? ??????? ???????? (? ???? ?????
? - "~/tmp/iso/boot/grub/grub.cfg"). ?????? ?? ?????? ? ???????? iso-?????? ????
?? LiveCD. ? ???? ??? ??????? ??????? grub-mkrescue. ??????? ????? ????????? ???
:
grub-mkrescue --overlay=tmp/iso/ tmp/grub.iso
?????? "tmp/iso" ??????? ???? ???????, ? ?????? "tmp/grub.iso" - ????, ???? ????
????? ?????????? iso-?????. ???? ??? ??????? - ???????? ?? ?????? ????? ????????
? iso-???? (~2.8M), ????????? ??? ?? rw-??? ? ??????? ?????????!
?????? ????? "grub.cfg"[???????]
??? ? ??????, ??????? ?????? ????? "grub.cfg", ????????? ??????????? ?? LiveCD ?
?????????????:
### ?????? ???????? ??????? iso9660 (cd-????)
insmod iso9660
### ?????? ??? ????????????? ??????? ???????? ???????? ?????! must have!!
insmod part_msdos
###
set
###
set
###
set

????????? ????? ?? ?????????


default=0
??????? ????
timeout=2
??????????
gfxmode=800x600x32,800x600x24,800x600

### ?????? ???????? ??????? ext2/3/4


insmod ext2
### ????????? ????? ? ???????? ??????????? ????
loadfont /boot/grub/unicode.pf2
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else terminal gfxterm; fi
###
set
set
set

????????? ??????
color_normal=white/black
menu_color_normal=green/black
menu_color_highlight=light-blue/black

#0
menuentry "9.10 @ 2.6.33rc1" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.33-020633rc1-generic root=UUID=0e717c2a-24bd-4abe-acfe-e
cf98fc814f8 ro quiet splash
initrd /boot/initrd.img-2.6.33-020633rc1-generic
}
#1
menuentry "9.10 @ 2.6.33rc1 (recovery)" {
search -u 0e717c2a-24bd-4abe-acfe-ecf98fc814f8 -s
linux /boot/vmlinuz-2.6.33-020633rc1-generic root=UUID=0e717c2a-24bd-4abe-acfe-e
cf98fc814f8 ro single
initrd /boot/initrd.img-2.6.33-020633rc1-generic
}
#2
menuentry "windooz"{
search -u AC9C75E59C75AA8A -s

chainloader +1
}
menuentry "ubuntu-11.04.iso" {
loopback loop (hd0,2)/ubuntu-11.04.iso
linux (loop)/install/vmlinuz boot=install iso-scan/filename=/ubuntu-11.04.iso
initrd (loop)/install/initrd.gz
}
menuentry "linuxmint-12-kde-dvd-64bit.iso" {
search -l FAT -s
#set root=(hd0,msdos1)
loopback loop /linuxmint-12-kde-dvd-64bit.iso
linux (loop)/casper/vmlinuz file=(loop)/preseed/mint.seed boot=casper iso-scan
/filename=/linuxmint-12-kde-dvd-64bit.iso quiet splash -initrd (loop)/casper/initrd.lz
}
menuentry "ubuntu-12.04-beta2-desktop-i386.iso" {
search -l FAT -s
#set root=(hd0,msdos1)
loopback loop /ubuntu-12.04-beta2-desktop-i386.iso
linux (loop)/casper/vmlinuz file=(loop)/preseed/ubuntu.seed boot=casper iso-sc
an/filename=/ubuntu-12.04-beta2-desktop-i386.iso quiet splash -initrd (loop)/casper/initrd.lz
}
menuentry "ubuntu live-dvd" {
loopback loop (hd0,2)/ubuntudvd.iso
linux (loop)/install/vmlinuz boot=install iso-scan/filename=/ubuntudvd.iso
initrd (loop)/install/initrd.gz
}
menuentry "Mint live-cd" {
loopback loop (hd0,2)/mint.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/mint.iso
initrd (loop)/casper/initrd.gz
}
menuentry "pmagic-4.10.iso" {
loopback loop (hd0,2)/pmagic-4.10.iso
linux (loop)/pmagic/bzImage boot=casper iso-scan/filename=/pmagic-4.10.iso
initrd (loop)/pmagic/initramfs
}
menuentry "Plop.bin" {
root (hd0,2)
linux16 (hd0,2)/boot/grub/plpbt.bin
}
menuentry "Plop.com" {
root (hd0,2)
linux16 (hd0,2)/boot/grub/plpinstc.com
}
menuentry "ubuntu-11.10-desktop-i386.iso" {
loopback loop /boot/iso/ubuntu-11.10-desktop-i386.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-11.10
-desktop-i386.iso noeject noprompt -initrd (loop)/casper/initrd.lz

}
menuentry "linuxmint-12-gnome-dvd-32bit.iso" {
loopback loop /boot/iso/linuxmint-12-gnome-dvd-32bit.iso
linux (loop)/casper/vmlinuz file=(loop)/preseed/mint.seed boot=casper iso-scan
/filename=/boot/iso/linuxmint-12-gnome-dvd-32bit.iso quiet splash -initrd (loop)/casper/initrd.lz
}
menuentry "Lucid ISO" {
loopback loop (hd0,1)/boot/iso/ubuntu-10.04-desktop-i386.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-10.04-desk
top-i386.iso noprompt noeject
initrd (loop)/casper/initrd.lz
}
menuentry "ubuntu-9.10-desktop-amd64.iso" {
loopback loop (hd0,1)/boot/iso/ubuntu-9.10-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-9.10-deskt
op-amd64.iso noprompt quiet splash
initrd (loop)/casper/initrd.lz
}
menuentry "gparted-live-0.6.1-2.iso" {
loopback loop (hd0,1)/boot/iso/gparted-live-0.6.1-2.iso
linux (loop)/live/vmlinuz boot=live union=aufs noswap noprompt ip=frommedia find
iso=/boot/iso/gparted-live-0.6.1-2.iso toram=filesystem.squashfs
initrd (loop)/live/initrd.img
}
menuentry "systemrescuecd-x86-1.5.8.iso" {
loopback loop (hd0,1)/boot/iso/systemrescuecd-x86-1.5.8.iso
linux (loop)/isolinux/rescue64 setkmap=us isoloop=/systemrescuecd-x86-1.5.8.iso
initrd (loop)/isolinux/initram.igz
}
menuentry "pmagic-5.2.iso" {
loopback loop (hd0,1)/boot/iso/pmagic-5.2.iso
linux (loop)/pmagic/bzImage iso_filename=/boot/iso/pmagic-5.2.iso boot=live load
_ramdisk=1 prompt_ramdisk=0 noeject noprompt
initrd (loop)/pmagic/initramfs
}
menuentry "Boot IMG - Seagate Tools" {
linux16 /memdisk bigraw
initrd16 /SeaTools.img
}
# Live Gparted ??????? ?????????, ?????? ?????????? ???? ? ?????????? ??? ?? ???
??? (?????????? live)
menuentry "Gparted" {
linux /live/vmlinuz boot=live config noswap ip=frommedia nosplash -initrd /live/initrd.img
}
#? ???? ?? LiveCD, ? ???-?? ???????? ???????????
menuentry "debian-6.0.3-amd64-netinst.iso" {
loopback loop /boot/iso/debian-6.0.3-amd64-netinst.iso
linux (loop)/install.amd/vmlinuz vga=normal -initrd (loop)/install.amd/initrd.gz

}
menuentry "debian installer amd64 netboot" {
linux /boot/debian/linux auto preseed/url=http://www.panticz.de/pxe/preseed/xen.
seed locale=en_US console-setup/layoutcode=de netcfg/choose_interface=eth0 debco
nf/priority=critical -initrd /boot/debian/initrd.gz
}
# ? "?????????" ?????? ? alternate ??????? ????????? (? ???? ? ?????) ??????????
. ??? ??? ????????? ?????? ??? "alternate":
menuentry "Xubuntu 12.04 64 bit" {
loopback loop /xubuntu-12.04-alternate-amd64.iso
linux (loop)/install/vmlinuz iso-scan/filename=/xubuntu-12.04-alternate-amd64
.iso vga=normal noeject noprompt nosplash -initrd (loop)/install/initrd.gz
#FreeDOS - ??????????????? ????????!
menuentry "FreeDOS 1.0" {
loopback loop /boot/iso/fdbasews.iso
linux16 (loop)/isolinux/data/memdisk
initrd16 (loop)/isolinux/data/fdboot.img
}
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
???????? LiveCD ? GRUB2 ?? ???? ?????????? ????????????[???????]
(?? ???? ??????? ???. komix)
????????? ??????? ????? ???????? ???? ?????? iso-????? ? grub2 ? 3 ????????? ???
? ?? ?????, ????? ?????????? ???????? ? ????????, ? ??????: LiveCD ? grub2 ? ???
????????? ???? ?????-?????? ???????. ???????? ?? ????? ?? ????, ??? ??????? iso
??????? LiveCD, ? ???????? ?? ????? ?????????? grub2. ??????? ???????? ????? ? ?
???? ?????????? ?????????? ? ?????????? ??????. ?????? ????? ???????? ???????, ?
??????? ????? ???????? ??? ????? ????. ? ??? ?? ???????? ??????? /boot/grub ? ?
??????, ? ??????? ????? ???????? ????? ????? live-??????? (? ?????? ?? live):
mkdir -p tmp/iso/{boot/grub,live}
?????? ??? ????? ?????????????? iso-????? ????? ??????? ? ?????????????? ???????
??? ???:
sudo mount -o loop downloads/some-live-system.iso tmp/iso/live
?????? ???????? "grub.cfg", ??? ??? ??????? ? ?????????? ?????? (?? ???????? ???
???????? ???? ??????, ???? ?????? ???????????? ??????????? ????). ????? ??? ????
?????? ?????????????? ???????, ?? ? ??? ???? ????????, ??? ? ???? ?? ??????? ???
?? ??? ???????? ????? live-???????. ??? ?????? ????? ????????? "????? ????"? ??
???? ?????? ??? ?????????????? ??????. ?????? ??? ?????, ??????????? ? ?????????
? ???????????? ?????????? (?????? ??? isolinux ??? ?? ?????? grub - ? ????? ????
??? ?????? ?????? ????????). ??????? ?????????? ?????? ??? ????-???????????? Par
ted Magic:
menuentry "Parted Magic" {
linux /live/bzImage
initrd /live/initramfs
}

? ?????? ?????? ????? ????? ??????????. ??? ?????? ?????? ????? ????????????? ??
???????????? ????????? ???????? ????. ???? ?? ????? ?????? ? "/live/boot" ??? ?
?????? ???????? ? ??????????? ?? ??????????? ????????????. ???????? ???????? ??
??, ??? ????? ?? ???????????? ?????? ???? "set root..." ??? "search...". ???? ??
??????? ?????????? "grub.cfg", ?? ???????? ???????? ??? ???????? ??????????????
? cdrom, ??????? ??? ????? ??? ???????? ????????. ????? ????, ??? "grub.cfg" ???
??, ????? ?????????? ? ???????? iso-??????:
sudo grub-mkrescue --overlay=tmp/iso tmp/my-live-system-grub2.iso
????????????????? ???????? ??????? ?? ??????? ????????????? ????????????. ?? ???
?????? ???????? ??????????????? iso-????? ? ???????????? ????????????? ? ???????
? ???? grub2. ??????????? ???????????? iso:
sudo umount tmp/iso/live
? ????????? ????? iso-???? ?? ????????. ???????? ? ????????? ?????????.

?????????? ? ???? ?????? ???????? ? CD/DVD & USB[???????]


?????????? ????????????? GRUB ??????????? ? CD-ROM/USB ?? ?????????, ?? "??? ??
??? ?????? ?????". ?????????? ????????????????, ?? ????? ???????????????????, ??
? GRUB, ??, ????, ??????? ??????? ??????? ? CD-ROM/USB, ???? ???? BIOS ????? ???
???????? ?? ?????????????.
?????? 1. ???????? ? CD & USB ??????????? Plop Boot Manager[???????]
???? ???????? ????? ?????????????? ??????????? Plop Boot Manager. ??? ????? ????
?? ????? Plop'?, ?????? ????????? ???? plpbt.bin, ? ?????? ??? ? ??????? /boot/
????? ???????. ????? ????????? ???? /etc/grub.d/40_custom:
nano /etc/grub.d/40_custom
? ????????? ? ???? ????????? ??????? (??? ????????? ?????? - (hd0,1)):
menuentry "Boot CD/DVD & USB -> Plop Boot Manager" {
set root=(hd0,1)
linux16 /boot/plpbt.bin
}
????? ????????? grub.cfg:
sudo update-grub
???????????????, ??????? ?????????.
?????? 2. ???????? ? CD ??????????? Smart Boot Manager[???????]
? ???? ?????? ???????? ????? ?????????????? ??????????? Smart Boot Manager. ????
, ?????? ??? ???????: memdisk.bin - "?????????" ?????? ?? ?????? ?????? ?????? s
yslinux ? sbootmgr.dsk - ????? ??????????? ??????? ?? Smart Boot Manager. ??????
??? ??????? ? ??????? /boot/ ????? ???????. ????? ????????? ???? /etc/grub.d/40
_custom:
nano /etc/grub.d/40_custom
? ????????? ? ???? ????????? ??????? (??? ????????? ?????? - (hd0,1)):
menuentry "Boot CD/DVD" {
set root=(hd0,1)
linux16 /boot/memdisk.bin
initrd16 /boot/sbootmgr.dsk
}
????? ????????? grub.cfg:
sudo update-grub
???????????????, ??????? ?????????.

Potrebbero piacerti anche