1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
|
This is grub.info, produced by makeinfo version 4.0 from grub.texi.
INFO-DIR-SECTION Kernel
START-INFO-DIR-ENTRY
* GRUB: (grub). The GRand Unified Bootloader
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password
in MD5 format
* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo
command from a
terminfo name
* grub-set-default: (grub)Invoking grub-set-default. Set a default boot
entry
* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel
END-INFO-DIR-ENTRY
Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the entire resulting derived work is distributed under the terms
of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions.
File: grub.info, Node: Diskless, Prev: General usage of network support, Up: Network
Booting from a network
======================
It is sometimes very useful to boot from a network, especially when
you use a machine which has no local disk. In this case, you need to
obtain a kind of Net Boot ROM, such as a PXE ROM or a free software
package like Etherboot. Such a Boot ROM first boots the machine, sets
up the network card installed into the machine, and downloads a second
stage boot image from the network. Then, the second image will try to
boot an operating system actually from the network.
GRUB provides two second stage images, `nbgrub' and `pxegrub' (*note
Images::). These images are the same as the normal Stage 2, except that
they set up a network automatically, and try to load a configuration
file from the network, if specified. The usage is very simple: If the
machine has a PXE ROM, use `pxegrub'. If the machine has an NBI loader
such as Etherboot, use `nbgrub'. There is no difference between them
except their formats. Since the way to load a second stage image you
want to use should be described in the manual on your Net Boot ROM,
please refer to the manual, for more information.
However, there is one thing specific to GRUB. Namely, how to specify
a configuration file in a BOOTP/DHCP server. For now, GRUB uses the tag
`150', to get the name of a configuration file. The following is an
example with a BOOTP configuration:
.allhost:hd=/tmp:bf=null:\
:ds=145.71.35.1 145.71.32.1:\
:sm=255.255.254.0:\
:gw=145.71.35.1:\
:sa=145.71.35.5:
foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\
:bf=/nbgrub:\
:tc=.allhost:\
:T150="(nd)/tftpboot/menu.lst.foo":
Note that you should specify the drive name `(nd)' in the name of
the configuration file. This is because you might change the root drive
before downloading the configuration from the TFTP server when the
preset menu feature is used (*note Preset Menu::).
See the manual of your BOOTP/DHCP server for more information. The
exact syntax should differ a little from the example.
File: grub.info, Node: Serial terminal, Next: Preset Menu, Prev: Network, Up: Top
Using GRUB via a serial line
****************************
This chapter describes how to use the serial terminal support in
GRUB.
If you have many computers or computers with no display/keyboard, it
could be very useful to control the computers through serial
communications. To connect one computer with another via a serial line,
you need to prepare a null-modem (cross) serial cable, and you may need
to have multiport serial boards, if your computer doesn't have extra
serial ports. In addition, a terminal emulator is also required, such as
minicom. Refer to a manual of your operating system, for more
information.
As for GRUB, the instruction to set up a serial terminal is quite
simple. First of all, make sure that you haven't specified the option
`--disable-serial' to the configure script when you built your GRUB
images. If you get them in binary form, probably they have serial
terminal support already.
Then, initialize your serial terminal after GRUB starts up. Here is
an example:
grub> serial --unit=0 --speed=9600
grub> terminal serial
The command `serial' initializes the serial unit 0 with the speed
9600bps. The serial unit 0 is usually called `COM1', so, if you want to
use COM2, you must specify `--unit=1' instead. This command accepts
many other options, so please refer to *Note serial::, for more details.
The command `terminal' (*note terminal::) chooses which type of
terminal you want to use. In the case above, the terminal will be a
serial terminal, but you can also pass `console' to the command, as
`terminal serial console'. In this case, a terminal in which you press
any key will be selected as a GRUB terminal.
However, note that GRUB assumes that your terminal emulator is
compatible with VT100 by default. This is true for most terminal
emulators nowadays, but you should pass the option `--dumb' to the
command if your terminal emulator is not VT100-compatible or implements
few VT100 escape sequences. If you specify this option then GRUB
provides you with an alternative menu interface, because the normal
menu requires several fancy features of your terminal.
File: grub.info, Node: Preset Menu, Next: Security, Prev: Serial terminal, Up: Top
Embedding a configuration file into GRUB
****************************************
GRUB supports a "preset menu" which is to be always loaded before
starting. The preset menu feature is useful, for example, when your
computer has no console but a serial cable. In this case, it is
critical to set up the serial terminal as soon as possible, since you
cannot see any message until the serial terminal begins to work. So it
is good to run the commands `serial' (*note serial::) and `terminal'
(*note terminal::) before anything else at the start-up time.
How the preset menu works is slightly complicated:
1. GRUB checks if the preset menu feature is used, and loads the
preset menu, if available. This includes running commands and
reading boot entries, like an ordinary configuration file.
2. GRUB checks if the configuration file is available. Note that this
check is performed *regardless of the existence of the preset
menu*. The configuration file is loaded even if the preset menu was
loaded.
3. If the preset menu includes any boot entries, they are cleared when
the configuration file is loaded. It doesn't matter whether the
configuration file has any entries or no entry. The boot entries
in the preset menu are used only when GRUB fails in loading the
configuration file.
To enable the preset menu feature, you must rebuild GRUB specifying a
file to the configure script with the option `--enable-preset-menu'.
The file has the same semantics as normal configuration files (*note
Configuration::).
Another point you should take care is that the diskless support
(*note Diskless::) diverts the preset menu. Diskless images embed a
preset menu to execute the command `bootp' (*note bootp::)
automatically, unless you specify your own preset menu to the configure
script. This means that you must put commands to initialize a network in
the preset menu yourself, because diskless images don't set it up
implicitly, when you use the preset menu explicitly.
Therefore, a typical preset menu used with diskless support would be
like this:
# Set up the serial terminal, first of all.
serial --unit=0 --speed=19200
terminal --timeout=0 serial
# Initialize the network.
dhcp
File: grub.info, Node: Security, Next: Images, Prev: Preset Menu, Up: Top
Protecting your computer from cracking
**************************************
You may be interested in how to prevent ordinary users from doing
whatever they like, if you share your computer with other people. So
this chapter describes how to improve the security of GRUB.
One thing which could be a security hole is that the user can do too
many things with GRUB, because GRUB allows one to modify its
configuration and run arbitrary commands at run-time. For example, the
user can even read `/etc/passwd' in the command-line interface by the
command `cat' (*note cat::). So it is necessary to disable all the
interactive operations.
Thus, GRUB provides a "password" feature, so that only administrators
can start the interactive operations (i.e. editing menu entries and
entering the command-line interface). To use this feature, you need to
run the command `password' in your configuration file (*note
password::), like this:
password --md5 PASSWORD
If this is specified, GRUB disallows any interactive control, until
you press the key <p> and enter a correct password. The option `--md5'
tells GRUB that `PASSWORD' is in MD5 format. If it is omitted, GRUB
assumes the `PASSWORD' is in clear text.
You can encrypt your password with the command `md5crypt' (*note
md5crypt::). For example, run the grub shell (*note Invoking the grub
shell::), and enter your password:
grub> md5crypt
Password: **********
Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb.
Then, cut and paste the encrypted password to your configuration
file.
Also, you can specify an optional argument to `password'. See this
example:
password PASSWORD /boot/grub/menu-admin.lst
In this case, GRUB will load `/boot/grub/menu-admin.lst' as a
configuration file when you enter the valid password.
Another thing which may be dangerous is that any user can choose any
menu entry. Usually, this wouldn't be problematic, but you might want to
permit only administrators to run some of your menu entries, such as an
entry for booting an insecure OS like DOS.
GRUB provides the command `lock' (*note lock::). This command always
fails until you enter the valid password, so you can use it, like this:
title Boot DOS
lock
rootnoverify (hd0,1)
makeactive
chainload +1
You should insert `lock' right after `title', because any user can
execute commands in an entry until GRUB encounters `lock'.
You can also use the command `password' instead of `lock'. In this
case the boot process will ask for the password and stop if it was
entered incorrectly. Since the `password' takes its own PASSWORD
argument this is useful if you want different passwords for different
entries.
File: grub.info, Node: Images, Next: Filesystem, Prev: Security, Up: Top
GRUB image files
****************
GRUB consists of several images: two essential stages, optional
stages called "Stage 1.5", one image for bootable CD-ROM, and two
network boot images. Here is a short overview of them. *Note
Internals::, for more details.
`stage1'
This is an essential image used for booting up GRUB. Usually, this
is embedded in an MBR or the boot sector of a partition. Because a
PC boot sector is 512 bytes, the size of this image is exactly 512
bytes.
All `stage1' must do is to load Stage 2 or Stage 1.5 from a local
disk. Because of the size restriction, `stage1' encodes the
location of Stage 2 (or Stage 1.5) in a block list format, so it
never understand any filesystem structure.
`stage2'
This is the core image of GRUB. It does everything but booting up
itself. Usually, this is put in a filesystem, but that is not
required.
`e2fs_stage1_5'
`fat_stage1_5'
`ffs_stage1_5'
`jfs_stage1_5'
`minix_stage1_5'
`reiserfs_stage1_5'
`vstafs_stage1_5'
`xfs_stage1_5'
These are called "Stage 1.5", because they serve as a bridge
between `stage1' and `stage2', that is to say, Stage 1.5 is loaded
by Stage 1 and Stage 1.5 loads Stage 2. The difference between
`stage1' and `*_stage1_5' is that the former doesn't understand
any filesystem while the latter understands one filesystem (e.g.
`e2fs_stage1_5' understands ext2fs). So you can move the Stage 2
image to another location safely, even after GRUB has been
installed.
While Stage 2 cannot generally be embedded in a fixed area as the
size is so large, Stage 1.5 can be installed into the area right
after an MBR, or the boot loader area of a ReiserFS or a FFS.
`stage2_eltorito'
This is a boot image for CD-ROMs using the "no emulation mode" in
El Torito specification. This is identical to Stage 2, except that
this boots up without Stage 1 and sets up a special drive `(cd)'.
`nbgrub'
This is a network boot image for the Network Image Proposal used
by some network boot loaders, such as Etherboot. This is mostly
the same as Stage 2, but it also sets up a network and loads a
configuration file from the network.
`pxegrub'
This is another network boot image for the Preboot Execution
Environment used by several Netboot ROMs. This is identical to
`nbgrub', except for the format.
File: grub.info, Node: Filesystem, Next: Interface, Prev: Images, Up: Top
Filesystem syntax and semantics
*******************************
GRUB uses a special syntax for specifying disk drives which can be
accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
device is equivalent to which OS device. Normally, that will be clear if
you see the files in a device or use the command `find' (*note find::).
* Menu:
* Device syntax:: How to specify devices
* File name syntax:: How to specify files
* Block list syntax:: How to specify block lists
File: grub.info, Node: Device syntax, Next: File name syntax, Up: Filesystem
How to specify devices
======================
The device syntax is like this:
`(DEVICE[,PART-NUM][,BSD-SUBPART-LETTER])'
`[]' means the parameter is optional. DEVICE should be either `fd'
or `hd' followed by a digit, like `fd0'. But you can also set DEVICE
to a hexadecimal or a decimal number which is a BIOS drive number, so
the following are equivalent:
(hd0)
(0x80)
(128)
PART-NUM represents the partition number of DEVICE, starting from
zero for primary partitions and from four for extended partitions, and
BSD-SUBPART-LETTER represents the BSD disklabel subpartition, such as
`a' or `e'.
A shortcut for specifying BSD subpartitions is
`(DEVICE,BSD-SUBPART-LETTER)', in this case, GRUB searches for the
first PC partition containing a BSD disklabel, then finds the
subpartition BSD-SUBPART-LETTER. Here is an example:
(hd0,a)
The syntax `(hd0)' represents using the entire disk (or the MBR when
installing GRUB), while the syntax `(hd0,0)' represents using the first
partition of the disk (or the boot sector of the partition when
installing GRUB).
If you enabled the network support, the special drive, `(nd)', is
also available. Before using the network drive, you must initialize the
network. *Note Network::, for more information.
If you boot GRUB from a CD-ROM, `(cd)' is available. *Note Making a
GRUB bootable CD-ROM::, for details.
File: grub.info, Node: File name syntax, Next: Block list syntax, Prev: Device syntax, Up: Filesystem
How to specify files
====================
There are two ways to specify files, by "absolute file name" and by
"block list".
An absolute file name resembles a Unix absolute file name, using `/'
for the directory separator (not `\' as in DOS). One example is
`(hd0,0)/boot/grub/menu.lst'. This means the file `/boot/grub/menu.lst'
in the first partition of the first hard disk. If you omit the device
name in an absolute file name, GRUB uses GRUB's "root device"
implicitly. So if you set the root device to, say, `(hd1,0)' by the
command `root' (*note root::), then `/boot/kernel' is the same as
`(hd1,0)/boot/kernel'.
File: grub.info, Node: Block list syntax, Prev: File name syntax, Up: Filesystem
How to specify block lists
==========================
A block list is used for specifying a file that doesn't appear in the
filesystem, like a chainloader. The syntax is
`[OFFSET]+LENGTH[,[OFFSET]+LENGTH]...'. Here is an example:
`0+100,200+1,300+300'
This represents that GRUB should read blocks 0 through 99, block 200,
and blocks 300 through 599. If you omit an offset, then GRUB assumes
the offset is zero.
Like the file name syntax (*note File name syntax::), if a blocklist
does not contain a device name, then GRUB uses GRUB's "root device". So
`(hd0,1)+1' is the same as `+1' when the root device is `(hd0,1)'.
File: grub.info, Node: Interface, Next: Commands, Prev: Filesystem, Up: Top
GRUB's user interface
*********************
GRUB has both a simple menu interface for choosing preset entries
from a configuration file, and a highly flexible command-line for
performing any desired combination of boot commands.
GRUB looks for its configuration file as soon as it is loaded. If one
is found, then the full menu interface is activated using whatever
entries were found in the file. If you choose the "command-line" menu
option, or if the configuration file was not found, then GRUB drops to
the command-line interface.
* Menu:
* Command-line interface:: The flexible command-line interface
* Menu interface:: The simple menu interface
* Menu entry editor:: Editing a menu entry
* Hidden menu interface:: The hidden menu interface
File: grub.info, Node: Command-line interface, Next: Menu interface, Up: Interface
The flexible command-line interface
===================================
The command-line interface provides a prompt and after it an editable
text area much like a command-line in Unix or DOS. Each command is
immediately executed after it is entered(1) (*note Command-line
interface-Footnote-1::). The commands (*note Command-line and menu
entry commands::) are a subset of those available in the configuration
file, used with exactly the same syntax.
Cursor movement and editing of the text on the line can be done via a
subset of the functions available in the Bash shell:
<C-f>
<PC right key>
Move forward one character.
<C-b>
<PC left key>
Move back one character.
<C-a>
<HOME>
Move to the start of the line.
<C-e>
<END>
Move the the end of the line.
<C-d>
<DEL>
Delete the character underneath the cursor.
<C-h>
<BS>
Delete the character to the left of the cursor.
<C-k>
Kill the text from the current cursor position to the end of the
line.
<C-u>
Kill backward from the cursor to the beginning of the line.
<C-y>
Yank the killed text back into the buffer at the cursor.
<C-p>
<PC up key>
Move up through the history list.
<C-n>
<PC down key>
Move down through the history list.
When typing commands interactively, if the cursor is within or before
the first word in the command-line, pressing the <TAB> key (or <C-i>)
will display a listing of the available commands, and if the cursor is
after the first word, the `<TAB>' will provide a completion listing of
disks, partitions, and file names depending on the context. Note that
to obtain a list of drives, one must open a parenthesis, as `root ('.
Note that you cannot use the completion functionality in the TFTP
filesystem. This is because TFTP doesn't support file name listing for
the security.
File: grub.info, Node: Command-line interface-Footnotes, Up: Command-line interface
(1) However, this behavior will be changed in the future version, in
a user-invisible way.
File: grub.info, Node: Menu interface, Next: Menu entry editor, Prev: Command-line interface, Up: Interface
The simple menu interface
=========================
The menu interface is quite easy to use. Its commands are both
reasonably intuitive and described on screen.
Basically, the menu interface provides a list of "boot entries" to
the user to choose from. Use the arrow keys to select the entry of
choice, then press <RET> to run it. An optional timeout is available
to boot the default entry (the first one if not set), which is aborted
by pressing any key.
Commands are available to enter a bare command-line by pressing <c>
(which operates exactly like the non-config-file version of GRUB, but
allows one to return to the menu if desired by pressing <ESC>) or to
edit any of the "boot entries" by pressing <e>.
If you protect the menu interface with a password (*note Security::),
all you can do is choose an entry by pressing <RET>, or press <p> to
enter the password.
File: grub.info, Node: Menu entry editor, Next: Hidden menu interface, Prev: Menu interface, Up: Interface
Editing a menu entry
====================
The menu entry editor looks much like the main menu interface, but
the lines in the menu are individual commands in the selected entry
instead of entry names.
If an <ESC> is pressed in the editor, it aborts all the changes made
to the configuration entry and returns to the main menu interface.
When a particular line is selected, the editor places the user in a
special version of the GRUB command-line to edit that line. When the
user hits <RET>, GRUB replaces the line in question in the boot entry
with the changes (unless it was aborted via <ESC>, in which case the
changes are thrown away).
If you want to add a new line to the menu entry, press <o> if adding
a line after the current line or press <O> if before the current line.
To delete a line, hit the key <d>. Although GRUB unfortunately does
not support "undo", you can do almost the same thing by just returning
to the main menu.
File: grub.info, Node: Hidden menu interface, Prev: Menu entry editor, Up: Interface
The hidden menu interface
=========================
When your terminal is dumb or you request GRUB to hide the menu
interface explicitly with the command `hiddenmenu' (*note
hiddenmenu::), GRUB doesn't show the menu interface (*note Menu
interface::) and automatically boots the default entry, unless
interrupted by pressing <ESC>.
When you interrupt the timeout and your terminal is dumb, GRUB falls
back to the command-line interface (*note Command-line interface::).
File: grub.info, Node: Commands, Next: Troubleshooting, Prev: Interface, Up: Top
The list of available commands
******************************
In this chapter, we list all commands that are available in GRUB.
Commands belong to different groups. A few can only be used in the
global section of the configuration file (or "menu"); most of them can
be entered on the command-line and can be used either anywhere in the
menu or specifically in the menu entries.
* Menu:
* Menu-specific commands::
* General commands::
* Command-line and menu entry commands::
File: grub.info, Node: Menu-specific commands, Next: General commands, Up: Commands
The list of commands for the menu only
======================================
The semantics used in parsing the configuration file are the
following:
* The menu-specific commands have to be used before any others.
* The files _must_ be in plain-text format.
* `#' at the beginning of a line in a configuration file means it is
only a comment.
* Options are separated by spaces.
* All numbers can be either decimal or hexadecimal. A hexadecimal
number must be preceded by `0x', and is case-insensitive.
* Extra options or text at the end of the line are ignored unless
otherwise specified.
* Unrecognized commands are added to the current entry, except
before entries start, where they are ignored.
These commands can only be used in the menu:
* Menu:
* default:: Set the default entry
* fallback:: Set the fallback entry
* hiddenmenu:: Hide the menu interface
* timeout:: Set the timeout
* title:: Start a menu entry
File: grub.info, Node: default, Next: fallback, Up: Menu-specific commands
default
-------
- Command: default num
Set the default entry to the entry number NUM. Numbering starts
from 0, and the entry number 0 is the default if the command is not
used.
You can specify `saved' instead of a number. In this case, the
default entry is the entry saved with the command `savedefault'.
*Note savedefault::, for more information.
File: grub.info, Node: fallback, Next: hiddenmenu, Prev: default, Up: Menu-specific commands
fallback
--------
- Command: fallback num...
Go into unattended boot mode: if the default boot entry has any
errors, instead of waiting for the user to do something,
immediately start over using the NUM entry (same numbering as the
`default' command (*note default::)). This obviously won't help if
the machine was rebooted by a kernel that GRUB loaded. You can
specify multiple fallback entry numbers.
File: grub.info, Node: hiddenmenu, Next: timeout, Prev: fallback, Up: Menu-specific commands
hiddenmenu
----------
- Command: hiddenmenu
Don't display the menu. If the command is used, no menu will be
displayed on the control terminal, and the default entry will be
booted after the timeout expired. The user can still request the
menu to be displayed by pressing <ESC> before the timeout expires.
See also *Note Hidden menu interface::.
File: grub.info, Node: timeout, Next: title, Prev: hiddenmenu, Up: Menu-specific commands
timeout
-------
- Command: timeout sec
Set a timeout, in SEC seconds, before automatically booting the
default entry (normally the first entry defined).
File: grub.info, Node: title, Prev: timeout, Up: Menu-specific commands
title
-----
- Command: title name ...
Start a new boot entry, and set its name to the contents of the
rest of the line, starting with the first non-space character.
File: grub.info, Node: General commands, Next: Command-line and menu entry commands, Prev: Menu-specific commands, Up: Commands
The list of general commands
============================
Commands usable anywhere in the menu and in the command-line.
* Menu:
* bootp:: Initialize a network device via BOOTP
* color:: Color the menu interface
* device:: Specify a file as a drive
* dhcp:: Initialize a network device via DHCP
* hide:: Hide a partition
* ifconfig:: Configure a network device manually
* pager:: Change the state of the internal pager
* partnew:: Make a primary partition
* parttype:: Change the type of a partition
* password:: Set a password for the menu interface
* rarp:: Initialize a network device via RARP
* serial:: Set up a serial device
* setkey:: Configure the key map
* terminal:: Choose a terminal
* terminfo:: Define escape sequences for a terminal
* tftpserver:: Specify a TFTP server
* unhide:: Unhide a partition
File: grub.info, Node: bootp, Next: color, Up: General commands
bootp
-----
- Command: bootp [`--with-configfile']
Initialize a network device via the "BOOTP" protocol. This command
is only available if GRUB is compiled with netboot support. See
also *Note Network::.
If you specify `--with-configfile' to this command, GRUB will
fetch and load a configuration file specified by your BOOTP server
with the vendor tag `150'.
File: grub.info, Node: color, Next: device, Prev: bootp, Up: General commands
color
-----
- Command: color normal [highlight]
Change the menu colors. The color NORMAL is used for most lines in
the menu (*note Menu interface::), and the color HIGHLIGHT is used
to highlight the line where the cursor points. If you omit
HIGHLIGHT, then the inverted color of NORMAL is used for the
highlighted line. The format of a color is
`FOREGROUND/BACKGROUND'. FOREGROUND and BACKGROUND are symbolic
color names. A symbolic color name must be one of these:
* black
* blue
* green
* cyan
* red
* magenta
* brown
* light-gray
*These below can be specified only for the foreground.*
* dark-gray
* light-blue
* light-green
* light-cyan
* light-red
* light-magenta
* yellow
* white
But only the first eight names can be used for BACKGROUND. You can
prefix `blink-' to FOREGROUND if you want a blinking foreground
color.
This command can be used in the configuration file and on the
command line, so you may write something like this in your
configuration file:
# Set default colors.
color light-gray/blue black/light-gray
# Change the colors.
title OS-BS like
color magenta/blue black/magenta
File: grub.info, Node: device, Next: dhcp, Prev: color, Up: General commands
device
------
- Command: device drive file
In the grub shell, specify the file FILE as the actual drive for a
BIOS drive DRIVE. You can use this command to create a disk image,
and/or to fix the drives guessed by GRUB when GRUB fails to
determine them correctly, like this:
grub> device (fd0) /floppy-image
grub> device (hd0) /dev/sd0
This command can be used only in the grub shell (*note Invoking
the grub shell::).
File: grub.info, Node: dhcp, Next: hide, Prev: device, Up: General commands
dhcp
----
- Command: dhcp [--with-configfile]
Initialize a network device via the "DHCP" protocol. Currently,
this command is just an alias for `bootp', since the two protocols
are very similar. This command is only available if GRUB is
compiled with netboot support. See also *Note Network::.
If you specify `--with-configfile' to this command, GRUB will
fetch and load a configuration file specified by your DHCP server
with the vendor tag `150'.
File: grub.info, Node: hide, Next: ifconfig, Prev: dhcp, Up: General commands
hide
----
- Command: hide partition
Hide the partition PARTITION by setting the "hidden" bit in its
partition type code. This is useful only when booting DOS or
Windows and multiple primary FAT partitions exist in one disk. See
also *Note DOS/Windows::.
File: grub.info, Node: ifconfig, Next: pager, Prev: hide, Up: General commands
ifconfig
--------
- Command: ifconfig [`--server=server'] [`--gateway=gateway']
[`--mask=mask'] [`--address=address']
Configure the IP address, the netmask, the gateway, and the server
address of a network device manually. The values must be in dotted
decimal format, like `192.168.11.178'. The order of the options is
not important. This command shows current network configuration,
if no option is specified. See also *Note Network::.
File: grub.info, Node: pager, Next: partnew, Prev: ifconfig, Up: General commands
pager
-----
- Command: pager [flag]
Toggle or set the state of the internal pager. If FLAG is `on',
the internal pager is enabled. If FLAG is `off', it is disabled.
If no argument is given, the state is toggled.
File: grub.info, Node: partnew, Next: parttype, Prev: pager, Up: General commands
partnew
-------
- Command: partnew part type from len
Create a new primary partition. PART is a partition specification
in GRUB syntax (*note Naming convention::); TYPE is the partition
type and must be a number in the range `0-0xff'; FROM is the
starting address and LEN is the length, both in sector units.
File: grub.info, Node: parttype, Next: password, Prev: partnew, Up: General commands
parttype
--------
- Command: parttype part type
Change the type of an existing partition. PART is a partition
specification in GRUB syntax (*note Naming convention::); TYPE is
the new partition type and must be a number in the range 0-0xff.
File: grub.info, Node: password, Next: rarp, Prev: parttype, Up: General commands
password
--------
- Command: password [`--md5'] passwd [new-config-file]
If used in the first section of a menu file, disable all
interactive editing control (menu entry editor and command-line)
and entries protected by the command `lock'. If the password
PASSWD is entered, it loads the NEW-CONFIG-FILE as a new config
file and restarts the GRUB Stage 2, if NEW-CONFIG-FILE is
specified. Otherwise, GRUB will just unlock the privileged
instructions. You can also use this command in the script
section, in which case it will ask for the password, before
continuing. The option `--md5' tells GRUB that PASSWD is
encrypted with `md5crypt' (*note md5crypt::).
File: grub.info, Node: rarp, Next: serial, Prev: password, Up: General commands
rarp
----
- Command: rarp
Initialize a network device via the "RARP" protocol. This command
is only available if GRUB is compiled with netboot support. See
also *Note Network::.
File: grub.info, Node: serial, Next: setkey, Prev: rarp, Up: General commands
serial
------
- Command: serial [`--unit=unit'] [`--port=port'] [`--speed=speed']
[`--word=word'] [`--parity=parity'] [`--stop=stop']
[`--device=dev']
Initialize a serial device. UNIT is a number in the range 0-3
specifying which serial port to use; default is 0, which
corresponds to the port often called COM1. PORT is the I/O port
where the UART is to be found; if specified it takes precedence
over UNIT. SPEED is the transmission speed; default is 9600. WORD
and STOP are the number of data bits and stop bits. Data bits must
be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
bits and one stop bit. PARITY is one of `no', `odd', `even' and
defaults to `no'. The option `--device' can only be used in the
grub shell and is used to specify the tty device to be used in the
host operating system (*note Invoking the grub shell::).
The serial port is not used as a communication channel unless the
`terminal' command is used (*note terminal::).
This command is only available if GRUB is compiled with serial
support. See also *Note Serial terminal::.
File: grub.info, Node: setkey, Next: terminal, Prev: serial, Up: General commands
setkey
------
- Command: setkey [to_key from_key]
Change the keyboard map. The key FROM_KEY is mapped to the key
TO_KEY. If no argument is specified, reset key mappings. Note that
this command _does not_ exchange the keys. If you want to exchange
the keys, run this command again with the arguments exchanged,
like this:
grub> setkey capslock control
grub> setkey control capslock
A key must be an alphabet letter, a digit, or one of these symbols:
`escape', `exclam', `at', `numbersign', `dollar', `percent',
`caret', `ampersand', `asterisk', `parenleft', `parenright',
`minus', `underscore', `equal', `plus', `backspace', `tab',
`bracketleft', `braceleft', `bracketright', `braceright', `enter',
`control', `semicolon', `colon', `quote', `doublequote',
`backquote', `tilde', `shift', `backslash', `bar', `comma',
`less', `period', `greater', `slash', `question', `alt', `space',
`capslock', `FX' (`X' is a digit), and `delete'. This table
describes to which character each of the symbols corresponds:
`exclam'
`!'
`at'
`@'
`numbersign'
`#'
`dollar'
`$'
`percent'
`%'
`caret'
`^'
`ampersand'
`&'
`asterisk'
`*'
`parenleft'
`('
`parenright'
`)'
`minus'
`-'
`underscore'
`_'
`equal'
`='
`plus'
`+'
`bracketleft'
`['
`braceleft'
`{'
`bracketright'
`]'
`braceright'
`}'
`semicolon'
`;'
`colon'
`:'
`quote'
`''
`doublequote'
`"'
`backquote'
``'
`tilde'
`~'
`backslash'
`\'
`bar'
`|'
`comma'
`,'
`less'
`<'
`period'
`.'
`greater'
`>'
`slash'
`/'
`question'
`?'
`space'
` '
File: grub.info, Node: terminal, Next: terminfo, Prev: setkey, Up: General commands
terminal
--------
- Command: terminal [`--dumb'] [`--no-echo'] [`--no-edit']
[`--timeout=secs'] [`--lines=lines'] [`--silent'] [`console']
[`serial'] [`hercules']
Select a terminal for user interaction. The terminal is assumed to
be VT100-compatible unless `--dumb' is specified. If both
`console' and `serial' are specified, then GRUB will use the one
where a key is entered first or the first when the timeout
expires. If neither are specified, the current setting is
reported. This command is only available if GRUB is compiled with
serial support. See also *Note Serial terminal::.
This may not make sense for most users, but GRUB supports Hercules
console as well. Hercules console is usable like the ordinary
console, and the usage is quite similar to that for serial
terminals: specify `hercules' as the argument.
The option `--lines' defines the number of lines in your terminal,
and it is used for the internal pager function. If you don't
specify this option, the number is assumed as 24.
The option `--silent' suppresses the message to prompt you to hit
any key. This might be useful if your system has no terminal
device.
The option `--no-echo' has GRUB not to echo back input characters.
This implies the option `--no-edit'.
The option `--no-edit' disables the BASH-like editing feature.
File: grub.info, Node: terminfo, Next: tftpserver, Prev: terminal, Up: General commands
terminfo
--------
- Command: terminfo `--name=name' `--cursor-address=seq'
[`--clear-screen=seq'] [`--enter-standout-mode=seq']
[`--exit-standout-mode=seq']
Define the capabilities of your terminal. Use this command to
define escape sequences, if it is not vt100-compatible. You may
use `\e' for <ESC> and `^X' for a control character.
You can use the utility `grub-terminfo' to generate appropriate
arguments to this command. *Note Invoking grub-terminfo::.
If no option is specified, the current settings are printed.
File: grub.info, Node: tftpserver, Next: unhide, Prev: terminfo, Up: General commands
tftpserver
----------
- Command: tftpserver ipaddr
*Caution:* This command exists only for backward compatibility.
Use `ifconfig' (*note ifconfig::) instead.
Override a TFTP server address returned by a BOOTP/DHCP/RARP
server. The argument IPADDR must be in dotted decimal format, like
`192.168.0.15'. This command is only available if GRUB is compiled
with netboot support. See also *Note Network::.
File: grub.info, Node: unhide, Prev: tftpserver, Up: General commands
unhide
------
- Command: unhide partition
Unhide the partition PARTITION by clearing the "hidden" bit in its
partition type code. This is useful only when booting DOS or
Windows and multiple primary partitions exist on one disk. See also
*Note DOS/Windows::.
File: grub.info, Node: Command-line and menu entry commands, Prev: General commands, Up: Commands
The list of command-line and menu entry commands
================================================
These commands are usable in the command-line and in menu entries.
If you forget a command, you can run the command `help' (*note help::).
* Menu:
* blocklist:: Get the block list notation of a file
* boot:: Start up your operating system
* cat:: Show the contents of a file
* chainloader:: Chain-load another boot loader
* cmp:: Compare two files
* configfile:: Load a configuration file
* debug:: Toggle the debug flag
* displayapm:: Display APM information
* displaymem:: Display memory configuration
* embed:: Embed Stage 1.5
* find:: Find a file
* fstest:: Test a filesystem
* geometry:: Manipulate the geometry of a drive
* halt:: Shut down your computer
* help:: Show help messages
* impsprobe:: Probe SMP
* initrd:: Load an initrd
* install:: Install GRUB
* ioprobe:: Probe I/O ports used for a drive
* kernel:: Load a kernel
* lock:: Lock a menu entry
* makeactive:: Make a partition active
* map:: Map a drive to another
* md5crypt:: Encrypt a password in MD5 format
* module:: Load a module
* modulenounzip:: Load a module without decompression
* pause:: Wait for a key press
* quit:: Exit from the grub shell
* reboot:: Reboot your computer
* read:: Read data from memory
* root:: Set GRUB's root device
* rootnoverify:: Set GRUB's root device without mounting
* savedefault:: Save current entry as the default entry
* setup:: Set up GRUB's installation automatically
* testload:: Load a file for testing a filesystem
* testvbe:: Test VESA BIOS EXTENSION
* uppermem:: Set the upper memory size
* vbeprobe:: Probe VESA BIOS EXTENSION
File: grub.info, Node: blocklist, Next: boot, Up: Command-line and menu entry commands
blocklist
---------
- Command: blocklist file
Print the block list notation of the file FILE. *Note Block list
syntax::.
File: grub.info, Node: boot, Next: cat, Prev: blocklist, Up: Command-line and menu entry commands
boot
----
- Command: boot
Boot the OS or chain-loader which has been loaded. Only necessary
if running the fully interactive command-line (it is implicit at
the end of a menu entry).
File: grub.info, Node: cat, Next: chainloader, Prev: boot, Up: Command-line and menu entry commands
cat
---
- Command: cat file
Display the contents of the file FILE. This command may be useful
to remind you of your OS's root partition:
grub> cat /etc/fstab
File: grub.info, Node: chainloader, Next: cmp, Prev: cat, Up: Command-line and menu entry commands
chainloader
-----------
- Command: chainloader [`--force'] file
Load FILE as a chain-loader. Like any other file loaded by the
filesystem code, it can use the blocklist notation to grab the
first sector of the current partition with `+1'. If you specify the
option `--force', then load FILE forcibly, whether it has a
correct signature or not. This is required when you want to load a
defective boot loader, such as SCO UnixWare 7.1 (*note SCO
UnixWare::).
File: grub.info, Node: cmp, Next: configfile, Prev: chainloader, Up: Command-line and menu entry commands
cmp
---
- Command: cmp file1 file2
Compare the file FILE1 with the file FILE2. If they differ in
size, print the sizes like this:
Differ in size: 0x1234 [foo], 0x4321 [bar]
If the sizes are equal but the bytes at an offset differ, then
print the bytes like this:
Differ at the offset 777: 0xbe [foo], 0xef [bar]
If they are completely identical, nothing will be printed.
File: grub.info, Node: configfile, Next: debug, Prev: cmp, Up: Command-line and menu entry commands
configfile
----------
- Command: configfile file
Load FILE as a configuration file.
File: grub.info, Node: debug, Next: displayapm, Prev: configfile, Up: Command-line and menu entry commands
debug
-----
- Command: debug
Toggle debug mode (by default it is off). When debug mode is on,
some extra messages are printed to show disk activity. This global
debug flag is mainly useful for GRUB developers when testing new
code.
File: grub.info, Node: displayapm, Next: displaymem, Prev: debug, Up: Command-line and menu entry commands
displayapm
----------
- Command: displayapm
Display APM BIOS information.
File: grub.info, Node: displaymem, Next: embed, Prev: displayapm, Up: Command-line and menu entry commands
displaymem
----------
- Command: displaymem
Display what GRUB thinks the system address space map of the
machine is, including all regions of physical RAM installed. GRUB's
"upper/lower memory" display uses the standard BIOS interface for
the available memory in the first megabyte, or "lower memory", and
a synthesized number from various BIOS interfaces of the memory
starting at 1MB and going up to the first chipset hole for "upper
memory" (the standard PC "upper memory" interface is limited to
reporting a maximum of 64MB).
File: grub.info, Node: embed, Next: find, Prev: displaymem, Up: Command-line and menu entry commands
embed
-----
- Command: embed stage1_5 device
Embed the Stage 1.5 STAGE1_5 in the sectors after the MBR if
DEVICE is a drive, or in the "boot loader" area if DEVICE is a FFS
partition or a ReiserFS partition.(1) (*note embed-Footnote-1::)
Print the number of sectors which STAGE1_5 occupies, if successful.
Usually, you don't need to run this command directly. *Note
setup::.
File: grub.info, Node: embed-Footnotes, Up: embed
(1) The latter feature has not been implemented yet.
File: grub.info, Node: find, Next: fstest, Prev: embed, Up: Command-line and menu entry commands
find
----
- Command: find filename
Search for the file name FILENAME in all mountable partitions and
print the list of the devices which contain the file. The file
name FILENAME should be an absolute file name like
`/boot/grub/stage1'.
File: grub.info, Node: fstest, Next: geometry, Prev: find, Up: Command-line and menu entry commands
fstest
------
- Command: fstest
Toggle filesystem test mode. Filesystem test mode, when turned
on, prints out data corresponding to all the device reads and what
values are being sent to the low-level routines. The format is
`<PARTITION-OFFSET-SECTOR, BYTE-OFFSET, BYTE-LENGTH>' for
high-level reads inside a partition, and `[DISK-OFFSET-SECTOR]'
for low-level sector requests from the disk. Filesystem test mode
is turned off by any use of the `install' (*note install::) or
`testload' (*note testload::) commands.
File: grub.info, Node: geometry, Next: halt, Prev: fstest, Up: Command-line and menu entry commands
geometry
--------
- Command: geometry drive [cylinder head sector [total_sector]]
Print the information for the drive DRIVE. In the grub shell, you
can set the geometry of the drive arbitrarily. The number of
cylinders, the number of heads, the number of sectors and the
number of total sectors are set to CYLINDER, HEAD, SECTOR and
TOTAL_SECTOR, respectively. If you omit TOTAL_SECTOR, then it will
be calculated based on the C/H/S values automatically.
File: grub.info, Node: halt, Next: help, Prev: geometry, Up: Command-line and menu entry commands
halt
----
- Command: halt `--no-apm'
The command halts the computer. If the `--no-apm' option is
specified, no APM BIOS call is performed. Otherwise, the computer
is shut down using APM.
File: grub.info, Node: help, Next: impsprobe, Prev: halt, Up: Command-line and menu entry commands
help
----
- Command: help `--all' [pattern ...]
Display helpful information about builtin commands. If you do not
specify PATTERN, this command shows short descriptions of most of
available commands. If you specify the option `--all' to this
command, short descriptions of rarely used commands (such as *Note
testload::) are displayed as well.
If you specify any PATTERNS, it displays longer information about
each of the commands which match those PATTERNS.
File: grub.info, Node: impsprobe, Next: initrd, Prev: help, Up: Command-line and menu entry commands
impsprobe
---------
- Command: impsprobe
Probe the Intel Multiprocessor Specification 1.1 or 1.4
configuration table and boot the various CPUs which are found into
a tight loop. This command can be used only in the Stage 2, but
not in the grub shell.
File: grub.info, Node: initrd, Next: install, Prev: impsprobe, Up: Command-line and menu entry commands
initrd
------
- Command: initrd file ...
Load an initial ramdisk for a Linux format boot image and set the
appropriate parameters in the Linux setup area in memory. See also
*Note GNU/Linux::.
|