grub.texi 128 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956
  1. \input texinfo
  2. @c -*-texinfo-*-
  3. @c %**start of header
  4. @setfilename grub.info
  5. @include version.texi
  6. @settitle GNU GRUB Manual @value{VERSION}
  7. @c Unify all our little indices for now.
  8. @syncodeindex fn cp
  9. @syncodeindex vr cp
  10. @syncodeindex ky cp
  11. @syncodeindex pg cp
  12. @syncodeindex tp cp
  13. @c %**end of header
  14. @footnotestyle separate
  15. @paragraphindent 3
  16. @finalout
  17. @copying
  18. This manual is for GNU GRUB (version @value{VERSION},
  19. @value{UPDATED}).
  20. Copyright @copyright{} 1999,2000,2001,2002,2004,2006 Free Software Foundation, Inc.
  21. @quotation
  22. Permission is granted to copy, distribute and/or modify this document
  23. under the terms of the GNU Free Documentation License, Version 1.2 or
  24. any later version published by the Free Software Foundation; with no
  25. Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
  26. and with the Back-Cover Texts as in (a) below. A copy of the
  27. license is included in the section entitled ``GNU Free Documentation
  28. License.''
  29. (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
  30. this GNU Manual, like GNU software. Copies published by the Free
  31. Software Foundation raise funds for GNU development.''
  32. @end quotation
  33. @end copying
  34. @dircategory Kernel
  35. @direntry
  36. * GRUB: (grub). The GRand Unified Bootloader
  37. * grub-install: (grub)Invoking grub-install. Install GRUB on your drive
  38. * grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password
  39. in MD5 format
  40. * grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo
  41. command from a
  42. terminfo name
  43. * grub-set-default: (grub)Invoking grub-set-default. Set a default boot
  44. entry
  45. @end direntry
  46. @setchapternewpage odd
  47. @titlepage
  48. @sp 10
  49. @title the GNU GRUB manual
  50. @subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}.
  51. @author Gordon Matzigkeit
  52. @author Yoshinori K. Okuji
  53. @c The following two commands start the copyright page.
  54. @page
  55. @vskip 0pt plus 1filll
  56. @insertcopying
  57. @end titlepage
  58. @c Output the table of contents at the beginning.
  59. @contents
  60. @finalout
  61. @headings double
  62. @ifnottex
  63. @node Top
  64. @top GNU GRUB manual
  65. This is the documentation of GNU GRUB, the GRand Unified Bootloader,
  66. a flexible and powerful boot loader program for @sc{pc}s.
  67. This edition documents version @value{VERSION}.
  68. @insertcopying
  69. @end ifnottex
  70. @menu
  71. * Introduction:: Capturing the spirit of GRUB
  72. * Naming convention:: Names of your drives in GRUB
  73. * Installation:: Installing GRUB on your drive
  74. * Booting:: How to boot different operating systems
  75. * Configuration:: Writing your own configuration file
  76. * Network:: Downloading OS images from a network
  77. * Serial terminal:: Using GRUB via a serial line
  78. * Preset Menu:: Embedding a configuration file into GRUB
  79. * Security:: Improving the security
  80. * Images:: GRUB image files
  81. * Filesystem:: Filesystem syntax and semantics
  82. * Interface:: The menu and the command-line
  83. * Commands:: The list of available built-in commands
  84. * Troubleshooting:: Error messages produced by GRUB
  85. * Invoking the grub shell:: How to use the grub shell
  86. * Invoking grub-install:: How to use the GRUB installer
  87. * Invoking grub-md5-crypt:: How to generate a cryptic password
  88. * Invoking grub-terminfo:: How to generate a terminfo command
  89. * Invoking grub-set-default:: How to set a default boot entry
  90. * Obtaining and Building GRUB:: How to obtain and build GRUB
  91. * Reporting bugs:: Where you should send a bug report
  92. * Future:: Some future plans on GRUB
  93. * Internals:: Hacking GRUB
  94. * Copying This Manual:: Copying This Manual
  95. * Index::
  96. @end menu
  97. @node Introduction
  98. @chapter Introduction to GRUB
  99. @menu
  100. * Overview:: What exactly GRUB is and how to use it
  101. * History:: From maggot to house fly
  102. * Features:: GRUB features
  103. * Role of a boot loader:: The role of a boot loader
  104. @end menu
  105. @node Overview
  106. @section Overview
  107. Briefly, a @dfn{boot loader} is the first software program that runs when
  108. a computer starts. It is responsible for loading and transferring
  109. control to an operating system @dfn{kernel} software (such as Linux or
  110. GNU Mach). The kernel, in turn, initializes the rest of the operating
  111. system (e.g. a GNU system).
  112. GNU GRUB is a very powerful boot loader, which can load a wide variety
  113. of free operating systems, as well as proprietary operating systems with
  114. chain-loading@footnote{@dfn{chain-load} is the mechanism for loading
  115. unsupported operating systems by loading another boot loader. It is
  116. typically used for loading DOS or Windows.}. GRUB is designed to
  117. address the complexity of booting a personal computer; both the
  118. program and this manual are tightly bound to that computer platform,
  119. although porting to other platforms may be addressed in the future.
  120. One of the important features in GRUB is flexibility; GRUB understands
  121. filesystems and kernel executable formats, so you can load an arbitrary
  122. operating system the way you like, without recording the physical
  123. position of your kernel on the disk. Thus you can load the kernel
  124. just by specifying its file name and the drive and partition where the
  125. kernel resides.
  126. When booting with GRUB, you can use either a command-line interface
  127. (@pxref{Command-line interface}), or a menu interface (@pxref{Menu
  128. interface}). Using the command-line interface, you type the drive
  129. specification and file name of the kernel manually. In the menu
  130. interface, you just select an OS using the arrow keys. The menu is
  131. based on a configuration file which you prepare beforehand
  132. (@pxref{Configuration}). While in the menu, you can switch to the
  133. command-line mode, and vice-versa. You can even edit menu entries
  134. before using them.
  135. In the following chapters, you will learn how to specify a drive, a
  136. partition, and a file name (@pxref{Naming convention}) to GRUB, how to
  137. install GRUB on your drive (@pxref{Installation}), and how to boot your
  138. OSes (@pxref{Booting}), step by step.
  139. Besides the GRUB boot loader itself, there is a @dfn{grub shell}
  140. @command{grub} (@pxref{Invoking the grub shell}) which can be run when
  141. you are in your operating system. It emulates the boot loader and can
  142. be used for installing the boot loader.
  143. @node History
  144. @section History of GRUB
  145. GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
  146. Hurd with the University of Utah's Mach 4 microkernel (now known as GNU
  147. Mach). Erich and Brian Ford designed the Multiboot Specification
  148. (@pxref{Top, Multiboot Specification, Motivation, multiboot, The Multiboot
  149. Specification}), because they were determined not to add to the large
  150. number of mutually-incompatible PC boot methods.
  151. Erich then began modifying the FreeBSD boot loader so that it would
  152. understand Multiboot. He soon realized that it would be a lot easier
  153. to write his own boot loader from scratch than to keep working on the
  154. FreeBSD boot loader, and so GRUB was born.
  155. Erich added many features to GRUB, but other priorities prevented him
  156. from keeping up with the demands of its quickly-expanding user base. In
  157. 1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an
  158. official GNU package, and opened its development by making the latest
  159. sources available via anonymous CVS. @xref{Obtaining and Building
  160. GRUB}, for more information.
  161. @node Features
  162. @section GRUB features
  163. The primary requirement for GRUB is that it be compliant with the
  164. @dfn{Multiboot Specification}, which is described in @ref{Top, Multiboot
  165. Specification, Motivation, multiboot, The Multiboot Specification}.
  166. The other goals, listed in approximate order of importance, are:
  167. @itemize @bullet{}
  168. @item
  169. Basic functions must be straightforward for end-users.
  170. @item
  171. Rich functionality to support kernel experts and designers.
  172. @item
  173. Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and
  174. Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are
  175. supported via a chain-loading function.
  176. @end itemize
  177. Except for specific compatibility modes (chain-loading and the Linux
  178. @dfn{piggyback} format), all kernels will be started in much the same
  179. state as in the Multiboot Specification. Only kernels loaded at 1 megabyte
  180. or above are presently supported. Any attempt to load below that
  181. boundary will simply result in immediate failure and an error message
  182. reporting the problem.
  183. In addition to the requirements above, GRUB has the following features
  184. (note that the Multiboot Specification doesn't require all the features
  185. that GRUB supports):
  186. @table @asis
  187. @item Recognize multiple executable formats
  188. Support many of the @dfn{a.out} variants plus @dfn{ELF}. Symbol
  189. tables are also loaded.
  190. @item Support non-Multiboot kernels
  191. Support many of the various free 32-bit kernels that lack Multiboot
  192. compliance (primarily FreeBSD, NetBSD, OpenBSD, and
  193. Linux). Chain-loading of other boot loaders is also supported.
  194. @item Load multiple modules
  195. Fully support the Multiboot feature of loading multiple modules.
  196. @item Load a configuration file
  197. Support a human-readable text configuration file with preset boot
  198. commands. You can also load another configuration file dynamically and
  199. embed a preset configuration file in a GRUB image file. The list of
  200. commands (@pxref{Commands}) are a superset of those supported on the
  201. command-line. An example configuration file is provided in
  202. @ref{Configuration}.
  203. @item Provide a menu interface
  204. A menu interface listing preset boot commands, with a programmable
  205. timeout, is available. There is no fixed limit on the number of boot
  206. entries, and the current implementation has space for several hundred.
  207. @item Have a flexible command-line interface
  208. A fairly flexible command-line interface, accessible from the menu,
  209. is available to edit any preset commands, or write a new boot command
  210. set from scratch. If no configuration file is present, GRUB drops to
  211. the command-line.
  212. The list of commands (@pxref{Commands}) are a subset of those supported
  213. for configuration files. Editing commands closely resembles the Bash
  214. command-line (@pxref{Command Line Editing, Bash, Command Line Editing,
  215. features, Bash Features}), with @key{TAB}-completion of commands,
  216. devices, partitions, and files in a directory depending on context.
  217. @item Support multiple filesystem types
  218. Support multiple filesystem types transparently, plus a useful explicit
  219. blocklist notation. The currently supported filesystem types are
  220. @dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, @dfn{Linux
  221. ext2fs}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa
  222. fs}. @xref{Filesystem}, for more information.
  223. @item Support automatic decompression
  224. Can decompress files which were compressed by @command{gzip}. This
  225. function is both automatic and transparent to the user (i.e. all
  226. functions operate upon the uncompressed contents of the specified
  227. files). This greatly reduces a file size and loading time, a
  228. particularly great benefit for floppies.@footnote{There are a few
  229. pathological cases where loading a very badly organized ELF kernel might
  230. take longer, but in practice this never happen.}
  231. It is conceivable that some kernel modules should be loaded in a
  232. compressed state, so a different module-loading command can be specified
  233. to avoid uncompressing the modules.
  234. @item Access data on any installed device
  235. Support reading data from any or all floppies or hard disk(s) recognized
  236. by the BIOS, independent of the setting of the root device.
  237. @item Be independent of drive geometry translations
  238. Unlike many other boot loaders, GRUB makes the particular drive
  239. translation irrelevant. A drive installed and running with one
  240. translation may be converted to another translation without any adverse
  241. effects or changes in GRUB's configuration.
  242. @item Detect all installed @sc{ram}
  243. GRUB can generally find all the installed @sc{ram} on a PC-compatible
  244. machine. It uses an advanced BIOS query technique for finding all
  245. memory regions. As described on the Multiboot Specification (@pxref{Top,
  246. Multiboot Specification, Motivation, multiboot, The Multiboot
  247. Specification}), not all kernels make use of this information, but GRUB
  248. provides it for those who do.
  249. @item Support Logical Block Address mode
  250. In traditional disk calls (called @dfn{CHS mode}), there is a geometry
  251. translation problem, that is, the BIOS cannot access over 1024
  252. cylinders, so the accessible space is limited to at least 508 MB and to
  253. at most 8GB. GRUB can't universally solve this problem, as there is no
  254. standard interface used in all machines. However, several newer machines
  255. have the new interface, Logical Block Address (@dfn{LBA}) mode. GRUB
  256. automatically detects if LBA mode is available and uses it if
  257. available. In LBA mode, GRUB can access the entire disk.
  258. @item Support network booting
  259. GRUB is basically a disk-based boot loader but also has network
  260. support. You can load OS images from a network by using the @dfn{TFTP}
  261. protocol.
  262. @item Support remote terminals
  263. To support computers with no console, GRUB provides remote terminal
  264. support, so that you can control GRUB from a remote host. Only serial
  265. terminal support is implemented at the moment.
  266. @end table
  267. @node Role of a boot loader
  268. @section The role of a boot loader
  269. The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
  270. @quotation
  271. Some people like to acknowledge both the operating system and kernel when
  272. they talk about their computers, so they might say they use
  273. ``GNU/Linux'' or ``GNU/Hurd''. Other people seem to think that the
  274. kernel is the most important part of the system, so they like to call
  275. their GNU operating systems ``Linux systems.''
  276. I, personally, believe that this is a grave injustice, because the
  277. @emph{boot loader} is the most important software of all. I used to
  278. refer to the above systems as either ``LILO''@footnote{The LInux LOader,
  279. a boot loader that everybody uses, but nobody likes.} or ``GRUB''
  280. systems.
  281. Unfortunately, nobody ever understood what I was talking about; now I
  282. just use the word ``GNU'' as a pseudonym for GRUB.
  283. So, if you ever hear people talking about their alleged ``GNU'' systems,
  284. remember that they are actually paying homage to the best boot loader
  285. around@dots{} GRUB!
  286. @end quotation
  287. We, the GRUB maintainers, do not (usually) encourage Gordon's level of
  288. fanaticism, but it helps to remember that boot loaders deserve
  289. recognition. We hope that you enjoy using GNU GRUB as much as we did
  290. writing it.
  291. @node Naming convention
  292. @chapter Naming convention
  293. The device syntax used in GRUB is a wee bit different from what you may
  294. have seen before in your operating system(s), and you need to know it so
  295. that you can specify a drive/partition.
  296. Look at the following examples and explanations:
  297. @example
  298. (fd0)
  299. @end example
  300. First of all, GRUB requires that the device name be enclosed with
  301. @samp{(} and @samp{)}. The @samp{fd} part means that it is a floppy
  302. disk. The number @samp{0} is the drive number, which is counted from
  303. @emph{zero}. This expression means that GRUB will use the whole floppy
  304. disk.
  305. @example
  306. (hd0,1)
  307. @end example
  308. Here, @samp{hd} means it is a hard disk drive. The first integer
  309. @samp{0} indicates the drive number, that is, the first hard disk, while
  310. the second integer, @samp{1}, indicates the partition number (or the
  311. @sc{pc} slice number in the BSD terminology). Once again, please note
  312. that the partition numbers are counted from @emph{zero}, not from
  313. one. This expression means the second partition of the first hard disk
  314. drive. In this case, GRUB uses one partition of the disk, instead of the
  315. whole disk.
  316. @example
  317. (hd0,4)
  318. @end example
  319. This specifies the first @dfn{extended partition} of the first hard disk
  320. drive. Note that the partition numbers for extended partitions are
  321. counted from @samp{4}, regardless of the actual number of primary
  322. partitions on your hard disk.
  323. @example
  324. (hd1,a)
  325. @end example
  326. This means the BSD @samp{a} partition of the second hard disk. If you
  327. need to specify which @sc{pc} slice number should be used, use something
  328. like this: @samp{(hd1,0,a)}. If the @sc{pc} slice number is omitted,
  329. GRUB searches for the first @sc{pc} slice which has a BSD @samp{a}
  330. partition.
  331. Of course, to actually access the disks or partitions with GRUB, you
  332. need to use the device specification in a command, like @samp{root
  333. (fd0)} or @samp{unhide (hd0,2)}. To help you find out which number
  334. specifies a partition you want, the GRUB command-line
  335. (@pxref{Command-line interface}) options have argument
  336. completion. This means that, for example, you only need to type
  337. @example
  338. root (
  339. @end example
  340. followed by a @key{TAB}, and GRUB will display the list of drives,
  341. partitions, or file names. So it should be quite easy to determine the
  342. name of your target partition, even with minimal knowledge of the
  343. syntax.
  344. Note that GRUB does @emph{not} distinguish IDE from SCSI - it simply
  345. counts the drive numbers from zero, regardless of their type. Normally,
  346. any IDE drive number is less than any SCSI drive number, although that
  347. is not true if you change the boot sequence by swapping IDE and SCSI
  348. drives in your BIOS.
  349. Now the question is, how to specify a file? Again, consider an
  350. example:
  351. @example
  352. (hd0,0)/vmlinuz
  353. @end example
  354. This specifies the file named @samp{vmlinuz}, found on the first
  355. partition of the first hard disk drive. Note that the argument
  356. completion works with file names, too.
  357. That was easy, admit it. Now read the next chapter, to find out how to
  358. actually install GRUB on your drive.
  359. @node Installation
  360. @chapter Installation
  361. In order to install GRUB as your boot loader, you need to first
  362. install the GRUB system and utilities under your UNIX-like operating
  363. system (@pxref{Obtaining and Building GRUB}). You can do this either
  364. from the source tarball, or as a package for your OS.
  365. After you have done that, you need to install the boot loader on a
  366. drive (floppy or hard disk). There are two ways of doing that - either
  367. using the utility @command{grub-install} (@pxref{Invoking
  368. grub-install}) on a UNIX-like OS, or by running GRUB itself from a
  369. floppy. These are quite similar, however the utility might probe a
  370. wrong BIOS drive, so you should be careful.
  371. Also, if you install GRUB on a UNIX-like OS, please make sure that you
  372. have an emergency boot disk ready, so that you can rescue your computer
  373. if, by any chance, your hard drive becomes unusable (unbootable).
  374. GRUB comes with boot images, which are normally put in the directory
  375. @file{/usr/lib/grub/i386-pc}. If you do not use grub-install, then
  376. you need to copy the files @file{stage1}, @file{stage2}, and
  377. @file{*stage1_5} to the directory @file{/boot/grub}, and run the
  378. @command{grub-set-default} (@pxref{Invoking grub-set-default}) if you
  379. intend to use @samp{default saved} (@pxref{default}) in your
  380. configuration file. Hereafter, the directory where GRUB images are
  381. initially placed (normally @file{/usr/lib/grub/i386-pc}) will be
  382. called the @dfn{image directory}, and the directory where the boot
  383. loader needs to find them (usually @file{/boot/grub}) will be called
  384. the @dfn{boot directory}.
  385. @menu
  386. * Creating a GRUB boot floppy::
  387. * Installing GRUB natively::
  388. * Installing GRUB using grub-install::
  389. * Making a GRUB bootable CD-ROM::
  390. @end menu
  391. @node Creating a GRUB boot floppy
  392. @section Creating a GRUB boot floppy
  393. To create a GRUB boot floppy, you need to take the files @file{stage1}
  394. and @file{stage2} from the image directory, and write them to the first
  395. and the second block of the floppy disk, respectively.
  396. @strong{Caution:} This procedure will destroy any data currently stored
  397. on the floppy.
  398. On a UNIX-like operating system, that is done with the following
  399. commands:
  400. @example
  401. @group
  402. # @kbd{cd /usr/lib/grub/i386-pc}
  403. # @kbd{dd if=stage1 of=/dev/fd0 bs=512 count=1}
  404. 1+0 records in
  405. 1+0 records out
  406. # @kbd{dd if=stage2 of=/dev/fd0 bs=512 seek=1}
  407. 153+1 records in
  408. 153+1 records out
  409. #
  410. @end group
  411. @end example
  412. The device file name may be different. Consult the manual for your OS.
  413. @node Installing GRUB natively
  414. @section Installing GRUB natively
  415. @strong{Caution:} Installing GRUB's stage1 in this manner will erase the
  416. normal boot sector used by an OS.
  417. GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD
  418. directly, so using it on a boot sector (the first sector of a
  419. partition) should be okay. But generally, it would be a good idea to
  420. back up the first sector of the partition on which you are installing
  421. GRUB's stage1. This isn't as important if you are installing GRUB on
  422. the first sector of a hard disk, since it's easy to reinitialize it
  423. (e.g. by running @samp{FDISK /MBR} from DOS).
  424. If you decide to install GRUB in the native environment, which is
  425. definitely desirable, you'll need to create a GRUB boot disk, and
  426. reboot your computer with it. Otherwise, see @ref{Installing GRUB using
  427. grub-install}.
  428. Once started, GRUB will show the command-line interface
  429. (@pxref{Command-line interface}). First, set the GRUB's @dfn{root
  430. device}@footnote{Note that GRUB's root device doesn't necessarily mean
  431. your OS's root partition; if you need to specify a root partition for
  432. your OS, add the argument into the command @command{kernel}.} to the
  433. partition containing the boot directory, like this:
  434. @example
  435. grub> @kbd{root (hd0,0)}
  436. @end example
  437. If you are not sure which partition actually holds this directory, use the
  438. command @command{find} (@pxref{find}), like this:
  439. @example
  440. grub> @kbd{find /boot/grub/stage1}
  441. @end example
  442. This will search for the file name @file{/boot/grub/stage1} and show the
  443. devices which contain the file.
  444. Once you've set the root device correctly, run the command
  445. @command{setup} (@pxref{setup}):
  446. @example
  447. grub> @kbd{setup (hd0)}
  448. @end example
  449. This command will install the GRUB boot loader on the Master Boot
  450. Record (MBR) of the first drive. If you want to put GRUB into the boot
  451. sector of a partition instead of putting it in the MBR, specify the
  452. partition into which you want to install GRUB:
  453. @example
  454. grub> @kbd{setup (hd0,0)}
  455. @end example
  456. If you install GRUB into a partition or a drive other than the first
  457. one, you must chain-load GRUB from another boot loader. Refer to the
  458. manual for the boot loader to know how to chain-load GRUB.
  459. After using the setup command, you will boot into GRUB without the
  460. GRUB floppy. See the chapter @ref{Booting} to find out how to boot
  461. your operating systems from GRUB.
  462. @node Installing GRUB using grub-install
  463. @section Installing GRUB using grub-install
  464. @strong{Caution:} This procedure is definitely less safe, because
  465. there are several ways in which your computer can become
  466. unbootable. For example, most operating systems don't tell GRUB how to
  467. map BIOS drives to OS devices correctly---GRUB merely @dfn{guesses}
  468. the mapping. This will succeed in most cases, but not
  469. always. Therefore, GRUB provides you with a map file called the
  470. @dfn{device map}, which you must fix if it is wrong. @xref{Device
  471. map}, for more details.
  472. If you still do want to install GRUB under a UNIX-like OS (such
  473. as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking
  474. grub-install}) as the superuser (@dfn{root}).
  475. The usage is basically very simple. You only need to specify one
  476. argument to the program, namely, where to install the boot loader. The
  477. argument can be either a device file (like @samp{/dev/hda}) or a
  478. partition specified in GRUB's notation. For example, under Linux the
  479. following will install GRUB into the MBR of the first IDE disk:
  480. @example
  481. # @kbd{grub-install /dev/hda}
  482. @end example
  483. Likewise, under GNU/Hurd, this has the same effect:
  484. @example
  485. # @kbd{grub-install /dev/hd0}
  486. @end example
  487. If it is the first BIOS drive, this is the same as well:
  488. @example
  489. # @kbd{grub-install '(hd0)'}
  490. @end example
  491. Or you can omit the parentheses:
  492. @example
  493. # @kbd{grub-install hd0}
  494. @end example
  495. But all the above examples assume that GRUB should use images under
  496. the root directory. If you want GRUB to use images under a directory
  497. other than the root directory, you need to specify the option
  498. @option{--root-directory}. The typical usage is that you create a GRUB
  499. boot floppy with a filesystem. Here is an example:
  500. @example
  501. @group
  502. # @kbd{mke2fs /dev/fd0}
  503. # @kbd{mount -t ext2 /dev/fd0 /mnt}
  504. # @kbd{grub-install --root-directory=/mnt fd0}
  505. # @kbd{umount /mnt}
  506. @end group
  507. @end example
  508. Another example is when you have a separate boot partition
  509. which is mounted at @file{/boot}. Since GRUB is a boot loader, it
  510. doesn't know anything about mount points at all. Thus, you need to run
  511. @command{grub-install} like this:
  512. @example
  513. # @kbd{grub-install --root-directory=/boot /dev/hda}
  514. @end example
  515. By the way, as noted above, it is quite difficult to guess BIOS drives
  516. correctly under a UNIX-like OS. Thus, @command{grub-install} will prompt
  517. you to check if it could really guess the correct mappings, after the
  518. installation. The format is defined in @ref{Device map}. Please be
  519. quite careful. If the output is wrong, it is unlikely that your
  520. computer will be able to boot with no problem.
  521. Note that @command{grub-install} is actually just a shell script and the
  522. real task is done by the grub shell @command{grub} (@pxref{Invoking the
  523. grub shell}). Therefore, you may run @command{grub} directly to install
  524. GRUB, without using @command{grub-install}. Don't do that, however,
  525. unless you are very familiar with the internals of GRUB. Installing a
  526. boot loader on a running OS may be extremely dangerous.
  527. @node Making a GRUB bootable CD-ROM
  528. @section Making a GRUB bootable CD-ROM
  529. GRUB supports the @dfn{no emulation mode} in the El Torito
  530. specification@footnote{El Torito is a specification for bootable CD
  531. using BIOS functions.}. This means that you can use the whole CD-ROM
  532. from GRUB and you don't have to make a floppy or hard disk image file,
  533. which can cause compatibility problems.
  534. For booting from a CD-ROM, GRUB uses a special Stage 2 called
  535. @file{stage2_eltorito}. The only GRUB files you need to have in your
  536. bootable CD-ROM are this @file{stage2_eltorito} and optionally a config file
  537. @file{menu.lst}. You don't need to use @file{stage1} or @file{stage2},
  538. because El Torito is quite different from the standard boot process.
  539. Here is an example of procedures to make a bootable CD-ROM
  540. image. First, make a top directory for the bootable image, say,
  541. @samp{iso}:
  542. @example
  543. $ @kbd{mkdir iso}
  544. @end example
  545. Make a directory for GRUB:
  546. @example
  547. $ @kbd{mkdir -p iso/boot/grub}
  548. @end example
  549. Copy the file @file{stage2_eltorito}:
  550. @example
  551. $ @kbd{cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub}
  552. @end example
  553. If desired, make the config file @file{menu.lst} under @file{iso/boot/grub}
  554. (@pxref{Configuration}), and copy any files and directories for the disc to the
  555. directory @file{iso/}.
  556. Finally, make a ISO9660 image file like this:
  557. @example
  558. $ @kbd{mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
  559. -boot-load-size 4 -boot-info-table -o grub.iso iso}
  560. @end example
  561. This produces a file named @file{grub.iso}, which then can be burned
  562. into a CD (or a DVD). @kbd{mkisofs} has already set up the disc to boot
  563. from the @kbd{boot/grub/stage2_eltorito} file, so there is no need to
  564. setup GRUB on the disc. (Note that the @kbd{-boot-load-size 4} bit is
  565. required for compatibility with the BIOS on many older machines.)
  566. You can use the device @samp{(cd)} to access a CD-ROM in your
  567. config file. This is not required; GRUB automatically sets the root device
  568. to @samp{(cd)} when booted from a CD-ROM. It is only necessary to refer to
  569. @samp{(cd)} if you want to access other drives as well.
  570. @node Booting
  571. @chapter Booting
  572. GRUB can load Multiboot-compliant kernels in a consistent way,
  573. but for some free operating systems you need to use some OS-specific
  574. magic.
  575. @menu
  576. * General boot methods:: How to boot OSes with GRUB generally
  577. * OS-specific notes:: Notes on some operating systems
  578. * Making your system robust:: How to make your system robust
  579. @end menu
  580. @node General boot methods
  581. @section How to boot operating systems
  582. GRUB has two distinct boot methods. One of the two is to load an
  583. operating system directly, and the other is to chain-load another boot
  584. loader which then will load an operating system actually. Generally
  585. speaking, the former is more desirable, because you don't need to
  586. install or maintain other boot loaders and GRUB is flexible enough to
  587. load an operating system from an arbitrary disk/partition. However,
  588. the latter is sometimes required, since GRUB doesn't support all the
  589. existing operating systems natively.
  590. @menu
  591. * Loading an operating system directly::
  592. * Chain-loading::
  593. @end menu
  594. @node Loading an operating system directly
  595. @subsection How to boot an OS directly with GRUB
  596. Multiboot (@pxref{Top, Multiboot Specification, Motivation, multiboot,
  597. The Multiboot Specification}) is the native format supported by GRUB.
  598. For the sake of convenience, there is also support for Linux, FreeBSD,
  599. NetBSD and OpenBSD. If you want to boot other operating systems, you
  600. will have to chain-load them (@pxref{Chain-loading}).
  601. Generally, GRUB can boot any Multiboot-compliant OS in the following
  602. steps:
  603. @enumerate
  604. @item
  605. Set GRUB's root device to the drive where the OS images are stored with
  606. the command @command{root} (@pxref{root}).
  607. @item
  608. Load the kernel image with the command @command{kernel} (@pxref{kernel}).
  609. @item
  610. If you need modules, load them with the command @command{module}
  611. (@pxref{module}) or @command{modulenounzip} (@pxref{modulenounzip}).
  612. @item
  613. Run the command @command{boot} (@pxref{boot}).
  614. @end enumerate
  615. Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar
  616. manner. You load a kernel image with the command @command{kernel} and
  617. then run the command @command{boot}. If the kernel requires some
  618. parameters, just append the parameters to @command{kernel}, after the
  619. file name of the kernel. Also, please refer to @ref{OS-specific notes},
  620. for information on your OS-specific issues.
  621. @node Chain-loading
  622. @subsection Load another boot loader to boot unsupported operating systems
  623. If you want to boot an unsupported operating system (e.g. Windows 95),
  624. chain-load a boot loader for the operating system. Normally, the boot
  625. loader is embedded in the @dfn{boot sector} of the partition on which
  626. the operating system is installed.
  627. @enumerate
  628. @item
  629. Set GRUB's root device to the partition by the command
  630. @command{rootnoverify} (@pxref{rootnoverify}):
  631. @example
  632. grub> @kbd{rootnoverify (hd0,0)}
  633. @end example
  634. @item
  635. Set the @dfn{active} flag in the partition using the command
  636. @command{makeactive}@footnote{This is not necessary for most of the
  637. modern operating systems.} (@pxref{makeactive}):
  638. @example
  639. grub> @kbd{makeactive}
  640. @end example
  641. @item
  642. Load the boot loader with the command @command{chainloader}
  643. (@pxref{chainloader}):
  644. @example
  645. grub> @kbd{chainloader +1}
  646. @end example
  647. @samp{+1} indicates that GRUB should read one sector from the start of
  648. the partition. The complete description about this syntax can be found
  649. in @ref{blocklist syntax}.
  650. @item
  651. Run the command @command{boot} (@pxref{boot}).
  652. @end enumerate
  653. However, DOS and Windows have some deficiencies, so you might have to
  654. use more complicated instructions. @xref{DOS/Windows}, for more
  655. information.
  656. @node OS-specific notes
  657. @section Some caveats on OS-specific issues
  658. Here, we describe some caveats on several operating systems.
  659. @menu
  660. * GNU/Hurd::
  661. * GNU/Linux::
  662. * FreeBSD::
  663. * NetBSD::
  664. * OpenBSD::
  665. * DOS/Windows::
  666. * SCO UnixWare::
  667. * QNX::
  668. @end menu
  669. @node GNU/Hurd
  670. @subsection GNU/Hurd
  671. Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is
  672. nothing special about it. But do not forget that you have to specify a
  673. root partition to the kernel.
  674. @enumerate
  675. @item
  676. Set GRUB's root device to the same drive as GNU/Hurd's. Probably the
  677. command @code{find /boot/gnumach} or similar can help you
  678. (@pxref{find}).
  679. @item
  680. Load the kernel and the module, like this:
  681. @example
  682. @group
  683. grub> @kbd{kernel /boot/gnumach root=hd0s1}
  684. grub> @kbd{module /boot/serverboot}
  685. @end group
  686. @end example
  687. @item
  688. Run the command @command{boot} (@pxref{boot}).
  689. @end enumerate
  690. @node GNU/Linux
  691. @subsection GNU/Linux
  692. It is relatively easy to boot GNU/Linux from GRUB, because it somewhat
  693. resembles to boot a Multiboot-compliant OS.
  694. @enumerate
  695. @item
  696. Set GRUB's root device to the same drive as GNU/Linux's. Probably the
  697. command @code{find /vmlinuz} or similar can help you (@pxref{find}).
  698. @item
  699. Load the kernel:
  700. @example
  701. grub> @kbd{kernel /vmlinuz root=/dev/hda1}
  702. @end example
  703. If you need to specify some kernel parameters, just append them to the
  704. command. For example, to set @option{vga} to @samp{ext}, do this:
  705. @example
  706. grub> @kbd{kernel /vmlinuz root=/dev/hda1 vga=ext}
  707. @end example
  708. See the documentation in the Linux source tree for complete
  709. information on the available options.
  710. @item
  711. If you use an initrd, execute the command @command{initrd}
  712. (@pxref{initrd}) after @command{kernel}:
  713. @example
  714. grub> @kbd{initrd /initrd}
  715. @end example
  716. @item
  717. Finally, run the command @command{boot} (@pxref{boot}).
  718. @end enumerate
  719. @strong{Caution:} If you use an initrd and specify the @samp{mem=}
  720. option to the kernel to let it use less than actual memory size, you
  721. will also have to specify the same memory size to GRUB. To let GRUB know
  722. the size, run the command @command{uppermem} @emph{before} loading the
  723. kernel. @xref{uppermem}, for more information.
  724. @node FreeBSD
  725. @subsection FreeBSD
  726. GRUB can load the kernel directly, either in ELF or a.out format. But
  727. this is not recommended, since FreeBSD's bootstrap interface sometimes
  728. changes heavily, so GRUB can't guarantee to pass kernel parameters
  729. correctly.
  730. Thus, we'd recommend loading the very flexible loader
  731. @file{/boot/loader} instead. See this example:
  732. @example
  733. @group
  734. grub> @kbd{root (hd0,a)}
  735. grub> @kbd{kernel /boot/loader}
  736. grub> @kbd{boot}
  737. @end group
  738. @end example
  739. @node NetBSD
  740. @subsection NetBSD
  741. GRUB can load NetBSD a.out and ELF directly, follow these steps:
  742. @enumerate
  743. @item
  744. Set GRUB's root device with @command{root} (@pxref{root}).
  745. @item
  746. Load the kernel with @command{kernel} (@pxref{kernel}). You should
  747. append the ugly option @option{--type=netbsd}, if you want to load an
  748. ELF kernel, like this:
  749. @example
  750. grub> @kbd{kernel --type=netbsd /netbsd-elf}
  751. @end example
  752. @item
  753. Run @command{boot} (@pxref{boot}).
  754. @end enumerate
  755. For now, however, GRUB doesn't allow you to pass kernel parameters, so
  756. it may be better to chain-load it instead. For more information, please
  757. see @ref{Chain-loading}.
  758. @node OpenBSD
  759. @subsection OpenBSD
  760. The booting instruction is exactly the same as for NetBSD
  761. (@pxref{NetBSD}).
  762. @node DOS/Windows
  763. @subsection DOS/Windows
  764. GRUB cannot boot DOS or Windows directly, so you must chain-load them
  765. (@pxref{Chain-loading}). However, their boot loaders have some critical
  766. deficiencies, so it may not work to just chain-load them. To overcome
  767. the problems, GRUB provides you with two helper functions.
  768. If you have installed DOS (or Windows) on a non-first hard disk, you
  769. have to use the disk swapping technique, because that OS cannot boot
  770. from any disks but the first one. The workaround used in GRUB is the
  771. command @command{map} (@pxref{map}), like this:
  772. @example
  773. @group
  774. grub> @kbd{map (hd0) (hd1)}
  775. grub> @kbd{map (hd1) (hd0)}
  776. @end group
  777. @end example
  778. This performs a @dfn{virtual} swap between your first and second hard
  779. drive.
  780. @strong{Caution:} This is effective only if DOS (or Windows) uses BIOS
  781. to access the swapped disks. If that OS uses a special driver for the
  782. disks, this probably won't work.
  783. Another problem arises if you installed more than one set of DOS/Windows
  784. onto one disk, because they could be confused if there are more than one
  785. primary partitions for DOS/Windows. Certainly you should avoid doing
  786. this, but there is a solution if you do want to do so. Use the partition
  787. hiding/unhiding technique.
  788. If GRUB @dfn{hide}s a DOS (or Windows) partition (@pxref{hide}), DOS (or
  789. Windows) will ignore the partition. If GRUB @dfn{unhide}s a DOS (or
  790. Windows) partition (@pxref{unhide}), DOS (or Windows) will detect the
  791. partition. Thus, if you have installed DOS (or Windows) on the first
  792. and the second partition of the first hard disk, and you want to boot
  793. the copy on the first partition, do the following:
  794. @example
  795. @group
  796. grub> @kbd{unhide (hd0,0)}
  797. grub> @kbd{hide (hd0,1)}
  798. grub> @kbd{rootnoverify (hd0,0)}
  799. grub> @kbd{chainloader +1}
  800. grub> @kbd{makeactive}
  801. grub> @kbd{boot}
  802. @end group
  803. @end example
  804. @node SCO UnixWare
  805. @subsection SCO UnixWare
  806. It is known that the signature in the boot loader for SCO UnixWare is
  807. wrong, so you will have to specify the option @option{--force} to
  808. @command{chainloader} (@pxref{chainloader}), like this:
  809. @example
  810. @group
  811. grub> @kbd{rootnoverify (hd1,0)}
  812. grub> @kbd{chainloader --force +1}
  813. grub> @kbd{makeactive}
  814. grub> @kbd{boot}
  815. @end group
  816. @end example
  817. @node QNX
  818. @subsection QNX
  819. QNX seems to use a bigger boot loader, so you need to boot it up, like
  820. this:
  821. @example
  822. @group
  823. grub> @kbd{rootnoverify (hd1,1)}
  824. grub> @kbd{chainloader +4}
  825. grub> @kbd{boot}
  826. @end group
  827. @end example
  828. @node Making your system robust
  829. @section How to make your system robust
  830. When you test a new kernel or a new OS, it is important to make sure
  831. that your computer can boot even if the new system is unbootable. This
  832. is crucial especially if you maintain servers or remote systems. To
  833. accomplish this goal, you need to set up two things:
  834. @enumerate
  835. @item
  836. You must maintain a system which is always bootable. For instance, if
  837. you test a new kernel, you need to keep a working kernel in a
  838. different place. And, it would sometimes be very nice to even have a
  839. complete copy of a working system in a different partition or disk.
  840. @item
  841. You must direct GRUB to boot a working system when the new system
  842. fails. This is possible with the @dfn{fallback} system in GRUB.
  843. @end enumerate
  844. The former requirement is very specific to each OS, so this
  845. documentation does not cover that topic. It is better to consult some
  846. backup tools.
  847. So let's see the GRUB part. There are two possibilities: one of them
  848. is quite simple but not very robust, and the other is a bit complex to
  849. set up but probably the best solution to make sure that your system
  850. can start as long as GRUB itself is bootable.
  851. @menu
  852. * Booting once-only::
  853. * Booting fallback systems::
  854. @end menu
  855. @node Booting once-only
  856. @subsection Booting once-only
  857. You can teach GRUB to boot an entry only at next boot time. Suppose
  858. that your have an old kernel @file{old_kernel} and a new kernel
  859. @file{new_kernel}. You know that @file{old_kernel} can boot
  860. your system correctly, and you want to test @file{new_kernel}.
  861. To ensure that your system will go back to the old kernel even if the
  862. new kernel fails (e.g. it panics), you can specify that GRUB should
  863. try the new kernel only once and boot the old kernel after that.
  864. First, modify your configuration file. Here is an example:
  865. @example
  866. @group
  867. default saved # This is important!!!
  868. timeout 10
  869. title the old kernel
  870. root (hd0,0)
  871. kernel /old_kernel
  872. savedefault
  873. title the new kernel
  874. root (hd0,0)
  875. kernel /new_kernel
  876. savedefault 0 # This is important!!!
  877. @end group
  878. @end example
  879. Note that this configuration file uses @samp{default saved}
  880. (@pxref{default}) at the head and @samp{savedefault 0}
  881. (@pxref{savedefault}) in the entry for the new kernel. This means
  882. that GRUB boots a saved entry by default, and booting the entry for the
  883. new kernel saves @samp{0} as the saved entry.
  884. With this configuration file, after all, GRUB always tries to boot the
  885. old kernel after it booted the new one, because @samp{0} is the entry
  886. of @code{the old kernel}.
  887. The next step is to tell GRUB to boot the new kernel at next boot
  888. time. For this, execute @command{grub-set-default} (@pxref{Invoking
  889. grub-set-default}):
  890. @example
  891. # @kbd{grub-set-default 1}
  892. @end example
  893. This command sets the saved entry to @samp{1}, that is, to the new
  894. kernel.
  895. This method is useful, but still not very robust, because GRUB stops
  896. booting, if there is any error in the boot entry, such that the new
  897. kernel has an invalid executable format. Thus, it it even better to
  898. use the @dfn{fallback} mechanism of GRUB. Look at next subsection for
  899. this feature.
  900. @node Booting fallback systems
  901. @subsection Booting fallback systems
  902. GRUB supports a fallback mechanism of booting one or more other
  903. entries if a default boot entry fails. You can specify multiple
  904. fallback entries if you wish.
  905. Suppose that you have three systems, @samp{A}, @samp{B} and
  906. @samp{C}. @samp{A} is a system which you want to boot by
  907. default. @samp{B} is a backup system which is supposed to boot
  908. safely. @samp{C} is another backup system which is used in case where
  909. @samp{B} is broken.
  910. Then you may want GRUB to boot the first system which is bootable
  911. among @samp{A}, @samp{B} and @samp{C}. A configuration file can be
  912. written in this way:
  913. @example
  914. @group
  915. default saved # This is important!!!
  916. timeout 10
  917. fallback 1 2 # This is important!!!
  918. title A
  919. root (hd0,0)
  920. kernel /kernel
  921. savedefault fallback # This is important!!!
  922. title B
  923. root (hd1,0)
  924. kernel /kernel
  925. savedefault fallback # This is important!!!
  926. title C
  927. root (hd2,0)
  928. kernel /kernel
  929. savedefault
  930. @end group
  931. @end example
  932. Note that @samp{default saved} (@pxref{default}), @samp{fallback 1 2}
  933. and @samp{savedefault fallback} are used. GRUB will boot a saved entry
  934. by default and save a fallback entry as next boot entry with this
  935. configuration.
  936. When GRUB tries to boot @samp{A}, GRUB saves @samp{1} as next boot
  937. entry, because the command @command{fallback} specifies that @samp{1}
  938. is the first fallback entry. The entry @samp{1} is @samp{B}, so GRUB
  939. will try to boot @samp{B} at next boot time.
  940. Likewise, when GRUB tries to boot @samp{B}, GRUB saves @samp{2} as
  941. next boot entry, because @command{fallback} specifies @samp{2} as next
  942. fallback entry. This makes sure that GRUB will boot @samp{C} after
  943. booting @samp{B}.
  944. It is noteworthy that GRUB uses fallback entries both when GRUB
  945. itself fails in booting an entry and when @samp{A} or @samp{B} fails
  946. in starting up your system. So this solution ensures that your system
  947. is started even if GRUB cannot find your kernel or if your kernel
  948. panics.
  949. However, you need to run @command{grub-set-default} (@pxref{Invoking
  950. grub-set-default}) when @samp{A} starts correctly or you fix @samp{A}
  951. after it crashes, since GRUB always sets next boot entry to a fallback
  952. entry. You should run this command in a startup script such as
  953. @file{rc.local} to boot @samp{A} by default:
  954. @example
  955. # @kbd{grub-set-default 0}
  956. @end example
  957. where @samp{0} is the number of the boot entry for the system
  958. @samp{A}.
  959. If you want to see what is current default entry, you can look at the
  960. file @file{/boot/grub/default} (or @file{/grub/default} in
  961. some systems). Because this file is plain-text, you can just
  962. @command{cat} this file. But it is strongly recommended @strong{not to
  963. modify this file directly}, because GRUB may fail in saving a default
  964. entry in this file, if you change this file in an unintended
  965. manner. Therefore, you should use @command{grub-set-default} when you
  966. need to change the default entry.
  967. @node Configuration
  968. @chapter Configuration
  969. You've probably noticed that you need to type several commands to boot your
  970. OS. There's a solution to that - GRUB provides a menu interface
  971. (@pxref{Menu interface}) from which you can select an item (using arrow
  972. keys) that will do everything to boot an OS.
  973. To enable the menu, you need a configuration file,
  974. @file{menu.lst} under the boot directory. We'll analyze an example
  975. file.
  976. The file first contains some general settings, the menu interface
  977. related options. You can put these commands (@pxref{Menu-specific
  978. commands}) before any of the items (starting with @command{title}
  979. (@pxref{title})).
  980. @example
  981. @group
  982. #
  983. # Sample boot menu configuration file
  984. #
  985. @end group
  986. @end example
  987. As you may have guessed, these lines are comments. Lines starting with a
  988. hash character (@samp{#}), and blank lines, are ignored by GRUB.
  989. @example
  990. @group
  991. # By default, boot the first entry.
  992. default 0
  993. @end group
  994. @end example
  995. The first entry (here, counting starts with number zero, not one!) will
  996. be the default choice.
  997. @example
  998. @group
  999. # Boot automatically after 30 secs.
  1000. timeout 30
  1001. @end group
  1002. @end example
  1003. As the comment says, GRUB will boot automatically in 30 seconds, unless
  1004. interrupted with a key press.
  1005. @example
  1006. @group
  1007. # Fallback to the second entry.
  1008. fallback 1
  1009. @end group
  1010. @end example
  1011. If, for any reason, the default entry doesn't work, fall back to the
  1012. second one (this is rarely used, for obvious reasons).
  1013. Note that the complete descriptions of these commands, which are menu
  1014. interface specific, can be found in @ref{Menu-specific
  1015. commands}. Other descriptions can be found in @ref{Commands}.
  1016. Now, on to the actual OS definitions. You will see that each entry
  1017. begins with a special command, @command{title} (@pxref{title}), and the
  1018. action is described after it. Note that there is no command
  1019. @command{boot} (@pxref{boot}) at the end of each item. That is because
  1020. GRUB automatically executes @command{boot} if it loads other commands
  1021. successfully.
  1022. The argument for the command @command{title} is used to display a short
  1023. title/description of the entry in the menu. Since @command{title}
  1024. displays the argument as is, you can write basically anything there.
  1025. @example
  1026. @group
  1027. # For booting GNU/Hurd
  1028. title GNU/Hurd
  1029. root (hd0,0)
  1030. kernel /boot/gnumach.gz root=hd0s1
  1031. module /boot/serverboot.gz
  1032. @end group
  1033. @end example
  1034. This boots GNU/Hurd from the first hard disk.
  1035. @example
  1036. @group
  1037. # For booting GNU/Linux
  1038. title GNU/Linux
  1039. kernel (hd1,0)/vmlinuz root=/dev/hdb1
  1040. @end group
  1041. @end example
  1042. This boots GNU/Linux, but from the second hard disk.
  1043. @example
  1044. @group
  1045. # For booting Mach (getting kernel from floppy)
  1046. title Utah Mach4 multiboot
  1047. root (hd0,2)
  1048. pause Insert the diskette now^G!!
  1049. kernel (fd0)/boot/kernel root=hd0s3
  1050. module (fd0)/boot/bootstrap
  1051. @end group
  1052. @end example
  1053. This boots Mach with a kernel on a floppy, but the root filesystem at
  1054. hd0s3. It also contains a @command{pause} line (@pxref{pause}), which
  1055. will cause GRUB to display a prompt and delay, before actually executing
  1056. the rest of the commands and booting.
  1057. @example
  1058. @group
  1059. # For booting FreeBSD
  1060. title FreeBSD
  1061. root (hd0,2,a)
  1062. kernel /boot/loader
  1063. @end group
  1064. @end example
  1065. This item will boot FreeBSD kernel loaded from the @samp{a} partition of
  1066. the third @sc{pc} slice of the first hard disk.
  1067. @example
  1068. @group
  1069. # For booting OS/2
  1070. title OS/2
  1071. root (hd0,1)
  1072. makeactive
  1073. # chainload OS/2 bootloader from the first sector
  1074. chainloader +1
  1075. # This is similar to "chainload", but loads a specific file
  1076. #chainloader /boot/chain.os2
  1077. @end group
  1078. @end example
  1079. This will boot OS/2, using a chain-loader (@pxref{Chain-loading}).
  1080. @example
  1081. @group
  1082. # For booting Windows NT or Windows95
  1083. title Windows NT / Windows 95 boot menu
  1084. root (hd0,0)
  1085. makeactive
  1086. chainloader +1
  1087. # For loading DOS if Windows NT is installed
  1088. # chainload /bootsect.dos
  1089. @end group
  1090. @end example
  1091. The same as the above, but for Windows.
  1092. @example
  1093. @group
  1094. # For installing GRUB into the hard disk
  1095. title Install GRUB into the hard disk
  1096. root (hd0,0)
  1097. setup (hd0)
  1098. @end group
  1099. @end example
  1100. This will just (re)install GRUB onto the hard disk.
  1101. @example
  1102. # Change the colors.
  1103. title Change the colors
  1104. color light-green/brown blink-red/blue
  1105. @end example
  1106. In the last entry, the command @command{color} is used (@pxref{color}),
  1107. to change the menu colors (try it!). This command is somewhat special,
  1108. because it can be used both in the command-line and in the menu. GRUB
  1109. has several such commands, see @ref{General commands}.
  1110. We hope that you now understand how to use the basic features of
  1111. GRUB. To learn more about GRUB, see the following chapters.
  1112. @node Network
  1113. @chapter Downloading OS images from a network
  1114. Although GRUB is a disk-based boot loader, it does provide network
  1115. support. To use the network support, you need to enable at least one
  1116. network driver in the GRUB build process. For more information please
  1117. see @file{netboot/README.netboot} in the source distribution.
  1118. @menu
  1119. * General usage of network support::
  1120. * Diskless::
  1121. @end menu
  1122. @node General usage of network support
  1123. @section How to set up your network
  1124. GRUB requires a file server and optionally a server that will assign an
  1125. IP address to the machine on which GRUB is running. For the former, only
  1126. TFTP is supported at the moment. The latter is either BOOTP, DHCP or a
  1127. RARP server@footnote{RARP is not advised, since it cannot serve much
  1128. information}. It is not necessary to run both the servers on one
  1129. computer. How to configure these servers is beyond the scope of this
  1130. document, so please refer to the manuals specific to those
  1131. protocols/servers.
  1132. If you decided to use a server to assign an IP address, set up the
  1133. server and run @command{bootp} (@pxref{bootp}), @command{dhcp}
  1134. (@pxref{dhcp}) or @command{rarp} (@pxref{rarp}) for BOOTP, DHCP or RARP,
  1135. respectively. Each command will show an assigned IP address, a netmask,
  1136. an IP address for your TFTP server and a gateway. If any of the
  1137. addresses is wrong or it causes an error, probably the configuration of
  1138. your servers isn't set up properly.
  1139. Otherwise, run @command{ifconfig}, like this:
  1140. @example
  1141. grub> @kbd{ifconfig --address=192.168.110.23 --server=192.168.110.14}
  1142. @end example
  1143. You can also use @command{ifconfig} in conjunction with @command{bootp},
  1144. @command{dhcp} or @command{rarp} (e.g. to reassign the server address
  1145. manually). @xref{ifconfig}, for more details.
  1146. Finally, download your OS images from your network. The network can be
  1147. accessed using the network drive @samp{(nd)}. Everything else is very
  1148. similar to the normal instructions (@pxref{Booting}).
  1149. Here is an example:
  1150. @example
  1151. @group
  1152. grub> @kbd{bootp}
  1153. Probing... [NE*000]
  1154. NE2000 base ...
  1155. Address: 192.168.110.23 Netmask: 255.255.255.0
  1156. Server: 192.168.110.14 Gateway: 192.168.110.1
  1157. grub> @kbd{root (nd)}
  1158. grub> @kbd{kernel /tftproot/gnumach.gz root=sd0s1}
  1159. grub> @kbd{module /tftproot/serverboot.gz}
  1160. grub> @kbd{boot}
  1161. @end group
  1162. @end example
  1163. @node Diskless
  1164. @section Booting from a network
  1165. It is sometimes very useful to boot from a network, especially when you
  1166. use a machine which has no local disk. In this case, you need to obtain
  1167. a kind of Net Boot @sc{rom}, such as a PXE @sc{rom} or a free software
  1168. package like Etherboot. Such a Boot @sc{rom} first boots the machine,
  1169. sets up the network card installed into the machine, and downloads a
  1170. second stage boot image from the network. Then, the second image will
  1171. try to boot an operating system actually from the network.
  1172. GRUB provides two second stage images, @file{nbgrub} and
  1173. @file{pxegrub} (@pxref{Images}). These images are the same as the
  1174. normal Stage 2, except that they set up a network automatically, and try
  1175. to load a configuration file from the network, if specified. The usage
  1176. is very simple: If the machine has a PXE @sc{rom}, use
  1177. @file{pxegrub}. If the machine has an NBI loader such as Etherboot, use
  1178. @file{nbgrub}. There is no difference between them except their
  1179. formats. Since the way to load a second stage image you want to use
  1180. should be described in the manual on your Net Boot @sc{rom}, please
  1181. refer to the manual, for more information.
  1182. However, there is one thing specific to GRUB. Namely, how to specify a
  1183. configuration file in a BOOTP/DHCP server. For now, GRUB uses the tag
  1184. @samp{150}, to get the name of a configuration file. The following is an
  1185. example with a BOOTP configuration:
  1186. @example
  1187. @group
  1188. .allhost:hd=/tmp:bf=null:\
  1189. :ds=145.71.35.1 145.71.32.1:\
  1190. :sm=255.255.254.0:\
  1191. :gw=145.71.35.1:\
  1192. :sa=145.71.35.5:
  1193. foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\
  1194. :bf=/nbgrub:\
  1195. :tc=.allhost:\
  1196. :T150="(nd)/tftpboot/menu.lst.foo":
  1197. @end group
  1198. @end example
  1199. Note that you should specify the drive name @code{(nd)} in the name of
  1200. the configuration file. This is because you might change the root drive
  1201. before downloading the configuration from the TFTP server when the
  1202. preset menu feature is used (@pxref{Preset Menu}).
  1203. See the manual of your BOOTP/DHCP server for more information. The
  1204. exact syntax should differ a little from the example.
  1205. @node Serial terminal
  1206. @chapter Using GRUB via a serial line
  1207. This chapter describes how to use the serial terminal support in GRUB.
  1208. If you have many computers or computers with no display/keyboard, it
  1209. could be very useful to control the computers through serial
  1210. communications. To connect one computer with another via a serial line,
  1211. you need to prepare a null-modem (cross) serial cable, and you may need
  1212. to have multiport serial boards, if your computer doesn't have extra
  1213. serial ports. In addition, a terminal emulator is also required, such as
  1214. minicom. Refer to a manual of your operating system, for more
  1215. information.
  1216. As for GRUB, the instruction to set up a serial terminal is quite
  1217. simple. First of all, make sure that you haven't specified the option
  1218. @option{--disable-serial} to the configure script when you built your
  1219. GRUB images. If you get them in binary form, probably they have serial
  1220. terminal support already.
  1221. Then, initialize your serial terminal after GRUB starts up. Here is an
  1222. example:
  1223. @example
  1224. @group
  1225. grub> @kbd{serial --unit=0 --speed=9600}
  1226. grub> @kbd{terminal serial}
  1227. @end group
  1228. @end example
  1229. The command @command{serial} initializes the serial unit 0 with the
  1230. speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if
  1231. you want to use COM2, you must specify @samp{--unit=1} instead. This
  1232. command accepts many other options, so please refer to @ref{serial},
  1233. for more details.
  1234. The command @command{terminal} (@pxref{terminal}) chooses which type of
  1235. terminal you want to use. In the case above, the terminal will be a
  1236. serial terminal, but you can also pass @code{console} to the command,
  1237. as @samp{terminal serial console}. In this case, a terminal in which
  1238. you press any key will be selected as a GRUB terminal.
  1239. However, note that GRUB assumes that your terminal emulator is
  1240. compatible with VT100 by default. This is true for most terminal
  1241. emulators nowadays, but you should pass the option @option{--dumb} to
  1242. the command if your terminal emulator is not VT100-compatible or
  1243. implements few VT100 escape sequences. If you specify this option then
  1244. GRUB provides you with an alternative menu interface, because the normal
  1245. menu requires several fancy features of your terminal.
  1246. @node Preset Menu
  1247. @chapter Embedding a configuration file into GRUB
  1248. GRUB supports a @dfn{preset menu} which is to be always loaded before
  1249. starting. The preset menu feature is useful, for example, when your
  1250. computer has no console but a serial cable. In this case, it is
  1251. critical to set up the serial terminal as soon as possible, since you
  1252. cannot see any message until the serial terminal begins to work. So it
  1253. is good to run the commands @command{serial} (@pxref{serial}) and
  1254. @command{terminal} (@pxref{terminal}) before anything else at the
  1255. start-up time.
  1256. How the preset menu works is slightly complicated:
  1257. @enumerate
  1258. @item
  1259. GRUB checks if the preset menu feature is used, and loads the preset
  1260. menu, if available. This includes running commands and reading boot
  1261. entries, like an ordinary configuration file.
  1262. @item
  1263. GRUB checks if the configuration file is available. Note that this check
  1264. is performed @strong{regardless of the existence of the preset
  1265. menu}. The configuration file is loaded even if the preset menu was
  1266. loaded.
  1267. @item
  1268. If the preset menu includes any boot entries, they are cleared when
  1269. the configuration file is loaded. It doesn't matter whether the
  1270. configuration file has any entries or no entry. The boot entries in the
  1271. preset menu are used only when GRUB fails in loading the configuration
  1272. file.
  1273. @end enumerate
  1274. To enable the preset menu feature, you must rebuild GRUB specifying a
  1275. file to the configure script with the option
  1276. @option{--enable-preset-menu}. The file has the same semantics as
  1277. normal configuration files (@pxref{Configuration}).
  1278. Another point you should take care is that the diskless support
  1279. (@pxref{Diskless}) diverts the preset menu. Diskless images embed a
  1280. preset menu to execute the command @command{bootp} (@pxref{bootp})
  1281. automatically, unless you specify your own preset menu to the configure
  1282. script. This means that you must put commands to initialize a network in
  1283. the preset menu yourself, because diskless images don't set it up
  1284. implicitly, when you use the preset menu explicitly.
  1285. Therefore, a typical preset menu used with diskless support would be
  1286. like this:
  1287. @example
  1288. @group
  1289. # Set up the serial terminal, first of all.
  1290. serial --unit=0 --speed=19200
  1291. terminal --timeout=0 serial
  1292. # Initialize the network.
  1293. dhcp
  1294. @end group
  1295. @end example
  1296. @node Security
  1297. @chapter Protecting your computer from cracking
  1298. You may be interested in how to prevent ordinary users from doing
  1299. whatever they like, if you share your computer with other people. So
  1300. this chapter describes how to improve the security of GRUB.
  1301. One thing which could be a security hole is that the user can do too
  1302. many things with GRUB, because GRUB allows one to modify its configuration
  1303. and run arbitrary commands at run-time. For example, the user can even
  1304. read @file{/etc/passwd} in the command-line interface by the command
  1305. @command{cat} (@pxref{cat}). So it is necessary to disable all the
  1306. interactive operations.
  1307. Thus, GRUB provides a @dfn{password} feature, so that only administrators
  1308. can start the interactive operations (i.e. editing menu entries and
  1309. entering the command-line interface). To use this feature, you need to
  1310. run the command @command{password} in your configuration file
  1311. (@pxref{password}), like this:
  1312. @example
  1313. password --md5 PASSWORD
  1314. @end example
  1315. If this is specified, GRUB disallows any interactive control, until you
  1316. press the key @key{p} and enter a correct password. The option
  1317. @option{--md5} tells GRUB that @samp{PASSWORD} is in MD5 format. If it
  1318. is omitted, GRUB assumes the @samp{PASSWORD} is in clear text.
  1319. You can encrypt your password with the command @command{md5crypt}
  1320. (@pxref{md5crypt}). For example, run the grub shell (@pxref{Invoking the
  1321. grub shell}), and enter your password:
  1322. @example
  1323. @group
  1324. grub> md5crypt
  1325. Password: **********
  1326. Encrypted: $1$U$JK7xFegdxWH6VuppCUSIb.
  1327. @end group
  1328. @end example
  1329. Then, cut and paste the encrypted password to your configuration file.
  1330. Also, you can specify an optional argument to @command{password}. See
  1331. this example:
  1332. @example
  1333. password PASSWORD /boot/grub/menu-admin.lst
  1334. @end example
  1335. In this case, GRUB will load @file{/boot/grub/menu-admin.lst} as a
  1336. configuration file when you enter the valid password.
  1337. Another thing which may be dangerous is that any user can choose any
  1338. menu entry. Usually, this wouldn't be problematic, but you might want to
  1339. permit only administrators to run some of your menu entries, such as an
  1340. entry for booting an insecure OS like DOS.
  1341. GRUB provides the command @command{lock} (@pxref{lock}). This command
  1342. always fails until you enter the valid password, so you can use it, like
  1343. this:
  1344. @example
  1345. @group
  1346. title Boot DOS
  1347. lock
  1348. rootnoverify (hd0,1)
  1349. makeactive
  1350. chainload +1
  1351. @end group
  1352. @end example
  1353. You should insert @command{lock} right after @command{title}, because
  1354. any user can execute commands in an entry until GRUB encounters
  1355. @command{lock}.
  1356. You can also use the command @command{password} instead of
  1357. @command{lock}. In this case the boot process will ask for the password
  1358. and stop if it was entered incorrectly. Since the @command{password}
  1359. takes its own @var{PASSWORD} argument this is useful if you want
  1360. different passwords for different entries.
  1361. @node Images
  1362. @chapter GRUB image files
  1363. GRUB consists of several images: two essential stages, optional stages
  1364. called @dfn{Stage 1.5}, one image for bootable CD-ROM, and two network
  1365. boot images. Here is a short overview of them. @xref{Internals}, for
  1366. more details.
  1367. @table @file
  1368. @item stage1
  1369. This is an essential image used for booting up GRUB. Usually, this is
  1370. embedded in an MBR or the boot sector of a partition. Because a PC boot
  1371. sector is 512 bytes, the size of this image is exactly 512 bytes.
  1372. All @file{stage1} must do is to load Stage 2 or Stage 1.5 from a local
  1373. disk. Because of the size restriction, @file{stage1} encodes the
  1374. location of Stage 2 (or Stage 1.5) in a blocklist format, so it never
  1375. understand any filesystem structure.
  1376. @item stage2
  1377. This is the core image of GRUB. It does everything but booting up
  1378. itself. Usually, this is put in a filesystem, but that is not required.
  1379. @item e2fs_stage1_5
  1380. @itemx fat_stage1_5
  1381. @itemx ffs_stage1_5
  1382. @itemx jfs_stage1_5
  1383. @itemx minix_stage1_5
  1384. @itemx reiserfs_stage1_5
  1385. @itemx vstafs_stage1_5
  1386. @itemx xfs_stage1_5
  1387. These are called @dfn{Stage 1.5}, because they serve as a bridge
  1388. between @file{stage1} and @file{stage2}, that is to say, Stage 1.5 is
  1389. loaded by Stage 1 and Stage 1.5 loads Stage 2. The difference between
  1390. @file{stage1} and @file{*_stage1_5} is that the former doesn't
  1391. understand any filesystem while the latter understands one filesystem
  1392. (e.g. @file{e2fs_stage1_5} understands ext2fs). So you can move the
  1393. Stage 2 image to another location safely, even after GRUB has been
  1394. installed.
  1395. While Stage 2 cannot generally be embedded in a fixed area as the size
  1396. is so large, Stage 1.5 can be installed into the area right after an MBR,
  1397. or the boot loader area of a ReiserFS or a FFS.
  1398. @item stage2_eltorito
  1399. This is a boot image for CD-ROMs using the @dfn{no emulation mode} in
  1400. El Torito specification. This is identical to Stage 2, except that
  1401. this boots up without Stage 1 and sets up a special drive @samp{(cd)}.
  1402. @item nbgrub
  1403. This is a network boot image for the Network Image Proposal used by some
  1404. network boot loaders, such as Etherboot. This is mostly the same as
  1405. Stage 2, but it also sets up a network and loads a configuration file
  1406. from the network.
  1407. @item pxegrub
  1408. This is another network boot image for the Preboot Execution Environment
  1409. used by several Netboot ROMs. This is identical to @file{nbgrub}, except
  1410. for the format.
  1411. @end table
  1412. @node Filesystem
  1413. @chapter Filesystem syntax and semantics
  1414. GRUB uses a special syntax for specifying disk drives which can be
  1415. accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
  1416. between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
  1417. device is equivalent to which OS device. Normally, that will be clear if
  1418. you see the files in a device or use the command @command{find}
  1419. (@pxref{find}).
  1420. @menu
  1421. * Device syntax:: How to specify devices
  1422. * File name syntax:: How to specify files
  1423. * blocklist syntax:: How to specify blocklists
  1424. @end menu
  1425. @node Device syntax
  1426. @section How to specify devices
  1427. The device syntax is like this:
  1428. @example
  1429. @code{(@var{device}[,@var{part-num}][,@var{bsd-subpart-letter}])}
  1430. @end example
  1431. @samp{[]} means the parameter is optional. @var{device} should be
  1432. either @samp{fd} or @samp{hd} followed by a digit, like @samp{fd0}.
  1433. But you can also set @var{device} to a hexadecimal or a decimal number
  1434. which is a BIOS drive number, so the following are equivalent:
  1435. @example
  1436. (hd0)
  1437. (0x80)
  1438. (128)
  1439. @end example
  1440. @var{part-num} represents the partition number of @var{device}, starting
  1441. from zero for primary partitions and from four for extended partitions,
  1442. and @var{bsd-subpart-letter} represents the BSD disklabel subpartition,
  1443. such as @samp{a} or @samp{e}.
  1444. A shortcut for specifying BSD subpartitions is
  1445. @code{(@var{device},@var{bsd-subpart-letter})}, in this case, GRUB
  1446. searches for the first PC partition containing a BSD disklabel, then
  1447. finds the subpartition @var{bsd-subpart-letter}. Here is an example:
  1448. @example
  1449. (hd0,a)
  1450. @end example
  1451. The syntax @samp{(hd0)} represents using the entire disk (or the
  1452. MBR when installing GRUB), while the syntax @samp{(hd0,0)}
  1453. represents using the first partition of the disk (or the boot sector
  1454. of the partition when installing GRUB).
  1455. If you enabled the network support, the special drive, @samp{(nd)}, is
  1456. also available. Before using the network drive, you must initialize the
  1457. network. @xref{Network}, for more information.
  1458. If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making
  1459. a GRUB bootable CD-ROM}, for details.
  1460. @node File name syntax
  1461. @section How to specify files
  1462. There are two ways to specify files, by @dfn{absolute file name} and by
  1463. @dfn{blocklist}.
  1464. An absolute file name resembles a Unix absolute file name, using
  1465. @samp{/} for the directory separator (not @samp{\} as in DOS). One
  1466. example is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file
  1467. @file{/boot/grub/menu.lst} in the first partition of the first hard
  1468. disk. If you omit the device name in an absolute file name, GRUB uses
  1469. GRUB's @dfn{root device} implicitly. So if you set the root device to,
  1470. say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then
  1471. @code{/boot/kernel} is the same as @code{(hd1,0)/boot/kernel}.
  1472. @node blocklist syntax
  1473. @section How to specify blocklists
  1474. A blocklist is used for specifying a file that doesn't appear in the
  1475. filesystem, like a chainloader. The syntax is
  1476. @code{[@var{offset}]+@var{length}[,[@var{offset}]+@var{length}]@dots{}}.
  1477. Here is an example:
  1478. @example
  1479. @code{0+100,200+1,300+300}
  1480. @end example
  1481. This represents that GRUB should read blocks 0 through 99, block 200,
  1482. and blocks 300 through 599. If you omit an offset, then GRUB assumes
  1483. the offset is zero.
  1484. Like the file name syntax (@pxref{File name syntax}), if a blocklist
  1485. does not contain a device name, then GRUB uses GRUB's @dfn{root
  1486. device}. So @code{(hd0,1)+1} is the same as @code{+1} when the root
  1487. device is @samp{(hd0,1)}.
  1488. @node Interface
  1489. @chapter GRUB's user interface
  1490. GRUB has both a simple menu interface for choosing preset entries from a
  1491. configuration file, and a highly flexible command-line for performing
  1492. any desired combination of boot commands.
  1493. GRUB looks for its configuration file as soon as it is loaded. If one
  1494. is found, then the full menu interface is activated using whatever
  1495. entries were found in the file. If you choose the @dfn{command-line} menu
  1496. option, or if the configuration file was not found, then GRUB drops to
  1497. the command-line interface.
  1498. @menu
  1499. * Command-line interface:: The flexible command-line interface
  1500. * Menu interface:: The simple menu interface
  1501. * Menu entry editor:: Editing a menu entry
  1502. * Hidden menu interface:: The hidden menu interface
  1503. @end menu
  1504. @node Command-line interface
  1505. @section The flexible command-line interface
  1506. The command-line interface provides a prompt and after it an editable
  1507. text area much like a command-line in Unix or DOS. Each command is
  1508. immediately executed after it is entered@footnote{However, this
  1509. behavior will be changed in the future version, in a user-invisible
  1510. way.}. The commands (@pxref{Command-line and menu entry commands}) are a
  1511. subset of those available in the configuration file, used with exactly
  1512. the same syntax.
  1513. Cursor movement and editing of the text on the line can be done via a
  1514. subset of the functions available in the Bash shell:
  1515. @table @key
  1516. @item C-f
  1517. @itemx PC right key
  1518. Move forward one character.
  1519. @item C-b
  1520. @itemx PC left key
  1521. Move back one character.
  1522. @item C-a
  1523. @itemx HOME
  1524. Move to the start of the line.
  1525. @item C-e
  1526. @itemx END
  1527. Move the the end of the line.
  1528. @item C-d
  1529. @itemx DEL
  1530. Delete the character underneath the cursor.
  1531. @item C-h
  1532. @itemx BS
  1533. Delete the character to the left of the cursor.
  1534. @item C-k
  1535. Kill the text from the current cursor position to the end of the line.
  1536. @item C-u
  1537. Kill backward from the cursor to the beginning of the line.
  1538. @item C-y
  1539. Yank the killed text back into the buffer at the cursor.
  1540. @item C-p
  1541. @itemx PC up key
  1542. Move up through the history list.
  1543. @item C-n
  1544. @itemx PC down key
  1545. Move down through the history list.
  1546. @end table
  1547. When typing commands interactively, if the cursor is within or before
  1548. the first word in the command-line, pressing the @key{TAB} key (or
  1549. @key{C-i}) will display a listing of the available commands, and if the
  1550. cursor is after the first word, the @kbd{@key{TAB}} will provide a
  1551. completion listing of disks, partitions, and file names depending on the
  1552. context. Note that to obtain a list of drives, one must open a
  1553. parenthesis, as @command{root (}.
  1554. Note that you cannot use the completion functionality in the TFTP
  1555. filesystem. This is because TFTP doesn't support file name listing for
  1556. the security.
  1557. @node Menu interface
  1558. @section The simple menu interface
  1559. The menu interface is quite easy to use. Its commands are both
  1560. reasonably intuitive and described on screen.
  1561. Basically, the menu interface provides a list of @dfn{boot entries} to
  1562. the user to choose from. Use the arrow keys to select the entry of
  1563. choice, then press @key{RET} to run it. An optional timeout is
  1564. available to boot the default entry (the first one if not set), which is
  1565. aborted by pressing any key.
  1566. Commands are available to enter a bare command-line by pressing @key{c}
  1567. (which operates exactly like the non-config-file version of GRUB, but
  1568. allows one to return to the menu if desired by pressing @key{ESC}) or to
  1569. edit any of the @dfn{boot entries} by pressing @key{e}.
  1570. If you protect the menu interface with a password (@pxref{Security}),
  1571. all you can do is choose an entry by pressing @key{RET}, or press
  1572. @key{p} to enter the password.
  1573. @node Menu entry editor
  1574. @section Editing a menu entry
  1575. The menu entry editor looks much like the main menu interface, but the
  1576. lines in the menu are individual commands in the selected entry instead
  1577. of entry names.
  1578. If an @key{ESC} is pressed in the editor, it aborts all the changes made
  1579. to the configuration entry and returns to the main menu interface.
  1580. When a particular line is selected, the editor places the user in a
  1581. special version of the GRUB command-line to edit that line. When the
  1582. user hits @key{RET}, GRUB replaces the line in question in the boot
  1583. entry with the changes (unless it was aborted via @key{ESC},
  1584. in which case the changes are thrown away).
  1585. If you want to add a new line to the menu entry, press @key{o} if adding
  1586. a line after the current line or press @key{O} if before the current
  1587. line.
  1588. To delete a line, hit the key @key{d}. Although GRUB unfortunately
  1589. does not support @dfn{undo}, you can do almost the same thing by just
  1590. returning to the main menu.
  1591. @node Hidden menu interface
  1592. @section The hidden menu interface
  1593. When your terminal is dumb or you request GRUB to hide the menu
  1594. interface explicitly with the command @command{hiddenmenu}
  1595. (@pxref{hiddenmenu}), GRUB doesn't show the menu interface (@pxref{Menu
  1596. interface}) and automatically boots the default entry, unless
  1597. interrupted by pressing @key{ESC}.
  1598. When you interrupt the timeout and your terminal is dumb, GRUB falls
  1599. back to the command-line interface (@pxref{Command-line interface}).
  1600. @node Commands
  1601. @chapter The list of available commands
  1602. In this chapter, we list all commands that are available in GRUB.
  1603. Commands belong to different groups. A few can only be used in
  1604. the global section of the configuration file (or ``menu''); most
  1605. of them can be entered on the command-line and can be used either
  1606. anywhere in the menu or specifically in the menu entries.
  1607. @menu
  1608. * Menu-specific commands::
  1609. * General commands::
  1610. * Command-line and menu entry commands::
  1611. @end menu
  1612. @node Menu-specific commands
  1613. @section The list of commands for the menu only
  1614. The semantics used in parsing the configuration file are the following:
  1615. @itemize @bullet
  1616. @item
  1617. The menu-specific commands have to be used before any others.
  1618. @item
  1619. The files @emph{must} be in plain-text format.
  1620. @item
  1621. @samp{#} at the beginning of a line in a configuration file means it is
  1622. only a comment.
  1623. @item
  1624. Options are separated by spaces.
  1625. @item
  1626. All numbers can be either decimal or hexadecimal. A hexadecimal number
  1627. must be preceded by @samp{0x}, and is case-insensitive.
  1628. @item
  1629. Extra options or text at the end of the line are ignored unless otherwise
  1630. specified.
  1631. @item
  1632. Unrecognized commands are added to the current entry, except before entries
  1633. start, where they are ignored.
  1634. @end itemize
  1635. These commands can only be used in the menu:
  1636. @menu
  1637. * default:: Set the default entry
  1638. * fallback:: Set the fallback entry
  1639. * hiddenmenu:: Hide the menu interface
  1640. * timeout:: Set the timeout
  1641. * title:: Start a menu entry
  1642. @end menu
  1643. @node default
  1644. @subsection default
  1645. @deffn Command default num
  1646. Set the default entry to the entry number @var{num}. Numbering starts
  1647. from 0, and the entry number 0 is the default if the command is not
  1648. used.
  1649. You can specify @samp{saved} instead of a number. In this case, the
  1650. default entry is the entry saved with the command
  1651. @command{savedefault}. @xref{savedefault}, for more information.
  1652. @end deffn
  1653. @node fallback
  1654. @subsection fallback
  1655. @deffn Command fallback num...
  1656. Go into unattended boot mode: if the default boot entry has any errors,
  1657. instead of waiting for the user to do something, immediately start
  1658. over using the @var{num} entry (same numbering as the @code{default}
  1659. command (@pxref{default})). This obviously won't help if the machine was
  1660. rebooted by a kernel that GRUB loaded. You can specify multiple
  1661. fallback entry numbers.
  1662. @end deffn
  1663. @node hiddenmenu
  1664. @subsection hiddenmenu
  1665. @deffn Command hiddenmenu
  1666. Don't display the menu. If the command is used, no menu will be
  1667. displayed on the control terminal, and the default entry will be
  1668. booted after the timeout expired. The user can still request the
  1669. menu to be displayed by pressing @key{ESC} before the timeout
  1670. expires. See also @ref{Hidden menu interface}.
  1671. @end deffn
  1672. @node timeout
  1673. @subsection timeout
  1674. @deffn Command timeout sec
  1675. Set a timeout, in @var{sec} seconds, before automatically booting the
  1676. default entry (normally the first entry defined).
  1677. @end deffn
  1678. @node title
  1679. @subsection title
  1680. @deffn Command title name @dots{}
  1681. Start a new boot entry, and set its name to the contents of the rest of
  1682. the line, starting with the first non-space character.
  1683. @end deffn
  1684. @node General commands
  1685. @section The list of general commands
  1686. Commands usable anywhere in the menu and in the command-line.
  1687. @menu
  1688. * bootp:: Initialize a network device via BOOTP
  1689. * color:: Color the menu interface
  1690. * device:: Specify a file as a drive
  1691. * dhcp:: Initialize a network device via DHCP
  1692. * hide:: Hide a partition
  1693. * ifconfig:: Configure a network device manually
  1694. * pager:: Change the state of the internal pager
  1695. * partnew:: Make a primary partition
  1696. * parttype:: Change the type of a partition
  1697. * password:: Set a password for the menu interface
  1698. * rarp:: Initialize a network device via RARP
  1699. * serial:: Set up a serial device
  1700. * setkey:: Configure the key map
  1701. * terminal:: Choose a terminal
  1702. * terminfo:: Define escape sequences for a terminal
  1703. * tftpserver:: Specify a TFTP server
  1704. * unhide:: Unhide a partition
  1705. @end menu
  1706. @node bootp
  1707. @subsection bootp
  1708. @deffn Command bootp [@option{--with-configfile}]
  1709. Initialize a network device via the @dfn{BOOTP} protocol. This command
  1710. is only available if GRUB is compiled with netboot support. See also
  1711. @ref{Network}.
  1712. If you specify @option{--with-configfile} to this command, GRUB will
  1713. fetch and load a configuration file specified by your BOOTP server
  1714. with the vendor tag @samp{150}.
  1715. @end deffn
  1716. @node color
  1717. @subsection color
  1718. @deffn Command color normal [highlight]
  1719. Change the menu colors. The color @var{normal} is used for most
  1720. lines in the menu (@pxref{Menu interface}), and the color
  1721. @var{highlight} is used to highlight the line where the cursor
  1722. points. If you omit @var{highlight}, then the inverted color of
  1723. @var{normal} is used for the highlighted line. The format of a color is
  1724. @code{@var{foreground}/@var{background}}. @var{foreground} and
  1725. @var{background} are symbolic color names. A symbolic color name must be
  1726. one of these:
  1727. @itemize @bullet
  1728. @item
  1729. black
  1730. @item
  1731. blue
  1732. @item
  1733. green
  1734. @item
  1735. cyan
  1736. @item
  1737. red
  1738. @item
  1739. magenta
  1740. @item
  1741. brown
  1742. @item
  1743. light-gray
  1744. @strong{These below can be specified only for the foreground.}
  1745. @item
  1746. dark-gray
  1747. @item
  1748. light-blue
  1749. @item
  1750. light-green
  1751. @item
  1752. light-cyan
  1753. @item
  1754. light-red
  1755. @item
  1756. light-magenta
  1757. @item
  1758. yellow
  1759. @item
  1760. white
  1761. @end itemize
  1762. But only the first eight names can be used for @var{background}. You can
  1763. prefix @code{blink-} to @var{foreground} if you want a blinking
  1764. foreground color.
  1765. This command can be used in the configuration file and on the command
  1766. line, so you may write something like this in your configuration file:
  1767. @example
  1768. @group
  1769. # Set default colors.
  1770. color light-gray/blue black/light-gray
  1771. # Change the colors.
  1772. title OS-BS like
  1773. color magenta/blue black/magenta
  1774. @end group
  1775. @end example
  1776. @end deffn
  1777. @node device
  1778. @subsection device
  1779. @deffn Command device drive file
  1780. In the grub shell, specify the file @var{file} as the actual drive for a
  1781. @sc{bios} drive @var{drive}. You can use this command to create a disk
  1782. image, and/or to fix the drives guessed by GRUB when GRUB fails to
  1783. determine them correctly, like this:
  1784. @example
  1785. @group
  1786. grub> @kbd{device (fd0) /floppy-image}
  1787. grub> @kbd{device (hd0) /dev/sd0}
  1788. @end group
  1789. @end example
  1790. This command can be used only in the grub shell (@pxref{Invoking the
  1791. grub shell}).
  1792. @end deffn
  1793. @node dhcp
  1794. @subsection dhcp
  1795. @deffn Command dhcp [--with-configfile]
  1796. Initialize a network device via the @dfn{DHCP} protocol. Currently,
  1797. this command is just an alias for @command{bootp}, since the two
  1798. protocols are very similar. This command is only available if GRUB is
  1799. compiled with netboot support. See also @ref{Network}.
  1800. If you specify @option{--with-configfile} to this command, GRUB will
  1801. fetch and load a configuration file specified by your DHCP server
  1802. with the vendor tag @samp{150}.
  1803. @end deffn
  1804. @node hide
  1805. @subsection hide
  1806. @deffn Command hide partition
  1807. Hide the partition @var{partition} by setting the @dfn{hidden} bit in
  1808. its partition type code. This is useful only when booting DOS or Windows
  1809. and multiple primary FAT partitions exist in one disk. See also
  1810. @ref{DOS/Windows}.
  1811. @end deffn
  1812. @node ifconfig
  1813. @subsection ifconfig
  1814. @deffn Command ifconfig [@option{--server=server}] [@option{--gateway=gateway}] [@option{--mask=mask}] [@option{--address=address}]
  1815. Configure the IP address, the netmask, the gateway, and the server
  1816. address of a network device manually. The values must be in dotted
  1817. decimal format, like @samp{192.168.11.178}. The order of the options is
  1818. not important. This command shows current network configuration, if no
  1819. option is specified. See also @ref{Network}.
  1820. @end deffn
  1821. @node pager
  1822. @subsection pager
  1823. @deffn Command pager [flag]
  1824. Toggle or set the state of the internal pager. If @var{flag} is
  1825. @samp{on}, the internal pager is enabled. If @var{flag} is @samp{off},
  1826. it is disabled. If no argument is given, the state is toggled.
  1827. @end deffn
  1828. @node partnew
  1829. @subsection partnew
  1830. @deffn Command partnew part type from len
  1831. Create a new primary partition. @var{part} is a partition specification
  1832. in GRUB syntax (@pxref{Naming convention}); @var{type} is the partition
  1833. type and must be a number in the range @code{0-0xff}; @var{from} is
  1834. the starting address and @var{len} is the length, both in sector units.
  1835. @end deffn
  1836. @node parttype
  1837. @subsection parttype
  1838. @deffn Command parttype part type
  1839. Change the type of an existing partition. @var{part} is a partition
  1840. specification in GRUB syntax (@pxref{Naming convention}); @var{type}
  1841. is the new partition type and must be a number in the range 0-0xff.
  1842. @end deffn
  1843. @node password
  1844. @subsection password
  1845. @deffn Command password [@option{--md5}] passwd [new-config-file]
  1846. If used in the first section of a menu file, disable all interactive
  1847. editing control (menu entry editor and command-line) and entries
  1848. protected by the command @command{lock}. If the password @var{passwd} is
  1849. entered, it loads the @var{new-config-file} as a new config file and
  1850. restarts the GRUB Stage 2, if @var{new-config-file} is
  1851. specified. Otherwise, GRUB will just unlock the privileged instructions.
  1852. You can also use this command in the script section, in which case it
  1853. will ask for the password, before continuing. The option
  1854. @option{--md5} tells GRUB that @var{passwd} is encrypted with
  1855. @command{md5crypt} (@pxref{md5crypt}).
  1856. @end deffn
  1857. @node rarp
  1858. @subsection rarp
  1859. @deffn Command rarp
  1860. Initialize a network device via the @dfn{RARP} protocol. This command
  1861. is only available if GRUB is compiled with netboot support. See also
  1862. @ref{Network}.
  1863. @end deffn
  1864. @node serial
  1865. @subsection serial
  1866. @deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}] [@option{--device=dev}]
  1867. Initialize a serial device. @var{unit} is a number in the range 0-3
  1868. specifying which serial port to use; default is 0, which corresponds to
  1869. the port often called COM1. @var{port} is the I/O port where the UART
  1870. is to be found; if specified it takes precedence over @var{unit}.
  1871. @var{speed} is the transmission speed; default is 9600. @var{word} and
  1872. @var{stop} are the number of data bits and stop bits. Data bits must
  1873. be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
  1874. bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd},
  1875. @samp{even} and defaults to @samp{no}. The option @option{--device}
  1876. can only be used in the grub shell and is used to specify the
  1877. tty device to be used in the host operating system (@pxref{Invoking the
  1878. grub shell}).
  1879. The serial port is not used as a communication channel unless the
  1880. @command{terminal} command is used (@pxref{terminal}).
  1881. This command is only available if GRUB is compiled with serial
  1882. support. See also @ref{Serial terminal}.
  1883. @end deffn
  1884. @node setkey
  1885. @subsection setkey
  1886. @deffn Command setkey [to_key from_key]
  1887. Change the keyboard map. The key @var{from_key} is mapped to the key
  1888. @var{to_key}. If no argument is specified, reset key mappings. Note that
  1889. this command @emph{does not} exchange the keys. If you want to exchange
  1890. the keys, run this command again with the arguments exchanged, like this:
  1891. @example
  1892. grub> @kbd{setkey capslock control}
  1893. grub> @kbd{setkey control capslock}
  1894. @end example
  1895. A key must be an alphabet letter, a digit, or one of these symbols:
  1896. @samp{escape}, @samp{exclam}, @samp{at}, @samp{numbersign},
  1897. @samp{dollar}, @samp{percent}, @samp{caret}, @samp{ampersand},
  1898. @samp{asterisk}, @samp{parenleft}, @samp{parenright}, @samp{minus},
  1899. @samp{underscore}, @samp{equal}, @samp{plus}, @samp{backspace},
  1900. @samp{tab}, @samp{bracketleft}, @samp{braceleft}, @samp{bracketright},
  1901. @samp{braceright}, @samp{enter}, @samp{control}, @samp{semicolon},
  1902. @samp{colon}, @samp{quote}, @samp{doublequote}, @samp{backquote},
  1903. @samp{tilde}, @samp{shift}, @samp{backslash}, @samp{bar}, @samp{comma},
  1904. @samp{less}, @samp{period}, @samp{greater}, @samp{slash},
  1905. @samp{question}, @samp{alt}, @samp{space}, @samp{capslock}, @samp{FX}
  1906. (@samp{X} is a digit), and @samp{delete}. This table describes to which
  1907. character each of the symbols corresponds:
  1908. @table @samp
  1909. @item exclam
  1910. @samp{!}
  1911. @item at
  1912. @samp{@@}
  1913. @item numbersign
  1914. @samp{#}
  1915. @item dollar
  1916. @samp{$}
  1917. @item percent
  1918. @samp{%}
  1919. @item caret
  1920. @samp{^}
  1921. @item ampersand
  1922. @samp{&}
  1923. @item asterisk
  1924. @samp{*}
  1925. @item parenleft
  1926. @samp{(}
  1927. @item parenright
  1928. @samp{)}
  1929. @item minus
  1930. @samp{-}
  1931. @item underscore
  1932. @samp{_}
  1933. @item equal
  1934. @samp{=}
  1935. @item plus
  1936. @samp{+}
  1937. @item bracketleft
  1938. @samp{[}
  1939. @item braceleft
  1940. @samp{@{}
  1941. @item bracketright
  1942. @samp{]}
  1943. @item braceright
  1944. @samp{@}}
  1945. @item semicolon
  1946. @samp{;}
  1947. @item colon
  1948. @samp{:}
  1949. @item quote
  1950. @samp{'}
  1951. @item doublequote
  1952. @samp{"}
  1953. @item backquote
  1954. @samp{`}
  1955. @item tilde
  1956. @samp{~}
  1957. @item backslash
  1958. @samp{\}
  1959. @item bar
  1960. @samp{|}
  1961. @item comma
  1962. @samp{,}
  1963. @item less
  1964. @samp{<}
  1965. @item period
  1966. @samp{.}
  1967. @item greater
  1968. @samp{>}
  1969. @item slash
  1970. @samp{/}
  1971. @item question
  1972. @samp{?}
  1973. @item space
  1974. @samp{ }
  1975. @end table
  1976. @end deffn
  1977. @node terminal
  1978. @subsection terminal
  1979. @deffn Command terminal [@option{--dumb}] [@option{--no-echo}] [@option{--no-edit}] [@option{--timeout=secs}] [@option{--lines=lines}] [@option{--silent}] [@option{console}] [@option{serial}] [@option{hercules}]
  1980. Select a terminal for user interaction. The terminal is assumed to be
  1981. VT100-compatible unless @option{--dumb} is specified. If both
  1982. @option{console} and @option{serial} are specified, then GRUB will use
  1983. the one where a key is entered first or the first when the timeout
  1984. expires. If neither are specified, the current setting is
  1985. reported. This command is only available if GRUB is compiled with serial
  1986. support. See also @ref{Serial terminal}.
  1987. This may not make sense for most users, but GRUB supports Hercules
  1988. console as well. Hercules console is usable like the ordinary console,
  1989. and the usage is quite similar to that for serial terminals: specify
  1990. @option{hercules} as the argument.
  1991. The option @option{--lines} defines the number of lines in your
  1992. terminal, and it is used for the internal pager function. If you don't
  1993. specify this option, the number is assumed as 24.
  1994. The option @option{--silent} suppresses the message to prompt you to
  1995. hit any key. This might be useful if your system has no terminal
  1996. device.
  1997. The option @option{--no-echo} has GRUB not to echo back input
  1998. characters. This implies the option @option{--no-edit}.
  1999. The option @option{--no-edit} disables the BASH-like editing feature.
  2000. @end deffn
  2001. @node terminfo
  2002. @subsection terminfo
  2003. @deffn Command terminfo @option{--name=name} @option{--cursor-address=seq} [@option{--clear-screen=seq}] [@option{--enter-standout-mode=seq}] [@option{--exit-standout-mode=seq}]
  2004. Define the capabilities of your terminal. Use this command to define
  2005. escape sequences, if it is not vt100-compatible. You may use @samp{\e}
  2006. for @key{ESC} and @samp{^X} for a control character.
  2007. You can use the utility @command{grub-terminfo} to generate
  2008. appropriate arguments to this command. @xref{Invoking grub-terminfo}.
  2009. If no option is specified, the current settings are printed.
  2010. @end deffn
  2011. @node tftpserver
  2012. @subsection tftpserver
  2013. @deffn Command tftpserver ipaddr
  2014. @strong{Caution:} This command exists only for backward
  2015. compatibility. Use @command{ifconfig} (@pxref{ifconfig}) instead.
  2016. Override a TFTP server address returned by a BOOTP/DHCP/RARP server. The
  2017. argument @var{ipaddr} must be in dotted decimal format, like
  2018. @samp{192.168.0.15}. This command is only available if GRUB is compiled
  2019. with netboot support. See also @ref{Network}.
  2020. @end deffn
  2021. @node unhide
  2022. @subsection unhide
  2023. @deffn Command unhide partition
  2024. Unhide the partition @var{partition} by clearing the @dfn{hidden} bit in
  2025. its partition type code. This is useful only when booting DOS or Windows
  2026. and multiple primary partitions exist on one disk. See also
  2027. @ref{DOS/Windows}.
  2028. @end deffn
  2029. @node Command-line and menu entry commands
  2030. @section The list of command-line and menu entry commands
  2031. These commands are usable in the command-line and in menu entries. If
  2032. you forget a command, you can run the command @command{help}
  2033. (@pxref{help}).
  2034. @menu
  2035. * blocklist:: Get the blocklist notation of a file
  2036. * boot:: Start up your operating system
  2037. * cat:: Show the contents of a file
  2038. * chainloader:: Chain-load another boot loader
  2039. * cmp:: Compare two files
  2040. * configfile:: Load a configuration file
  2041. * debug:: Toggle the debug flag
  2042. * displayapm:: Display APM information
  2043. * displaymem:: Display memory configuration
  2044. * embed:: Embed Stage 1.5
  2045. * find:: Find a file
  2046. * fstest:: Test a filesystem
  2047. * geometry:: Manipulate the geometry of a drive
  2048. * halt:: Shut down your computer
  2049. * help:: Show help messages
  2050. * impsprobe:: Probe SMP
  2051. * initrd:: Load an initrd
  2052. * install:: Install GRUB
  2053. * ioprobe:: Probe I/O ports used for a drive
  2054. * kernel:: Load a kernel
  2055. * lock:: Lock a menu entry
  2056. * makeactive:: Make a partition active
  2057. * map:: Map a drive to another
  2058. * md5crypt:: Encrypt a password in MD5 format
  2059. * module:: Load a module
  2060. * modulenounzip:: Load a module without decompression
  2061. * pause:: Wait for a key press
  2062. * quit:: Exit from the grub shell
  2063. * reboot:: Reboot your computer
  2064. * read:: Read data from memory
  2065. * root:: Set GRUB's root device
  2066. * rootnoverify:: Set GRUB's root device without mounting
  2067. * savedefault:: Save current entry as the default entry
  2068. * setup:: Set up GRUB's installation automatically
  2069. * testload:: Load a file for testing a filesystem
  2070. * testvbe:: Test VESA BIOS Extension
  2071. * uppermem:: Set the upper memory size
  2072. * vbeprobe:: Probe VESA BIOS Extension
  2073. @end menu
  2074. @node blocklist
  2075. @subsection blocklist
  2076. @deffn Command blocklist file
  2077. Print the blocklist notation of the file @var{file}. @xref{blocklist
  2078. syntax}.
  2079. @end deffn
  2080. @node boot
  2081. @subsection boot
  2082. @deffn Command boot
  2083. Boot the OS or chain-loader which has been loaded. Only necessary if
  2084. running the fully interactive command-line (it is implicit at the end of
  2085. a menu entry).
  2086. @end deffn
  2087. @node cat
  2088. @subsection cat
  2089. @deffn Command cat file
  2090. Display the contents of the file @var{file}. This command may be useful
  2091. to remind you of your OS's root partition:
  2092. @example
  2093. grub> @kbd{cat /etc/fstab}
  2094. @end example
  2095. @end deffn
  2096. @node chainloader
  2097. @subsection chainloader
  2098. @deffn Command chainloader [@option{--force}] file
  2099. Load @var{file} as a chain-loader. Like any other file loaded by the
  2100. filesystem code, it can use the blocklist notation to grab the first
  2101. sector of the current partition with @samp{+1}. If you specify the
  2102. option @option{--force}, then load @var{file} forcibly, whether it has a
  2103. correct signature or not. This is required when you want to load a
  2104. defective boot loader, such as SCO UnixWare 7.1 (@pxref{SCO UnixWare}).
  2105. @end deffn
  2106. @node cmp
  2107. @subsection cmp
  2108. @deffn Command cmp file1 file2
  2109. Compare the file @var{file1} with the file @var{file2}. If they differ
  2110. in size, print the sizes like this:
  2111. @example
  2112. Differ in size: 0x1234 [foo], 0x4321 [bar]
  2113. @end example
  2114. If the sizes are equal but the bytes at an offset differ, then print the
  2115. bytes like this:
  2116. @example
  2117. Differ at the offset 777: 0xbe [foo], 0xef [bar]
  2118. @end example
  2119. If they are completely identical, nothing will be printed.
  2120. @end deffn
  2121. @node configfile
  2122. @subsection configfile
  2123. @deffn Command configfile file
  2124. Load @var{file} as a configuration file.
  2125. @end deffn
  2126. @node debug
  2127. @subsection debug
  2128. @deffn Command debug
  2129. Toggle debug mode (by default it is off). When debug mode is on, some
  2130. extra messages are printed to show disk activity. This global debug flag
  2131. is mainly useful for GRUB developers when testing new code.
  2132. @end deffn
  2133. @node displayapm
  2134. @subsection displayapm
  2135. @deffn Command displayapm
  2136. Display APM BIOS information.
  2137. @end deffn
  2138. @node displaymem
  2139. @subsection displaymem
  2140. @deffn Command displaymem
  2141. Display what GRUB thinks the system address space map of the machine is,
  2142. including all regions of physical @sc{ram} installed. GRUB's
  2143. @dfn{upper/lower memory} display uses the standard BIOS interface for
  2144. the available memory in the first megabyte, or @dfn{lower memory}, and a
  2145. synthesized number from various BIOS interfaces of the memory starting
  2146. at 1MB and going up to the first chipset hole for @dfn{upper memory}
  2147. (the standard PC @dfn{upper memory} interface is limited to reporting a
  2148. maximum of 64MB).
  2149. @end deffn
  2150. @node embed
  2151. @subsection embed
  2152. @deffn Command embed stage1_5 device
  2153. Embed the Stage 1.5 @var{stage1_5} in the sectors after the MBR if
  2154. @var{device} is a drive, or in the @dfn{boot loader} area if @var{device}
  2155. is a FFS partition or a ReiserFS partition.@footnote{The latter feature
  2156. has not been implemented yet.} Print the number of sectors which
  2157. @var{stage1_5} occupies, if successful.
  2158. Usually, you don't need to run this command directly. @xref{setup}.
  2159. @end deffn
  2160. @node find
  2161. @subsection find
  2162. @deffn Command find filename
  2163. Search for the file name @var{filename} in all mountable partitions
  2164. and print the list of the devices which contain the file. The file
  2165. name @var{filename} should be an absolute file name like
  2166. @code{/boot/grub/stage1}.
  2167. @end deffn
  2168. @node fstest
  2169. @subsection fstest
  2170. @deffn Command fstest
  2171. Toggle filesystem test mode.
  2172. Filesystem test mode, when turned on, prints out data corresponding to
  2173. all the device reads and what values are being sent to the low-level
  2174. routines. The format is @samp{<@var{partition-offset-sector},
  2175. @var{byte-offset}, @var{byte-length}>} for high-level reads inside a
  2176. partition, and @samp{[@var{disk-offset-sector}]} for low-level sector
  2177. requests from the disk.
  2178. Filesystem test mode is turned off by any use of the @command{install}
  2179. (@pxref{install}) or @command{testload} (@pxref{testload}) commands.
  2180. @end deffn
  2181. @node geometry
  2182. @subsection geometry
  2183. @deffn Command geometry drive [cylinder head sector [total_sector]]
  2184. Print the information for the drive @var{drive}. In the grub shell, you
  2185. can set the geometry of the drive arbitrarily. The number of
  2186. cylinders, the number of heads, the number of sectors and the number of
  2187. total sectors are set to CYLINDER, HEAD, SECTOR and TOTAL_SECTOR,
  2188. respectively. If you omit TOTAL_SECTOR, then it will be calculated
  2189. based on the C/H/S values automatically.
  2190. @end deffn
  2191. @node halt
  2192. @subsection halt
  2193. @deffn Command halt @option{--no-apm}
  2194. The command halts the computer. If the @option{--no-apm} option
  2195. is specified, no APM BIOS call is performed. Otherwise, the computer
  2196. is shut down using APM.
  2197. @end deffn
  2198. @node help
  2199. @subsection help
  2200. @deffn Command help @option{--all} [pattern @dots{}]
  2201. Display helpful information about built-in commands. If you do not
  2202. specify @var{pattern}, this command shows short descriptions of most of
  2203. available commands. If you specify the option @option{--all} to this
  2204. command, short descriptions of rarely used commands (such as
  2205. @ref{testload}) are displayed as well.
  2206. If you specify any @var{patterns}, it displays longer information
  2207. about each of the commands which match those @var{patterns}.
  2208. @end deffn
  2209. @node impsprobe
  2210. @subsection impsprobe
  2211. @deffn Command impsprobe
  2212. Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration
  2213. table and boot the various CPUs which are found into a tight loop. This
  2214. command can be used only in the Stage 2, but not in the grub shell.
  2215. @end deffn
  2216. @node initrd
  2217. @subsection initrd
  2218. @deffn Command initrd file @dots{}
  2219. Load an initial ramdisk for a Linux format boot image and set the
  2220. appropriate parameters in the Linux setup area in memory. See also
  2221. @ref{GNU/Linux}.
  2222. @end deffn
  2223. @node install
  2224. @subsection install
  2225. @deffn Command install [@option{--force-lba}] [@option{--stage2=os_stage2_file}] stage1_file [@option{d}] dest_dev stage2_file [addr] [@option{p}] [config_file] [real_config_file]
  2226. This command is fairly complex, and you should not use this command
  2227. unless you are familiar with GRUB. Use @command{setup} (@pxref{setup})
  2228. instead.
  2229. In short, it will perform a full install presuming the Stage 2 or Stage
  2230. 1.5@footnote{They're loaded the same way, so we will refer to the Stage
  2231. 1.5 as a Stage 2 from now on.} is in its final install location.
  2232. In slightly more detail, it will load @var{stage1_file}, validate that
  2233. it is a GRUB Stage 1 of the right version number, install in it a
  2234. blocklist for loading @var{stage2_file} as a Stage 2. If the option
  2235. @option{d} is present, the Stage 1 will always look for the actual
  2236. disk @var{stage2_file} was installed on, rather than using the booting
  2237. drive. The Stage 2 will be loaded at address @var{addr}, which must be
  2238. @samp{0x8000} for a true Stage 2, and @samp{0x2000} for a Stage 1.5. If
  2239. @var{addr} is not present, GRUB will determine the address
  2240. automatically. It then writes the completed Stage 1 to the first block
  2241. of the device @var{dest_dev}. If the options @option{p} or
  2242. @var{config_file} are present, then it reads the first block of stage2,
  2243. modifies it with the values of the partition @var{stage2_file} was found
  2244. on (for @option{p}) or places the string @var{config_file} into the area
  2245. telling the stage2 where to look for a configuration file at boot
  2246. time. Likewise, if @var{real_config_file} is present and
  2247. @var{stage2_file} is a Stage 1.5, then the Stage 2 @var{config_file} is
  2248. patched with the configuration file name @var{real_config_file}. This
  2249. command preserves the DOS BPB (and for hard disks, the partition table)
  2250. of the sector the Stage 1 is to be installed into.
  2251. @strong{Caution:} Several buggy BIOSes don't pass a booting drive
  2252. properly when booting from a hard disk drive. Therefore, you will
  2253. unfortunately have to specify the option @option{d}, whether your
  2254. Stage2 resides at the booting drive or not, if you have such a
  2255. BIOS. We know these are defective in this way:
  2256. @table @asis
  2257. @item
  2258. Fujitsu LifeBook 400 BIOS version 31J0103A
  2259. @item
  2260. HP Vectra XU 6/200 BIOS version GG.06.11
  2261. @end table
  2262. @strong{Caution2:} A number of BIOSes don't return a correct LBA support
  2263. bitmap even if they do have the support. So GRUB provides a solution to
  2264. ignore the wrong bitmap, that is, the option @option{--force-lba}. Don't
  2265. use this option if you know that your BIOS doesn't have LBA support.
  2266. @strong{Caution3:} You must specify the option @option{--stage2} in the
  2267. grub shell, if you cannot unmount the filesystem where your stage2 file
  2268. resides. The argument should be the file name in your operating system.
  2269. @end deffn
  2270. @node ioprobe
  2271. @subsection ioprobe
  2272. @deffn Command ioprobe drive
  2273. Probe I/O ports used for the drive @var{drive}. This command will list
  2274. the I/O ports on the screen. For technical information,
  2275. @xref{Internals}.
  2276. @end deffn
  2277. @node kernel
  2278. @subsection kernel
  2279. @deffn Command kernel [@option{--type=type}] [@option{--no-mem-option}] file @dots{}
  2280. Attempt to load the primary boot image (Multiboot a.out or @sc{elf},
  2281. Linux zImage or bzImage, FreeBSD a.out, NetBSD a.out, etc.) from
  2282. @var{file}. The rest of the line is passed verbatim as the @dfn{kernel
  2283. command-line}. Any modules must be reloaded after using this command.
  2284. This command also accepts the option @option{--type} so that you can
  2285. specify the kernel type of @var{file} explicitly. The argument
  2286. @var{type} must be one of these: @samp{netbsd}, @samp{freebsd},
  2287. @samp{openbsd}, @samp{linux}, @samp{biglinux}, and
  2288. @samp{multiboot}. However, you need to specify it only if you want to
  2289. load a NetBSD @sc{elf} kernel, because GRUB can automatically determine
  2290. a kernel type in the other cases, quite safely.
  2291. The option @option{--no-mem-option} is effective only for Linux. If the
  2292. option is specified, GRUB doesn't pass the option @option{mem=} to the
  2293. kernel. This option is implied for Linux kernels 2.4.18 and newer.
  2294. @end deffn
  2295. @node lock
  2296. @subsection lock
  2297. @deffn Command lock
  2298. Prevent normal users from executing arbitrary menu entries. You must use
  2299. the command @command{password} if you really want this command to be
  2300. useful (@pxref{password}).
  2301. This command is used in a menu, as shown in this example:
  2302. @example
  2303. @group
  2304. title This entry is too dangerous to be executed by normal users
  2305. lock
  2306. root (hd0,a)
  2307. kernel /no-security-os
  2308. @end group
  2309. @end example
  2310. See also @ref{Security}.
  2311. @end deffn
  2312. @node makeactive
  2313. @subsection makeactive
  2314. @deffn Command makeactive
  2315. Set the active partition on the root disk to GRUB's root device.
  2316. This command is limited to @emph{primary} PC partitions on a hard disk.
  2317. @end deffn
  2318. @node map
  2319. @subsection map
  2320. @deffn Command map to_drive from_drive
  2321. Map the drive @var{from_drive} to the drive @var{to_drive}. This is
  2322. necessary when you chain-load some operating systems, such as DOS, if
  2323. such an OS resides at a non-first drive. Here is an example:
  2324. @example
  2325. @group
  2326. grub> @kbd{map (hd0) (hd1)}
  2327. grub> @kbd{map (hd1) (hd0)}
  2328. @end group
  2329. @end example
  2330. The example exchanges the order between the first hard disk and the
  2331. second hard disk. See also @ref{DOS/Windows}.
  2332. @end deffn
  2333. @node md5crypt
  2334. @subsection md5crypt
  2335. @deffn Command md5crypt
  2336. Prompt to enter a password, and encrypt it in MD5 format. The encrypted
  2337. password can be used with the command @command{password}
  2338. (@pxref{password}). See also @ref{Security}.
  2339. @end deffn
  2340. @node module
  2341. @subsection module
  2342. @deffn Command module file @dots{}
  2343. Load a boot module @var{file} for a Multiboot format boot image (no
  2344. interpretation of the file contents are made, so the user of this
  2345. command must know what the kernel in question expects). The rest of the
  2346. line is passed as the @dfn{module command-line}, like the
  2347. @command{kernel} command. You must load a Multiboot kernel image before
  2348. loading any module. See also @ref{modulenounzip}.
  2349. @end deffn
  2350. @node modulenounzip
  2351. @subsection modulenounzip
  2352. @deffn Command modulenounzip file @dots{}
  2353. The same as @command{module} (@pxref{module}), except that automatic
  2354. decompression is disabled.
  2355. @end deffn
  2356. @node pause
  2357. @subsection pause
  2358. @deffn Command pause message @dots{}
  2359. Print the @var{message}, then wait until a key is pressed. Note that
  2360. placing @key{^G} (ASCII code 7) in the message will cause the speaker to
  2361. emit the standard beep sound, which is useful when prompting the user to
  2362. change floppies.
  2363. @end deffn
  2364. @node quit
  2365. @subsection quit
  2366. @deffn Command quit
  2367. Exit from the grub shell @command{grub} (@pxref{Invoking the grub
  2368. shell}). This command can be used only in the grub shell.
  2369. @end deffn
  2370. @node reboot
  2371. @subsection reboot
  2372. @deffn Command reboot
  2373. Reboot the computer.
  2374. @end deffn
  2375. @node read
  2376. @subsection read
  2377. @deffn Command read addr
  2378. Read a 32-bit value from memory at address @var{addr} and display it in
  2379. hex format.
  2380. @end deffn
  2381. @node root
  2382. @subsection root
  2383. @deffn Command root device [hdbias]
  2384. Set the current @dfn{root device} to the device @var{device}, then
  2385. attempt to mount it to get the partition size (for passing the partition
  2386. descriptor in @code{ES:ESI}, used by some chain-loaded boot loaders), the
  2387. BSD drive type (for booting BSD kernels using their native boot format),
  2388. and correctly determine the PC partition where a BSD sub-partition is
  2389. located. The optional @var{hdbias} parameter is a number to tell a BSD
  2390. kernel how many BIOS drive numbers are on controllers before the current
  2391. one. For example, if there is an IDE disk and a SCSI disk, and your
  2392. FreeBSD root partition is on the SCSI disk, then use a @samp{1} for
  2393. @var{hdbias}.
  2394. See also @ref{rootnoverify}.
  2395. @end deffn
  2396. @node rootnoverify
  2397. @subsection rootnoverify
  2398. @deffn Command rootnoverify device [hdbias]
  2399. Similar to @command{root} (@pxref{root}), but don't attempt to mount the
  2400. partition. This is useful for when an OS is outside of the area of the
  2401. disk that GRUB can read, but setting the correct root device is still
  2402. desired. Note that the items mentioned in @command{root} above which
  2403. derived from attempting the mount will @emph{not} work correctly.
  2404. @end deffn
  2405. @node savedefault
  2406. @subsection savedefault
  2407. @deffn Command savedefault num
  2408. Save the current menu entry or @var{num} if specified as a default
  2409. entry. Here is an example:
  2410. @example
  2411. @group
  2412. default saved
  2413. timeout 10
  2414. title GNU/Linux
  2415. root (hd0,0)
  2416. kernel /boot/vmlinuz root=/dev/sda1 vga=ext
  2417. initrd /boot/initrd
  2418. savedefault
  2419. title FreeBSD
  2420. root (hd0,a)
  2421. kernel /boot/loader
  2422. savedefault
  2423. @end group
  2424. @end example
  2425. With this configuration, GRUB will choose the entry booted previously as
  2426. the default entry.
  2427. You can specify @samp{fallback} instead of a number. Then, next
  2428. fallback entry is saved. Next fallback entry is chosen from fallback
  2429. entries. Normally, this will be the first entry in fallback ones.
  2430. See also @ref{default} and @ref{Invoking grub-set-default}.
  2431. @end deffn
  2432. @node setup
  2433. @subsection setup
  2434. @deffn Command setup [@option{--force-lba}] [@option{--stage2=os_stage2_file}] [@option{--prefix=dir}] install_device [image_device]
  2435. Set up the installation of GRUB automatically. This command uses the
  2436. more flexible command @command{install} (@pxref{install}) in the backend
  2437. and installs GRUB into the device @var{install_device}. If
  2438. @var{image_device} is specified, then find the GRUB images
  2439. (@pxref{Images}) in the device @var{image_device}, otherwise use the
  2440. current @dfn{root device}, which can be set by the command
  2441. @command{root}. If @var{install_device} is a hard disk, then embed a
  2442. Stage 1.5 in the disk if possible.
  2443. The option @option{--prefix} specifies the directory under which GRUB
  2444. images are put. If it is not specified, GRUB automatically searches them
  2445. in @file{/boot/grub} and @file{/grub}.
  2446. The options @option{--force-lba} and @option{--stage2} are just passed
  2447. to @command{install} if specified. @xref{install}, for more
  2448. information.
  2449. @end deffn
  2450. @node testload
  2451. @subsection testload
  2452. @deffn Command testload file
  2453. Read the entire contents of @var{file} in several different ways and
  2454. compare them, to test the filesystem code. The output is somewhat
  2455. cryptic, but if no errors are reported and the final @samp{i=@var{X},
  2456. filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is
  2457. definitely consistent, and very likely works correctly subject to a
  2458. consistent offset error. If this test succeeds, then a good next step is
  2459. to try loading a kernel.
  2460. @end deffn
  2461. @node testvbe
  2462. @subsection testvbe
  2463. @deffn Command testvbe mode
  2464. Test the VESA BIOS Extension mode @var{mode}. This command will switch
  2465. your video card to the graphics mode, and show an endless animation. Hit
  2466. any key to return. See also @ref{vbeprobe}.
  2467. @end deffn
  2468. @node uppermem
  2469. @subsection uppermem
  2470. @deffn Command uppermem kbytes
  2471. Force GRUB to assume that only @var{kbytes} kilobytes of upper memory
  2472. are installed. Any system address range maps are discarded.
  2473. @strong{Caution:} This should be used with great caution, and should
  2474. only be necessary on some old machines. GRUB's BIOS probe can pick up
  2475. all @sc{ram} on all new machines the author has ever heard of. It can
  2476. also be used for debugging purposes to lie to an OS.
  2477. @end deffn
  2478. @node vbeprobe
  2479. @subsection vbeprobe
  2480. @deffn Command vbeprobe [mode]
  2481. Probe VESA BIOS Extension information. If the mode @var{mode} is
  2482. specified, show only the information about @var{mode}. Otherwise, this
  2483. command lists up available VBE modes on the screen. See also
  2484. @ref{testvbe}.
  2485. @end deffn
  2486. @node Troubleshooting
  2487. @chapter Error messages reported by GRUB
  2488. This chapter describes error messages reported by GRUB when you
  2489. encounter trouble. @xref{Invoking the grub shell}, if your problem is
  2490. specific to the grub shell.
  2491. @menu
  2492. * Stage1 errors:: Errors reported by the Stage 1
  2493. * Stage1.5 errors:: Errors reported by the Stage 1.5
  2494. * Stage2 errors:: Errors reported by the Stage 2
  2495. @end menu
  2496. @node Stage1 errors
  2497. @section Errors reported by the Stage 1
  2498. The general way that the Stage 1 handles errors is to print an error
  2499. string and then halt. Pressing @kbd{@key{CTRL}-@key{ALT}-@key{DEL}} will
  2500. reboot.
  2501. The following is a comprehensive list of error messages for the Stage 1:
  2502. @table @asis
  2503. @item Hard Disk Error
  2504. The stage2 or stage1.5 is being read from a hard disk, and the attempt
  2505. to determine the size and geometry of the hard disk failed.
  2506. @item Floppy Error
  2507. The stage2 or stage1.5 is being read from a floppy disk, and the attempt
  2508. to determine the size and geometry of the floppy disk failed. It's listed
  2509. as a separate error since the probe sequence is different than for hard
  2510. disks.
  2511. @item Read Error
  2512. A disk read error happened while trying to read the stage2 or stage1.5.
  2513. @item Geom Error
  2514. The location of the stage2 or stage1.5 is not in the portion of the disk
  2515. supported directly by the BIOS read calls. This could occur because the
  2516. BIOS translated geometry has been changed by the user or the disk is
  2517. moved to another machine or controller after installation, or GRUB was
  2518. not installed using itself (if it was, the Stage 2 version of this error
  2519. would have been seen during that process and it would not have completed
  2520. the install).
  2521. @end table
  2522. @node Stage1.5 errors
  2523. @section Errors reported by the Stage 1.5
  2524. The general way that the Stage 1.5 handles errors is to print an error
  2525. number in the form @code{Error @var{num}} and then halt. Pressing
  2526. @kbd{@key{CTRL}-@key{ALT}-@key{DEL}} will reboot.
  2527. The error numbers correspond to the errors reported by Stage
  2528. 2. @xref{Stage2 errors}.
  2529. @node Stage2 errors
  2530. @section Errors reported by the Stage 2
  2531. The general way that the Stage 2 handles errors is to abort the
  2532. operation in question, print an error string, then (if possible) either
  2533. continue based on the fact that an error occurred or wait for the user to
  2534. deal with the error.
  2535. The following is a comprehensive list of error messages for the Stage 2
  2536. (error numbers for the Stage 1.5 are listed before the colon in each
  2537. description):
  2538. @table @asis
  2539. @item 1 : Filename must be either an absolute filename or blocklist
  2540. This error is returned if a file name is requested which doesn't fit the
  2541. syntax/rules listed in the @ref{Filesystem}.
  2542. @item 2 : Bad file or directory type
  2543. This error is returned if a file requested is not a regular file, but
  2544. something like a symbolic link, directory, or FIFO.
  2545. @item 3 : Bad or corrupt data while decompressing file
  2546. This error is returned if the run-length decompression code gets an
  2547. internal error. This is usually from a corrupt file.
  2548. @item 4 : Bad or incompatible header in compressed file
  2549. This error is returned if the file header for a supposedly compressed
  2550. file is bad.
  2551. @item 5 : Partition table invalid or corrupt
  2552. This error is returned if the sanity checks on the integrity of the
  2553. partition table fail. This is a bad sign.
  2554. @item 6 : Mismatched or corrupt version of stage1/stage2
  2555. This error is returned if the install command points to incompatible
  2556. or corrupt versions of the stage1 or stage2. It can't detect corruption
  2557. in general, but this is a sanity check on the version numbers, which
  2558. should be correct.
  2559. @item 7 : Loading below 1MB is not supported
  2560. This error is returned if the lowest address in a kernel is below the
  2561. 1MB boundary. The Linux zImage format is a special case and can be
  2562. handled since it has a fixed loading address and maximum size.
  2563. @item 8 : Kernel must be loaded before booting
  2564. This error is returned if GRUB is told to execute the boot sequence
  2565. without having a kernel to start.
  2566. @item 9 : Unknown boot failure
  2567. This error is returned if the boot attempt did not succeed for reasons
  2568. which are unknown.
  2569. @item 10 : Unsupported Multiboot features requested
  2570. This error is returned when the Multiboot features word in the Multiboot
  2571. header requires a feature that is not recognized. The point of this is
  2572. that the kernel requires special handling which GRUB is probably
  2573. unable to provide.
  2574. @item 11 : Unrecognized device string
  2575. This error is returned if a device string was expected, and the string
  2576. encountered didn't fit the syntax/rules listed in the @ref{Filesystem}.
  2577. @item 12 : Invalid device requested
  2578. This error is returned if a device string is recognizable but does not
  2579. fall under the other device errors.
  2580. @item 13 : Invalid or unsupported executable format
  2581. This error is returned if the kernel image being loaded is not
  2582. recognized as Multiboot or one of the supported native formats (Linux
  2583. zImage or bzImage, FreeBSD, or NetBSD).
  2584. @item 14 : Filesystem compatibility error, cannot read whole file
  2585. Some of the filesystem reading code in GRUB has limits on the length of
  2586. the files it can read. This error is returned when the user runs into
  2587. such a limit.
  2588. @item 15 : File not found
  2589. This error is returned if the specified file name cannot be found, but
  2590. everything else (like the disk/partition info) is OK.
  2591. @item 16 : Inconsistent filesystem structure
  2592. This error is returned by the filesystem code to denote an internal
  2593. error caused by the sanity checks of the filesystem structure on disk
  2594. not matching what it expects. This is usually caused by a corrupt
  2595. filesystem or bugs in the code handling it in GRUB.
  2596. @item 17 : Cannot mount selected partition
  2597. This error is returned if the partition requested exists, but the
  2598. filesystem type cannot be recognized by GRUB.
  2599. @item 18 : Selected cylinder exceeds maximum supported by BIOS
  2600. This error is returned when a read is attempted at a linear block
  2601. address beyond the end of the BIOS translated area. This generally
  2602. happens if your disk is larger than the BIOS can handle (512MB for
  2603. (E)IDE disks on older machines or larger than 8GB in general).
  2604. @item 19 : Linux kernel must be loaded before initrd
  2605. This error is returned if the initrd command is used before loading a
  2606. Linux kernel.
  2607. @item 20 : Multiboot kernel must be loaded before modules
  2608. This error is returned if the module load command is used before loading
  2609. a Multiboot kernel. It only makes sense in this case anyway, as GRUB has
  2610. no idea how to communicate the presence of such modules to a
  2611. non-Multiboot-aware kernel.
  2612. @item 21 : Selected disk does not exist
  2613. This error is returned if the device part of a device- or full file name
  2614. refers to a disk or BIOS device that is not present or not recognized by
  2615. the BIOS in the system.
  2616. @item 22 : No such partition
  2617. This error is returned if a partition is requested in the device part of
  2618. a device- or full file name which isn't on the selected disk.
  2619. @item 23 : Error while parsing number
  2620. This error is returned if GRUB was expecting to read a number and
  2621. encountered bad data.
  2622. @item 24 : Attempt to access block outside partition
  2623. This error is returned if a linear block address is outside of the disk
  2624. partition. This generally happens because of a corrupt filesystem on the
  2625. disk or a bug in the code handling it in GRUB (it's a great debugging
  2626. tool).
  2627. @item 25 : Disk read error
  2628. This error is returned if there is a disk read error when trying to
  2629. probe or read data from a particular disk.
  2630. @item 26 : Too many symbolic links
  2631. This error is returned if the link count is beyond the maximum
  2632. (currently 5), possibly the symbolic links are looped.
  2633. @item 27 : Unrecognized command
  2634. This error is returned if an unrecognized command is entered on the
  2635. command-line or in a boot sequence section of a configuration file and
  2636. that entry is selected.
  2637. @item 28 : Selected item cannot fit into memory
  2638. This error is returned if a kernel, module, or raw file load command is
  2639. either trying to load its data such that it won't fit into memory or it
  2640. is simply too big.
  2641. @item 29 : Disk write error
  2642. This error is returned if there is a disk write error when trying to
  2643. write to a particular disk. This would generally only occur during an
  2644. install of set active partition command.
  2645. @item 30 : Invalid argument
  2646. This error is returned if an argument specified to a command is invalid.
  2647. @item 31 : File is not sector aligned
  2648. This error may occur only when you access a ReiserFS partition by
  2649. block-lists (e.g. the command @command{install}). In this case, you
  2650. should mount the partition with the @samp{-o notail} option.
  2651. @item 32 : Must be authenticated
  2652. This error is returned if you try to run a locked entry. You should
  2653. enter a correct password before running such an entry.
  2654. @item 33 : Serial device not configured
  2655. This error is returned if you try to change your terminal to a serial
  2656. one before initializing any serial device.
  2657. @item 34 : No spare sectors on the disk
  2658. This error is returned if a disk doesn't have enough spare space. This
  2659. happens when you try to embed Stage 1.5 into the unused sectors after
  2660. the MBR, but the first partition starts right after the MBR or they are
  2661. used by EZ-BIOS.
  2662. @end table
  2663. @node Invoking the grub shell
  2664. @chapter Invoking the grub shell
  2665. This chapter documents the grub shell @command{grub}. Note that the grub
  2666. shell is an emulator; it doesn't run under the native environment, so it
  2667. sometimes does something wrong. Therefore, you shouldn't trust it too
  2668. much. If there is anything wrong with it, don't hesitate to try the
  2669. native GRUB environment, especially when it guesses a wrong map between
  2670. BIOS drives and OS devices.
  2671. @menu
  2672. * Basic usage:: How to use the grub shell
  2673. * Installation under UNIX:: How to install GRUB via @command{grub}
  2674. * Device map:: The map between BIOS drives and OS devices
  2675. @end menu
  2676. @node Basic usage
  2677. @section Introduction into the grub shell
  2678. You can use the command @command{grub} for installing GRUB under your
  2679. operating systems and for a testbed when you add a new feature into GRUB
  2680. or when fixing a bug. @command{grub} is almost the same as the Stage 2,
  2681. and, in fact, it shares the source code with the Stage 2 and you can use
  2682. the same commands (@pxref{Commands}) in @command{grub}. It is emulated by
  2683. replacing BIOS calls with UNIX system calls and libc functions.
  2684. The command @command{grub} accepts the following options:
  2685. @table @option
  2686. @item --help
  2687. Print a summary of the command-line options and exit.
  2688. @item --version
  2689. Print the version number of GRUB and exit.
  2690. @item --verbose
  2691. Print some verbose messages for debugging purpose.
  2692. @item --device-map=@var{file}
  2693. Use the device map file @var{file}. The format is described in
  2694. @ref{Device map}.
  2695. @item --no-floppy
  2696. Do not probe any floppy drive. This option has no effect if the option
  2697. @option{--device-map} is specified (@pxref{Device map}).
  2698. @item --probe-second-floppy
  2699. Probe the second floppy drive. If this option is not specified, the grub
  2700. shell does not probe it, as that sometimes takes a long time. If you
  2701. specify the device map file (@pxref{Device map}), the grub shell just
  2702. ignores this option.
  2703. @item --config-file=@var{file}
  2704. Read the configuration file @var{file} instead of
  2705. @file{/boot/grub/menu.lst}. The format is the same as the normal GRUB
  2706. syntax. See @ref{Filesystem}, for more information.
  2707. @item --boot-drive=@var{drive}
  2708. Set the stage2 @var{boot_drive} to @var{drive}. This argument should be
  2709. an integer (decimal, octal or hexadecimal).
  2710. @item --install-partition=@var{par}
  2711. Set the stage2 @var{install_partition} to @var{par}. This argument
  2712. should be an integer (decimal, octal or hexadecimal).
  2713. @item --no-config-file
  2714. Do not use the configuration file even if it can be read.
  2715. @item --no-curses
  2716. Do not use the screen handling interface by the curses even if it is
  2717. available.
  2718. @item --batch
  2719. This option has the same meaning as @samp{--no-config-file --no-curses}.
  2720. @item --read-only
  2721. Disable writing to any disk.
  2722. @item --hold
  2723. Wait until a debugger will attach. This option is useful when you want
  2724. to debug the startup code.
  2725. @end table
  2726. @node Installation under UNIX
  2727. @section How to install GRUB via @command{grub}
  2728. The installation procedure is the same as under the @dfn{native} Stage
  2729. 2. @xref{Installation}, for more information. The command
  2730. @command{grub}-specific information is described here.
  2731. What you should be careful about is @dfn{buffer cache}. @command{grub}
  2732. makes use of raw devices instead of filesystems that your operating
  2733. systems serve, so there exists a potential problem that some cache
  2734. inconsistency may corrupt your filesystems. What we recommend is:
  2735. @itemize @bullet
  2736. @item
  2737. If you can unmount drives to which GRUB may write any amount of data,
  2738. unmount them before running @command{grub}.
  2739. @item
  2740. If a drive cannot be unmounted but can be mounted with the read-only
  2741. flag, mount it in read-only mode. That should be secure.
  2742. @item
  2743. If a drive must be mounted with the read-write flag, make sure that no
  2744. activity is being done on it while the command @command{grub} is
  2745. running.
  2746. @item
  2747. Reboot your operating system as soon as possible. This is probably not
  2748. required if you follow the rules above, but reboot is the most secure
  2749. way.
  2750. @end itemize
  2751. In addition, enter the command @command{quit} when you finish the
  2752. installation. That is @emph{very important} because @command{quit} makes
  2753. the buffer cache consistent. Do not push @key{C-c}.
  2754. If you want to install GRUB non-interactively, specify @samp{--batch}
  2755. option in the command-line. This is a simple example:
  2756. @example
  2757. @group
  2758. #!/bin/sh
  2759. # Use /usr/sbin/grub if you are on an older system.
  2760. /sbin/grub --batch <<EOT 1>/dev/null 2>/dev/null
  2761. root (hd0,0)
  2762. setup (hd0)
  2763. quit
  2764. EOT
  2765. @end group
  2766. @end example
  2767. @node Device map
  2768. @section The map between BIOS drives and OS devices
  2769. When you specify the option @option{--device-map} (@pxref{Basic usage}),
  2770. the grub shell creates the @dfn{device map file} automatically unless it
  2771. already exists. The file name @file{/boot/grub/device.map} is preferred.
  2772. If the device map file exists, the grub shell reads it to map BIOS
  2773. drives to OS devices. This file consists of lines like this:
  2774. @example
  2775. @var{device} @var{file}
  2776. @end example
  2777. @var{device} is a drive specified in the GRUB syntax (@pxref{Device
  2778. syntax}), and @var{file} is an OS file, which is normally a device
  2779. file.
  2780. The reason why the grub shell gives you the device map file is that it
  2781. cannot guess the map between BIOS drives and OS devices correctly in
  2782. some environments. For example, if you exchange the boot sequence
  2783. between IDE and SCSI in your BIOS, it gets the order wrong.
  2784. Thus, edit the file if the grub shell makes a mistake. You can put any
  2785. comments in the file if needed, as the grub shell assumes that a line is
  2786. just a comment if the first character is @samp{#}.
  2787. @node Invoking grub-install
  2788. @chapter Invoking grub-install
  2789. The program @command{grub-install} installs GRUB on your drive using the
  2790. grub shell (@pxref{Invoking the grub shell}). You must specify the
  2791. device name on which you want to install GRUB, like this:
  2792. @example
  2793. grub-install @var{install_device}
  2794. @end example
  2795. The device name @var{install_device} is an OS device name or a GRUB
  2796. device name.
  2797. @command{grub-install} accepts the following options:
  2798. @table @option
  2799. @item --help
  2800. Print a summary of the command-line options and exit.
  2801. @item --version
  2802. Print the version number of GRUB and exit.
  2803. @item --force-lba
  2804. Force GRUB to use LBA mode even for a buggy BIOS. Use this option only
  2805. if your BIOS doesn't work properly in LBA mode even though it supports
  2806. LBA mode.
  2807. @item --root-directory=@var{dir}
  2808. Install GRUB images under the directory @var{dir} instead of the root
  2809. directory. This option is useful when you want to install GRUB into a
  2810. separate partition or a removable disk. Here is an example in which
  2811. you have a separate @dfn{boot} partition which is mounted on
  2812. @file{/boot}:
  2813. @example
  2814. @kbd{grub-install --root-directory=/boot hd0}
  2815. @end example
  2816. @item --grub-shell=@var{file}
  2817. Use @var{file} as the grub shell. You can append arbitrary options to
  2818. @var{file} after the file name, like this:
  2819. @example
  2820. @kbd{grub-install --grub-shell="grub --read-only" /dev/fd0}
  2821. @end example
  2822. @item --recheck
  2823. Recheck the device map, even if @file{/boot/grub/device.map} already
  2824. exists. You should use this option whenever you add/remove a disk
  2825. into/from your computer.
  2826. @end table
  2827. @node Invoking grub-md5-crypt
  2828. @chapter Invoking grub-md5-crypt
  2829. The program @command{grub-md5-crypt} encrypts a password in MD5 format.
  2830. This is just a front-end of the grub shell (@pxref{Invoking the grub
  2831. shell}). Passwords encrypted by this program can be used with the
  2832. command @command{password} (@pxref{password}).
  2833. @command{grub-md5-crypt} accepts the following options:
  2834. @table @option
  2835. @item --help
  2836. Print a summary of the command-line options and exit.
  2837. @item --version
  2838. Print the version information and exit.
  2839. @item --grub-shell=@var{file}
  2840. Use @var{file} as the grub shell.
  2841. @end table
  2842. @node Invoking grub-terminfo
  2843. @chapter Invoking grub-terminfo
  2844. The program @command{grub-terminfo} generates a terminfo command from
  2845. a terminfo name (@pxref{terminfo}). The result can be used in the
  2846. configuration file, to define escape sequences. Because GRUB assumes
  2847. that your terminal is vt100-compatible by default, this would be
  2848. useful only if your terminal is uncommon (such as vt52).
  2849. @command{grub-terminfo} accepts the following options:
  2850. @table @option
  2851. @item --help
  2852. Print a summary of the command-line options and exit.
  2853. @item --version
  2854. Print the version information and exit.
  2855. @end table
  2856. You must specify one argument to this command. For example:
  2857. @example
  2858. @kbd{grub-terminfo vt52}
  2859. @end example
  2860. @node Invoking grub-set-default
  2861. @chapter Invoking grub-set-default
  2862. The program @command{grub-set-default} sets the default boot entry for
  2863. GRUB. This automatically creates a file named @file{default} under
  2864. your GRUB directory (i.e. @file{/boot/grub}), if it is not
  2865. present. This file is used to determine the default boot entry when
  2866. GRUB boots up your system when you use @samp{default saved} in your
  2867. configuration file (@pxref{default}), and to save next default boot
  2868. entry when you use @samp{savedefault} in a boot entry
  2869. (@pxref{savedefault}).
  2870. @command{grub-set-default} accepts the following options:
  2871. @table @option
  2872. @item --help
  2873. Print a summary of the command-line options and exit.
  2874. @item --version
  2875. Print the version information and exit.
  2876. @item --root-directory=@var{dir}
  2877. Use the directory @var{dir} instead of the root directory
  2878. (i.e. @file{/}) to define the location of the default file. This
  2879. is useful when you mount a disk which is used for another system.
  2880. @end table
  2881. You must specify a single argument to @command{grub-set-default}. This
  2882. argument is normally the number of a default boot entry. For example,
  2883. if you have this configuration file:
  2884. @example
  2885. @group
  2886. default saved
  2887. timeout 10
  2888. title GNU/Hurd
  2889. root (hd0,0)
  2890. ...
  2891. title GNU/Linux
  2892. root (hd0,1)
  2893. ...
  2894. @end group
  2895. @end example
  2896. and if you want to set the next default boot entry to GNU/Linux, you
  2897. may execute this command:
  2898. @example
  2899. @kbd{grub-set-default 1}
  2900. @end example
  2901. Because the entry for GNU/Linux is @samp{1}. Note that entries are
  2902. counted from zero. So, if you want to specify GNU/Hurd here, then you
  2903. should specify @samp{0}.
  2904. This feature is very useful if you want to test a new kernel or to
  2905. make your system quite robust. @xref{Making your system robust}, for
  2906. more hints about how to set up a robust system.
  2907. @node Obtaining and Building GRUB
  2908. @appendix How to obtain and build GRUB
  2909. @quotation
  2910. @strong{Caution:} GRUB requires binutils-2.9.1.0.23 or later because the
  2911. GNU assembler has been changed so that it can produce real 16bits
  2912. machine code between 2.9.1 and 2.9.1.0.x. See
  2913. @uref{http://sources.redhat.com/binutils/}, to obtain information on
  2914. how to get the latest version.
  2915. @end quotation
  2916. GRUB is available from the GNU alpha archive site
  2917. @uref{ftp://alpha.gnu.org/gnu/grub} or any of its mirrors. The file
  2918. will be named grub-version.tar.gz. The current version is
  2919. @value{VERSION}, so the file you should grab is:
  2920. @uref{ftp://alpha.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz}
  2921. To unbundle GRUB use the instruction:
  2922. @example
  2923. @kbd{zcat grub-@value{VERSION}.tar.gz | tar xvf -}
  2924. @end example
  2925. which will create a directory called @file{grub-@value{VERSION}} with
  2926. all the sources. You can look at the file @file{INSTALL} for detailed
  2927. instructions on how to build and install GRUB, but you should be able to
  2928. just do:
  2929. @example
  2930. @group
  2931. @kbd{cd grub-@value{VERSION}}
  2932. @kbd{./configure}
  2933. @kbd{make install}
  2934. @end group
  2935. @end example
  2936. This will install the grub shell @file{grub} (@pxref{Invoking the grub
  2937. shell}), and the GRUB images. This will also install the GRUB manual.
  2938. Also, the latest version is available from the CVS. See
  2939. @uref{http://savannah.gnu.org/cvs/?group=grub} for more information.
  2940. @node Reporting bugs
  2941. @appendix Reporting bugs
  2942. These are the guideline for how to report bugs. Take a look at this
  2943. list below before you submit bugs:
  2944. @enumerate
  2945. @item
  2946. Before getting unsettled, read this manual through and through. Also,
  2947. see the @uref{http://www.gnu.org/software/grub/grub-faq.html, GNU GRUB FAQ}.
  2948. @item
  2949. Always mention the information on your GRUB. The version number and the
  2950. configuration are quite important. If you build it yourself, write the
  2951. options specified to the configure script and your operating system,
  2952. including the versions of gcc and binutils.
  2953. @item
  2954. If you have trouble with the installation, inform us of how you
  2955. installed GRUB. Don't omit error messages, if any. Just @samp{GRUB hangs
  2956. up when it boots} is not enough.
  2957. The information on your hardware is also essential. These are especially
  2958. important: the geometries and the partition tables of your hard disk
  2959. drives and your BIOS.
  2960. @item
  2961. If GRUB cannot boot your operating system, write down
  2962. @emph{everything} you see on the screen. Don't paraphrase them, like
  2963. @samp{The foo OS crashes with GRUB, even though it can boot with the
  2964. bar boot loader just fine}. Mention the commands you executed, the
  2965. messages printed by them, and information on your operating system
  2966. including the version number.
  2967. @item
  2968. Explain what you wanted to do. It is very useful to know your purpose
  2969. and your wish, and how GRUB didn't satisfy you.
  2970. @item
  2971. If you can investigate the problem yourself, please do. That will give
  2972. you and us much more information on the problem. Attaching a patch is
  2973. even better.
  2974. When you attach a patch, make the patch in unified diff format, and
  2975. write ChangeLog entries. But, even when you make a patch, don't forget
  2976. to explain the problem, so that we can understand what your patch is
  2977. for.
  2978. @item
  2979. Write down anything that you think might be related. Please understand
  2980. that we often need to reproduce the same problem you encountered in our
  2981. environment. So your information should be sufficient for us to do the
  2982. same thing---Don't forget that we cannot see your computer directly. If
  2983. you are not sure whether to state a fact or leave it out, state it!
  2984. Reporting too many things is much better than omitting something
  2985. important.
  2986. @end enumerate
  2987. If you follow the guideline above, submit a report to the
  2988. @uref{http://savannah.gnu.org/bugs/?group=grub, Bug Tracking System}.
  2989. Alternatively, you can submit a report via electronic mail to
  2990. @email{bug-grub@@gnu.org}, but we strongly recommend that you use the
  2991. Bug Tracking System, because e-mail can be passed over easily.
  2992. Once we get your report, we will try to fix the bugs.
  2993. @node Future
  2994. @appendix Where GRUB will go
  2995. We started the next generation of GRUB, GRUB 2. This will include
  2996. internationalization, dynamic module loading, real memory management,
  2997. multiple architecture support, a scripting language, and many other
  2998. nice feature. If you are interested in the development of GRUB 2, take
  2999. a look at @uref{http://www.gnu.org/software/grub/grub.html, the
  3000. homepage}.
  3001. @c Separate the programming guide.
  3002. @include internals.texi
  3003. @node Copying This Manual
  3004. @appendix Copying This Manual
  3005. @menu
  3006. * GNU Free Documentation License:: License for copying this manual.
  3007. @end menu
  3008. @include fdl.texi
  3009. @node Index
  3010. @unnumbered Index
  3011. @c Currently, we use only the Concept Index.
  3012. @printindex cp
  3013. @bye
  3014. Some notes:
  3015. This is the second attempt to rewrite the manual. The status is
  3016. mostly complete, but I need to check the spelling by ispell, and add
  3017. more indices. Perhaps I also have to let some English native speakers
  3018. proofread this manual through. My English is syntactically almost
  3019. perfect, but sometimes (often?) awful in the nuance. Hehe, I can't be an
  3020. English poet for now.