grub.texi 240 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591
  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,2008,2009,2010,2011,2012,2013 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.
  26. @end quotation
  27. @end copying
  28. @dircategory Kernel
  29. @direntry
  30. * GRUB: (grub). The GRand Unified Bootloader
  31. * grub-install: (grub)Invoking grub-install. Install GRUB on your drive
  32. * grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
  33. * grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
  34. * grub-mkrelpath: (grub)Invoking grub-mkrelpath.
  35. * grub-mkrescue: (grub)Invoking grub-mkrescue. Make a GRUB rescue image
  36. * grub-mount: (grub)Invoking grub-mount. Mount a file system using GRUB
  37. * grub-probe: (grub)Invoking grub-probe. Probe device information
  38. * grub-script-check: (grub)Invoking grub-script-check.
  39. @end direntry
  40. @setchapternewpage odd
  41. @titlepage
  42. @sp 10
  43. @title the GNU GRUB manual
  44. @subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}.
  45. @author Gordon Matzigkeit
  46. @author Yoshinori K. Okuji
  47. @author Colin Watson
  48. @author Colin D. Bennett
  49. @c The following two commands start the copyright page.
  50. @page
  51. @vskip 0pt plus 1filll
  52. @insertcopying
  53. @end titlepage
  54. @c Output the table of contents at the beginning.
  55. @contents
  56. @finalout
  57. @headings double
  58. @ifnottex
  59. @node Top
  60. @top GNU GRUB manual
  61. This is the documentation of GNU GRUB, the GRand Unified Bootloader,
  62. a flexible and powerful boot loader program for a wide range of
  63. architectures.
  64. This edition documents version @value{VERSION}.
  65. @insertcopying
  66. @end ifnottex
  67. @menu
  68. * Introduction:: Capturing the spirit of GRUB
  69. * Naming convention:: Names of your drives in GRUB
  70. * OS-specific notes about grub tools::
  71. Some notes about OS-specific behaviour of GRUB
  72. tools
  73. * Installation:: Installing GRUB on your drive
  74. * Booting:: How to boot different operating systems
  75. * Configuration:: Writing your own configuration file
  76. * Theme file format:: Format of GRUB theme files
  77. * Network:: Downloading OS images from a network
  78. * Serial terminal:: Using GRUB via a serial line
  79. * Vendor power-on keys:: Changing GRUB behaviour on vendor power-on keys
  80. * Images:: GRUB image files
  81. * Core image size limitation:: GRUB image files size limitations
  82. * Filesystem:: Filesystem syntax and semantics
  83. * Interface:: The menu and the command-line
  84. * Environment:: GRUB environment variables
  85. * Commands:: The list of available builtin commands
  86. * Internationalisation:: Topics relating to language support
  87. * Security:: Authentication, authorisation, and signatures
  88. * Platform limitations:: The list of platform-specific limitations
  89. * Platform-specific operations:: Platform-specific operations
  90. * Supported kernels:: The list of supported kernels
  91. * Troubleshooting:: Error messages produced by GRUB
  92. * Invoking grub-install:: How to use the GRUB installer
  93. * Invoking grub-mkconfig:: Generate a GRUB configuration file
  94. * Invoking grub-mkpasswd-pbkdf2::
  95. Generate GRUB password hashes
  96. * Invoking grub-mkrelpath:: Make system path relative to its root
  97. * Invoking grub-mkrescue:: Make a GRUB rescue image
  98. * Invoking grub-mount:: Mount a file system using GRUB
  99. * Invoking grub-probe:: Probe device information for GRUB
  100. * Invoking grub-script-check:: Check GRUB script file for syntax errors
  101. * Obtaining and Building GRUB:: How to obtain and build GRUB
  102. * Reporting bugs:: Where you should send a bug report
  103. * Future:: Some future plans on GRUB
  104. * Copying This Manual:: Copying This Manual
  105. * Index::
  106. @end menu
  107. @node Introduction
  108. @chapter Introduction to GRUB
  109. @menu
  110. * Overview:: What exactly GRUB is and how to use it
  111. * History:: From maggot to house fly
  112. * Changes from GRUB Legacy:: Differences from previous versions
  113. * Features:: GRUB features
  114. * Role of a boot loader:: The role of a boot loader
  115. @end menu
  116. @node Overview
  117. @section Overview
  118. Briefly, a @dfn{boot loader} is the first software program that runs when
  119. a computer starts. It is responsible for loading and transferring
  120. control to an operating system @dfn{kernel} software (such as Linux or
  121. GNU Mach). The kernel, in turn, initializes the rest of the operating
  122. system (e.g. a GNU system).
  123. GNU GRUB is a very powerful boot loader, which can load a wide variety
  124. of free operating systems, as well as proprietary operating systems with
  125. chain-loading@footnote{@dfn{chain-load} is the mechanism for loading
  126. unsupported operating systems by loading another boot loader. It is
  127. typically used for loading DOS or Windows.}. GRUB is designed to
  128. address the complexity of booting a personal computer; both the
  129. program and this manual are tightly bound to that computer platform,
  130. although porting to other platforms may be addressed in the future.
  131. One of the important features in GRUB is flexibility; GRUB understands
  132. filesystems and kernel executable formats, so you can load an arbitrary
  133. operating system the way you like, without recording the physical
  134. position of your kernel on the disk. Thus you can load the kernel
  135. just by specifying its file name and the drive and partition where the
  136. kernel resides.
  137. When booting with GRUB, you can use either a command-line interface
  138. (@pxref{Command-line interface}), or a menu interface (@pxref{Menu
  139. interface}). Using the command-line interface, you type the drive
  140. specification and file name of the kernel manually. In the menu
  141. interface, you just select an OS using the arrow keys. The menu is
  142. based on a configuration file which you prepare beforehand
  143. (@pxref{Configuration}). While in the menu, you can switch to the
  144. command-line mode, and vice-versa. You can even edit menu entries
  145. before using them.
  146. In the following chapters, you will learn how to specify a drive, a
  147. partition, and a file name (@pxref{Naming convention}) to GRUB, how to
  148. install GRUB on your drive (@pxref{Installation}), and how to boot your
  149. OSes (@pxref{Booting}), step by step.
  150. @node History
  151. @section History of GRUB
  152. GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
  153. Hurd with the University of Utah's Mach 4 microkernel (now known as GNU
  154. Mach). Erich and Brian Ford designed the Multiboot Specification
  155. (@pxref{Top, Multiboot Specification, Motivation, multiboot, The Multiboot
  156. Specification}), because they were determined not to add to the large
  157. number of mutually-incompatible PC boot methods.
  158. Erich then began modifying the FreeBSD boot loader so that it would
  159. understand Multiboot. He soon realized that it would be a lot easier
  160. to write his own boot loader from scratch than to keep working on the
  161. FreeBSD boot loader, and so GRUB was born.
  162. Erich added many features to GRUB, but other priorities prevented him
  163. from keeping up with the demands of its quickly-expanding user base. In
  164. 1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an
  165. official GNU package, and opened its development by making the latest
  166. sources available via anonymous CVS. @xref{Obtaining and Building
  167. GRUB}, for more information.
  168. Over the next few years, GRUB was extended to meet many needs, but it
  169. quickly became clear that its design was not keeping up with the extensions
  170. being made to it, and we reached the point where it was very difficult to
  171. make any further changes without breaking existing features. Around 2002,
  172. Yoshinori K. Okuji started work on PUPA (Preliminary Universal Programming
  173. Architecture for GNU GRUB), aiming to rewrite the core of GRUB to make it
  174. cleaner, safer, more robust, and more powerful. PUPA was eventually renamed
  175. to GRUB 2, and the original version of GRUB was renamed to GRUB Legacy.
  176. Small amounts of maintenance continued to be done on GRUB Legacy, but the
  177. last release (0.97) was made in 2005 and at the time of writing it seems
  178. unlikely that there will be another.
  179. By around 2007, GNU/Linux distributions started to use GRUB 2 to limited
  180. extents, and by the end of 2009 multiple major distributions were installing
  181. it by default.
  182. @node Changes from GRUB Legacy
  183. @section Differences from previous versions
  184. GRUB 2 is a rewrite of GRUB (@pxref{History}), although it shares many
  185. characteristics with the previous version, now known as GRUB Legacy. Users
  186. of GRUB Legacy may need some guidance to find their way around this new
  187. version.
  188. @itemize @bullet
  189. @item
  190. The configuration file has a new name (@file{grub.cfg} rather than
  191. @file{menu.lst} or @file{grub.conf}), new syntax (@pxref{Configuration}) and
  192. many new commands (@pxref{Commands}). Configuration cannot be copied over
  193. directly, although most GRUB Legacy users should not find the syntax too
  194. surprising.
  195. @item
  196. @file{grub.cfg} is typically automatically generated by
  197. @command{grub-mkconfig} (@pxref{Simple configuration}). This makes it
  198. easier to handle versioned kernel upgrades.
  199. @item
  200. Partition numbers in GRUB device names now start at 1, not 0 (@pxref{Naming
  201. convention}).
  202. @item
  203. The configuration file is now written in something closer to a full
  204. scripting language: variables, conditionals, and loops are available.
  205. @item
  206. A small amount of persistent storage is available across reboots, using the
  207. @command{save_env} and @command{load_env} commands in GRUB and the
  208. @command{grub-editenv} utility. This is not available in all configurations
  209. (@pxref{Environment block}).
  210. @item
  211. GRUB 2 has more reliable ways to find its own files and those of target
  212. kernels on multiple-disk systems, and has commands (@pxref{search}) to find
  213. devices using file system labels or Universally Unique Identifiers (UUIDs).
  214. @item
  215. GRUB 2 is available for several other types of system in addition to the PC
  216. BIOS systems supported by GRUB Legacy: PC EFI, PC coreboot, PowerPC, SPARC,
  217. and MIPS Lemote Yeeloong are all supported.
  218. @item
  219. Many more file systems are supported, including but not limited to ext4,
  220. HFS+, and NTFS.
  221. @item
  222. GRUB 2 can read files directly from LVM and RAID devices.
  223. @item
  224. A graphical terminal and a graphical menu system are available.
  225. @item
  226. GRUB 2's interface can be translated, including menu entry names.
  227. @item
  228. The image files (@pxref{Images}) that make up GRUB have been reorganised;
  229. Stage 1, Stage 1.5, and Stage 2 are no more.
  230. @item
  231. GRUB 2 puts many facilities in dynamically loaded modules, allowing the core
  232. image to be smaller, and allowing the core image to be built in more
  233. flexible ways.
  234. @end itemize
  235. @node Features
  236. @section GRUB features
  237. The primary requirement for GRUB is that it be compliant with the
  238. @dfn{Multiboot Specification}, which is described in @ref{Top, Multiboot
  239. Specification, Motivation, multiboot, The Multiboot Specification}.
  240. The other goals, listed in approximate order of importance, are:
  241. @itemize @bullet{}
  242. @item
  243. Basic functions must be straightforward for end-users.
  244. @item
  245. Rich functionality to support kernel experts and designers.
  246. @item
  247. Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and
  248. Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are
  249. supported via a chain-loading function.
  250. @end itemize
  251. Except for specific compatibility modes (chain-loading and the Linux
  252. @dfn{piggyback} format), all kernels will be started in much the same
  253. state as in the Multiboot Specification. Only kernels loaded at 1 megabyte
  254. or above are presently supported. Any attempt to load below that
  255. boundary will simply result in immediate failure and an error message
  256. reporting the problem.
  257. In addition to the requirements above, GRUB has the following features
  258. (note that the Multiboot Specification doesn't require all the features
  259. that GRUB supports):
  260. @table @asis
  261. @item Recognize multiple executable formats
  262. Support many of the @dfn{a.out} variants plus @dfn{ELF}. Symbol
  263. tables are also loaded.
  264. @item Support non-Multiboot kernels
  265. Support many of the various free 32-bit kernels that lack Multiboot
  266. compliance (primarily FreeBSD, NetBSD@footnote{The NetBSD/i386 kernel
  267. is Multiboot-compliant, but lacks support for Multiboot modules.},
  268. OpenBSD, and Linux). Chain-loading of other boot loaders is also
  269. supported.
  270. @item Load multiples modules
  271. Fully support the Multiboot feature of loading multiple modules.
  272. @item Load a configuration file
  273. Support a human-readable text configuration file with preset boot
  274. commands. You can also load another configuration file dynamically and
  275. embed a preset configuration file in a GRUB image file. The list of
  276. commands (@pxref{Commands}) are a superset of those supported on the
  277. command-line. An example configuration file is provided in
  278. @ref{Configuration}.
  279. @item Provide a menu interface
  280. A menu interface listing preset boot commands, with a programmable
  281. timeout, is available. There is no fixed limit on the number of boot
  282. entries, and the current implementation has space for several hundred.
  283. @item Have a flexible command-line interface
  284. A fairly flexible command-line interface, accessible from the menu,
  285. is available to edit any preset commands, or write a new boot command
  286. set from scratch. If no configuration file is present, GRUB drops to
  287. the command-line.
  288. The list of commands (@pxref{Commands}) are a subset of those supported
  289. for configuration files. Editing commands closely resembles the Bash
  290. command-line (@pxref{Command Line Editing, Bash, Command Line Editing,
  291. features, Bash Features}), with @key{TAB}-completion of commands,
  292. devices, partitions, and files in a directory depending on context.
  293. @item Support multiple filesystem types
  294. Support multiple filesystem types transparently, plus a useful explicit
  295. blocklist notation. The currently supported filesystem types are @dfn{Amiga
  296. Fast FileSystem (AFFS)}, @dfn{AtheOS fs}, @dfn{BeFS},
  297. @dfn{BtrFS} (including raid0, raid1, raid10, gzip and lzo),
  298. @dfn{cpio} (little- and big-endian bin, odc and newc variants),
  299. @dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, @dfn{exFAT}, @dfn{HFS},
  300. @dfn{HFS+}, @dfn{ISO9660} (including Joliet, Rock-ridge and multi-chunk files),
  301. @dfn{JFS}, @dfn{Minix fs} (versions 1, 2 and 3), @dfn{nilfs2},
  302. @dfn{NTFS} (including compression), @dfn{ReiserFS}, @dfn{ROMFS},
  303. @dfn{Amiga Smart FileSystem (SFS)}, @dfn{Squash4}, @dfn{tar}, @dfn{UDF},
  304. @dfn{BSD UFS/UFS2}, @dfn{XFS}, and @dfn{ZFS} (including lzjb, gzip,
  305. zle, mirror, stripe, raidz1/2/3 and encryption in AES-CCM and AES-GCM).
  306. @xref{Filesystem}, for more information.
  307. @item Support automatic decompression
  308. Can decompress files which were compressed by @command{gzip} or
  309. @command{xz}@footnote{Only CRC32 data integrity check is supported (xz default
  310. is CRC64 so one should use --check=crc32 option). LZMA BCJ filters are
  311. supported.}. This function is both automatic and transparent to the user
  312. (i.e. all functions operate upon the uncompressed contents of the specified
  313. files). This greatly reduces a file size and loading time, a
  314. particularly great benefit for floppies.@footnote{There are a few
  315. pathological cases where loading a very badly organized ELF kernel might
  316. take longer, but in practice this never happen.}
  317. It is conceivable that some kernel modules should be loaded in a
  318. compressed state, so a different module-loading command can be specified
  319. to avoid uncompressing the modules.
  320. @item Access data on any installed device
  321. Support reading data from any or all floppies or hard disk(s) recognized
  322. by the BIOS, independent of the setting of the root device.
  323. @item Be independent of drive geometry translations
  324. Unlike many other boot loaders, GRUB makes the particular drive
  325. translation irrelevant. A drive installed and running with one
  326. translation may be converted to another translation without any adverse
  327. effects or changes in GRUB's configuration.
  328. @item Detect all installed @sc{ram}
  329. GRUB can generally find all the installed @sc{ram} on a PC-compatible
  330. machine. It uses an advanced BIOS query technique for finding all
  331. memory regions. As described on the Multiboot Specification (@pxref{Top,
  332. Multiboot Specification, Motivation, multiboot, The Multiboot
  333. Specification}), not all kernels make use of this information, but GRUB
  334. provides it for those who do.
  335. @item Support Logical Block Address mode
  336. In traditional disk calls (called @dfn{CHS mode}), there is a geometry
  337. translation problem, that is, the BIOS cannot access over 1024
  338. cylinders, so the accessible space is limited to at least 508 MB and to
  339. at most 8GB. GRUB can't universally solve this problem, as there is no
  340. standard interface used in all machines. However, several newer machines
  341. have the new interface, Logical Block Address (@dfn{LBA}) mode. GRUB
  342. automatically detects if LBA mode is available and uses it if
  343. available. In LBA mode, GRUB can access the entire disk.
  344. @item Support network booting
  345. GRUB is basically a disk-based boot loader but also has network
  346. support. You can load OS images from a network by using the @dfn{TFTP}
  347. protocol.
  348. @item Support remote terminals
  349. To support computers with no console, GRUB provides remote terminal
  350. support, so that you can control GRUB from a remote host. Only serial
  351. terminal support is implemented at the moment.
  352. @end table
  353. @node Role of a boot loader
  354. @section The role of a boot loader
  355. The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
  356. @quotation
  357. Some people like to acknowledge both the operating system and kernel when
  358. they talk about their computers, so they might say they use
  359. ``GNU/Linux'' or ``GNU/Hurd''. Other people seem to think that the
  360. kernel is the most important part of the system, so they like to call
  361. their GNU operating systems ``Linux systems.''
  362. I, personally, believe that this is a grave injustice, because the
  363. @emph{boot loader} is the most important software of all. I used to
  364. refer to the above systems as either ``LILO''@footnote{The LInux LOader,
  365. a boot loader that everybody uses, but nobody likes.} or ``GRUB''
  366. systems.
  367. Unfortunately, nobody ever understood what I was talking about; now I
  368. just use the word ``GNU'' as a pseudonym for GRUB.
  369. So, if you ever hear people talking about their alleged ``GNU'' systems,
  370. remember that they are actually paying homage to the best boot loader
  371. around@dots{} GRUB!
  372. @end quotation
  373. We, the GRUB maintainers, do not (usually) encourage Gordon's level of
  374. fanaticism, but it helps to remember that boot loaders deserve
  375. recognition. We hope that you enjoy using GNU GRUB as much as we did
  376. writing it.
  377. @node Naming convention
  378. @chapter Naming convention
  379. The device syntax used in GRUB is a wee bit different from what you may
  380. have seen before in your operating system(s), and you need to know it so
  381. that you can specify a drive/partition.
  382. Look at the following examples and explanations:
  383. @example
  384. (fd0)
  385. @end example
  386. First of all, GRUB requires that the device name be enclosed with
  387. @samp{(} and @samp{)}. The @samp{fd} part means that it is a floppy
  388. disk. The number @samp{0} is the drive number, which is counted from
  389. @emph{zero}. This expression means that GRUB will use the whole floppy
  390. disk.
  391. @example
  392. (hd0,msdos2)
  393. @end example
  394. Here, @samp{hd} means it is a hard disk drive. The first integer
  395. @samp{0} indicates the drive number, that is, the first hard disk,
  396. the string @samp{msdos} indicates the partition scheme, while
  397. the second integer, @samp{2}, indicates the partition number (or the
  398. @sc{pc} slice number in the BSD terminology). The partition numbers are
  399. counted from @emph{one}, not from zero (as was the case in previous
  400. versions of GRUB). This expression means the second partition of the
  401. first hard disk drive. In this case, GRUB uses one partition of the
  402. disk, instead of the whole disk.
  403. @example
  404. (hd0,msdos5)
  405. @end example
  406. This specifies the first @dfn{extended partition} of the first hard disk
  407. drive. Note that the partition numbers for extended partitions are
  408. counted from @samp{5}, regardless of the actual number of primary
  409. partitions on your hard disk.
  410. @example
  411. (hd1,msdos1,bsd1)
  412. @end example
  413. This means the BSD @samp{a} partition on first @sc{pc} slice number
  414. of the second hard disk.
  415. Of course, to actually access the disks or partitions with GRUB, you
  416. need to use the device specification in a command, like @samp{set
  417. root=(fd0)} or @samp{parttool (hd0,msdos3) hidden-}. To help you find out
  418. which number specifies a partition you want, the GRUB command-line
  419. (@pxref{Command-line interface}) options have argument
  420. completion. This means that, for example, you only need to type
  421. @example
  422. set root=(
  423. @end example
  424. followed by a @key{TAB}, and GRUB will display the list of drives,
  425. partitions, or file names. So it should be quite easy to determine the
  426. name of your target partition, even with minimal knowledge of the
  427. syntax.
  428. Note that GRUB does @emph{not} distinguish IDE from SCSI - it simply
  429. counts the drive numbers from zero, regardless of their type. Normally,
  430. any IDE drive number is less than any SCSI drive number, although that
  431. is not true if you change the boot sequence by swapping IDE and SCSI
  432. drives in your BIOS.
  433. Now the question is, how to specify a file? Again, consider an
  434. example:
  435. @example
  436. (hd0,msdos1)/vmlinuz
  437. @end example
  438. This specifies the file named @samp{vmlinuz}, found on the first
  439. partition of the first hard disk drive. Note that the argument
  440. completion works with file names, too.
  441. That was easy, admit it. Now read the next chapter, to find out how to
  442. actually install GRUB on your drive.
  443. @node OS-specific notes about grub tools
  444. @chapter OS-specific notes about grub tools
  445. On OS which have device nodes similar to Unix-like OS GRUB tools use the
  446. OS name. E.g. for GNU/Linux:
  447. @example
  448. # @kbd{grub-install /dev/sda}
  449. @end example
  450. On AROS we use another syntax. For volumes:
  451. @example
  452. //:<volume name>
  453. @end example
  454. E.g.
  455. @example
  456. //:DH0
  457. @end example
  458. For disks we use syntax:
  459. @example
  460. //:<driver name>/unit/flags
  461. @end example
  462. E.g.
  463. @example
  464. # @kbd{grub-install //:ata.device/0/0}
  465. @end example
  466. On Windows we use UNC path. For volumes it's typically
  467. @example
  468. \\?\Volume@{<GUID>@}
  469. \\?\<drive letter>:
  470. @end example
  471. E.g.
  472. @example
  473. \\?\Volume@{17f34d50-cf64-4b02-800e-51d79c3aa2ff@}
  474. \\?\C:
  475. @end example
  476. For disks it's
  477. @example
  478. \\?\PhysicalDrive<number>
  479. @end example
  480. E.g.
  481. @example
  482. # @kbd{grub-install \\?\PhysicalDrive0}
  483. @end example
  484. Beware that you may need to further escape the backslashes depending on your
  485. shell.
  486. When compiled with cygwin support then cygwin drive names are automatically
  487. when needed. E.g.
  488. @example
  489. # @kbd{grub-install /dev/sda}
  490. @end example
  491. @node Installation
  492. @chapter Installation
  493. In order to install GRUB as your boot loader, you need to first
  494. install the GRUB system and utilities under your UNIX-like operating
  495. system (@pxref{Obtaining and Building GRUB}). You can do this either
  496. from the source tarball, or as a package for your OS.
  497. After you have done that, you need to install the boot loader on a
  498. drive (floppy or hard disk) by using the utility
  499. @command{grub-install} (@pxref{Invoking grub-install}) on a UNIX-like OS.
  500. GRUB comes with boot images, which are normally put in the directory
  501. @file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines
  502. @file{/usr/lib/grub/i386-pc}). Hereafter, the directory where GRUB images are
  503. initially placed (normally @file{/usr/lib/grub/<cpu>-<platform>}) will be
  504. called the @dfn{image directory}, and the directory where the boot
  505. loader needs to find them (usually @file{/boot}) will be called
  506. the @dfn{boot directory}.
  507. @menu
  508. * Installing GRUB using grub-install::
  509. * Making a GRUB bootable CD-ROM::
  510. * Device map::
  511. * BIOS installation::
  512. @end menu
  513. @node Installing GRUB using grub-install
  514. @section Installing GRUB using grub-install
  515. For information on where GRUB should be installed on PC BIOS platforms,
  516. @pxref{BIOS installation}.
  517. In order to install GRUB under a UNIX-like OS (such
  518. as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking
  519. grub-install}) as the superuser (@dfn{root}).
  520. The usage is basically very simple. You only need to specify one
  521. argument to the program, namely, where to install the boot loader. The
  522. argument has to be either a device file (like @samp{/dev/hda}).
  523. For example, under Linux the following will install GRUB into the MBR
  524. of the first IDE disk:
  525. @example
  526. # @kbd{grub-install /dev/sda}
  527. @end example
  528. Likewise, under GNU/Hurd, this has the same effect:
  529. @example
  530. # @kbd{grub-install /dev/hd0}
  531. @end example
  532. But all the above examples assume that GRUB should put images under
  533. the @file{/boot} directory. If you want GRUB to put images under a directory
  534. other than @file{/boot}, you need to specify the option
  535. @option{--boot-directory}. The typical usage is that you create a GRUB
  536. boot floppy with a filesystem. Here is an example:
  537. @example
  538. @group
  539. # @kbd{mke2fs /dev/fd0}
  540. # @kbd{mount -t ext2 /dev/fd0 /mnt}
  541. # @kbd{mkdir /mnt/boot}
  542. # @kbd{grub-install --boot-directory=/mnt/boot /dev/fd0}
  543. # @kbd{umount /mnt}
  544. @end group
  545. @end example
  546. Some BIOSes have a bug of exposing the first partition of a USB drive as a
  547. floppy instead of exposing the USB drive as a hard disk (they call it
  548. ``USB-FDD'' boot). In such cases, you need to install like this:
  549. @example
  550. # @kbd{losetup /dev/loop0 /dev/sdb1}
  551. # @kbd{mount /dev/loop0 /mnt/usb}
  552. # @kbd{grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0}
  553. @end example
  554. This install doesn't conflict with standard install as long as they are in
  555. separate directories.
  556. Note that @command{grub-install} is actually just a shell script and the
  557. real task is done by other tools such as @command{grub-mkimage}. Therefore,
  558. you may run those commands directly to install GRUB, without using
  559. @command{grub-install}. Don't do that, however, unless you are very familiar
  560. with the internals of GRUB. Installing a boot loader on a running OS may be
  561. extremely dangerous.
  562. On EFI systems for fixed disk install you have to mount EFI System Partition.
  563. If you mount it at @file{/boot/efi} then you don't need any special arguments:
  564. @example
  565. # @kbd{grub-install}
  566. @end example
  567. Otherwise you need to specify where your EFI System partition is mounted:
  568. @example
  569. # @kbd{grub-install --efi-directory=/mnt/efi}
  570. @end example
  571. For removable installs you have to use @option{--removable} and specify both
  572. @option{--boot-directory} and @option{--efi-directory}:
  573. @example
  574. # @kbd{grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable}
  575. @end example
  576. @node Making a GRUB bootable CD-ROM
  577. @section Making a GRUB bootable CD-ROM
  578. GRUB supports the @dfn{no emulation mode} in the El Torito
  579. specification@footnote{El Torito is a specification for bootable CD
  580. using BIOS functions.}. This means that you can use the whole CD-ROM
  581. from GRUB and you don't have to make a floppy or hard disk image file,
  582. which can cause compatibility problems.
  583. For booting from a CD-ROM, GRUB uses a special image called
  584. @file{cdboot.img}, which is concatenated with @file{core.img}. The
  585. @file{core.img} used for this should be built with at least the
  586. @samp{iso9660} and @samp{biosdisk} modules. Your bootable CD-ROM will
  587. usually also need to include a configuration file @file{grub.cfg} and some
  588. other GRUB modules.
  589. To make a simple generic GRUB rescue CD, you can use the
  590. @command{grub-mkrescue} program (@pxref{Invoking grub-mkrescue}):
  591. @example
  592. $ @kbd{grub-mkrescue -o grub.iso}
  593. @end example
  594. You will often need to include other files in your image. To do this, first
  595. make a top directory for the bootable image, say, @samp{iso}:
  596. @example
  597. $ @kbd{mkdir iso}
  598. @end example
  599. Make a directory for GRUB:
  600. @example
  601. $ @kbd{mkdir -p iso/boot/grub}
  602. @end example
  603. If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub}
  604. (@pxref{Configuration}), and copy any files and directories for the disc to the
  605. directory @file{iso/}.
  606. Finally, make the image:
  607. @example
  608. $ @kbd{grub-mkrescue -o grub.iso iso}
  609. @end example
  610. This produces a file named @file{grub.iso}, which then can be burned
  611. into a CD (or a DVD), or written to a USB mass storage device.
  612. The root device will be set up appropriately on entering your
  613. @file{grub.cfg} configuration file, so you can refer to file names on the CD
  614. without needing to use an explicit device name. This makes it easier to
  615. produce rescue images that will work on both optical drives and USB mass
  616. storage devices.
  617. @node Device map
  618. @section The map between BIOS drives and OS devices
  619. If the device map file exists, the GRUB utilities (@command{grub-probe},
  620. etc.) read it to map BIOS drives to OS devices. This file consists of lines
  621. like this:
  622. @example
  623. (@var{device}) @var{file}
  624. @end example
  625. @var{device} is a drive specified in the GRUB syntax (@pxref{Device
  626. syntax}), and @var{file} is an OS file, which is normally a device file.
  627. Historically, the device map file was used because GRUB device names had to
  628. be used in the configuration file, and they were derived from BIOS drive
  629. numbers. The map between BIOS drives and OS devices cannot always be
  630. guessed correctly: for example, GRUB will get the order wrong if you
  631. exchange the boot sequence between IDE and SCSI in your BIOS.
  632. Unfortunately, even OS device names are not always stable. Modern versions
  633. of the Linux kernel may probe drives in a different order from boot to boot,
  634. and the prefix (@file{/dev/hd*} versus @file{/dev/sd*}) may change depending
  635. on the driver subsystem in use. As a result, the device map file required
  636. frequent editing on some systems.
  637. GRUB avoids this problem nowadays by using UUIDs or file system labels when
  638. generating @file{grub.cfg}, and we advise that you do the same for any
  639. custom menu entries you write. If the device map file does not exist, then
  640. the GRUB utilities will assume a temporary device map on the fly. This is
  641. often good enough, particularly in the common case of single-disk systems.
  642. However, the device map file is not entirely obsolete yet, and it is
  643. used for overriding when current environment is different from the one on boot.
  644. Most common case is if you use a partition or logical volume as a disk for
  645. virtual machine. You can put any comments in the file if needed,
  646. as the GRUB utilities assume that a line is just a comment if
  647. the first character is @samp{#}.
  648. @node BIOS installation
  649. @section BIOS installation
  650. @heading MBR
  651. The partition table format traditionally used on PC BIOS platforms is called
  652. the Master Boot Record (MBR) format; this is the format that allows up to
  653. four primary partitions and additional logical partitions. With this
  654. partition table format, there are two ways to install GRUB: it can be
  655. embedded in the area between the MBR and the first partition (called by
  656. various names, such as the "boot track", "MBR gap", or "embedding area", and
  657. which is usually at least 31 KiB), or the core image can be installed in a
  658. file system and a list of the blocks that make it up can be stored in the
  659. first sector of that partition.
  660. Each of these has different problems. There is no way to reserve space in
  661. the embedding area with complete safety, and some proprietary software is
  662. known to use it to make it difficult for users to work around licensing
  663. restrictions; and systems are sometimes partitioned without leaving enough
  664. space before the first partition. On the other hand, installing to a
  665. filesystem means that GRUB is vulnerable to its blocks being moved around by
  666. filesystem features such as tail packing, or even by aggressive fsck
  667. implementations, so this approach is quite fragile; and this approach can
  668. only be used if the @file{/boot} filesystem is on the same disk that the
  669. BIOS boots from, so that GRUB does not have to rely on guessing BIOS drive
  670. numbers.
  671. The GRUB development team generally recommends embedding GRUB before the
  672. first partition, unless you have special requirements. You must ensure that
  673. the first partition starts at least 31 KiB (63 sectors) from the start of
  674. the disk; on modern disks, it is often a performance advantage to align
  675. partitions on larger boundaries anyway, so the first partition might start 1
  676. MiB from the start of the disk.
  677. @heading GPT
  678. Some newer systems use the GUID Partition Table (GPT) format. This was
  679. specified as part of the Extensible Firmware Interface (EFI), but it can
  680. also be used on BIOS platforms if system software supports it; for example,
  681. GRUB and GNU/Linux can be used in this configuration. With this format, it
  682. is possible to reserve a whole partition for GRUB, called the BIOS Boot
  683. Partition. GRUB can then be embedded into that partition without the risk
  684. of being overwritten by other software and without being contained in a
  685. filesystem which might move its blocks around.
  686. When creating a BIOS Boot Partition on a GPT system, you should make sure
  687. that it is at least 31 KiB in size. (GPT-formatted disks are not usually
  688. particularly small, so we recommend that you make it larger than the bare
  689. minimum, such as 1 MiB, to allow plenty of room for growth.) You must also
  690. make sure that it has the proper partition type. Using GNU Parted, you can
  691. set this using a command such as the following:
  692. @example
  693. # @kbd{parted /dev/@var{disk} set @var{partition-number} bios_grub on}
  694. @end example
  695. If you are using gdisk, set the partition type to @samp{0xEF02}. With
  696. partitioning programs that require setting the GUID directly, it should be
  697. @samp{21686148-6449-6e6f-744e656564454649}.
  698. @strong{Caution:} Be very careful which partition you select! When GRUB
  699. finds a BIOS Boot Partition during installation, it will automatically
  700. overwrite part of it. Make sure that the partition does not contain any
  701. other data.
  702. @node Booting
  703. @chapter Booting
  704. GRUB can load Multiboot-compliant kernels in a consistent way,
  705. but for some free operating systems you need to use some OS-specific
  706. magic.
  707. @menu
  708. * General boot methods:: How to boot OSes with GRUB generally
  709. * Loopback booting:: Notes on booting from loopbacks
  710. * OS-specific notes:: Notes on some operating systems
  711. @end menu
  712. @node General boot methods
  713. @section How to boot operating systems
  714. GRUB has two distinct boot methods. One of the two is to load an
  715. operating system directly, and the other is to chain-load another boot
  716. loader which then will load an operating system actually. Generally
  717. speaking, the former is more desirable, because you don't need to
  718. install or maintain other boot loaders and GRUB is flexible enough to
  719. load an operating system from an arbitrary disk/partition. However,
  720. the latter is sometimes required, since GRUB doesn't support all the
  721. existing operating systems natively.
  722. @menu
  723. * Loading an operating system directly::
  724. * Chain-loading::
  725. @end menu
  726. @node Loading an operating system directly
  727. @subsection How to boot an OS directly with GRUB
  728. Multiboot (@pxref{Top, Multiboot Specification, Motivation, multiboot,
  729. The Multiboot Specification}) is the native format supported by GRUB.
  730. For the sake of convenience, there is also support for Linux, FreeBSD,
  731. NetBSD and OpenBSD. If you want to boot other operating systems, you
  732. will have to chain-load them (@pxref{Chain-loading}).
  733. FIXME: this section is incomplete.
  734. @enumerate
  735. @item
  736. Run the command @command{boot} (@pxref{boot}).
  737. @end enumerate
  738. However, DOS and Windows have some deficiencies, so you might have to
  739. use more complicated instructions. @xref{DOS/Windows}, for more
  740. information.
  741. @node Chain-loading
  742. @subsection Chain-loading an OS
  743. Operating systems that do not support Multiboot and do not have specific
  744. support in GRUB (specific support is available for Linux, FreeBSD, NetBSD
  745. and OpenBSD) must be chain-loaded, which involves loading another boot
  746. loader and jumping to it in real mode.
  747. The @command{chainloader} command (@pxref{chainloader}) is used to set this
  748. up. It is normally also necessary to load some GRUB modules and set the
  749. appropriate root device. Putting this together, we get something like this,
  750. for a Windows system on the first partition of the first hard disk:
  751. @verbatim
  752. menuentry "Windows" {
  753. insmod chain
  754. insmod ntfs
  755. set root=(hd0,1)
  756. chainloader +1
  757. }
  758. @end verbatim
  759. @c FIXME: document UUIDs.
  760. On systems with multiple hard disks, an additional workaround may be
  761. required. @xref{DOS/Windows}.
  762. Chain-loading is only supported on PC BIOS and EFI platforms.
  763. @node Loopback booting
  764. @section Loopback booting
  765. GRUB is able to read from an image (be it one of CD or HDD) stored on
  766. any of its accessible storages (refer to @pxref{loopback} command).
  767. However the OS itself should be able to find its root. This usually
  768. involves running a userspace program running before the real root
  769. is discovered. This is achieved by GRUB loading a specially made
  770. small image and passing it as ramdisk to the kernel. This is achieved
  771. by commands @command{kfreebsd_module}, @command{knetbsd_module_elf},
  772. @command{kopenbsd_ramdisk}, @command{initrd} (@pxref{initrd}),
  773. @command{initrd16} (@pxref{initrd}), @command{multiboot_module},
  774. @command{multiboot2_module} or @command{xnu_ramdisk}
  775. depending on the loader. Note that for knetbsd the image must be put
  776. inside miniroot.kmod and the whole miniroot.kmod has to be loaded. In
  777. kopenbsd payload this is disabled by default. Aditionally behaviour of
  778. initial ramdisk depends on command line options. Several distributors provide
  779. the image for this purpose or it's integrated in their standard ramdisk and
  780. activated by special option. Consult your kernel and distribution manual for
  781. more details. Other loaders like appleloader, chainloader (BIOS, EFI, coreboot),
  782. freedos, ntldr and plan9 provide no possibility of loading initial ramdisk and
  783. as far as author is aware the payloads in question don't support either initial
  784. ramdisk or discovering loopback boot in other way and as such not bootable this
  785. way. Please consider alternative boot methods like copying all files
  786. from the image to actual partition. Consult your OS documentation for
  787. more details
  788. @node OS-specific notes
  789. @section Some caveats on OS-specific issues
  790. Here, we describe some caveats on several operating systems.
  791. @menu
  792. * GNU/Hurd::
  793. * GNU/Linux::
  794. * NetBSD::
  795. * DOS/Windows::
  796. @end menu
  797. @node GNU/Hurd
  798. @subsection GNU/Hurd
  799. Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is
  800. nothing special about it. But do not forget that you have to specify a
  801. root partition to the kernel.
  802. @enumerate
  803. @item
  804. Set GRUB's root device to the same drive as GNU/Hurd's. The command
  805. @code{search --set=root --file /boot/gnumach.gz} or similar may help you
  806. (@pxref{search}).
  807. @item
  808. Load the kernel and the modules, like this:
  809. @example
  810. @group
  811. grub> @kbd{multiboot /boot/gnumach.gz root=device:hd0s1}
  812. grub> @kbd{module /hurd/ext2fs.static ext2fs --readonly \
  813. --multiboot-command-line='$@{kernel-command-line@}' \
  814. --host-priv-port='$@{host-port@}' \
  815. --device-master-port='$@{device-port@}' \
  816. --exec-server-task='$@{exec-task@}' -T typed '$@{root@}' \
  817. '$(task-create)' '$(task-resume)'}
  818. grub> @kbd{module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'}
  819. @end group
  820. @end example
  821. @item
  822. Finally, run the command @command{boot} (@pxref{boot}).
  823. @end enumerate
  824. @node GNU/Linux
  825. @subsection GNU/Linux
  826. It is relatively easy to boot GNU/Linux from GRUB, because it somewhat
  827. resembles to boot a Multiboot-compliant OS.
  828. @enumerate
  829. @item
  830. Set GRUB's root device to the same drive as GNU/Linux's. The command
  831. @code{search --set=root --file /vmlinuz} or similar may help you
  832. (@pxref{search}).
  833. @item
  834. Load the kernel using the command @command{linux} (@pxref{linux}):
  835. @example
  836. grub> @kbd{linux /vmlinuz root=/dev/sda1}
  837. @end example
  838. If you need to specify some kernel parameters, just append them to the
  839. command. For example, to set @option{acpi} to @samp{off}, do this:
  840. @example
  841. grub> @kbd{linux /vmlinuz root=/dev/sda1 acpi=off}
  842. @end example
  843. See the documentation in the Linux source tree for complete information on
  844. the available options.
  845. With @command{linux} GRUB uses 32-bit protocol. Some BIOS services like APM
  846. or EDD aren't available with this protocol. In this case you need to use
  847. @command{linux16}
  848. @example
  849. grub> @kbd{linux16 /vmlinuz root=/dev/sda1 acpi=off}
  850. @end example
  851. @item
  852. If you use an initrd, execute the command @command{initrd} (@pxref{initrd})
  853. after @command{linux}:
  854. @example
  855. grub> @kbd{initrd /initrd}
  856. @end example
  857. If you used @command{linux16} you need to use @command{initrd16}:
  858. @example
  859. grub> @kbd{initrd16 /initrd}
  860. @end example
  861. @item
  862. Finally, run the command @command{boot} (@pxref{boot}).
  863. @end enumerate
  864. @strong{Caution:} If you use an initrd and specify the @samp{mem=}
  865. option to the kernel to let it use less than actual memory size, you
  866. will also have to specify the same memory size to GRUB. To let GRUB know
  867. the size, run the command @command{uppermem} @emph{before} loading the
  868. kernel. @xref{uppermem}, for more information.
  869. @node NetBSD
  870. @subsection NetBSD
  871. Booting a NetBSD kernel from GRUB is also relatively easy: first set
  872. GRUB's root device, then load the kernel and the modules, and finally
  873. run @command{boot}.
  874. @enumerate
  875. @item
  876. Set GRUB's root device to the partition holding the NetBSD root file
  877. system. For a disk with a NetBSD disk label, this is usually the first
  878. partition (a:). In that case, and assuming that the partition is on the
  879. first hard disk, set GRUB's root device as follows:
  880. @example
  881. grub> @kbd{insmod part_bsd}
  882. grub> @kbd{set root=(hd0,netbsd1)}
  883. @end example
  884. For a disk with a GUID Partition Table (GPT), and assuming that the
  885. NetBSD root partition is the third GPT partition, do this:
  886. @example
  887. grub> @kbd{insmod part_gpt}
  888. grub> @kbd{set root=(hd0,gpt3)}
  889. @end example
  890. @item
  891. Load the kernel using the command @command{knetbsd}:
  892. @example
  893. grub> @kbd{knetbsd /netbsd}
  894. @end example
  895. Various options may be given to @command{knetbsd}. These options are,
  896. for the most part, the same as in the NetBSD boot loader. For instance,
  897. to boot the system in single-user mode and with verbose messages, do
  898. this:
  899. @example
  900. grub> @kbd{knetbsd /netbsd -s -v}
  901. @end example
  902. @item
  903. If needed, load kernel modules with the command
  904. @command{knetbsd_module_elf}. A typical example is the module for the
  905. root file system:
  906. @example
  907. grub> @kbd{knetbsd_module_elf /stand/amd64/6.0/modules/ffs/ffs.kmod}
  908. @end example
  909. @item
  910. Finally, run the command @command{boot} (@pxref{boot}).
  911. @end enumerate
  912. @node DOS/Windows
  913. @subsection DOS/Windows
  914. GRUB cannot boot DOS or Windows directly, so you must chain-load them
  915. (@pxref{Chain-loading}). However, their boot loaders have some critical
  916. deficiencies, so it may not work to just chain-load them. To overcome
  917. the problems, GRUB provides you with two helper functions.
  918. If you have installed DOS (or Windows) on a non-first hard disk, you
  919. have to use the disk swapping technique, because that OS cannot boot
  920. from any disks but the first one. The workaround used in GRUB is the
  921. command @command{drivemap} (@pxref{drivemap}), like this:
  922. @example
  923. drivemap -s (hd0) (hd1)
  924. @end example
  925. This performs a @dfn{virtual} swap between your first and second hard
  926. drive.
  927. @strong{Caution:} This is effective only if DOS (or Windows) uses BIOS
  928. to access the swapped disks. If that OS uses a special driver for the
  929. disks, this probably won't work.
  930. Another problem arises if you installed more than one set of DOS/Windows
  931. onto one disk, because they could be confused if there are more than one
  932. primary partitions for DOS/Windows. Certainly you should avoid doing
  933. this, but there is a solution if you do want to do so. Use the partition
  934. hiding/unhiding technique.
  935. If GRUB @dfn{hides} a DOS (or Windows) partition (@pxref{parttool}), DOS (or
  936. Windows) will ignore the partition. If GRUB @dfn{unhides} a DOS (or Windows)
  937. partition, DOS (or Windows) will detect the partition. Thus, if you have
  938. installed DOS (or Windows) on the first and the second partition of the
  939. first hard disk, and you want to boot the copy on the first partition, do
  940. the following:
  941. @example
  942. @group
  943. parttool (hd0,1) hidden-
  944. parttool (hd0,2) hidden+
  945. set root=(hd0,1)
  946. chainloader +1
  947. parttool @verb{'${root}'} boot+
  948. boot
  949. @end group
  950. @end example
  951. @node Configuration
  952. @chapter Writing your own configuration file
  953. GRUB is configured using @file{grub.cfg}, usually located under
  954. @file{/boot/grub}. This file is quite flexible, but most users will not
  955. need to write the whole thing by hand.
  956. @menu
  957. * Simple configuration:: Recommended for most users
  958. * Shell-like scripting:: For power users and developers
  959. * Multi-boot manual config:: For non-standard multi-OS scenarios
  960. * Embedded configuration:: Embedding a configuration file into GRUB
  961. @end menu
  962. @node Simple configuration
  963. @section Simple configuration handling
  964. The program @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig})
  965. generates @file{grub.cfg} files suitable for most cases. It is suitable for
  966. use when upgrading a distribution, and will discover available kernels and
  967. attempt to generate menu entries for them.
  968. @command{grub-mkconfig} does have some limitations. While adding extra
  969. custom menu entries to the end of the list can be done by editing
  970. @file{/etc/grub.d/40_custom} or creating @file{/boot/grub/custom.cfg},
  971. changing the order of menu entries or changing their titles may require
  972. making complex changes to shell scripts stored in @file{/etc/grub.d/}. This
  973. may be improved in the future. In the meantime, those who feel that it
  974. would be easier to write @file{grub.cfg} directly are encouraged to do so
  975. (@pxref{Booting}, and @ref{Shell-like scripting}), and to disable any system
  976. provided by their distribution to automatically run @command{grub-mkconfig}.
  977. The file @file{/etc/default/grub} controls the operation of
  978. @command{grub-mkconfig}. It is sourced by a shell script, and so must be
  979. valid POSIX shell input; normally, it will just be a sequence of
  980. @samp{KEY=value} lines, but if the value contains spaces or other special
  981. characters then it must be quoted. For example:
  982. @example
  983. GRUB_TERMINAL_INPUT="console serial"
  984. @end example
  985. Valid keys in @file{/etc/default/grub} are as follows:
  986. @table @samp
  987. @item GRUB_DEFAULT
  988. The default menu entry. This may be a number, in which case it identifies
  989. the Nth entry in the generated menu counted from zero, or the title of a
  990. menu entry, or the special string @samp{saved}. Using the id may be
  991. useful if you want to set a menu entry as the default even though there may
  992. be a variable number of entries before it.
  993. For example, if you have:
  994. @verbatim
  995. menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
  996. ...
  997. }
  998. @end verbatim
  999. then you can make this the default using:
  1000. @example
  1001. GRUB_DEFAULT=example-gnu-linux
  1002. @end example
  1003. Previously it was documented the way to use entry title. While this still
  1004. works it's not recommended since titles often contain unstable device names
  1005. and may be translated
  1006. If you set this to @samp{saved}, then the default menu entry will be that
  1007. saved by @samp{GRUB_SAVEDEFAULT} or @command{grub-set-default}. This relies on
  1008. the environment block, which may not be available in all situations
  1009. (@pxref{Environment block}).
  1010. The default is @samp{0}.
  1011. @item GRUB_SAVEDEFAULT
  1012. If this option is set to @samp{true}, then, when an entry is selected, save
  1013. it as a new default entry for use by future runs of GRUB. This is only
  1014. useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
  1015. @samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
  1016. @command{grub-set-default}. Unset by default.
  1017. This option relies on the environment block, which may not be available in
  1018. all situations (@pxref{Environment block}).
  1019. @item GRUB_TIMEOUT
  1020. Boot the default entry this many seconds after the menu is displayed, unless
  1021. a key is pressed. The default is @samp{5}. Set to @samp{0} to boot
  1022. immediately without displaying the menu, or to @samp{-1} to wait
  1023. indefinitely.
  1024. If @samp{GRUB_TIMEOUT_STYLE} is set to @samp{countdown} or @samp{hidden},
  1025. the timeout is instead counted before the menu is displayed.
  1026. @item GRUB_TIMEOUT_STYLE
  1027. If this option is unset or set to @samp{menu}, then GRUB will display the
  1028. menu and then wait for the timeout set by @samp{GRUB_TIMEOUT} to expire
  1029. before booting the default entry. Pressing a key interrupts the timeout.
  1030. If this option is set to @samp{countdown} or @samp{hidden}, then, before
  1031. displaying the menu, GRUB will wait for the timeout set by
  1032. @samp{GRUB_TIMEOUT} to expire. If @key{ESC} is pressed during that time, it
  1033. will display the menu and wait for input. If a hotkey associated with a
  1034. menu entry is pressed, it will boot the associated menu entry immediately.
  1035. If the timeout expires before either of these happens, it will boot the
  1036. default entry. In the @samp{countdown} case, it will show a one-line
  1037. indication of the remaining time.
  1038. @item GRUB_DEFAULT_BUTTON
  1039. @itemx GRUB_TIMEOUT_BUTTON
  1040. @itemx GRUB_TIMEOUT_STYLE_BUTTON
  1041. @itemx GRUB_BUTTON_CMOS_ADDRESS
  1042. Variants of the corresponding variables without the @samp{_BUTTON} suffix,
  1043. used to support vendor-specific power buttons. @xref{Vendor power-on keys}.
  1044. @item GRUB_DISTRIBUTOR
  1045. Set by distributors of GRUB to their identifying name. This is used to
  1046. generate more informative menu entry titles.
  1047. @item GRUB_TERMINAL_INPUT
  1048. Select the terminal input device. You may select multiple devices here,
  1049. separated by spaces.
  1050. Valid terminal input names depend on the platform, but may include
  1051. @samp{console} (native platform console), @samp{serial} (serial terminal),
  1052. @samp{serial_<port>} (serial terminal with explicit port selection),
  1053. @samp{at_keyboard} (PC AT keyboard), or @samp{usb_keyboard} (USB keyboard
  1054. using the HID Boot Protocol, for cases where the firmware does not handle
  1055. this).
  1056. The default is to use the platform's native terminal input.
  1057. @item GRUB_TERMINAL_OUTPUT
  1058. Select the terminal output device. You may select multiple devices here,
  1059. separated by spaces.
  1060. Valid terminal output names depend on the platform, but may include
  1061. @samp{console} (native platform console), @samp{serial} (serial terminal),
  1062. @samp{serial_<port>} (serial terminal with explicit port selection),
  1063. @samp{gfxterm} (graphics-mode output), @samp{vga_text} (VGA text output),
  1064. @samp{mda_text} (MDA text output), @samp{morse} (Morse-coding using system
  1065. beeper) or @samp{spkmodem} (simple data protocol using system speaker).
  1066. @samp{spkmodem} is useful when no serial port is available. Connect the output
  1067. of sending system (where GRUB is running) to line-in of receiving system
  1068. (usually developer machine).
  1069. On receiving system compile @samp{spkmodem-recv} from
  1070. @samp{util/spkmodem-recv.c} and run:
  1071. @example
  1072. parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv
  1073. @end example
  1074. The default is to use the platform's native terminal output.
  1075. @item GRUB_TERMINAL
  1076. If this option is set, it overrides both @samp{GRUB_TERMINAL_INPUT} and
  1077. @samp{GRUB_TERMINAL_OUTPUT} to the same value.
  1078. @item GRUB_SERIAL_COMMAND
  1079. A command to configure the serial port when using the serial console.
  1080. @xref{serial}. Defaults to @samp{serial}.
  1081. @item GRUB_CMDLINE_LINUX
  1082. Command-line arguments to add to menu entries for the Linux kernel.
  1083. @item GRUB_CMDLINE_LINUX_DEFAULT
  1084. Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu
  1085. entries will be generated for each Linux kernel: one default entry and one
  1086. entry for recovery mode. This option lists command-line arguments to add
  1087. only to the default menu entry, after those listed in
  1088. @samp{GRUB_CMDLINE_LINUX}.
  1089. @item GRUB_CMDLINE_NETBSD
  1090. @itemx GRUB_CMDLINE_NETBSD_DEFAULT
  1091. As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
  1092. NetBSD.
  1093. @item GRUB_CMDLINE_GNUMACH
  1094. As @samp{GRUB_CMDLINE_LINUX}, but for GNU Mach.
  1095. @item GRUB_CMDLINE_XEN
  1096. @itemx GRUB_CMDLINE_XEN_DEFAULT
  1097. The values of these options are passed to Xen hypervisor Xen menu entries,
  1098. for all respectively normal entries.
  1099. @item GRUB_CMDLINE_LINUX_XEN_REPLACE
  1100. @item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
  1101. The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
  1102. and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
  1103. @item GRUB_DISABLE_LINUX_UUID
  1104. Normally, @command{grub-mkconfig} will generate menu entries that use
  1105. universally-unique identifiers (UUIDs) to identify the root filesystem to
  1106. the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
  1107. usually more reliable, but in some cases it may not be appropriate. To
  1108. disable the use of UUIDs, set this option to @samp{true}.
  1109. @item GRUB_DISABLE_RECOVERY
  1110. If this option is set to @samp{true}, disable the generation of recovery
  1111. mode menu entries.
  1112. @item GRUB_VIDEO_BACKEND
  1113. If graphical video support is required, either because the @samp{gfxterm}
  1114. graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
  1115. then @command{grub-mkconfig} will normally load all available GRUB video
  1116. drivers and use the one most appropriate for your hardware. If you need to
  1117. override this for some reason, then you can set this option.
  1118. After @command{grub-install} has been run, the available video drivers are
  1119. listed in @file{/boot/grub/video.lst}.
  1120. @item GRUB_GFXMODE
  1121. Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
  1122. you can only use modes which your graphics card supports via VESA BIOS
  1123. Extensions (VBE), so for example native LCD panel resolutions may not be
  1124. available. The default is @samp{auto}, which tries to select a preferred
  1125. resolution. @xref{gfxmode}.
  1126. @item GRUB_BACKGROUND
  1127. Set a background image for use with the @samp{gfxterm} graphical terminal.
  1128. The value of this option must be a file readable by GRUB at boot time, and
  1129. it must end with @file{.png}, @file{.tga}, @file{.jpg}, or @file{.jpeg}.
  1130. The image will be scaled if necessary to fit the screen.
  1131. @item GRUB_THEME
  1132. Set a theme for use with the @samp{gfxterm} graphical terminal.
  1133. @item GRUB_GFXPAYLOAD_LINUX
  1134. Set to @samp{text} to force the Linux kernel to boot in normal text mode,
  1135. @samp{keep} to preserve the graphics mode set using @samp{GRUB_GFXMODE},
  1136. @samp{@var{width}x@var{height}}[@samp{x@var{depth}}] to set a particular
  1137. graphics mode, or a sequence of these separated by commas or semicolons to
  1138. try several modes in sequence. @xref{gfxpayload}.
  1139. Depending on your kernel, your distribution, your graphics card, and the
  1140. phase of the moon, note that using this option may cause GNU/Linux to suffer
  1141. from various display problems, particularly during the early part of the
  1142. boot sequence. If you have problems, set this option to @samp{text} and
  1143. GRUB will tell Linux to boot in normal text mode.
  1144. @item GRUB_DISABLE_OS_PROBER
  1145. Normally, @command{grub-mkconfig} will try to use the external
  1146. @command{os-prober} program, if installed, to discover other operating
  1147. systems installed on the same system and generate appropriate menu entries
  1148. for them. Set this option to @samp{true} to disable this.
  1149. @item GRUB_OS_PROBER_SKIP_LIST
  1150. List of space-separated FS UUIDs of filesystems to be ignored from os-prober
  1151. output. For efi chainloaders it's <UUID>@@<EFI FILE>
  1152. @item GRUB_DISABLE_SUBMENU
  1153. Normally, @command{grub-mkconfig} will generate top level menu entry for
  1154. the kernel with highest version number and put all other found kernels
  1155. or alternative menu entries for recovery mode in submenu. For entries returned
  1156. by @command{os-prober} first entry will be put on top level and all others
  1157. in submenu. If this option is set to @samp{y}, flat menu with all entries
  1158. on top level will be generated instead. Changing this option will require
  1159. changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
  1160. and @samp{default} (@pxref{default}) environment variables as well as saved
  1161. default entry using @command{grub-set-default} and value used with
  1162. @command{grub-reboot}.
  1163. @item GRUB_ENABLE_CRYPTODISK
  1164. If set to @samp{y}, @command{grub-mkconfig} and @command{grub-install} will
  1165. check for encrypted disks and generate additional commands needed to access
  1166. them during boot. Note that in this case unattended boot is not possible
  1167. because GRUB will wait for passphrase to unlock encrypted container.
  1168. @item GRUB_INIT_TUNE
  1169. Play a tune on the speaker when GRUB starts. This is particularly useful
  1170. for users unable to see the screen. The value of this option is passed
  1171. directly to @ref{play}.
  1172. @item GRUB_BADRAM
  1173. If this option is set, GRUB will issue a @ref{badram} command to filter
  1174. out specified regions of RAM.
  1175. @item GRUB_PRELOAD_MODULES
  1176. This option may be set to a list of GRUB module names separated by spaces.
  1177. Each module will be loaded as early as possible, at the start of
  1178. @file{grub.cfg}.
  1179. @end table
  1180. The following options are still accepted for compatibility with existing
  1181. configurations, but have better replacements:
  1182. @table @samp
  1183. @item GRUB_HIDDEN_TIMEOUT
  1184. Wait this many seconds before displaying the menu. If @key{ESC} is pressed
  1185. during that time, display the menu and wait for input according to
  1186. @samp{GRUB_TIMEOUT}. If a hotkey associated with a menu entry is pressed,
  1187. boot the associated menu entry immediately. If the timeout expires before
  1188. either of these happens, display the menu for the number of seconds
  1189. specified in @samp{GRUB_TIMEOUT} before booting the default entry.
  1190. If you set @samp{GRUB_HIDDEN_TIMEOUT}, you should also set
  1191. @samp{GRUB_TIMEOUT=0} so that the menu is not displayed at all unless
  1192. @key{ESC} is pressed.
  1193. This option is unset by default, and is deprecated in favour of the less
  1194. confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
  1195. @samp{GRUB_TIMEOUT_STYLE=hidden}.
  1196. @item GRUB_HIDDEN_TIMEOUT_QUIET
  1197. In conjunction with @samp{GRUB_HIDDEN_TIMEOUT}, set this to @samp{true} to
  1198. suppress the verbose countdown while waiting for a key to be pressed before
  1199. displaying the menu.
  1200. This option is unset by default, and is deprecated in favour of the less
  1201. confusing @samp{GRUB_TIMEOUT_STYLE=countdown}.
  1202. @item GRUB_HIDDEN_TIMEOUT_BUTTON
  1203. Variant of @samp{GRUB_HIDDEN_TIMEOUT}, used to support vendor-specific power
  1204. buttons. @xref{Vendor power-on keys}.
  1205. This option is unset by default, and is deprecated in favour of the less
  1206. confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
  1207. @samp{GRUB_TIMEOUT_STYLE=hidden}.
  1208. @end table
  1209. For more detailed customisation of @command{grub-mkconfig}'s output, you may
  1210. edit the scripts in @file{/etc/grub.d} directly.
  1211. @file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
  1212. menu entries; simply type the menu entries you want to add at the end of
  1213. that file, making sure to leave at least the first two lines intact.
  1214. @node Shell-like scripting
  1215. @section Writing full configuration files directly
  1216. @c Some of this section is derived from the GNU Bash manual page, also
  1217. @c copyrighted by the FSF.
  1218. @file{grub.cfg} is written in GRUB's built-in scripting language, which has
  1219. a syntax quite similar to that of GNU Bash and other Bourne shell
  1220. derivatives.
  1221. @heading Words
  1222. A @dfn{word} is a sequence of characters considered as a single unit by
  1223. GRUB. Words are separated by @dfn{metacharacters}, which are the following
  1224. plus space, tab, and newline:
  1225. @example
  1226. @{ @} | & $ ; < >
  1227. @end example
  1228. Quoting may be used to include metacharacters in words; see below.
  1229. @heading Reserved words
  1230. Reserved words have a special meaning to GRUB. The following words are
  1231. recognised as reserved when unquoted and either the first word of a simple
  1232. command or the third word of a @code{for} command:
  1233. @example
  1234. ! [[ ]] @{ @}
  1235. case do done elif else esac fi for function
  1236. if in menuentry select then time until while
  1237. @end example
  1238. Not all of these reserved words have a useful purpose yet; some are reserved
  1239. for future expansion.
  1240. @heading Quoting
  1241. Quoting is used to remove the special meaning of certain characters or
  1242. words. It can be used to treat metacharacters as part of a word, to prevent
  1243. reserved words from being recognised as such, and to prevent variable
  1244. expansion.
  1245. There are three quoting mechanisms: the escape character, single quotes, and
  1246. double quotes.
  1247. A non-quoted backslash (\) is the @dfn{escape character}. It preserves the
  1248. literal value of the next character that follows, with the exception of
  1249. newline.
  1250. Enclosing characters in single quotes preserves the literal value of each
  1251. character within the quotes. A single quote may not occur between single
  1252. quotes, even when preceded by a backslash.
  1253. Enclosing characters in double quotes preserves the literal value of all
  1254. characters within the quotes, with the exception of @samp{$} and @samp{\}.
  1255. The @samp{$} character retains its special meaning within double quotes.
  1256. The backslash retains its special meaning only when followed by one of the
  1257. following characters: @samp{$}, @samp{"}, @samp{\}, or newline. A
  1258. backslash-newline pair is treated as a line continuation (that is, it is
  1259. removed from the input stream and effectively ignored@footnote{Currently a
  1260. backslash-newline pair within a variable name is not handled properly, so
  1261. use this feature with some care.}). A double quote may be quoted within
  1262. double quotes by preceding it with a backslash.
  1263. @heading Variable expansion
  1264. The @samp{$} character introduces variable expansion. The variable name to
  1265. be expanded may be enclosed in braces, which are optional but serve to
  1266. protect the variable to be expanded from characters immediately following it
  1267. which could be interpreted as part of the name.
  1268. Normal variable names begin with an alphabetic character, followed by zero
  1269. or more alphanumeric characters. These names refer to entries in the GRUB
  1270. environment (@pxref{Environment}).
  1271. Positional variable names consist of one or more digits. They represent
  1272. parameters passed to function calls, with @samp{$1} representing the first
  1273. parameter, and so on.
  1274. The special variable name @samp{?} expands to the exit status of the most
  1275. recently executed command. When positional variable names are active, other
  1276. special variable names @samp{@@}, @samp{*} and @samp{#} are defined and they
  1277. expand to all positional parameters with necessary quoting, positional
  1278. parameters without any quoting, and positional parameter count respectively.
  1279. @heading Comments
  1280. A word beginning with @samp{#} causes that word and all remaining characters
  1281. on that line to be ignored.
  1282. @heading Simple commands
  1283. A @dfn{simple command} is a sequence of words separated by spaces or tabs
  1284. and terminated by a semicolon or a newline. The first word specifies the
  1285. command to be executed. The remaining words are passed as arguments to the
  1286. invoked command.
  1287. The return value of a simple command is its exit status. If the reserved
  1288. word @code{!} precedes the command, then the return value is instead the
  1289. logical negation of the command's exit status.
  1290. @heading Compound commands
  1291. A @dfn{compound command} is one of the following:
  1292. @table @asis
  1293. @item for @var{name} in @var{word} @dots{}; do @var{list}; done
  1294. The list of words following @code{in} is expanded, generating a list of
  1295. items. The variable @var{name} is set to each element of this list in turn,
  1296. and @var{list} is executed each time. The return value is the exit status
  1297. of the last command that executes. If the expansion of the items following
  1298. @code{in} results in an empty list, no commands are executed, and the return
  1299. status is 0.
  1300. @item if @var{list}; then @var{list}; [elif @var{list}; then @var{list};] @dots{} [else @var{list};] fi
  1301. The @code{if} @var{list} is executed. If its exit status is zero, the
  1302. @code{then} @var{list} is executed. Otherwise, each @code{elif} @var{list}
  1303. is executed in turn, and if its exit status is zero, the corresponding
  1304. @code{then} @var{list} is executed and the command completes. Otherwise,
  1305. the @code{else} @var{list} is executed, if present. The exit status is the
  1306. exit status of the last command executed, or zero if no condition tested
  1307. true.
  1308. @item while @var{cond}; do @var{list}; done
  1309. @itemx until @var{cond}; do @var{list}; done
  1310. The @code{while} command continuously executes the @code{do} @var{list} as
  1311. long as the last command in @var{cond} returns an exit status of zero. The
  1312. @code{until} command is identical to the @code{while} command, except that
  1313. the test is negated; the @code{do} @var{list} is executed as long as the
  1314. last command in @var{cond} returns a non-zero exit status. The exit status
  1315. of the @code{while} and @code{until} commands is the exit status of the last
  1316. @code{do} @var{list} command executed, or zero if none was executed.
  1317. @item function @var{name} @{ @var{command}; @dots{} @}
  1318. This defines a function named @var{name}. The @dfn{body} of the function is
  1319. the list of commands within braces, each of which must be terminated with a
  1320. semicolon or a newline. This list of commands will be executed whenever
  1321. @var{name} is specified as the name of a simple command. Function
  1322. definitions do not affect the exit status in @code{$?}. When executed, the
  1323. exit status of a function is the exit status of the last command executed in
  1324. the body.
  1325. @item menuentry @var{title} [@option{--class=class} @dots{}] [@option{--users=users}] [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @{ @var{command}; @dots{} @}
  1326. @xref{menuentry}.
  1327. @end table
  1328. @heading Built-in Commands
  1329. Some built-in commands are also provided by GRUB script to help script
  1330. writers perform actions that are otherwise not possible. For example, these
  1331. include commands to jump out of a loop without fully completing it, etc.
  1332. @table @asis
  1333. @item break [@code{n}]
  1334. Exit from within a @code{for}, @code{while}, or @code{until} loop. If
  1335. @code{n} is specified, break @code{n} levels. @code{n} must be greater than
  1336. or equal to 1. If @code{n} is greater than the number of enclosing loops,
  1337. all enclosing loops are exited. The return value is 0 unless @code{n} is
  1338. not greater than or equal to 1.
  1339. @item continue [@code{n}]
  1340. Resume the next iteration of the enclosing @code{for}, @code{while} or
  1341. @code{until} loop. If @code{n} is specified, resume at the @code{n}th
  1342. enclosing loop. @code{n} must be greater than or equal to 1. If @code{n}
  1343. is greater than the number of enclosing loops, the last enclosing loop (the
  1344. @dfn{top-level} loop) is resumed. The return value is 0 unless @code{n} is
  1345. not greater than or equal to 1.
  1346. @item return [@code{n}]
  1347. Causes a function to exit with the return value specified by @code{n}. If
  1348. @code{n} is omitted, the return status is that of the last command executed
  1349. in the function body. If used outside a function the return status is
  1350. false.
  1351. @item setparams [@code{arg}] @dots{}
  1352. Replace positional parameters starting with @code{$1} with arguments to
  1353. @command{setparams}.
  1354. @item shift [@code{n}]
  1355. The positional parameters from @code{n}+1 @dots{} are renamed to
  1356. @code{$1}@dots{}. Parameters represented by the numbers @code{$#} down to
  1357. @code{$#}-@code{n}+1 are unset. @code{n} must be a non-negative number less
  1358. than or equal to @code{$#}. If @code{n} is 0, no parameters are changed.
  1359. If @code{n} is not given, it is assumed to be 1. If @code{n} is greater
  1360. than @code{$#}, the positional parameters are not changed. The return
  1361. status is greater than zero if @code{n} is greater than @code{$#} or less
  1362. than zero; otherwise 0.
  1363. @end table
  1364. @node Multi-boot manual config
  1365. @section Multi-boot manual config
  1366. Currently autogenerating config files for multi-boot environments depends on
  1367. os-prober and has several shortcomings. While fixing it is scheduled for the
  1368. next release, meanwhile you can make use of the power of GRUB syntax and do it
  1369. yourself. A possible configuration is detailed here, feel free to adjust to your
  1370. needs.
  1371. First create a separate GRUB partition, big enough to hold GRUB. Some of the
  1372. following entries show how to load OS installer images from this same partition,
  1373. for that you obviously need to make the partition large enough to hold those
  1374. images as well.
  1375. Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
  1376. install self-compiled latest GRUB with:
  1377. @code{grub-install --boot-directory=/mnt/boot /dev/sda}
  1378. In all the OSes install GRUB tools but disable installing GRUB in bootsector,
  1379. so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
  1380. use by setting:
  1381. @code{GRUB_DISABLE_OS_PROBER=true}
  1382. in /etc/default/grub
  1383. Then write a grub.cfg (/mnt/boot/grub/grub.cfg):
  1384. @example
  1385. menuentry "OS using grub2" @{
  1386. insmod xfs
  1387. search --set=root --label OS1 --hint hd0,msdos8
  1388. configfile /boot/grub/grub.cfg
  1389. @}
  1390. menuentry "OS using grub2-legacy" @{
  1391. insmod ext2
  1392. search --set=root --label OS2 --hint hd0,msdos6
  1393. legacy_configfile /boot/grub/menu.lst
  1394. @}
  1395. menuentry "Windows XP" @{
  1396. insmod ntfs
  1397. search --set=root --label WINDOWS_XP --hint hd0,msdos1
  1398. ntldr /ntldr
  1399. @}
  1400. menuentry "Windows 7" @{
  1401. insmod ntfs
  1402. search --set=root --label WINDOWS_7 --hint hd0,msdos2
  1403. ntldr /bootmgr
  1404. @}
  1405. menuentry "FreeBSD" @{
  1406. insmod zfs
  1407. search --set=root --label freepool --hint hd0,msdos7
  1408. kfreebsd /freebsd@@/boot/kernel/kernel
  1409. kfreebsd_module_elf /freebsd@@/boot/kernel/opensolaris.ko
  1410. kfreebsd_module_elf /freebsd@@/boot/kernel/zfs.ko
  1411. kfreebsd_module /freebsd@@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
  1412. set kFreeBSD.vfs.root.mountfrom=zfs:freepool/freebsd
  1413. set kFreeBSD.hw.psm.synaptics_support=1
  1414. @}
  1415. menuentry "experimental GRUB" @{
  1416. search --set=root --label GRUB --hint hd0,msdos5
  1417. multiboot /experimental/grub/i386-pc/core.img
  1418. @}
  1419. menuentry "Fedora 16 installer" @{
  1420. search --set=root --label GRUB --hint hd0,msdos5
  1421. linux /fedora/vmlinuz lang=en_US keymap=sg resolution=1280x800
  1422. initrd /fedora/initrd.img
  1423. @}
  1424. menuentry "Fedora rawhide installer" @{
  1425. search --set=root --label GRUB --hint hd0,msdos5
  1426. linux /fedora/vmlinuz repo=ftp://mirror.switch.ch/mirror/fedora/linux/development/rawhide/x86_64 lang=en_US keymap=sg resolution=1280x800
  1427. initrd /fedora/initrd.img
  1428. @}
  1429. menuentry "Debian sid installer" @{
  1430. search --set=root --label GRUB --hint hd0,msdos5
  1431. linux /debian/dists/sid/main/installer-amd64/current/images/hd-media/vmlinuz
  1432. initrd /debian/dists/sid/main/installer-amd64/current/images/hd-media/initrd.gz
  1433. @}
  1434. @end example
  1435. Notes:
  1436. @itemize
  1437. @item Argument to search after --label is FS LABEL. You can also use UUIDs with --fs-uuid UUID instead of --label LABEL. You could also use direct @code{root=hd0,msdosX} but this is not recommended due to device name instability.
  1438. @end itemize
  1439. @node Embedded configuration
  1440. @section Embedding a configuration file into GRUB
  1441. GRUB supports embedding a configuration file directly into the core image,
  1442. so that it is loaded before entering normal mode. This is useful, for
  1443. example, when it is not straightforward to find the real configuration file,
  1444. or when you need to debug problems with loading that file.
  1445. @command{grub-install} uses this feature when it is not using BIOS disk
  1446. functions or when installing to a different disk from the one containing
  1447. @file{/boot/grub}, in which case it needs to use the @command{search}
  1448. command (@pxref{search}) to find @file{/boot/grub}.
  1449. To embed a configuration file, use the @option{-c} option to
  1450. @command{grub-mkimage}. The file is copied into the core image, so it may
  1451. reside anywhere on the file system, and may be removed after running
  1452. @command{grub-mkimage}.
  1453. After the embedded configuration file (if any) is executed, GRUB will load
  1454. the @samp{normal} module (@pxref{normal}), which will then read the real
  1455. configuration file from @file{$prefix/grub.cfg}. By this point, the
  1456. @code{root} variable will also have been set to the root device name. For
  1457. example, @code{prefix} might be set to @samp{(hd0,1)/boot/grub}, and
  1458. @code{root} might be set to @samp{hd0,1}. Thus, in most cases, the embedded
  1459. configuration file only needs to set the @code{prefix} and @code{root}
  1460. variables, and then drop through to GRUB's normal processing. A typical
  1461. example of this might look like this:
  1462. @example
  1463. @group
  1464. search.fs_uuid 01234567-89ab-cdef-0123-456789abcdef root
  1465. set prefix=($root)/boot/grub
  1466. @end group
  1467. @end example
  1468. (The @samp{search_fs_uuid} module must be included in the core image for this
  1469. example to work.)
  1470. In more complex cases, it may be useful to read other configuration files
  1471. directly from the embedded configuration file. This allows such things as
  1472. reading files not called @file{grub.cfg}, or reading files from a directory
  1473. other than that where GRUB's loadable modules are installed. To do this,
  1474. include the @samp{configfile} and @samp{normal} modules in the core image,
  1475. and embed a configuration file that uses the @command{configfile} command to
  1476. load another file. The following example of this also requires the
  1477. @command{echo}, @command{search_label}, and @command{test} modules to be
  1478. included in the core image:
  1479. @example
  1480. @group
  1481. search.fs_label grub root
  1482. if [ -e /boot/grub/example/test1.cfg ]; then
  1483. set prefix=($root)/boot/grub
  1484. configfile /boot/grub/example/test1.cfg
  1485. else
  1486. if [ -e /boot/grub/example/test2.cfg ]; then
  1487. set prefix=($root)/boot/grub
  1488. configfile /boot/grub/example/test2.cfg
  1489. else
  1490. echo "Could not find an example configuration file!"
  1491. fi
  1492. fi
  1493. @end group
  1494. @end example
  1495. The embedded configuration file may not contain menu entries directly, but
  1496. may only read them from elsewhere using @command{configfile}.
  1497. @node Theme file format
  1498. @chapter Theme file format
  1499. @section Introduction
  1500. The GRUB graphical menu supports themes that can customize the layout and
  1501. appearance of the GRUB boot menu. The theme is configured through a plain
  1502. text file that specifies the layout of the various GUI components (including
  1503. the boot menu, timeout progress bar, and text messages) as well as the
  1504. appearance using colors, fonts, and images. Example is available in docs/example_theme.txt
  1505. @section Theme Elements
  1506. @subsection Colors
  1507. Colors can be specified in several ways:
  1508. @itemize
  1509. @item HTML-style ``#RRGGBB'' or ``#RGB'' format, where *R*, *G*, and *B* are hexadecimal digits (e.g., ``#8899FF'')
  1510. @item as comma-separated decimal RGB values (e.g., ``128, 128, 255'')
  1511. @item with ``SVG 1.0 color names'' (e.g., ``cornflowerblue'') which must be specified in lowercase.
  1512. @end itemize
  1513. @subsection Fonts
  1514. The fonts GRUB uses ``PFF2 font format'' bitmap fonts. Fonts are specified
  1515. with full font names. Currently there is no
  1516. provision for a preference list of fonts, or deriving one font from another.
  1517. Fonts are loaded with the ``loadfont'' command in GRUB (@ref{loadfont}). To see the list of
  1518. loaded fonts, execute the ``lsfonts'' command (@ref{lsfonts}). If there are too many fonts to
  1519. fit on screen, do ``set pager=1'' before executing ``lsfonts''.
  1520. @subsection Progress Bar
  1521. @float Figure, Pixmap-styled progress bar
  1522. @c @image{Theme_progress_bar,,,,png}
  1523. @end float
  1524. @float Figure, Plain progress bar, drawn with solid color.
  1525. @c @image{Theme_progress_bar_filled,,,,png}
  1526. @end float
  1527. Progress bars are used to display the remaining time before GRUB boots the
  1528. default menu entry. To create a progress bar that will display the remaining
  1529. time before automatic boot, simply create a ``progress_bar'' component with
  1530. the id ``__timeout__''. This indicates to GRUB that the progress bar should
  1531. be updated as time passes, and it should be made invisible if the countdown to
  1532. automatic boot is interrupted by the user.
  1533. Progress bars may optionally have text displayed on them. This text is
  1534. controlled by variable ``text'' which contains a printf template with the
  1535. only argument %d is the number of seconds remaining. Additionally special
  1536. values ``@@TIMEOUT_NOTIFICATION_SHORT@@'', ``@@TIMEOUT_NOTIFICATION_MIDDLE@@'',
  1537. ``@@TIMEOUT_NOTIFICATION_LONG@@'' are replaced with standard and translated
  1538. templates.
  1539. @subsection Circular Progress Indicator
  1540. @c @image{Theme_circular_progress,,,,.png}
  1541. The circular progress indicator functions similarly to the progress bar. When
  1542. given an id of ``__timeout__'', GRUB updates the circular progress indicator's
  1543. value to indicate the time remaining. For the circular progress indicator,
  1544. there are two images used to render it: the *center* image, and the *tick*
  1545. image. The center image is rendered in the center of the component, while the
  1546. tick image is used to render each mark along the circumference of the
  1547. indicator.
  1548. @subsection Labels
  1549. Text labels can be placed on the boot screen. The font, color, and horizontal
  1550. alignment can be specified for labels. If a label is given the id
  1551. ``__timeout__'', then the ``text'' property for that label is also updated
  1552. with a message informing the user of the number of seconds remaining until
  1553. automatic boot. This is useful in case you want the text displayed somewhere
  1554. else instead of directly on the progress bar.
  1555. @subsection Boot Menu
  1556. @c @image{Theme_boot_menu,,,,.png}
  1557. The boot menu where GRUB displays the menu entries from the ``grub.cfg'' file.
  1558. It is a list of items, where each item has a title and an optional icon. The
  1559. icon is selected based on the *classes* specified for the menu entry. If
  1560. there is a PNG file named ``myclass.png'' in the ``grub/themes/icons''
  1561. directory, it will be displayed for items which have the class *myclass*. The
  1562. boot menu can be customized in several ways, such as the font and color used
  1563. for the menu entry title, and by specifying styled boxes for the menu itself
  1564. and for the selected item highlight.
  1565. @subsection Styled Boxes
  1566. One of the most important features for customizing the layout is the use of
  1567. *styled boxes*. A styled box is composed of 9 rectangular (and potentially
  1568. empty) regions, which are used to seamlessly draw the styled box on screen:
  1569. @multitable @columnfractions 0.3 0.3 0.3
  1570. @item Northwest (nw) @tab North (n) @tab Northeast (ne)
  1571. @item West (w) @tab Center (c) @tab East (e)
  1572. @item Southwest (sw) @tab South (s) @tab Southeast (se)
  1573. @end multitable
  1574. To support any size of box on screen, the center slice and the slices for the
  1575. top, bottom, and sides are all scaled to the correct size for the component on
  1576. screen, using the following rules:
  1577. @enumerate
  1578. @item The edge slices (north, south, east, and west) are scaled in the direction of the edge they are adjacent to. For instance, the west slice is scaled vertically.
  1579. @item The corner slices (northwest, northeast, southeast, and southwest) are not scaled.
  1580. @item The center slice is scaled to fill the remaining space in the middle.
  1581. @end enumerate
  1582. As an example of how an image might be sliced up, consider the styled box
  1583. used for a terminal view.
  1584. @float Figure, An example of the slices (in red) used for a terminal window. This drawing was created and sliced in Inkscape_, as the next section explains.
  1585. @c @image{Box_slice_example_terminal,,,,.png}
  1586. @end float
  1587. @subsection Creating Styled Box Images
  1588. The Inkscape_ scalable vector graphics editor is a very useful tool for
  1589. creating styled box images. One process that works well for slicing a drawing
  1590. into the necessary image slices is:
  1591. @enumerate
  1592. @item Create or open the drawing you'd like use.
  1593. @item Create a new layer on the top of the layer stack. Make it visible. Select this layer as the current layer.
  1594. @item Draw 9 rectangles on your drawing where you'd like the slices to be. Clear the fill option, and set the stroke to 1 pixel wide solid stroke. The corners of the slices must meet precisely; if it is off by a single pixel, it will probably be evident when the styled box is rendered in the GRUB menu. You should probably go to File | Document Properties | Grids and enable a grid or create a guide (click on one of the rulers next to the drawing and drag over the drawing; release the mouse button to place the guide) to help place the rectangles precisely.
  1595. @item Right click on the center slice rectangle and choose Object Properties. Change the "Id" to ``slice_c`` and click Set. Repeat this for the remaining 8 rectangles, giving them Id values of ``slice_n``, ``slice_ne``, ``slice_e``, and so on according to the location.
  1596. @item Save the drawing.
  1597. @item Select all the slice rectangles. With the slice layer selected, you can simply press Ctrl+A to select all rectangles. The status bar should indicate that 9 rectangles are selected.
  1598. @item Click the layer hide icon for the slice layer in the layer palette. The rectangles will remain selected, even though they are hidden.
  1599. @item Choose File | Export Bitmap and check the *Batch export 9 selected objects* box. Make sure that *Hide all except selected* is unchecked. click *Export*. This will create PNG files in the same directory as the drawing, named after the slices. These can now be used for a styled box in a GRUB theme.
  1600. @end enumerate
  1601. @section Theme File Manual
  1602. The theme file is a plain text file. Lines that begin with ``#`` are ignored
  1603. and considered comments. (Note: This may not be the case if the previous line
  1604. ended where a value was expected.)
  1605. The theme file contains two types of statements:
  1606. @enumerate
  1607. @item Global properties.
  1608. @item Component construction.
  1609. @end enumerate
  1610. @subsection Global Properties
  1611. @subsection Format
  1612. Global properties are specified with the simple format:
  1613. @itemize
  1614. @item name1: value1
  1615. @item name2: "value which may contain spaces"
  1616. @item name3: #88F
  1617. @end itemize
  1618. In this example, name3 is assigned a color value.
  1619. @subsection Global Property List
  1620. @multitable @columnfractions 0.3 0.6
  1621. @item title-text
  1622. @tab Specifies the text to display at the top center of the screen as a title.
  1623. @item title-font
  1624. @tab Defines the font used for the title message at the top of the screen.
  1625. @item title-color
  1626. @tab Defines the color of the title message.
  1627. @item message-font
  1628. @tab Currently unused. Left for backward compatibility.
  1629. @item message-color
  1630. @tab Currently unused. Left for backward compatibility.
  1631. @item message-bg-color
  1632. @tab Currently unused. Left for backward compatibility.
  1633. @item desktop-image
  1634. @tab Specifies the image to use as the background. It will be scaled
  1635. to fit the screen size or proportionally scaled depending on the scale
  1636. method.
  1637. @item desktop-image-scale-method
  1638. @tab Specifies the scaling method for the *desktop-image*. Options are
  1639. ``stretch``, ``crop``, ``padding``, ``fitwidth``, ``fitheight``.
  1640. ``stretch`` for fitting the screen size. Otherwise it is proportional
  1641. scaling of a part of *desktop-image* to the part of the screen.
  1642. ``crop`` part of the *desktop-image* will be proportionally scaled to
  1643. fit the screen sizes. ``padding`` the entire *desktop-image* will be
  1644. contained on the screen. ``fitwidth`` for fitting the *desktop-image*'s
  1645. width with screen width. ``fitheight`` for fitting the *desktop-image*'s
  1646. height with the screen height. Default is ``stretch``.
  1647. @item desktop-image-h-align
  1648. @tab Specifies the horizontal alignment of the *desktop-image* if
  1649. *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
  1650. ``left``, ``center``, ``right``. Default is ``center``.
  1651. @item desktop-image-v-align
  1652. @tab Specifies the vertical alignment of the *desktop-image* if
  1653. *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
  1654. ``top``, ``center``, ``bottom``. Default is ``center``.
  1655. @item desktop-color
  1656. @tab Specifies the color for the background if *desktop-image* is not
  1657. specified.
  1658. @item terminal-box
  1659. @tab Specifies the file name pattern for the styled box slices used for the
  1660. command line terminal window. For example, ``terminal-box: terminal_*.png``
  1661. will use the images ``terminal_c.png`` as the center area, ``terminal_n.png``
  1662. as the north (top) edge, ``terminal_nw.png`` as the northwest (upper left)
  1663. corner, and so on. If the image for any slice is not found, it will simply
  1664. be left empty.
  1665. @item terminal-border
  1666. @tab Specifies the border width of the terminal window.
  1667. @item terminal-left
  1668. @tab Specifies the left coordinate of the terminal window.
  1669. @item terminal-top
  1670. @tab Specifies the top coordinate of the terminal window.
  1671. @item terminal-width
  1672. @tab Specifies the width of the terminal window.
  1673. @item terminal-height
  1674. @tab Specifies the height of the terminal window.
  1675. @end multitable
  1676. @subsection Component Construction
  1677. Greater customizability comes is provided by components. A tree of components
  1678. forms the user interface. *Containers* are components that can contain other
  1679. components, and there is always a single root component which is an instance
  1680. of a *canvas* container.
  1681. Components are created in the theme file by prefixing the type of component
  1682. with a '+' sign:
  1683. @code{ + label @{ text="GRUB" font="aqui 11" color="#8FF" @} }
  1684. properties of a component are specified as "name = value" (whitespace
  1685. surrounding tokens is optional and is ignored) where *value* may be:
  1686. @itemize
  1687. @item a single word (e.g., ``align = center``, ``color = #FF8080``),
  1688. @item a quoted string (e.g., ``text = "Hello, World!"``), or
  1689. @item a tuple (e.g., ``preferred_size = (120, 80)``).
  1690. @end itemize
  1691. @subsection Component List
  1692. The following is a list of the components and the properties they support.
  1693. @itemize
  1694. @item label
  1695. A label displays a line of text.
  1696. Properties:
  1697. @multitable @columnfractions 0.2 0.7
  1698. @item id
  1699. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1700. boot of the default entry.
  1701. @item text
  1702. @tab The text to display. If ``id`` is set to ``__timeout__`` and no
  1703. ``text`` property is set then the amount of seconds will be shown.
  1704. If set to ``@@KEYMAP_SHORT@@``, ``@@KEYMAP_MIDDLE@@`` or
  1705. ``@@KEYMAP_LONG@@`` then predefined hotkey information will be shown.
  1706. @item font
  1707. @tab The font to use for text display.
  1708. @item color
  1709. @tab The color of the text.
  1710. @item align
  1711. @tab The horizontal alignment of the text within the component.
  1712. Options are ``left``, ``center`` and ``right``.
  1713. @item visible
  1714. @tab Set to ``false`` to hide the label.
  1715. @end multitable
  1716. @item image
  1717. A component that displays an image. The image is scaled to fit
  1718. the component.
  1719. Properties:
  1720. @multitable @columnfractions 0.2 0.7
  1721. @item file
  1722. @tab The full path to the image file to load.
  1723. @end multitable
  1724. @item progress_bar
  1725. Displays a horizontally oriented progress bar. It can be rendered using
  1726. simple solid filled rectangles, or using a pair of pixmap styled boxes.
  1727. Properties:
  1728. @multitable @columnfractions 0.2 0.7
  1729. @item id
  1730. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1731. boot of the default entry.
  1732. @item fg_color
  1733. @tab The foreground color for plain solid color rendering.
  1734. @item bg_color
  1735. @tab The background color for plain solid color rendering.
  1736. @item border_color
  1737. @tab The border color for plain solid color rendering.
  1738. @item text_color
  1739. @tab The text color.
  1740. @item bar_style
  1741. @tab The styled box specification for the frame of the progress bar.
  1742. Example: ``progress_frame_*.png``
  1743. If the value is equal to ``highlight_style`` then no styled boxes
  1744. will be shown.
  1745. @item highlight_style
  1746. @tab The styled box specification for the highlighted region of the
  1747. progress bar. This box will be used to paint just the highlighted region
  1748. of the bar, and will be increased in size as the bar nears completion.
  1749. Example: ``progress_hl_*.png``.
  1750. If the value is equal to ``bar_style`` then no styled boxes
  1751. will be shown.
  1752. @item highlight_overlay
  1753. @tab If this option is set to ``true`` then the highlight box
  1754. side slices (every slice except the center slice) will overlay the
  1755. frame box side slices. And the center slice of the highlight box
  1756. can move all the way (from top to bottom), being drawn on the center
  1757. slice of the frame box. That way we can make a progress bar with
  1758. round-shaped edges so there won't be a free space from the highlight to
  1759. the frame in top and bottom scrollbar positions. Default is ``false``.
  1760. @item font
  1761. @tab The font to use for progress bar.
  1762. @item text
  1763. @tab The text to display on the progress bar. If the progress bar's ID
  1764. is set to ``__timeout__`` and the value of this property is set to
  1765. ``@@TIMEOUT_NOTIFICATION_SHORT@@``, ``@@TIMEOUT_NOTIFICATION_MIDDLE@@``
  1766. or ``@@TIMEOUT_NOTIFICATION_LONG@@``, then GRUB will update this
  1767. property with an informative message as the timeout approaches.
  1768. @end multitable
  1769. @item circular_progress
  1770. Displays a circular progress indicator. The appearance of this component
  1771. is determined by two images: the *center* image and the *tick* image. The
  1772. center image is generally larger and will be drawn in the center of the
  1773. component. Around the circumference of a circle within the component, the
  1774. tick image will be drawn a certain number of times, depending on the
  1775. properties of the component.
  1776. Properties:
  1777. @multitable @columnfractions 0.3 0.6
  1778. @item id
  1779. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1780. boot of the default entry.
  1781. @item center_bitmap
  1782. @tab The file name of the image to draw in the center of the component.
  1783. @item tick_bitmap
  1784. @tab The file name of the image to draw for the tick marks.
  1785. @item num_ticks
  1786. @tab The number of ticks that make up a full circle.
  1787. @item ticks_disappear
  1788. @tab Boolean value indicating whether tick marks should progressively appear,
  1789. or progressively disappear as *value* approaches *end*. Specify
  1790. ``true`` or ``false``. Default is ``false``.
  1791. @item start_angle
  1792. @tab The position of the first tick mark to appear or disappear.
  1793. Measured in "parrots", 1 "parrot" = 1 / 256 of the full circle.
  1794. Use values ``xxx deg`` or ``xxx \xc2\xb0`` to set the angle in degrees.
  1795. @end multitable
  1796. @item boot_menu
  1797. Displays the GRUB boot menu. It allows selecting items and executing them.
  1798. Properties:
  1799. @multitable @columnfractions 0.4 0.5
  1800. @item item_font
  1801. @tab The font to use for the menu item titles.
  1802. @item selected_item_font
  1803. @tab The font to use for the selected menu item, or ``inherit`` (the default)
  1804. to use ``item_font`` for the selected menu item as well.
  1805. @item item_color
  1806. @tab The color to use for the menu item titles.
  1807. @item selected_item_color
  1808. @tab The color to use for the selected menu item, or ``inherit`` (the default)
  1809. to use ``item_color`` for the selected menu item as well.
  1810. @item icon_width
  1811. @tab The width of menu item icons. Icons are scaled to the specified size.
  1812. @item icon_height
  1813. @tab The height of menu item icons.
  1814. @item item_height
  1815. @tab The height of each menu item in pixels.
  1816. @item item_padding
  1817. @tab The amount of space in pixels to leave on each side of the menu item
  1818. contents.
  1819. @item item_icon_space
  1820. @tab The space between an item's icon and the title text, in pixels.
  1821. @item item_spacing
  1822. @tab The amount of space to leave between menu items, in pixels.
  1823. @item menu_pixmap_style
  1824. @tab The image file pattern for the menu frame styled box.
  1825. Example: ``menu_*.png`` (this will use images such as ``menu_c.png``,
  1826. ``menu_w.png``, `menu_nw.png``, etc.)
  1827. @item item_pixmap_style
  1828. @tab The image file pattern for the item styled box.
  1829. @item selected_item_pixmap_style
  1830. @tab The image file pattern for the selected item highlight styled box.
  1831. @item scrollbar
  1832. @tab Boolean value indicating whether the scroll bar should be drawn if the
  1833. frame and thumb styled boxes are configured.
  1834. @item scrollbar_frame
  1835. @tab The image file pattern for the entire scroll bar.
  1836. Example: ``scrollbar_*.png``
  1837. @item scrollbar_thumb
  1838. @tab The image file pattern for the scroll bar thumb (the part of the scroll
  1839. bar that moves as scrolling occurs).
  1840. Example: ``scrollbar_thumb_*.png``
  1841. @item scrollbar_thumb_overlay
  1842. @tab If this option is set to ``true`` then the scrollbar thumb
  1843. side slices (every slice except the center slice) will overlay the
  1844. scrollbar frame side slices. And the center slice of the scrollbar_thumb
  1845. can move all the way (from top to bottom), being drawn on the center
  1846. slice of the scrollbar frame. That way we can make a scrollbar with
  1847. round-shaped edges so there won't be a free space from the thumb to
  1848. the frame in top and bottom scrollbar positions. Default is ``false``.
  1849. @item scrollbar_slice
  1850. @tab The menu frame styled box's slice in which the scrollbar will be
  1851. drawn. Possible values are ``west``, ``center``, ``east`` (default).
  1852. ``west`` - the scrollbar will be drawn in the west slice (right-aligned).
  1853. ``east`` - the scrollbar will be drawn in the east slice (left-aligned).
  1854. ``center`` - the scrollbar will be drawn in the center slice.
  1855. Note: in case of ``center`` slice:
  1856. a) If the scrollbar should be drawn then boot menu entry's width is
  1857. decreased by the scrollbar's width and the scrollbar is drawn at the
  1858. right side of the center slice.
  1859. b) If the scrollbar won't be drawn then the boot menu entry's width
  1860. is the width of the center slice.
  1861. c) We don't necessary need the menu pixmap box to display the scrollbar.
  1862. @item scrollbar_left_pad
  1863. @tab The left scrollbar padding in pixels.
  1864. Unused if ``scrollbar_slice`` is ``west``.
  1865. @item scrollbar_right_pad
  1866. @tab The right scrollbar padding in pixels.
  1867. Unused if ``scrollbar_slice`` is ``east``.
  1868. @item scrollbar_top_pad
  1869. @tab The top scrollbar padding in pixels.
  1870. @item scrollbar_bottom_pad
  1871. @tab The bottom scrollbar padding in pixels.
  1872. @item visible
  1873. @tab Set to ``false`` to hide the boot menu.
  1874. @end multitable
  1875. @item canvas
  1876. Canvas is a container that allows manual placement of components within it.
  1877. It does not alter the positions of its child components. It assigns all
  1878. child components their preferred sizes.
  1879. @item hbox
  1880. The *hbox* container lays out its children from left to right, giving each
  1881. one its preferred width. The height of each child is set to the maximum of
  1882. the preferred heights of all children.
  1883. @item vbox
  1884. The *vbox* container lays out its children from top to bottom, giving each
  1885. one its preferred height. The width of each child is set to the maximum of
  1886. the preferred widths of all children.
  1887. @end itemize
  1888. @subsection Common properties
  1889. The following properties are supported by all components:
  1890. @table @samp
  1891. @item left
  1892. The distance from the left border of container to left border of the object in either of three formats:
  1893. @multitable @columnfractions 0.2 0.7
  1894. @item x @tab Value in pixels
  1895. @item p% @tab Percentage
  1896. @item p%+x @tab mixture of both
  1897. @end multitable
  1898. @item top
  1899. The distance from the left border of container to left border of the object in same format.
  1900. @item width
  1901. The width of object in same format.
  1902. @item height
  1903. The height of object in same format.
  1904. @item id
  1905. The identifier for the component. This can be any arbitrary string.
  1906. The ID can be used by scripts to refer to various components in the GUI
  1907. component tree. Currently, there is one special ID value that GRUB
  1908. recognizes:
  1909. @multitable @columnfractions 0.2 0.7
  1910. @item ``__timeout__``
  1911. @tab Component with this ID will be updated by GRUB and will indicate
  1912. time elapsed to an automatical boot of the default entry.
  1913. Affected components: ``label``, ``circular_progress``, ``progress_bar``.
  1914. @end multitable
  1915. @end table
  1916. @node Network
  1917. @chapter Booting GRUB from the network
  1918. The following instructions don't work for *-emu, i386-qemu, i386-coreboot,
  1919. i386-multiboot, mips_loongson, mips-arc and mips_qemu_mips
  1920. To generate a netbootable directory, run:
  1921. @example
  1922. @group
  1923. grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/<platform>
  1924. @end group
  1925. @end example
  1926. E.g. for i386-pc:
  1927. @example
  1928. @group
  1929. grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i386-pc
  1930. @end group
  1931. @end example
  1932. Then follow instructions printed out by grub-mknetdir on configuring your DHCP
  1933. server.
  1934. After GRUB has started, files on the TFTP server will be accessible via the
  1935. @samp{(tftp)} device.
  1936. The server IP address can be controlled by changing the
  1937. @samp{(tftp)} device name to @samp{(tftp,@var{server-ip})}. Note that
  1938. this should be changed both in the prefix and in any references to the
  1939. device name in the configuration file.
  1940. GRUB provides several environment variables which may be used to inspect or
  1941. change the behaviour of the PXE device. In the following description
  1942. @var{<interface>} is placeholder for the name of network interface (platform
  1943. dependent):
  1944. @table @samp
  1945. @item net_@var{<interface>}_ip
  1946. The network interface's IP address. Read-only.
  1947. @item net_@var{<interface>}_mac
  1948. The network interface's MAC address. Read-only.
  1949. @item net_@var{<interface>}_hostname
  1950. The client host name provided by DHCP. Read-only.
  1951. @item net_@var{<interface>}_domain
  1952. The client domain name provided by DHCP. Read-only.
  1953. @item net_@var{<interface>}_rootpath
  1954. The path to the client's root disk provided by DHCP. Read-only.
  1955. @item net_@var{<interface>}_extensionspath
  1956. The path to additional DHCP vendor extensions provided by DHCP. Read-only.
  1957. @item net_@var{<interface>}_boot_file
  1958. The boot file name provided by DHCP. Read-only.
  1959. @item net_@var{<interface>}_dhcp_server_name
  1960. The name of the DHCP server responsible for these boot parameters.
  1961. Read-only.
  1962. @item net_@var{<interface>}_next_server
  1963. The IP address of the next (usually, TFTP) server provided by DHCP.
  1964. Read-only.
  1965. @item net_default_interface
  1966. Initially set to name of network interface that was used to load grub.
  1967. Read-write, although setting it affects only interpretation of
  1968. @samp{net_default_ip} and @samp{net_default_mac}
  1969. @item net_default_ip
  1970. The IP address of default interface. Read-only. This is alias for the
  1971. @samp{net_$@{net_default_interface@}_ip}.
  1972. @item net_default_mac
  1973. The default interface's MAC address. Read-only. This is alias for the
  1974. @samp{net_$@{net_default_interface@}_mac}.
  1975. @item net_default_server
  1976. The default server used by network drives (@pxref{Device syntax}). Read-write,
  1977. although setting this is only useful before opening a network device.
  1978. @end table
  1979. @node Serial terminal
  1980. @chapter Using GRUB via a serial line
  1981. This chapter describes how to use the serial terminal support in GRUB.
  1982. If you have many computers or computers with no display/keyboard, it
  1983. could be very useful to control the computers through serial
  1984. communications. To connect one computer with another via a serial line,
  1985. you need to prepare a null-modem (cross) serial cable, and you may need
  1986. to have multiport serial boards, if your computer doesn't have extra
  1987. serial ports. In addition, a terminal emulator is also required, such as
  1988. minicom. Refer to a manual of your operating system, for more
  1989. information.
  1990. As for GRUB, the instruction to set up a serial terminal is quite
  1991. simple. Here is an example:
  1992. @example
  1993. @group
  1994. grub> @kbd{serial --unit=0 --speed=9600}
  1995. grub> @kbd{terminal_input serial; terminal_output serial}
  1996. @end group
  1997. @end example
  1998. The command @command{serial} initializes the serial unit 0 with the
  1999. speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if
  2000. you want to use COM2, you must specify @samp{--unit=1} instead. This
  2001. command accepts many other options, so please refer to @ref{serial},
  2002. for more details.
  2003. The commands @command{terminal_input} (@pxref{terminal_input}) and
  2004. @command{terminal_output} (@pxref{terminal_output}) choose which type of
  2005. terminal you want to use. In the case above, the terminal will be a
  2006. serial terminal, but you can also pass @code{console} to the command,
  2007. as @samp{terminal_input serial console}. In this case, a terminal in which
  2008. you press any key will be selected as a GRUB terminal. In the example above,
  2009. note that you need to put both commands on the same command line, as you
  2010. will lose the ability to type commands on the console after the first
  2011. command.
  2012. However, note that GRUB assumes that your terminal emulator is
  2013. compatible with VT100 by default. This is true for most terminal
  2014. emulators nowadays, but you should pass the option @option{--dumb} to
  2015. the command if your terminal emulator is not VT100-compatible or
  2016. implements few VT100 escape sequences. If you specify this option then
  2017. GRUB provides you with an alternative menu interface, because the normal
  2018. menu requires several fancy features of your terminal.
  2019. @node Vendor power-on keys
  2020. @chapter Using GRUB with vendor power-on keys
  2021. Some laptop vendors provide an additional power-on button which boots
  2022. another OS. GRUB supports such buttons with the @samp{GRUB_TIMEOUT_BUTTON},
  2023. @samp{GRUB_TIMEOUT_STYLE_BUTTON}, @samp{GRUB_DEFAULT_BUTTON}, and
  2024. @samp{GRUB_BUTTON_CMOS_ADDRESS} variables in default/grub (@pxref{Simple
  2025. configuration}). @samp{GRUB_TIMEOUT_BUTTON},
  2026. @samp{GRUB_TIMEOUT_STYLE_BUTTON}, and @samp{GRUB_DEFAULT_BUTTON} are used
  2027. instead of the corresponding variables without the @samp{_BUTTON} suffix
  2028. when powered on using the special button. @samp{GRUB_BUTTON_CMOS_ADDRESS}
  2029. is vendor-specific and partially model-specific. Values known to the GRUB
  2030. team are:
  2031. @table @key
  2032. @item Dell XPS M1330M
  2033. 121:3
  2034. @item Dell XPS M1530
  2035. 85:3
  2036. @item Dell Latitude E4300
  2037. 85:3
  2038. @item Asus EeePC 1005PE
  2039. 84:1 (unconfirmed)
  2040. @item LENOVO ThinkPad T410s (2912W1C)
  2041. 101:3
  2042. @end table
  2043. To take full advantage of this function, install GRUB into the MBR
  2044. (@pxref{Installing GRUB using grub-install}).
  2045. If you have a laptop which has a similar feature and not in the above list
  2046. could you figure your address and contribute?
  2047. To discover the address do the following:
  2048. @itemize
  2049. @item boot normally
  2050. @item
  2051. @example
  2052. sudo modprobe nvram
  2053. sudo cat /dev/nvram | xxd > normal_button.txt
  2054. @end example
  2055. @item boot using vendor button
  2056. @item
  2057. @example
  2058. sudo modprobe nvram
  2059. sudo cat /dev/nvram | xxd > normal_vendor.txt
  2060. @end example
  2061. @end itemize
  2062. Then compare these text files and find where a bit was toggled. E.g. in
  2063. case of Dell XPS it was:
  2064. @example
  2065. byte 0x47: 20 --> 28
  2066. @end example
  2067. It's a bit number 3 as seen from following table:
  2068. @multitable @columnfractions .2 .2
  2069. @item 0 @tab 01
  2070. @item 1 @tab 02
  2071. @item 2 @tab 04
  2072. @item 3 @tab 08
  2073. @item 4 @tab 10
  2074. @item 5 @tab 20
  2075. @item 6 @tab 40
  2076. @item 7 @tab 80
  2077. @end multitable
  2078. 0x47 is decimal 71. Linux nvram implementation cuts first 14 bytes of
  2079. CMOS. So the real byte address in CMOS is 71+14=85
  2080. So complete address is 85:3
  2081. @node Images
  2082. @chapter GRUB image files
  2083. @c FIXME: parts of this section are specific to PC BIOS right now.
  2084. GRUB consists of several images: a variety of bootstrap images for starting
  2085. GRUB in various ways, a kernel image, and a set of modules which are
  2086. combined with the kernel image to form a core image. Here is a short
  2087. overview of them.
  2088. @table @file
  2089. @item boot.img
  2090. On PC BIOS systems, this image is the first part of GRUB to start. It is
  2091. written to a master boot record (MBR) or to the boot sector of a partition.
  2092. Because a PC boot sector is 512 bytes, the size of this image is exactly 512
  2093. bytes.
  2094. The sole function of @file{boot.img} is to read the first sector of the core
  2095. image from a local disk and jump to it. Because of the size restriction,
  2096. @file{boot.img} cannot understand any file system structure, so
  2097. @command{grub-install} hardcodes the location of the first sector of the
  2098. core image into @file{boot.img} when installing GRUB.
  2099. @item diskboot.img
  2100. This image is used as the first sector of the core image when booting from a
  2101. hard disk. It reads the rest of the core image into memory and starts the
  2102. kernel. Since file system handling is not yet available, it encodes the
  2103. location of the core image using a block list format.
  2104. @item cdboot.img
  2105. This image is used as the first sector of the core image when booting from a
  2106. CD-ROM drive. It performs a similar function to @file{diskboot.img}.
  2107. @item pxeboot.img
  2108. This image is used as the start of the core image when booting from the
  2109. network using PXE. @xref{Network}.
  2110. @item lnxboot.img
  2111. This image may be placed at the start of the core image in order to make
  2112. GRUB look enough like a Linux kernel that it can be booted by LILO using an
  2113. @samp{image=} section.
  2114. @item kernel.img
  2115. This image contains GRUB's basic run-time facilities: frameworks for device
  2116. and file handling, environment variables, the rescue mode command-line
  2117. parser, and so on. It is rarely used directly, but is built into all core
  2118. images.
  2119. @item core.img
  2120. This is the core image of GRUB. It is built dynamically from the kernel
  2121. image and an arbitrary list of modules by the @command{grub-mkimage}
  2122. program. Usually, it contains enough modules to access @file{/boot/grub},
  2123. and loads everything else (including menu handling, the ability to load
  2124. target operating systems, and so on) from the file system at run-time. The
  2125. modular design allows the core image to be kept small, since the areas of
  2126. disk where it must be installed are often as small as 32KB.
  2127. @xref{BIOS installation}, for details on where the core image can be
  2128. installed on PC systems.
  2129. @item *.mod
  2130. Everything else in GRUB resides in dynamically loadable modules. These are
  2131. often loaded automatically, or built into the core image if they are
  2132. essential, but may also be loaded manually using the @command{insmod}
  2133. command (@pxref{insmod}).
  2134. @end table
  2135. @heading For GRUB Legacy users
  2136. GRUB 2 has a different design from GRUB Legacy, and so correspondences with
  2137. the images it used cannot be exact. Nevertheless, GRUB Legacy users often
  2138. ask questions in the terms they are familiar with, and so here is a brief
  2139. guide to how GRUB 2's images relate to that.
  2140. @table @file
  2141. @item stage1
  2142. Stage 1 from GRUB Legacy was very similar to @file{boot.img} in GRUB 2, and
  2143. they serve the same function.
  2144. @item *_stage1_5
  2145. In GRUB Legacy, Stage 1.5's function was to include enough filesystem code
  2146. to allow the much larger Stage 2 to be read from an ordinary filesystem. In
  2147. this respect, its function was similar to @file{core.img} in GRUB 2.
  2148. However, @file{core.img} is much more capable than Stage 1.5 was; since it
  2149. offers a rescue shell, it is sometimes possible to recover manually in the
  2150. event that it is unable to load any other modules, for example if partition
  2151. numbers have changed. @file{core.img} is built in a more flexible way,
  2152. allowing GRUB 2 to support reading modules from advanced disk types such as
  2153. LVM and RAID.
  2154. GRUB Legacy could run with only Stage 1 and Stage 2 in some limited
  2155. configurations, while GRUB 2 requires @file{core.img} and cannot work
  2156. without it.
  2157. @item stage2
  2158. GRUB 2 has no single Stage 2 image. Instead, it loads modules from
  2159. @file{/boot/grub} at run-time.
  2160. @item stage2_eltorito
  2161. In GRUB 2, images for booting from CD-ROM drives are now constructed using
  2162. @file{cdboot.img} and @file{core.img}, making sure that the core image
  2163. contains the @samp{iso9660} module. It is usually best to use the
  2164. @command{grub-mkrescue} program for this.
  2165. @item nbgrub
  2166. There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by
  2167. Etherboot and some other network boot loaders.
  2168. @item pxegrub
  2169. In GRUB 2, images for PXE network booting are now constructed using
  2170. @file{pxeboot.img} and @file{core.img}, making sure that the core image
  2171. contains the @samp{pxe} and @samp{pxecmd} modules. @xref{Network}.
  2172. @end table
  2173. @node Core image size limitation
  2174. @chapter Core image size limitation
  2175. Heavily limited platforms:
  2176. @itemize
  2177. @item i386-pc (normal and PXE): the core image size (compressed) is limited by 458240 bytes.
  2178. kernel.img (.text + .data + .bss, uncompressed) is limited by 392704 bytes.
  2179. module size (uncompressed) + kernel.img (.text + .data, uncompressed) is limited by the size of contiguous chunk at 1M address.
  2180. @item sparc64-ieee1275: kernel.img (.text + .data + .bss) + modules + 256K (stack) + 2M (heap) is limited by space available at 0x4400. On most platforms it's just 3 or 4M since ieee1275 maps only so much.
  2181. @item i386-ieee1275: kernel.img (.text + .data + .bss) + modules is limited by memory available at 0x10000, at most 596K
  2182. @end itemize
  2183. Lightly limited platforms:
  2184. @itemize
  2185. @item *-xen: limited only by adress space and RAM size.
  2186. @item i386-qemu: kernel.img (.text + .data + .bss) is limited by 392704 bytes.
  2187. (core.img would be limited by ROM size but it's unlimited on qemu
  2188. @item All EFI platforms: limited by contiguous RAM size and possibly firmware bugs
  2189. @item Coreboot and multiboot. kernel.img (.text + .data + .bss) is limited by 392704 bytes.
  2190. module size is limited by the size of contiguous chunk at 1M address.
  2191. @item mipsel-loongson (ELF), mips(el)-qemu_mips (ELF): if uncompressed:
  2192. kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
  2193. if compressed:
  2194. kernel.img (.text + .data, uncompressed) + modules (uncompressed)
  2195. + (modules + kernel.img (.text + .data)) (compressed)
  2196. + decompressor is limited by the space from 80200000 forward
  2197. @item mipsel-loongson (Flash), mips(el)-qemu_mips (Flash): kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
  2198. core.img (final) is limited by flash size (512K on yeeloong and fulooong)
  2199. @item mips-arc: if uncompressed:
  2200. kernel.img (.text + .data) is limited by the space from 8bd00000 forward
  2201. modules + dummy decompressor is limited by the space from 8bd00000 backward
  2202. if compressed:
  2203. kernel.img (.text + .data, uncompressed) is limited by the space from 8bd00000 forward
  2204. modules (uncompressed) + (modules + kernel.img (.text + .data)) (compressed, aligned to 1M)
  2205. + 1M (decompressor + scratch space) is limited by the space from 8bd00000 backward
  2206. @item powerpc-ieee1275: kernel.img (.text + .data + .bss) + modules is limited by space available at 0x200000
  2207. @end itemize
  2208. @node Filesystem
  2209. @chapter Filesystem syntax and semantics
  2210. GRUB uses a special syntax for specifying disk drives which can be
  2211. accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
  2212. between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
  2213. device is equivalent to which OS device. Normally, that will be clear if
  2214. you see the files in a device or use the command @command{search}
  2215. (@pxref{search}).
  2216. @menu
  2217. * Device syntax:: How to specify devices
  2218. * File name syntax:: How to specify files
  2219. * Block list syntax:: How to specify block lists
  2220. @end menu
  2221. @node Device syntax
  2222. @section How to specify devices
  2223. The device syntax is like this:
  2224. @example
  2225. @code{(@var{device}[,@var{partmap-name1}@var{part-num1}[,@var{partmap-name2}@var{part-num2}[,...]]])}
  2226. @end example
  2227. @samp{[]} means the parameter is optional. @var{device} depends on the disk
  2228. driver in use. BIOS and EFI disks use either @samp{fd} or @samp{hd} followed
  2229. by a digit, like @samp{fd0}, or @samp{cd}.
  2230. AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
  2231. Memdisk and host are limited to one disk and so it's refered just by driver
  2232. name.
  2233. RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM, virtio (vdsk)
  2234. and arcdisk (arc) use intrinsic name of disk prefixed by driver name.
  2235. Additionally just ``nand'' refers to the disk aliased as ``nand''.
  2236. Conflicts are solved by suffixing a number if necessarry.
  2237. Commas need to be escaped.
  2238. Loopback uses whatever name specified to @command{loopback} command.
  2239. Hostdisk uses names specified in device.map as long as it's of the form
  2240. [fhc]d[0-9]* or hostdisk/<OS DEVICE>.
  2241. For crypto and RAID (md) additionally you can use the syntax
  2242. <driver name>uuid/<uuid>. For LVM additionally you can use the syntax
  2243. lvmid/<volume-group-uuid>/<volume-uuid>.
  2244. @example
  2245. (fd0)
  2246. (hd0)
  2247. (cd)
  2248. (ahci0)
  2249. (ata0)
  2250. (crypto0)
  2251. (usb0)
  2252. (cryptouuid/123456789abcdef0123456789abcdef0)
  2253. (mduuid/123456789abcdef0123456789abcdef0)
  2254. (lvm/system-root)
  2255. (lvmid/F1ikgD-2RES-306G-il9M-7iwa-4NKW-EbV1NV/eLGuCQ-L4Ka-XUgR-sjtJ-ffch-bajr-fCNfz5)
  2256. (md/myraid)
  2257. (md/0)
  2258. (ieee1275/disk2)
  2259. (ieee1275//pci@@1f\,0/ide@@d/disk@@2)
  2260. (nand)
  2261. (memdisk)
  2262. (host)
  2263. (myloop)
  2264. (hostdisk//dev/sda)
  2265. @end example
  2266. @var{part-num} represents the partition number of @var{device}, starting
  2267. from one. @var{partname} is optional but is recommended since disk may have
  2268. several top-level partmaps. Specifying third and later component you can access
  2269. to subpartitions.
  2270. The syntax @samp{(hd0)} represents using the entire disk (or the
  2271. MBR when installing GRUB), while the syntax @samp{(hd0,1)}
  2272. represents using the first partition of the disk (or the boot sector
  2273. of the partition when installing GRUB).
  2274. @example
  2275. (hd0,msdos1)
  2276. (hd0,msdos1,msdos5)
  2277. (hd0,msdos1,bsd3)
  2278. (hd0,netbsd1)
  2279. (hd0,gpt1)
  2280. (hd0,1,3)
  2281. @end example
  2282. If you enabled the network support, the special drives
  2283. @code{(@var{protocol}[,@var{server}])} are also available. Supported protocols
  2284. are @samp{http} and @samp{tftp}. If @var{server} is omitted, value of
  2285. environment variable @samp{net_default_server} is used.
  2286. Before using the network drive, you must initialize the network.
  2287. @xref{Network}, for more information.
  2288. If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making
  2289. a GRUB bootable CD-ROM}, for details.
  2290. @node File name syntax
  2291. @section How to specify files
  2292. There are two ways to specify files, by @dfn{absolute file name} and by
  2293. @dfn{block list}.
  2294. An absolute file name resembles a Unix absolute file name, using
  2295. @samp{/} for the directory separator (not @samp{\} as in DOS). One
  2296. example is @samp{(hd0,1)/boot/grub/grub.cfg}. This means the file
  2297. @file{/boot/grub/grub.cfg} in the first partition of the first hard
  2298. disk. If you omit the device name in an absolute file name, GRUB uses
  2299. GRUB's @dfn{root device} implicitly. So if you set the root device to,
  2300. say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}),
  2301. then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
  2302. On ZFS filesystem the first path component must be
  2303. @var{volume}@samp{@@}[@var{snapshot}].
  2304. So @samp{/rootvol@@snap-129/boot/grub/grub.cfg} refers to file
  2305. @samp{/boot/grub/grub.cfg} in snapshot of volume @samp{rootvol} with name
  2306. @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if
  2307. snapshot name is omitted.
  2308. @node Block list syntax
  2309. @section How to specify block lists
  2310. A block list is used for specifying a file that doesn't appear in the
  2311. filesystem, like a chainloader. The syntax is
  2312. @code{[@var{offset}]+@var{length}[,[@var{offset}]+@var{length}]@dots{}}.
  2313. Here is an example:
  2314. @example
  2315. @code{0+100,200+1,300+300}
  2316. @end example
  2317. This represents that GRUB should read blocks 0 through 99, block 200,
  2318. and blocks 300 through 599. If you omit an offset, then GRUB assumes
  2319. the offset is zero.
  2320. Like the file name syntax (@pxref{File name syntax}), if a blocklist
  2321. does not contain a device name, then GRUB uses GRUB's @dfn{root
  2322. device}. So @code{(hd0,2)+1} is the same as @code{+1} when the root
  2323. device is @samp{(hd0,2)}.
  2324. @node Interface
  2325. @chapter GRUB's user interface
  2326. GRUB has both a simple menu interface for choosing preset entries from a
  2327. configuration file, and a highly flexible command-line for performing
  2328. any desired combination of boot commands.
  2329. GRUB looks for its configuration file as soon as it is loaded. If one
  2330. is found, then the full menu interface is activated using whatever
  2331. entries were found in the file. If you choose the @dfn{command-line} menu
  2332. option, or if the configuration file was not found, then GRUB drops to
  2333. the command-line interface.
  2334. @menu
  2335. * Command-line interface:: The flexible command-line interface
  2336. * Menu interface:: The simple menu interface
  2337. * Menu entry editor:: Editing a menu entry
  2338. @end menu
  2339. @node Command-line interface
  2340. @section The flexible command-line interface
  2341. The command-line interface provides a prompt and after it an editable
  2342. text area much like a command-line in Unix or DOS. Each command is
  2343. immediately executed after it is entered@footnote{However, this
  2344. behavior will be changed in the future version, in a user-invisible
  2345. way.}. The commands (@pxref{Command-line and menu entry commands}) are a
  2346. subset of those available in the configuration file, used with exactly
  2347. the same syntax.
  2348. Cursor movement and editing of the text on the line can be done via a
  2349. subset of the functions available in the Bash shell:
  2350. @table @key
  2351. @item C-f
  2352. @itemx PC right key
  2353. Move forward one character.
  2354. @item C-b
  2355. @itemx PC left key
  2356. Move back one character.
  2357. @item C-a
  2358. @itemx HOME
  2359. Move to the start of the line.
  2360. @item C-e
  2361. @itemx END
  2362. Move the the end of the line.
  2363. @item C-d
  2364. @itemx DEL
  2365. Delete the character underneath the cursor.
  2366. @item C-h
  2367. @itemx BS
  2368. Delete the character to the left of the cursor.
  2369. @item C-k
  2370. Kill the text from the current cursor position to the end of the line.
  2371. @item C-u
  2372. Kill backward from the cursor to the beginning of the line.
  2373. @item C-y
  2374. Yank the killed text back into the buffer at the cursor.
  2375. @item C-p
  2376. @itemx PC up key
  2377. Move up through the history list.
  2378. @item C-n
  2379. @itemx PC down key
  2380. Move down through the history list.
  2381. @end table
  2382. When typing commands interactively, if the cursor is within or before
  2383. the first word in the command-line, pressing the @key{TAB} key (or
  2384. @key{C-i}) will display a listing of the available commands, and if the
  2385. cursor is after the first word, the @kbd{@key{TAB}} will provide a
  2386. completion listing of disks, partitions, and file names depending on the
  2387. context. Note that to obtain a list of drives, one must open a
  2388. parenthesis, as @command{root (}.
  2389. Note that you cannot use the completion functionality in the TFTP
  2390. filesystem. This is because TFTP doesn't support file name listing for
  2391. the security.
  2392. @node Menu interface
  2393. @section The simple menu interface
  2394. The menu interface is quite easy to use. Its commands are both
  2395. reasonably intuitive and described on screen.
  2396. Basically, the menu interface provides a list of @dfn{boot entries} to
  2397. the user to choose from. Use the arrow keys to select the entry of
  2398. choice, then press @key{RET} to run it. An optional timeout is
  2399. available to boot the default entry (the first one if not set), which is
  2400. aborted by pressing any key.
  2401. Commands are available to enter a bare command-line by pressing @key{c}
  2402. (which operates exactly like the non-config-file version of GRUB, but
  2403. allows one to return to the menu if desired by pressing @key{ESC}) or to
  2404. edit any of the @dfn{boot entries} by pressing @key{e}.
  2405. If you protect the menu interface with a password (@pxref{Security}),
  2406. all you can do is choose an entry by pressing @key{RET}, or press
  2407. @key{p} to enter the password.
  2408. @node Menu entry editor
  2409. @section Editing a menu entry
  2410. The menu entry editor looks much like the main menu interface, but the
  2411. lines in the menu are individual commands in the selected entry instead
  2412. of entry names.
  2413. If an @key{ESC} is pressed in the editor, it aborts all the changes made
  2414. to the configuration entry and returns to the main menu interface.
  2415. Each line in the menu entry can be edited freely, and you can add new lines
  2416. by pressing @key{RET} at the end of a line. To boot the edited entry, press
  2417. @key{Ctrl-x}.
  2418. Although GRUB unfortunately does not support @dfn{undo}, you can do almost
  2419. the same thing by just returning to the main menu using @key{ESC}.
  2420. @node Environment
  2421. @chapter GRUB environment variables
  2422. GRUB supports environment variables which are rather like those offered by
  2423. all Unix-like systems. Environment variables have a name, which is unique
  2424. and is usually a short identifier, and a value, which is an arbitrary string
  2425. of characters. They may be set (@pxref{set}), unset (@pxref{unset}), or
  2426. looked up (@pxref{Shell-like scripting}) by name.
  2427. A number of environment variables have special meanings to various parts of
  2428. GRUB. Others may be used freely in GRUB configuration files.
  2429. @menu
  2430. * Special environment variables::
  2431. * Environment block::
  2432. @end menu
  2433. @node Special environment variables
  2434. @section Special environment variables
  2435. These variables have special meaning to GRUB.
  2436. @menu
  2437. * biosnum::
  2438. * check_signatures::
  2439. * chosen::
  2440. * cmdpath::
  2441. * color_highlight::
  2442. * color_normal::
  2443. * config_directory::
  2444. * config_file::
  2445. * debug::
  2446. * default::
  2447. * fallback::
  2448. * gfxmode::
  2449. * gfxpayload::
  2450. * gfxterm_font::
  2451. * grub_cpu::
  2452. * grub_platform::
  2453. * icondir::
  2454. * lang::
  2455. * locale_dir::
  2456. * menu_color_highlight::
  2457. * menu_color_normal::
  2458. * net_@var{<interface>}_boot_file::
  2459. * net_@var{<interface>}_dhcp_server_name::
  2460. * net_@var{<interface>}_domain::
  2461. * net_@var{<interface>}_extensionspath::
  2462. * net_@var{<interface>}_hostname::
  2463. * net_@var{<interface>}_ip::
  2464. * net_@var{<interface>}_mac::
  2465. * net_@var{<interface>}_next_server::
  2466. * net_@var{<interface>}_rootpath::
  2467. * net_default_interface::
  2468. * net_default_ip::
  2469. * net_default_mac::
  2470. * net_default_server::
  2471. * pager::
  2472. * prefix::
  2473. * pxe_blksize::
  2474. * pxe_default_gateway::
  2475. * pxe_default_server::
  2476. * root::
  2477. * superusers::
  2478. * theme::
  2479. * timeout::
  2480. * timeout_style::
  2481. @end menu
  2482. @node biosnum
  2483. @subsection biosnum
  2484. When chain-loading another boot loader (@pxref{Chain-loading}), GRUB may
  2485. need to know what BIOS drive number corresponds to the root device
  2486. (@pxref{root}) so that it can set up registers properly. If the
  2487. @var{biosnum} variable is set, it overrides GRUB's own means of guessing
  2488. this.
  2489. For an alternative approach which also changes BIOS drive mappings for the
  2490. chain-loaded system, @pxref{drivemap}.
  2491. @node check_signatures
  2492. @subsection check_signatures
  2493. This variable controls whether GRUB enforces digital signature
  2494. validation on loaded files. @xref{Using digital signatures}.
  2495. @node chosen
  2496. @subsection chosen
  2497. When executing a menu entry, GRUB sets the @var{chosen} variable to the
  2498. title of the entry being executed.
  2499. If the menu entry is in one or more submenus, then @var{chosen} is set to
  2500. the titles of each of the submenus starting from the top level followed by
  2501. the title of the menu entry itself, separated by @samp{>}.
  2502. @node cmdpath
  2503. @subsection cmdpath
  2504. The location from which @file{core.img} was loaded as an absolute
  2505. directory name (@pxref{File name syntax}). This is set by GRUB at
  2506. startup based on information returned by platform firmware. Not every
  2507. platform provides this information and some may return only device
  2508. without path name.
  2509. @node color_highlight
  2510. @subsection color_highlight
  2511. This variable contains the ``highlight'' foreground and background terminal
  2512. colors, separated by a slash (@samp{/}). Setting this variable changes
  2513. those colors. For the available color names, @pxref{color_normal}.
  2514. The default is @samp{black/light-gray}.
  2515. @node color_normal
  2516. @subsection color_normal
  2517. This variable contains the ``normal'' foreground and background terminal
  2518. colors, separated by a slash (@samp{/}). Setting this variable changes
  2519. those colors. Each color must be a name from the following list:
  2520. @itemize @bullet
  2521. @item black
  2522. @item blue
  2523. @item green
  2524. @item cyan
  2525. @item red
  2526. @item magenta
  2527. @item brown
  2528. @item light-gray
  2529. @item dark-gray
  2530. @item light-blue
  2531. @item light-green
  2532. @item light-cyan
  2533. @item light-red
  2534. @item light-magenta
  2535. @item yellow
  2536. @item white
  2537. @end itemize
  2538. The default is @samp{light-gray/black}.
  2539. The color support support varies from terminal to terminal.
  2540. @samp{morse} has no color support at all.
  2541. @samp{mda_text} color support is limited to highlighting by
  2542. black/white reversal.
  2543. @samp{console} on ARC, EMU and IEEE1275, @samp{serial_*} and
  2544. @samp{spkmodem} are governed by terminfo and support
  2545. only 8 colors if in modes @samp{vt100-color} (default for console on emu),
  2546. @samp{arc} (default for console on ARC), @samp{ieee1275} (default
  2547. for console on IEEE1275). When in mode @samp{vt100}
  2548. then the color support is limited to highlighting by black/white
  2549. reversal. When in mode @samp{dumb} there is no color support.
  2550. When console supports no colors this setting is ignored.
  2551. When console supports 8 colors, then the colors from the
  2552. second half of the previous list are mapped to the
  2553. matching colors of first half.
  2554. @samp{console} on EFI and BIOS and @samp{vga_text} support all 16 colors.
  2555. @samp{gfxterm} supports all 16 colors and would be theoretically extendable
  2556. to support whole rgb24 palette but currently there is no compelling reason
  2557. to go beyond the current 16 colors.
  2558. @node config_directory
  2559. @subsection config_directory
  2560. This variable is automatically set by GRUB to the directory part of
  2561. current configuration file name (@pxref{config_file}).
  2562. @node config_file
  2563. @subsection config_file
  2564. This variable is automatically set by GRUB to the name of configuration file that is being
  2565. processed by commands @command{configfile} (@pxref{configfile}) or @command{normal}
  2566. (@pxref{normal}). It is restored to the previous value when command completes.
  2567. @node debug
  2568. @subsection debug
  2569. This variable may be set to enable debugging output from various components
  2570. of GRUB. The value is a list of debug facility names separated by
  2571. whitespace or @samp{,}, or @samp{all} to enable all available debugging
  2572. output. The facility names are the first argument to grub_dprintf. Consult
  2573. source for more details.
  2574. @node default
  2575. @subsection default
  2576. If this variable is set, it identifies a menu entry that should be
  2577. selected by default, possibly after a timeout (@pxref{timeout}). The
  2578. entry may be identified by number (starting from 0 at each level of
  2579. the hierarchy), by title, or by id.
  2580. For example, if you have:
  2581. @verbatim
  2582. menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
  2583. ...
  2584. }
  2585. @end verbatim
  2586. then you can make this the default using:
  2587. @example
  2588. default=example-gnu-linux
  2589. @end example
  2590. If the entry is in a submenu, then it must be identified using the
  2591. number, title, or id of each of the submenus starting from the top
  2592. level, followed by the number, title, or id of the menu entry itself,
  2593. with each element separated by @samp{>}. For example, take the
  2594. following menu structure:
  2595. @example
  2596. GNU/Hurd --id gnu-hurd
  2597. Standard Boot --id=gnu-hurd-std
  2598. Rescue shell --id=gnu-hurd-rescue
  2599. Other platforms --id=other
  2600. Minix --id=minix
  2601. Version 3.4.0 --id=minix-3.4.0
  2602. Version 3.3.0 --id=minix-3.3.0
  2603. GRUB Invaders --id=grub-invaders
  2604. @end example
  2605. The more recent release of Minix would then be identified as
  2606. @samp{Other platforms>Minix>Version 3.4.0}, or as @samp{1>0>0}, or as
  2607. @samp{other>minix>minix-3.4.0}.
  2608. This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
  2609. configuration}), @command{grub-set-default}, or @command{grub-reboot}.
  2610. @node fallback
  2611. @subsection fallback
  2612. If this variable is set, it identifies a menu entry that should be selected
  2613. if the default menu entry fails to boot. Entries are identified in the same
  2614. way as for @samp{default} (@pxref{default}).
  2615. @node gfxmode
  2616. @subsection gfxmode
  2617. If this variable is set, it sets the resolution used on the @samp{gfxterm}
  2618. graphical terminal. Note that you can only use modes which your graphics
  2619. card supports via VESA BIOS Extensions (VBE), so for example native LCD
  2620. panel resolutions may not be available. The default is @samp{auto}, which
  2621. selects a platform-specific default that should look reasonable. Supported
  2622. modes can be listed by @samp{videoinfo} command in GRUB.
  2623. The resolution may be specified as a sequence of one or more modes,
  2624. separated by commas (@samp{,}) or semicolons (@samp{;}); each will be tried
  2625. in turn until one is found. Each mode should be either @samp{auto},
  2626. @samp{@var{width}x@var{height}}, or
  2627. @samp{@var{width}x@var{height}x@var{depth}}.
  2628. @node gfxpayload
  2629. @subsection gfxpayload
  2630. If this variable is set, it controls the video mode in which the Linux
  2631. kernel starts up, replacing the @samp{vga=} boot option (@pxref{linux}). It
  2632. may be set to @samp{text} to force the Linux kernel to boot in normal text
  2633. mode, @samp{keep} to preserve the graphics mode set using @samp{gfxmode}, or
  2634. any of the permitted values for @samp{gfxmode} to set a particular graphics
  2635. mode (@pxref{gfxmode}).
  2636. Depending on your kernel, your distribution, your graphics card, and the
  2637. phase of the moon, note that using this option may cause GNU/Linux to suffer
  2638. from various display problems, particularly during the early part of the
  2639. boot sequence. If you have problems, set this variable to @samp{text} and
  2640. GRUB will tell Linux to boot in normal text mode.
  2641. The default is platform-specific. On platforms with a native text mode
  2642. (such as PC BIOS platforms), the default is @samp{text}. Otherwise the
  2643. default may be @samp{auto} or a specific video mode.
  2644. This variable is often set by @samp{GRUB_GFXPAYLOAD_LINUX} (@pxref{Simple
  2645. configuration}).
  2646. @node gfxterm_font
  2647. @subsection gfxterm_font
  2648. If this variable is set, it names a font to use for text on the
  2649. @samp{gfxterm} graphical terminal. Otherwise, @samp{gfxterm} may use any
  2650. available font.
  2651. @node grub_cpu
  2652. @subsection grub_cpu
  2653. In normal mode (@pxref{normal}), GRUB sets the @samp{grub_cpu} variable to
  2654. the CPU type for which GRUB was built (e.g. @samp{i386} or @samp{powerpc}).
  2655. @node grub_platform
  2656. @subsection grub_platform
  2657. In normal mode (@pxref{normal}), GRUB sets the @samp{grub_platform} variable
  2658. to the platform for which GRUB was built (e.g. @samp{pc} or @samp{efi}).
  2659. @node icondir
  2660. @subsection icondir
  2661. If this variable is set, it names a directory in which the GRUB graphical
  2662. menu should look for icons after looking in the theme's @samp{icons}
  2663. directory. @xref{Theme file format}.
  2664. @node lang
  2665. @subsection lang
  2666. If this variable is set, it names the language code that the
  2667. @command{gettext} command (@pxref{gettext}) uses to translate strings. For
  2668. example, French would be named as @samp{fr}, and Simplified Chinese as
  2669. @samp{zh_CN}.
  2670. @command{grub-mkconfig} (@pxref{Simple configuration}) will try to set a
  2671. reasonable default for this variable based on the system locale.
  2672. @node locale_dir
  2673. @subsection locale_dir
  2674. If this variable is set, it names the directory where translation files may
  2675. be found (@pxref{gettext}), usually @file{/boot/grub/locale}. Otherwise,
  2676. internationalization is disabled.
  2677. @command{grub-mkconfig} (@pxref{Simple configuration}) will set a reasonable
  2678. default for this variable if internationalization is needed and any
  2679. translation files are available.
  2680. @node menu_color_highlight
  2681. @subsection menu_color_highlight
  2682. This variable contains the foreground and background colors to be used for
  2683. the highlighted menu entry, separated by a slash (@samp{/}). Setting this
  2684. variable changes those colors. For the available color names,
  2685. @pxref{color_normal}.
  2686. The default is the value of @samp{color_highlight}
  2687. (@pxref{color_highlight}).
  2688. @node menu_color_normal
  2689. @subsection menu_color_normal
  2690. This variable contains the foreground and background colors to be used for
  2691. non-highlighted menu entries, separated by a slash (@samp{/}). Setting this
  2692. variable changes those colors. For the available color names,
  2693. @pxref{color_normal}.
  2694. The default is the value of @samp{color_normal} (@pxref{color_normal}).
  2695. @node net_@var{<interface>}_boot_file
  2696. @subsection net_@var{<interface>}_boot_file
  2697. @xref{Network}.
  2698. @node net_@var{<interface>}_dhcp_server_name
  2699. @subsection net_@var{<interface>}_dhcp_server_name
  2700. @xref{Network}.
  2701. @node net_@var{<interface>}_domain
  2702. @subsection net_@var{<interface>}_domain
  2703. @xref{Network}.
  2704. @node net_@var{<interface>}_extensionspath
  2705. @subsection net_@var{<interface>}_extensionspath
  2706. @xref{Network}.
  2707. @node net_@var{<interface>}_hostname
  2708. @subsection net_@var{<interface>}_hostname
  2709. @xref{Network}.
  2710. @node net_@var{<interface>}_ip
  2711. @subsection net_@var{<interface>}_ip
  2712. @xref{Network}.
  2713. @node net_@var{<interface>}_mac
  2714. @subsection net_@var{<interface>}_mac
  2715. @xref{Network}.
  2716. @node net_@var{<interface>}_next_server
  2717. @subsection net_@var{<interface>}_next_server
  2718. @xref{Network}.
  2719. @node net_@var{<interface>}_rootpath
  2720. @subsection net_@var{<interface>}_rootpath
  2721. @xref{Network}.
  2722. @node net_default_interface
  2723. @subsection net_default_interface
  2724. @xref{Network}.
  2725. @node net_default_ip
  2726. @subsection net_default_ip
  2727. @xref{Network}.
  2728. @node net_default_mac
  2729. @subsection net_default_mac
  2730. @xref{Network}.
  2731. @node net_default_server
  2732. @subsection net_default_server
  2733. @xref{Network}.
  2734. @node pager
  2735. @subsection pager
  2736. If set to @samp{1}, pause output after each screenful and wait for keyboard
  2737. input. The default is not to pause output.
  2738. @node prefix
  2739. @subsection prefix
  2740. The location of the @samp{/boot/grub} directory as an absolute file name
  2741. (@pxref{File name syntax}). This is normally set by GRUB at startup based
  2742. on information provided by @command{grub-install}. GRUB modules are
  2743. dynamically loaded from this directory, so it must be set correctly in order
  2744. for many parts of GRUB to work.
  2745. @node pxe_blksize
  2746. @subsection pxe_blksize
  2747. @xref{Network}.
  2748. @node pxe_default_gateway
  2749. @subsection pxe_default_gateway
  2750. @xref{Network}.
  2751. @node pxe_default_server
  2752. @subsection pxe_default_server
  2753. @xref{Network}.
  2754. @node root
  2755. @subsection root
  2756. The root device name (@pxref{Device syntax}). Any file names that do not
  2757. specify an explicit device name are read from this device. The default is
  2758. normally set by GRUB at startup based on the value of @samp{prefix}
  2759. (@pxref{prefix}).
  2760. For example, if GRUB was installed to the first partition of the first hard
  2761. disk, then @samp{prefix} might be set to @samp{(hd0,msdos1)/boot/grub} and
  2762. @samp{root} to @samp{hd0,msdos1}.
  2763. @node superusers
  2764. @subsection superusers
  2765. This variable may be set to a list of superuser names to enable
  2766. authentication support. @xref{Security}.
  2767. @node theme
  2768. @subsection theme
  2769. This variable may be set to a directory containing a GRUB graphical menu
  2770. theme. @xref{Theme file format}.
  2771. This variable is often set by @samp{GRUB_THEME} (@pxref{Simple
  2772. configuration}).
  2773. @node timeout
  2774. @subsection timeout
  2775. If this variable is set, it specifies the time in seconds to wait for
  2776. keyboard input before booting the default menu entry. A timeout of @samp{0}
  2777. means to boot the default entry immediately without displaying the menu; a
  2778. timeout of @samp{-1} (or unset) means to wait indefinitely.
  2779. If @samp{timeout_style} (@pxref{timeout_style}) is set to @samp{countdown}
  2780. or @samp{hidden}, the timeout is instead counted before the menu is
  2781. displayed.
  2782. This variable is often set by @samp{GRUB_TIMEOUT} (@pxref{Simple
  2783. configuration}).
  2784. @node timeout_style
  2785. @subsection timeout_style
  2786. This variable may be set to @samp{menu}, @samp{countdown}, or @samp{hidden}
  2787. to control the way in which the timeout (@pxref{timeout}) interacts with
  2788. displaying the menu. See the documentation of @samp{GRUB_TIMEOUT_STYLE}
  2789. (@pxref{Simple configuration}) for details.
  2790. @node Environment block
  2791. @section The GRUB environment block
  2792. It is often useful to be able to remember a small amount of information from
  2793. one boot to the next. For example, you might want to set the default menu
  2794. entry based on what was selected the last time. GRUB deliberately does not
  2795. implement support for writing files in order to minimise the possibility of
  2796. the boot loader being responsible for file system corruption, so a GRUB
  2797. configuration file cannot just create a file in the ordinary way. However,
  2798. GRUB provides an ``environment block'' which can be used to save a small
  2799. amount of state.
  2800. The environment block is a preallocated 1024-byte file, which normally lives
  2801. in @file{/boot/grub/grubenv} (although you should not assume this). At boot
  2802. time, the @command{load_env} command (@pxref{load_env}) loads environment
  2803. variables from it, and the @command{save_env} (@pxref{save_env}) command
  2804. saves environment variables to it. From a running system, the
  2805. @command{grub-editenv} utility can be used to edit the environment block.
  2806. For safety reasons, this storage is only available when installed on a plain
  2807. disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and
  2808. using BIOS or EFI functions (no ATA, USB or IEEE1275).
  2809. @command{grub-mkconfig} uses this facility to implement
  2810. @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
  2811. @node Commands
  2812. @chapter The list of available commands
  2813. In this chapter, we list all commands that are available in GRUB.
  2814. Commands belong to different groups. A few can only be used in
  2815. the global section of the configuration file (or ``menu''); most
  2816. of them can be entered on the command-line and can be used either
  2817. anywhere in the menu or specifically in the menu entries.
  2818. In rescue mode, only the @command{insmod} (@pxref{insmod}), @command{ls}
  2819. (@pxref{ls}), @command{set} (@pxref{set}), and @command{unset}
  2820. (@pxref{unset}) commands are normally available. If you end up in rescue
  2821. mode and do not know what to do, then @pxref{GRUB only offers a rescue
  2822. shell}.
  2823. @menu
  2824. * Menu-specific commands::
  2825. * General commands::
  2826. * Command-line and menu entry commands::
  2827. * Networking commands::
  2828. @end menu
  2829. @node Menu-specific commands
  2830. @section The list of commands for the menu only
  2831. The semantics used in parsing the configuration file are the following:
  2832. @itemize @bullet
  2833. @item
  2834. The files @emph{must} be in plain-text format.
  2835. @item
  2836. @samp{#} at the beginning of a line in a configuration file means it is
  2837. only a comment.
  2838. @item
  2839. Options are separated by spaces.
  2840. @item
  2841. All numbers can be either decimal or hexadecimal. A hexadecimal number
  2842. must be preceded by @samp{0x}, and is case-insensitive.
  2843. @end itemize
  2844. These commands can only be used in the menu:
  2845. @menu
  2846. * menuentry:: Start a menu entry
  2847. * submenu:: Group menu entries
  2848. @end menu
  2849. @node menuentry
  2850. @subsection menuentry
  2851. @deffn Command menuentry @var{title} @
  2852. [@option{--class=class} @dots{}] [@option{--users=users}] @
  2853. [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
  2854. [@var{arg} @dots{}] @{ @var{command}; @dots{} @}
  2855. This defines a GRUB menu entry named @var{title}. When this entry is
  2856. selected from the menu, GRUB will set the @var{chosen} environment variable
  2857. to value of @option{--id} if @option{--id} is given, execute the list of
  2858. commands given within braces, and if the last command in the list returned
  2859. successfully and a kernel was loaded it will execute the @command{boot} command.
  2860. The @option{--class} option may be used any number of times to group menu
  2861. entries into classes. Menu themes may display different classes using
  2862. different styles.
  2863. The @option{--users} option grants specific users access to specific menu
  2864. entries. @xref{Security}.
  2865. The @option{--unrestricted} option grants all users access to specific menu
  2866. entries. @xref{Security}.
  2867. The @option{--hotkey} option associates a hotkey with a menu entry.
  2868. @var{key} may be a single letter, or one of the aliases @samp{backspace},
  2869. @samp{tab}, or @samp{delete}.
  2870. The @option{--id} may be used to associate unique identifier with a menu entry.
  2871. @var{id} is string of ASCII aphanumeric characters, underscore and hyphen
  2872. and should not start with a digit.
  2873. All other arguments including @var{title} are passed as positional parameters
  2874. when list of commands is executed with @var{title} always assigned to @code{$1}.
  2875. @end deffn
  2876. @node submenu
  2877. @subsection submenu
  2878. @deffn Command submenu @var{title} @
  2879. [@option{--class=class} @dots{}] [@option{--users=users}] @
  2880. [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
  2881. @{ @var{menu entries} @dots{} @}
  2882. This defines a submenu. An entry called @var{title} will be added to the
  2883. menu; when that entry is selected, a new menu will be displayed showing all
  2884. the entries within this submenu.
  2885. All options are the same as in the @command{menuentry} command
  2886. (@pxref{menuentry}).
  2887. @end deffn
  2888. @node General commands
  2889. @section The list of general commands
  2890. Commands usable anywhere in the menu and in the command-line.
  2891. @menu
  2892. * serial:: Set up a serial device
  2893. * terminal_input:: Manage input terminals
  2894. * terminal_output:: Manage output terminals
  2895. * terminfo:: Define terminal type
  2896. @end menu
  2897. @node serial
  2898. @subsection serial
  2899. @deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}]
  2900. Initialize a serial device. @var{unit} is a number in the range 0-3
  2901. specifying which serial port to use; default is 0, which corresponds to
  2902. the port often called COM1. @var{port} is the I/O port where the UART
  2903. is to be found; if specified it takes precedence over @var{unit}.
  2904. @var{speed} is the transmission speed; default is 9600. @var{word} and
  2905. @var{stop} are the number of data bits and stop bits. Data bits must
  2906. be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
  2907. bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd},
  2908. @samp{even} and defaults to @samp{no}.
  2909. The serial port is not used as a communication channel unless the
  2910. @command{terminal_input} or @command{terminal_output} command is used
  2911. (@pxref{terminal_input}, @pxref{terminal_output}).
  2912. See also @ref{Serial terminal}.
  2913. @end deffn
  2914. @node terminal_input
  2915. @subsection terminal_input
  2916. @deffn Command terminal_input [@option{--append}|@option{--remove}] @
  2917. [terminal1] [terminal2] @dots{}
  2918. List or select an input terminal.
  2919. With no arguments, list the active and available input terminals.
  2920. With @option{--append}, add the named terminals to the list of active input
  2921. terminals; any of these may be used to provide input to GRUB.
  2922. With @option{--remove}, remove the named terminals from the active list.
  2923. With no options but a list of terminal names, make only the listed terminal
  2924. names active.
  2925. @end deffn
  2926. @node terminal_output
  2927. @subsection terminal_output
  2928. @deffn Command terminal_output [@option{--append}|@option{--remove}] @
  2929. [terminal1] [terminal2] @dots{}
  2930. List or select an output terminal.
  2931. With no arguments, list the active and available output terminals.
  2932. With @option{--append}, add the named terminals to the list of active output
  2933. terminals; all of these will receive output from GRUB.
  2934. With @option{--remove}, remove the named terminals from the active list.
  2935. With no options but a list of terminal names, make only the listed terminal
  2936. names active.
  2937. @end deffn
  2938. @node terminfo
  2939. @subsection terminfo
  2940. @deffn Command terminfo [-a|-u|-v] [term]
  2941. Define the capabilities of your terminal by giving the name of an entry in
  2942. the terminfo database, which should correspond roughly to a @samp{TERM}
  2943. environment variable in Unix.
  2944. The currently available terminal types are @samp{vt100}, @samp{vt100-color},
  2945. @samp{ieee1275}, and @samp{dumb}. If you need other terminal types, please
  2946. contact us to discuss the best way to include support for these in GRUB.
  2947. The @option{-a} (@option{--ascii}), @option{-u} (@option{--utf8}), and
  2948. @option{-v} (@option{--visual-utf8}) options control how non-ASCII text is
  2949. displayed. @option{-a} specifies an ASCII-only terminal; @option{-u}
  2950. specifies logically-ordered UTF-8; and @option{-v} specifies
  2951. "visually-ordered UTF-8" (in other words, arranged such that a terminal
  2952. emulator without bidirectional text support will display right-to-left text
  2953. in the proper order; this is not really proper UTF-8, but a workaround).
  2954. If no option or terminal type is specified, the current terminal type is
  2955. printed.
  2956. @end deffn
  2957. @node Command-line and menu entry commands
  2958. @section The list of command-line and menu entry commands
  2959. These commands are usable in the command-line and in menu entries. If
  2960. you forget a command, you can run the command @command{help}
  2961. (@pxref{help}).
  2962. @menu
  2963. * [:: Check file types and compare values
  2964. * acpi:: Load ACPI tables
  2965. * authenticate:: Check whether user is in user list
  2966. * background_color:: Set background color for active terminal
  2967. * background_image:: Load background image for active terminal
  2968. * badram:: Filter out bad regions of RAM
  2969. * blocklist:: Print a block list
  2970. * boot:: Start up your operating system
  2971. * cat:: Show the contents of a file
  2972. * chainloader:: Chain-load another boot loader
  2973. * clear:: Clear the screen
  2974. * cmosclean:: Clear bit in CMOS
  2975. * cmosdump:: Dump CMOS contents
  2976. * cmostest:: Test bit in CMOS
  2977. * cmp:: Compare two files
  2978. * configfile:: Load a configuration file
  2979. * cpuid:: Check for CPU features
  2980. * crc:: Compute or check CRC32 checksums
  2981. * cryptomount:: Mount a crypto device
  2982. * date:: Display or set current date and time
  2983. * devicetree:: Load a device tree blob
  2984. * distrust:: Remove a pubkey from trusted keys
  2985. * drivemap:: Map a drive to another
  2986. * echo:: Display a line of text
  2987. * eval:: Evaluate agruments as GRUB commands
  2988. * export:: Export an environment variable
  2989. * false:: Do nothing, unsuccessfully
  2990. * gettext:: Translate a string
  2991. * gptsync:: Fill an MBR based on GPT entries
  2992. * halt:: Shut down your computer
  2993. * hashsum:: Compute or check hash checksum
  2994. * help:: Show help messages
  2995. * initrd:: Load a Linux initrd
  2996. * initrd16:: Load a Linux initrd (16-bit mode)
  2997. * insmod:: Insert a module
  2998. * keystatus:: Check key modifier status
  2999. * linux:: Load a Linux kernel
  3000. * linux16:: Load a Linux kernel (16-bit mode)
  3001. * list_env:: List variables in environment block
  3002. * list_trusted:: List trusted public keys
  3003. * load_env:: Load variables from environment block
  3004. * loadfont:: Load font files
  3005. * loopback:: Make a device from a filesystem image
  3006. * ls:: List devices or files
  3007. * lsfonts:: List loaded fonts
  3008. * lsmod:: Show loaded modules
  3009. * md5sum:: Compute or check MD5 hash
  3010. * module:: Load module for multiboot kernel
  3011. * multiboot:: Load multiboot compliant kernel
  3012. * nativedisk:: Switch to native disk drivers
  3013. * normal:: Enter normal mode
  3014. * normal_exit:: Exit from normal mode
  3015. * parttool:: Modify partition table entries
  3016. * password:: Set a clear-text password
  3017. * password_pbkdf2:: Set a hashed password
  3018. * play:: Play a tune
  3019. * probe:: Retrieve device info
  3020. * pxe_unload:: Unload the PXE environment
  3021. * read:: Read user input
  3022. * reboot:: Reboot your computer
  3023. * regexp:: Test if regular expression matches string
  3024. * rmmod:: Remove a module
  3025. * save_env:: Save variables to environment block
  3026. * search:: Search devices by file, label, or UUID
  3027. * sendkey:: Emulate keystrokes
  3028. * set:: Set an environment variable
  3029. * sha1sum:: Compute or check SHA1 hash
  3030. * sha256sum:: Compute or check SHA256 hash
  3031. * sha512sum:: Compute or check SHA512 hash
  3032. * sleep:: Wait for a specified number of seconds
  3033. * source:: Read a configuration file in same context
  3034. * test:: Check file types and compare values
  3035. * true:: Do nothing, successfully
  3036. * trust:: Add public key to list of trusted keys
  3037. * unset:: Unset an environment variable
  3038. * uppermem:: Set the upper memory size
  3039. @comment * vbeinfo:: List available video modes
  3040. * verify_detached:: Verify detached digital signature
  3041. * videoinfo:: List available video modes
  3042. @comment * xen_*:: Xen boot commands
  3043. * xen_hypervisor:: Load xen hypervisor binary
  3044. * xen_linux:: Load dom0 kernel for xen hypervisor
  3045. * xen_initrd:: Load dom0 initrd for dom0 kernel
  3046. * xen_xsm:: Load xen security module for xen hypervisor
  3047. @end menu
  3048. @node [
  3049. @subsection [
  3050. @deffn Command @code{[} expression @code{]}
  3051. Alias for @code{test @var{expression}} (@pxref{test}).
  3052. @end deffn
  3053. @node acpi
  3054. @subsection acpi
  3055. @deffn Command acpi [@option{-1}|@option{-2}] @
  3056. [@option{--exclude=table1,@dots{}}|@option{--load-only=table1,@dots{}}] @
  3057. [@option{--oemid=id}] [@option{--oemtable=table}] @
  3058. [@option{--oemtablerev=rev}] [@option{--oemtablecreator=creator}] @
  3059. [@option{--oemtablecreatorrev=rev}] [@option{--no-ebda}] @
  3060. filename @dots{}
  3061. Modern BIOS systems normally implement the Advanced Configuration and Power
  3062. Interface (ACPI), and define various tables that describe the interface
  3063. between an ACPI-compliant operating system and the firmware. In some cases,
  3064. the tables provided by default only work well with certain operating
  3065. systems, and it may be necessary to replace some of them.
  3066. Normally, this command will replace the Root System Description Pointer
  3067. (RSDP) in the Extended BIOS Data Area to point to the new tables. If the
  3068. @option{--no-ebda} option is used, the new tables will be known only to
  3069. GRUB, but may be used by GRUB's EFI emulation.
  3070. @end deffn
  3071. @node authenticate
  3072. @subsection authenticate
  3073. @deffn Command authenticate [userlist]
  3074. Check whether user is in @var{userlist} or listed in the value of variable
  3075. @samp{superusers}. See @pxref{superusers} for valid user list format.
  3076. If @samp{superusers} is empty, this command returns true. @xref{Security}.
  3077. @end deffn
  3078. @node background_color
  3079. @subsection background_color
  3080. @deffn Command background_color color
  3081. Set background color for active terminal. For valid color specifications see
  3082. @pxref{Theme file format, ,Colors}. Background color can be changed only when
  3083. using @samp{gfxterm} for terminal output.
  3084. This command sets color of empty areas without text. Text background color
  3085. is controlled by environment variables @var{color_normal}, @var{color_highlight},
  3086. @var{menu_color_normal}, @var{menu_color_highlight}. @xref{Special environment variables}.
  3087. @end deffn
  3088. @node background_image
  3089. @subsection background_image
  3090. @deffn Command background_image [[@option{--mode} @samp{stretch}|@samp{normal}] file]
  3091. Load background image for active terminal from @var{file}. Image is stretched
  3092. to fill up entire screen unless option @option{--mode} @samp{normal} is given.
  3093. Without arguments remove currently loaded background image. Background image
  3094. can be changed only when using @samp{gfxterm} for terminal output.
  3095. @end deffn
  3096. @node badram
  3097. @subsection badram
  3098. @deffn Command badram addr,mask[,addr,mask...]
  3099. Filter out bad RAM.
  3100. @end deffn
  3101. This command notifies the memory manager that specified regions of
  3102. RAM ought to be filtered out (usually, because they're damaged). This
  3103. remains in effect after a payload kernel has been loaded by GRUB, as
  3104. long as the loaded kernel obtains its memory map from GRUB. Kernels that
  3105. support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
  3106. kernels in general.
  3107. Syntax is the same as provided by the @uref{http://www.memtest.org/,
  3108. Memtest86+ utility}: a list of address/mask pairs. Given a page-aligned
  3109. address and a base address / mask pair, if all the bits of the page-aligned
  3110. address that are enabled by the mask match with the base address, it means
  3111. this page is to be filtered. This syntax makes it easy to represent patterns
  3112. that are often result of memory damage, due to physical distribution of memory
  3113. cells.
  3114. @node blocklist
  3115. @subsection blocklist
  3116. @deffn Command blocklist file
  3117. Print a block list (@pxref{Block list syntax}) for @var{file}.
  3118. @end deffn
  3119. @node boot
  3120. @subsection boot
  3121. @deffn Command boot
  3122. Boot the OS or chain-loader which has been loaded. Only necessary if
  3123. running the fully interactive command-line (it is implicit at the end of
  3124. a menu entry).
  3125. @end deffn
  3126. @node cat
  3127. @subsection cat
  3128. @deffn Command cat [@option{--dos}] file
  3129. Display the contents of the file @var{file}. This command may be useful
  3130. to remind you of your OS's root partition:
  3131. @example
  3132. grub> @kbd{cat /etc/fstab}
  3133. @end example
  3134. If the @option{--dos} option is used, then carriage return / new line pairs
  3135. will be displayed as a simple new line. Otherwise, the carriage return will
  3136. be displayed as a control character (@samp{<d>}) to make it easier to see
  3137. when boot problems are caused by a file formatted using DOS-style line
  3138. endings.
  3139. @end deffn
  3140. @node chainloader
  3141. @subsection chainloader
  3142. @deffn Command chainloader [@option{--force}] file
  3143. Load @var{file} as a chain-loader. Like any other file loaded by the
  3144. filesystem code, it can use the blocklist notation (@pxref{Block list
  3145. syntax}) to grab the first sector of the current partition with @samp{+1}.
  3146. If you specify the option @option{--force}, then load @var{file} forcibly,
  3147. whether it has a correct signature or not. This is required when you want to
  3148. load a defective boot loader, such as SCO UnixWare 7.1.
  3149. @end deffn
  3150. @node clear
  3151. @subsection clear
  3152. @deffn Command clear
  3153. Clear the screen.
  3154. @end deffn
  3155. @node cmosclean
  3156. @subsection cmosclean
  3157. @deffn Command cmosclean byte:bit
  3158. Clear value of bit in CMOS at location @var{byte}:@var{bit}. This command
  3159. is available only on platforms that support CMOS.
  3160. @end deffn
  3161. @node cmosdump
  3162. @subsection cmosdump
  3163. @deffn Dump CMOS contents
  3164. Dump full CMOS contents as hexadecimal values. This command is available only
  3165. on platforms that support CMOS.
  3166. @end deffn
  3167. @node cmostest
  3168. @subsection cmostest
  3169. @deffn Command cmostest byte:bit
  3170. Test value of bit in CMOS at location @var{byte}:@var{bit}. Exit status
  3171. is zero if bit is set, non zero otherwise. This command is available only
  3172. on platforms that support CMOS.
  3173. @end deffn
  3174. @node cmp
  3175. @subsection cmp
  3176. @deffn Command cmp file1 file2
  3177. Compare the file @var{file1} with the file @var{file2}. If they differ
  3178. in size, print the sizes like this:
  3179. @example
  3180. Differ in size: 0x1234 [foo], 0x4321 [bar]
  3181. @end example
  3182. If the sizes are equal but the bytes at an offset differ, then print the
  3183. bytes like this:
  3184. @example
  3185. Differ at the offset 777: 0xbe [foo], 0xef [bar]
  3186. @end example
  3187. If they are completely identical, nothing will be printed.
  3188. @end deffn
  3189. @node configfile
  3190. @subsection configfile
  3191. @deffn Command configfile file
  3192. Load @var{file} as a configuration file. If @var{file} defines any menu
  3193. entries, then show a menu containing them immediately. Any environment
  3194. variable changes made by the commands in @var{file} will not be preserved
  3195. after @command{configfile} returns.
  3196. @end deffn
  3197. @node cpuid
  3198. @subsection cpuid
  3199. @deffn Command cpuid [-l] [-p]
  3200. Check for CPU features. This command is only available on x86 systems.
  3201. With the @option{-l} option, return true if the CPU supports long mode
  3202. (64-bit).
  3203. With the @option{-p} option, return true if the CPU supports Physical
  3204. Address Extension (PAE).
  3205. If invoked without options, this command currently behaves as if it had been
  3206. invoked with @option{-l}. This may change in the future.
  3207. @end deffn
  3208. @node crc
  3209. @subsection crc
  3210. @deffn Command crc arg @dots{}
  3211. Alias for @code{hashsum --hash crc32 arg @dots{}}. See command @command{hashsum}
  3212. (@pxref{hashsum}) for full description.
  3213. @end deffn
  3214. @node cryptomount
  3215. @subsection cryptomount
  3216. @deffn Command cryptomount device|@option{-u} uuid|@option{-a}|@option{-b}
  3217. Setup access to encrypted device. If necessary, passphrase
  3218. is requested interactively. Option @var{device} configures specific grub device
  3219. (@pxref{Naming convention}); option @option{-u} @var{uuid} configures device
  3220. with specified @var{uuid}; option @option{-a} configures all detected encrypted
  3221. devices; option @option{-b} configures all geli containers that have boot flag set.
  3222. GRUB suports devices encrypted using LUKS and geli. Note that necessary modules (@var{luks} and @var{geli}) have to be loaded manually before this command can
  3223. be used.
  3224. @end deffn
  3225. @node date
  3226. @subsection date
  3227. @deffn Command date [[year-]month-day] [hour:minute[:second]]
  3228. With no arguments, print the current date and time.
  3229. Otherwise, take the current date and time, change any elements specified as
  3230. arguments, and set the result as the new date and time. For example, `date
  3231. 01-01' will set the current month and day to January 1, but leave the year,
  3232. hour, minute, and second unchanged.
  3233. @end deffn
  3234. @node devicetree
  3235. @subsection linux
  3236. @deffn Command devicetree file
  3237. Load a device tree blob (.dtb) from a filesystem, for later use by a Linux
  3238. kernel. Does not perform merging with any device tree supplied by firmware,
  3239. but rather replaces it completely.
  3240. @ref{GNU/Linux}.
  3241. @end deffn
  3242. @node distrust
  3243. @subsection distrust
  3244. @deffn Command distrust pubkey_id
  3245. Remove public key @var{pubkey_id} from GRUB's keyring of trusted keys.
  3246. @var{pubkey_id} is the last four bytes (eight hexadecimal digits) of
  3247. the GPG v4 key id, which is also the output of @command{list_trusted}
  3248. (@pxref{list_trusted}). Outside of GRUB, the key id can be obtained
  3249. using @code{gpg --fingerprint}).
  3250. These keys are used to validate signatures when environment variable
  3251. @code{check_signatures} is set to @code{enforce}
  3252. (@pxref{check_signatures}), and by some invocations of
  3253. @command{verify_detached} (@pxref{verify_detached}). @xref{Using
  3254. digital signatures}, for more information.
  3255. @end deffn
  3256. @node drivemap
  3257. @subsection drivemap
  3258. @deffn Command drivemap @option{-l}|@option{-r}|[@option{-s}] @
  3259. from_drive to_drive
  3260. Without options, map the drive @var{from_drive} to the drive @var{to_drive}.
  3261. This is necessary when you chain-load some operating systems, such as DOS,
  3262. if such an OS resides at a non-first drive. For convenience, any partition
  3263. suffix on the drive is ignored, so you can safely use @verb{'${root}'} as a
  3264. drive specification.
  3265. With the @option{-s} option, perform the reverse mapping as well, swapping
  3266. the two drives.
  3267. With the @option{-l} option, list the current mappings.
  3268. With the @option{-r} option, reset all mappings to the default values.
  3269. For example:
  3270. @example
  3271. drivemap -s (hd0) (hd1)
  3272. @end example
  3273. @end deffn
  3274. @node echo
  3275. @subsection echo
  3276. @deffn Command echo [@option{-n}] [@option{-e}] string @dots{}
  3277. Display the requested text and, unless the @option{-n} option is used, a
  3278. trailing new line. If there is more than one string, they are separated by
  3279. spaces in the output. As usual in GRUB commands, variables may be
  3280. substituted using @samp{$@{var@}}.
  3281. The @option{-e} option enables interpretation of backslash escapes. The
  3282. following sequences are recognised:
  3283. @table @code
  3284. @item \\
  3285. backslash
  3286. @item \a
  3287. alert (BEL)
  3288. @item \c
  3289. suppress trailing new line
  3290. @item \f
  3291. form feed
  3292. @item \n
  3293. new line
  3294. @item \r
  3295. carriage return
  3296. @item \t
  3297. horizontal tab
  3298. @item \v
  3299. vertical tab
  3300. @end table
  3301. When interpreting backslash escapes, backslash followed by any other
  3302. character will print that character.
  3303. @end deffn
  3304. @node eval
  3305. @subsection eval
  3306. @deffn Command eval string ...
  3307. Concatenate arguments together using single space as separator and evaluate
  3308. result as sequence of GRUB commands.
  3309. @end deffn
  3310. @node export
  3311. @subsection export
  3312. @deffn Command export envvar
  3313. Export the environment variable @var{envvar}. Exported variables are visible
  3314. to subsidiary configuration files loaded using @command{configfile}.
  3315. @end deffn
  3316. @node false
  3317. @subsection false
  3318. @deffn Command false
  3319. Do nothing, unsuccessfully. This is mainly useful in control constructs
  3320. such as @code{if} and @code{while} (@pxref{Shell-like scripting}).
  3321. @end deffn
  3322. @node gettext
  3323. @subsection gettext
  3324. @deffn Command gettext string
  3325. Translate @var{string} into the current language.
  3326. The current language code is stored in the @samp{lang} variable in GRUB's
  3327. environment (@pxref{lang}). Translation files in MO format are read from
  3328. @samp{locale_dir} (@pxref{locale_dir}), usually @file{/boot/grub/locale}.
  3329. @end deffn
  3330. @node gptsync
  3331. @subsection gptsync
  3332. @deffn Command gptsync device [partition[+/-[type]]] @dots{}
  3333. Disks using the GUID Partition Table (GPT) also have a legacy Master Boot
  3334. Record (MBR) partition table for compatibility with the BIOS and with older
  3335. operating systems. The legacy MBR can only represent a limited subset of
  3336. GPT partition entries.
  3337. This command populates the legacy MBR with the specified @var{partition}
  3338. entries on @var{device}. Up to three partitions may be used.
  3339. @var{type} is an MBR partition type code; prefix with @samp{0x} if you want
  3340. to enter this in hexadecimal. The separator between @var{partition} and
  3341. @var{type} may be @samp{+} to make the partition active, or @samp{-} to make
  3342. it inactive; only one partition may be active. If both the separator and
  3343. type are omitted, then the partition will be inactive.
  3344. @end deffn
  3345. @node halt
  3346. @subsection halt
  3347. @deffn Command halt @option{--no-apm}
  3348. The command halts the computer. If the @option{--no-apm} option
  3349. is specified, no APM BIOS call is performed. Otherwise, the computer
  3350. is shut down using APM.
  3351. @end deffn
  3352. @node hashsum
  3353. @subsection hashsum
  3354. @deffn Command hashsum @option{--hash} hash @option{--keep-going} @option{--uncompress} @option{--check} file [@option{--prefix} dir]|file @dots{}
  3355. Compute or verify file hashes. Hash type is selected with option @option{--hash}.
  3356. Supported hashes are: @samp{adler32}, @samp{crc64}, @samp{crc32},
  3357. @samp{crc32rfc1510}, @samp{crc24rfc2440}, @samp{md4}, @samp{md5},
  3358. @samp{ripemd160}, @samp{sha1}, @samp{sha224}, @samp{sha256}, @samp{sha512},
  3359. @samp{sha384}, @samp{tiger192}, @samp{tiger}, @samp{tiger2}, @samp{whirlpool}.
  3360. Option @option{--uncompress} uncompresses files before computing hash.
  3361. When list of files is given, hash of each file is computed and printed,
  3362. followed by file name, each file on a new line.
  3363. When option @option{--check} is given, it points to a file that contains
  3364. list of @var{hash name} pairs in the same format as used by UNIX
  3365. @command{md5sum} command. Option @option{--prefix}
  3366. may be used to give directory where files are located. Hash verification
  3367. stops after the first mismatch was found unless option @option{--keep-going}
  3368. was given. The exit code @code{$?} is set to 0 if hash verification
  3369. is successful. If it fails, @code{$?} is set to a nonzero value.
  3370. @end deffn
  3371. @node help
  3372. @subsection help
  3373. @deffn Command help [pattern @dots{}]
  3374. Display helpful information about builtin commands. If you do not
  3375. specify @var{pattern}, this command shows short descriptions of all
  3376. available commands.
  3377. If you specify any @var{patterns}, it displays longer information
  3378. about each of the commands whose names begin with those @var{patterns}.
  3379. @end deffn
  3380. @node initrd
  3381. @subsection initrd
  3382. @deffn Command initrd file
  3383. Load an initial ramdisk for a Linux kernel image, and set the appropriate
  3384. parameters in the Linux setup area in memory. This may only be used after
  3385. the @command{linux} command (@pxref{linux}) has been run. See also
  3386. @ref{GNU/Linux}.
  3387. @end deffn
  3388. @node initrd16
  3389. @subsection initrd16
  3390. @deffn Command initrd16 file
  3391. Load an initial ramdisk for a Linux kernel image to be booted in 16-bit
  3392. mode, and set the appropriate parameters in the Linux setup area in memory.
  3393. This may only be used after the @command{linux16} command (@pxref{linux16})
  3394. has been run. See also @ref{GNU/Linux}.
  3395. This command is only available on x86 systems.
  3396. @end deffn
  3397. @node insmod
  3398. @subsection insmod
  3399. @deffn Command insmod module
  3400. Insert the dynamic GRUB module called @var{module}.
  3401. @end deffn
  3402. @node keystatus
  3403. @subsection keystatus
  3404. @deffn Command keystatus [@option{--shift}] [@option{--ctrl}] [@option{--alt}]
  3405. Return true if the Shift, Control, or Alt modifier keys are held down, as
  3406. requested by options. This is useful in scripting, to allow some user
  3407. control over behaviour without having to wait for a keypress.
  3408. Checking key modifier status is only supported on some platforms. If invoked
  3409. without any options, the @command{keystatus} command returns true if and
  3410. only if checking key modifier status is supported.
  3411. @end deffn
  3412. @node linux
  3413. @subsection linux
  3414. @deffn Command linux file @dots{}
  3415. Load a Linux kernel image from @var{file}. The rest of the line is passed
  3416. verbatim as the @dfn{kernel command-line}. Any initrd must be reloaded
  3417. after using this command (@pxref{initrd}).
  3418. On x86 systems, the kernel will be booted using the 32-bit boot protocol.
  3419. Note that this means that the @samp{vga=} boot option will not work; if you
  3420. want to set a special video mode, you will need to use GRUB commands such as
  3421. @samp{set gfxpayload=1024x768} or @samp{set gfxpayload=keep} (to keep the
  3422. same mode as used in GRUB) instead. GRUB can automatically detect some uses
  3423. of @samp{vga=} and translate them to appropriate settings of
  3424. @samp{gfxpayload}. The @command{linux16} command (@pxref{linux16}) avoids
  3425. this restriction.
  3426. @end deffn
  3427. @node linux16
  3428. @subsection linux16
  3429. @deffn Command linux16 file @dots{}
  3430. Load a Linux kernel image from @var{file} in 16-bit mode. The rest of the
  3431. line is passed verbatim as the @dfn{kernel command-line}. Any initrd must
  3432. be reloaded after using this command (@pxref{initrd16}).
  3433. The kernel will be booted using the traditional 16-bit boot protocol. As
  3434. well as bypassing problems with @samp{vga=} described in @ref{linux}, this
  3435. permits booting some other programs that implement the Linux boot protocol
  3436. for the sake of convenience.
  3437. This command is only available on x86 systems.
  3438. @end deffn
  3439. @node list_env
  3440. @subsection list_env
  3441. @deffn Command list_env [@option{--file} file]
  3442. List all variables in the environment block file. @xref{Environment block}.
  3443. The @option{--file} option overrides the default location of the
  3444. environment block.
  3445. @end deffn
  3446. @node list_trusted
  3447. @subsection list_trusted
  3448. @deffn Command list_trusted
  3449. List all public keys trusted by GRUB for validating signatures.
  3450. The output is in GPG's v4 key fingerprint format (i.e., the output of
  3451. @code{gpg --fingerprint}). The least significant four bytes (last
  3452. eight hexadecimal digits) can be used as an argument to
  3453. @command{distrust} (@pxref{distrust}).
  3454. @xref{Using digital signatures}, for more information about uses for
  3455. these keys.
  3456. @end deffn
  3457. @node load_env
  3458. @subsection load_env
  3459. @deffn Command load_env [@option{--file} file] [@option{--skip-sig}] [whitelisted_variable_name] @dots{}
  3460. Load all variables from the environment block file into the environment.
  3461. @xref{Environment block}.
  3462. The @option{--file} option overrides the default location of the environment
  3463. block.
  3464. The @option{--skip-sig} option skips signature checking even when the
  3465. value of environment variable @code{check_signatures} is set to
  3466. @code{enforce} (@pxref{check_signatures}).
  3467. If one or more variable names are provided as arguments, they are
  3468. interpreted as a whitelist of variables to load from the environment
  3469. block file. Variables set in the file but not present in the
  3470. whitelist are ignored.
  3471. The @option{--skip-sig} option should be used with care, and should
  3472. always be used in concert with a whitelist of acceptable variables
  3473. whose values should be set. Failure to employ a carefully constructed
  3474. whitelist could result in reading a malicious value into critical
  3475. environment variables from the file, such as setting
  3476. @code{check_signatures=no}, modifying @code{prefix} to boot from an
  3477. unexpected location or not at all, etc.
  3478. When used with care, @option{--skip-sig} and the whitelist enable an
  3479. administrator to configure a system to boot only signed
  3480. configurations, but to allow the user to select from among multiple
  3481. configurations, and to enable ``one-shot'' boot attempts and
  3482. ``savedefault'' behavior. @xref{Using digital signatures}, for more
  3483. information.
  3484. @end deffn
  3485. @node loadfont
  3486. @subsection loadfont
  3487. @deffn Command loadfont file @dots{}
  3488. Load specified font files. Unless absolute pathname is given, @var{file}
  3489. is assumed to be in directory @samp{$prefix/fonts} with
  3490. suffix @samp{.pf2} appended. @xref{Theme file format,,Fonts}.
  3491. @end deffn
  3492. @node loopback
  3493. @subsection loopback
  3494. @deffn Command loopback [@option{-d}] device file
  3495. Make the device named @var{device} correspond to the contents of the
  3496. filesystem image in @var{file}. For example:
  3497. @example
  3498. loopback loop0 /path/to/image
  3499. ls (loop0)/
  3500. @end example
  3501. With the @option{-d} option, delete a device previously created using this
  3502. command.
  3503. @end deffn
  3504. @node ls
  3505. @subsection ls
  3506. @deffn Command ls [arg @dots{}]
  3507. List devices or files.
  3508. With no arguments, print all devices known to GRUB.
  3509. If the argument is a device name enclosed in parentheses (@pxref{Device
  3510. syntax}), then print the name of the filesystem of that device.
  3511. If the argument is a directory given as an absolute file name (@pxref{File
  3512. name syntax}), then list the contents of that directory.
  3513. @end deffn
  3514. @node lsfonts
  3515. @subsection lsfonts
  3516. @deffn Command lsfonts
  3517. List loaded fonts.
  3518. @end deffn
  3519. @node lsmod
  3520. @subsection lsmod
  3521. @deffn Command lsmod
  3522. Show list of loaded modules.
  3523. @end deffn
  3524. @node md5sum
  3525. @subsection md5sum
  3526. @deffn Command md5sum arg @dots{}
  3527. Alias for @code{hashsum --hash md5 arg @dots{}}. See command @command{hashsum}
  3528. (@pxref{hashsum}) for full description.
  3529. @end deffn
  3530. @node module
  3531. @subsection module
  3532. @deffn Command module [--nounzip] file [arguments]
  3533. Load a module for multiboot kernel image. The rest of the
  3534. line is passed verbatim as the module command line.
  3535. @end deffn
  3536. @node multiboot
  3537. @subsection multiboot
  3538. @deffn Command multiboot [--quirk-bad-kludge] [--quirk-modules-after-kernel] file @dots{}
  3539. Load a multiboot kernel image from @var{file}. The rest of the
  3540. line is passed verbatim as the @dfn{kernel command-line}. Any module must
  3541. be reloaded after using this command (@pxref{module}).
  3542. Some kernels have known problems. You need to specify --quirk-* for those.
  3543. --quirk-bad-kludge is a problem seen in several products that they include
  3544. loading kludge information with invalid data in ELF file. GRUB prior to 0.97
  3545. and some custom builds prefered ELF information while 0.97 and GRUB 2
  3546. use kludge. Use this option to ignore kludge.
  3547. Known affected systems: old Solaris, SkyOS.
  3548. --quirk-modules-after-kernel is needed for kernels which load at relatively
  3549. high address e.g. 16MiB mark and can't cope with modules stuffed between
  3550. 1MiB mark and beginning of the kernel.
  3551. Known afftected systems: VMWare.
  3552. @end deffn
  3553. @node nativedisk
  3554. @subsection nativedisk
  3555. @deffn Command nativedisk
  3556. Switch from firmware disk drivers to native ones.
  3557. Really useful only on platforms where both
  3558. firmware and native disk drives are available.
  3559. Currently i386-pc, i386-efi, i386-ieee1275 and
  3560. x86_64-efi.
  3561. @end deffn
  3562. @node normal
  3563. @subsection normal
  3564. @deffn Command normal [file]
  3565. Enter normal mode and display the GRUB menu.
  3566. In normal mode, commands, filesystem modules, and cryptography modules are
  3567. automatically loaded, and the full GRUB script parser is available. Other
  3568. modules may be explicitly loaded using @command{insmod} (@pxref{insmod}).
  3569. If a @var{file} is given, then commands will be read from that file.
  3570. Otherwise, they will be read from @file{$prefix/grub.cfg} if it exists.
  3571. @command{normal} may be called from within normal mode, creating a nested
  3572. environment. It is more usual to use @command{configfile}
  3573. (@pxref{configfile}) for this.
  3574. @end deffn
  3575. @node normal_exit
  3576. @subsection normal_exit
  3577. @deffn Command normal_exit
  3578. Exit normal mode (@pxref{normal}). If this instance of normal mode was not
  3579. nested within another one, then return to rescue mode.
  3580. @end deffn
  3581. @node parttool
  3582. @subsection parttool
  3583. @deffn Command parttool partition commands
  3584. Make various modifications to partition table entries.
  3585. Each @var{command} is either a boolean option, in which case it must be
  3586. followed with @samp{+} or @samp{-} (with no intervening space) to enable or
  3587. disable that option, or else it takes a value in the form
  3588. @samp{@var{command}=@var{value}}.
  3589. Currently, @command{parttool} is only useful on DOS partition tables (also
  3590. known as Master Boot Record, or MBR). On these partition tables, the
  3591. following commands are available:
  3592. @table @asis
  3593. @item @samp{boot} (boolean)
  3594. When enabled, this makes the selected partition be the active (bootable)
  3595. partition on its disk, clearing the active flag on all other partitions.
  3596. This command is limited to @emph{primary} partitions.
  3597. @item @samp{type} (value)
  3598. Change the type of an existing partition. The value must be a number in the
  3599. range 0-0xFF (prefix with @samp{0x} to enter it in hexadecimal).
  3600. @item @samp{hidden} (boolean)
  3601. When enabled, this hides the selected partition by setting the @dfn{hidden}
  3602. bit in its partition type code; when disabled, unhides the selected
  3603. partition by clearing this bit. This is useful only when booting DOS or
  3604. Wwindows and multiple primary FAT partitions exist in one disk. See also
  3605. @ref{DOS/Windows}.
  3606. @end table
  3607. @end deffn
  3608. @node password
  3609. @subsection password
  3610. @deffn Command password user clear-password
  3611. Define a user named @var{user} with password @var{clear-password}.
  3612. @xref{Security}.
  3613. @end deffn
  3614. @node password_pbkdf2
  3615. @subsection password_pbkdf2
  3616. @deffn Command password_pbkdf2 user hashed-password
  3617. Define a user named @var{user} with password hash @var{hashed-password}.
  3618. Use @command{grub-mkpasswd-pbkdf2} (@pxref{Invoking grub-mkpasswd-pbkdf2})
  3619. to generate password hashes. @xref{Security}.
  3620. @end deffn
  3621. @node play
  3622. @subsection play
  3623. @deffn Command play file | tempo [pitch1 duration1] [pitch2 duration2] @dots{}
  3624. Plays a tune
  3625. If the argument is a file name (@pxref{File name syntax}), play the tune
  3626. recorded in it. The file format is first the tempo as an unsigned 32bit
  3627. little-endian number, then pairs of unsigned 16bit little-endian numbers for
  3628. pitch and duration pairs.
  3629. If the arguments are a series of numbers, play the inline tune.
  3630. The tempo is the base for all note durations. 60 gives a 1-second base, 120
  3631. gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
  3632. a rest.
  3633. @end deffn
  3634. @node probe
  3635. @subsection probe
  3636. @deffn Command probe [@option{--set} var] @option{--driver}|@option{--partmap}|@option{--fs}|@option{--fs-uuid}|@option{--label} device
  3637. Retrieve device information. If option @option{--set} is given, assign result
  3638. to variable @var{var}, otherwise print information on the screen.
  3639. @end deffn
  3640. @node pxe_unload
  3641. @subsection pxe_unload
  3642. @deffn Command pxe_unload
  3643. Unload the PXE environment (@pxref{Network}).
  3644. This command is only available on PC BIOS systems.
  3645. @end deffn
  3646. @node read
  3647. @subsection read
  3648. @deffn Command read [var]
  3649. Read a line of input from the user. If an environment variable @var{var} is
  3650. given, set that environment variable to the line of input that was read,
  3651. with no terminating newline.
  3652. @end deffn
  3653. @node reboot
  3654. @subsection reboot
  3655. @deffn Command reboot
  3656. Reboot the computer.
  3657. @end deffn
  3658. @node regexp
  3659. @subsection regexp
  3660. @deffn Command regexp [@option{--set} [number:]var] regexp string
  3661. Test if regular expression @var{regexp} matches @var{string}. Supported
  3662. regular expressions are POSIX.2 Extended Regular Expressions. If option
  3663. @option{--set} is given, store @var{number}th matched subexpression in
  3664. variable @var{var}. Subexpressions are numbered in order of their opening
  3665. parentheses starting from @samp{1}. @var{number} defaults to @samp{1}.
  3666. @end deffn
  3667. @node rmmod
  3668. @subsection rmmod
  3669. @deffn Command rmmod module
  3670. Remove a loaded @var{module}.
  3671. @end deffn
  3672. @node save_env
  3673. @subsection save_env
  3674. @deffn Command save_env [@option{--file} file] var @dots{}
  3675. Save the named variables from the environment to the environment block file.
  3676. @xref{Environment block}.
  3677. The @option{--file} option overrides the default location of the environment
  3678. block.
  3679. This command will operate successfully even when environment variable
  3680. @code{check_signatures} is set to @code{enforce}
  3681. (@pxref{check_signatures}), since it writes to disk and does not alter
  3682. the behavior of GRUB based on any contents of disk that have been
  3683. read. It is possible to modify a digitally signed environment block
  3684. file from within GRUB using this command, such that its signature will
  3685. no longer be valid on subsequent boots. Care should be taken in such
  3686. advanced configurations to avoid rendering the system
  3687. unbootable. @xref{Using digital signatures}, for more information.
  3688. @end deffn
  3689. @node search
  3690. @subsection search
  3691. @deffn Command search @
  3692. [@option{--file}|@option{--label}|@option{--fs-uuid}] @
  3693. [@option{--set} [var]] [@option{--no-floppy}] name
  3694. Search devices by file (@option{-f}, @option{--file}), filesystem label
  3695. (@option{-l}, @option{--label}), or filesystem UUID (@option{-u},
  3696. @option{--fs-uuid}).
  3697. If the @option{--set} option is used, the first device found is set as the
  3698. value of environment variable @var{var}. The default variable is
  3699. @samp{root}.
  3700. The @option{--no-floppy} option prevents searching floppy devices, which can
  3701. be slow.
  3702. The @samp{search.file}, @samp{search.fs_label}, and @samp{search.fs_uuid}
  3703. commands are aliases for @samp{search --file}, @samp{search --label}, and
  3704. @samp{search --fs-uuid} respectively.
  3705. @end deffn
  3706. @node sendkey
  3707. @subsection sendkey
  3708. @deffn Command sendkey @
  3709. [@option{--num}|@option{--caps}|@option{--scroll}|@option{--insert}|@
  3710. @option{--pause}|@option{--left-shift}|@option{--right-shift}|@
  3711. @option{--sysrq}|@option{--numkey}|@option{--capskey}|@option{--scrollkey}|@
  3712. @option{--insertkey}|@option{--left-alt}|@option{--right-alt}|@
  3713. @option{--left-ctrl}|@option{--right-ctrl} @
  3714. @samp{on}|@samp{off}]@dots{} @
  3715. [@option{no-led}] @
  3716. keystroke
  3717. Insert keystrokes into the keyboard buffer when booting. Sometimes an
  3718. operating system or chainloaded boot loader requires particular keys to be
  3719. pressed: for example, one might need to press a particular key to enter
  3720. "safe mode", or when chainloading another boot loader one might send
  3721. keystrokes to it to navigate its menu.
  3722. You may provide up to 16 keystrokes (the length of the BIOS keyboard
  3723. buffer). Keystroke names may be upper-case or lower-case letters, digits,
  3724. or taken from the following table:
  3725. @c Please keep this table in the same order as in
  3726. @c commands/i386/pc/sendkey.c, for ease of maintenance.
  3727. @c Exception: The function and numeric keys are sorted, for aesthetics.
  3728. @multitable @columnfractions .4 .5
  3729. @headitem Name @tab Key
  3730. @item escape @tab Escape
  3731. @item exclam @tab !
  3732. @item at @tab @@
  3733. @item numbersign @tab #
  3734. @item dollar @tab $
  3735. @item percent @tab %
  3736. @item caret @tab ^
  3737. @item ampersand @tab &
  3738. @item asterisk @tab *
  3739. @item parenleft @tab (
  3740. @item parenright @tab )
  3741. @item minus @tab -
  3742. @item underscore @tab _
  3743. @item equal @tab =
  3744. @item plus @tab +
  3745. @item backspace @tab Backspace
  3746. @item tab @tab Tab
  3747. @item bracketleft @tab [
  3748. @item braceleft @tab @{
  3749. @item bracketright @tab ]
  3750. @item braceright @tab @}
  3751. @item enter @tab Enter
  3752. @item control @tab press and release Control
  3753. @item semicolon @tab ;
  3754. @item colon @tab :
  3755. @item quote @tab '
  3756. @item doublequote @tab "
  3757. @item backquote @tab `
  3758. @item tilde @tab ~
  3759. @item shift @tab press and release left Shift
  3760. @item backslash @tab \
  3761. @item bar @tab |
  3762. @item comma @tab ,
  3763. @item less @tab <
  3764. @item period @tab .
  3765. @item greater @tab >
  3766. @item slash @tab /
  3767. @item question @tab ?
  3768. @item rshift @tab press and release right Shift
  3769. @item alt @tab press and release Alt
  3770. @item space @tab space bar
  3771. @item capslock @tab Caps Lock
  3772. @item F1 @tab F1
  3773. @item F2 @tab F2
  3774. @item F3 @tab F3
  3775. @item F4 @tab F4
  3776. @item F5 @tab F5
  3777. @item F6 @tab F6
  3778. @item F7 @tab F7
  3779. @item F8 @tab F8
  3780. @item F9 @tab F9
  3781. @item F10 @tab F10
  3782. @item F11 @tab F11
  3783. @item F12 @tab F12
  3784. @item num1 @tab 1 (numeric keypad)
  3785. @item num2 @tab 2 (numeric keypad)
  3786. @item num3 @tab 3 (numeric keypad)
  3787. @item num4 @tab 4 (numeric keypad)
  3788. @item num5 @tab 5 (numeric keypad)
  3789. @item num6 @tab 6 (numeric keypad)
  3790. @item num7 @tab 7 (numeric keypad)
  3791. @item num8 @tab 8 (numeric keypad)
  3792. @item num9 @tab 9 (numeric keypad)
  3793. @item num0 @tab 0 (numeric keypad)
  3794. @item numperiod @tab . (numeric keypad)
  3795. @item numend @tab End (numeric keypad)
  3796. @item numdown @tab Down (numeric keypad)
  3797. @item numpgdown @tab Page Down (numeric keypad)
  3798. @item numleft @tab Left (numeric keypad)
  3799. @item numcenter @tab 5 with Num Lock inactive (numeric keypad)
  3800. @item numright @tab Right (numeric keypad)
  3801. @item numhome @tab Home (numeric keypad)
  3802. @item numup @tab Up (numeric keypad)
  3803. @item numpgup @tab Page Up (numeric keypad)
  3804. @item numinsert @tab Insert (numeric keypad)
  3805. @item numdelete @tab Delete (numeric keypad)
  3806. @item numasterisk @tab * (numeric keypad)
  3807. @item numminus @tab - (numeric keypad)
  3808. @item numplus @tab + (numeric keypad)
  3809. @item numslash @tab / (numeric keypad)
  3810. @item numenter @tab Enter (numeric keypad)
  3811. @item delete @tab Delete
  3812. @item insert @tab Insert
  3813. @item home @tab Home
  3814. @item end @tab End
  3815. @item pgdown @tab Page Down
  3816. @item pgup @tab Page Up
  3817. @item down @tab Down
  3818. @item up @tab Up
  3819. @item left @tab Left
  3820. @item right @tab Right
  3821. @end multitable
  3822. As well as keystrokes, the @command{sendkey} command takes various options
  3823. that affect the BIOS keyboard status flags. These options take an @samp{on}
  3824. or @samp{off} parameter, specifying that the corresponding status flag be
  3825. set or unset; omitting the option for a given status flag will leave that
  3826. flag at its initial state at boot. The @option{--num}, @option{--caps},
  3827. @option{--scroll}, and @option{--insert} options emulate setting the
  3828. corresponding mode, while the @option{--numkey}, @option{--capskey},
  3829. @option{--scrollkey}, and @option{--insertkey} options emulate pressing and
  3830. holding the corresponding key. The other status flag options are
  3831. self-explanatory.
  3832. If the @option{--no-led} option is given, the status flag options will have
  3833. no effect on keyboard LEDs.
  3834. If the @command{sendkey} command is given multiple times, then only the last
  3835. invocation has any effect.
  3836. Since @command{sendkey} manipulates the BIOS keyboard buffer, it may cause
  3837. hangs, reboots, or other misbehaviour on some systems. If the operating
  3838. system or boot loader that runs after GRUB uses its own keyboard driver
  3839. rather than the BIOS keyboard functions, then @command{sendkey} will have no
  3840. effect.
  3841. This command is only available on PC BIOS systems.
  3842. @end deffn
  3843. @node set
  3844. @subsection set
  3845. @deffn Command set [envvar=value]
  3846. Set the environment variable @var{envvar} to @var{value}. If invoked with no
  3847. arguments, print all environment variables with their values.
  3848. @end deffn
  3849. @node sha1sum
  3850. @subsection sha1sum
  3851. @deffn Command sha1sum arg @dots{}
  3852. Alias for @code{hashsum --hash sha1 arg @dots{}}. See command @command{hashsum}
  3853. (@pxref{hashsum}) for full description.
  3854. @end deffn
  3855. @node sha256sum
  3856. @subsection sha256sum
  3857. @deffn Command sha256sum arg @dots{}
  3858. Alias for @code{hashsum --hash sha256 arg @dots{}}. See command @command{hashsum}
  3859. (@pxref{hashsum}) for full description.
  3860. @end deffn
  3861. @node sha512sum
  3862. @subsection sha512sum
  3863. @deffn Command sha512sum arg @dots{}
  3864. Alias for @code{hashsum --hash sha512 arg @dots{}}. See command @command{hashsum}
  3865. (@pxref{hashsum}) for full description.
  3866. @end deffn
  3867. @node sleep
  3868. @subsection sleep
  3869. @deffn Command sleep [@option{--verbose}] [@option{--interruptible}] count
  3870. Sleep for @var{count} seconds. If option @option{--interruptible} is given,
  3871. allow @key{ESC} to interrupt sleep. With @option{--verbose} show countdown
  3872. of remaining seconds. Exit code is set to 0 if timeout expired and to 1
  3873. if timeout was interrupted by @key{ESC}.
  3874. @end deffn
  3875. @node source
  3876. @subsection source
  3877. @deffn Command source file
  3878. Read @var{file} as a configuration file, as if its contents had been
  3879. incorporated directly into the sourcing file. Unlike @command{configfile}
  3880. (@pxref{configfile}), this executes the contents of @var{file} without
  3881. changing context: any environment variable changes made by the commands in
  3882. @var{file} will be preserved after @command{source} returns, and the menu
  3883. will not be shown immediately.
  3884. @end deffn
  3885. @node test
  3886. @subsection test
  3887. @deffn Command test expression
  3888. Evaluate @var{expression} and return zero exit status if result is true,
  3889. non zero status otherwise.
  3890. @var{expression} is one of:
  3891. @table @asis
  3892. @item @var{string1} @code{==} @var{string2}
  3893. the strings are equal
  3894. @item @var{string1} @code{!=} @var{string2}
  3895. the strings are not equal
  3896. @item @var{string1} @code{<} @var{string2}
  3897. @var{string1} is lexicographically less than @var{string2}
  3898. @item @var{string1} @code{<=} @var{string2}
  3899. @var{string1} is lexicographically less or equal than @var{string2}
  3900. @item @var{string1} @code{>} @var{string2}
  3901. @var{string1} is lexicographically greater than @var{string2}
  3902. @item @var{string1} @code{>=} @var{string2}
  3903. @var{string1} is lexicographically greater or equal than @var{string2}
  3904. @item @var{integer1} @code{-eq} @var{integer2}
  3905. @var{integer1} is equal to @var{integer2}
  3906. @item @var{integer1} @code{-ge} @var{integer2}
  3907. @var{integer1} is greater than or equal to @var{integer2}
  3908. @item @var{integer1} @code{-gt} @var{integer2}
  3909. @var{integer1} is greater than @var{integer2}
  3910. @item @var{integer1} @code{-le} @var{integer2}
  3911. @var{integer1} is less than or equal to @var{integer2}
  3912. @item @var{integer1} @code{-lt} @var{integer2}
  3913. @var{integer1} is less than @var{integer2}
  3914. @item @var{integer1} @code{-ne} @var{integer2}
  3915. @var{integer1} is not equal to @var{integer2}
  3916. @item @var{prefix}@var{integer1} @code{-pgt} @var{prefix}@var{integer2}
  3917. @var{integer1} is greater than @var{integer2} after stripping off common non-numeric @var{prefix}.
  3918. @item @var{prefix}@var{integer1} @code{-plt} @var{prefix}@var{integer2}
  3919. @var{integer1} is less than @var{integer2} after stripping off common non-numeric @var{prefix}.
  3920. @item @var{file1} @code{-nt} @var{file2}
  3921. @var{file1} is newer than @var{file2} (modification time). Optionally numeric @var{bias} may be directly appended to @code{-nt} in which case it is added to the first file modification time.
  3922. @item @var{file1} @code{-ot} @var{file2}
  3923. @var{file1} is older than @var{file2} (modification time). Optionally numeric @var{bias} may be directly appended to @code{-ot} in which case it is added to the first file modification time.
  3924. @item @code{-d} @var{file}
  3925. @var{file} exists and is a directory
  3926. @item @code{-e} @var{file}
  3927. @var{file} exists
  3928. @item @code{-f} @var{file}
  3929. @var{file} exists and is not a directory
  3930. @item @code{-s} @var{file}
  3931. @var{file} exists and has a size greater than zero
  3932. @item @code{-n} @var{string}
  3933. the length of @var{string} is nonzero
  3934. @item @var{string}
  3935. @var{string} is equivalent to @code{-n @var{string}}
  3936. @item @code{-z} @var{string}
  3937. the length of @var{string} is zero
  3938. @item @code{(} @var{expression} @code{)}
  3939. @var{expression} is true
  3940. @item @code{!} @var{expression}
  3941. @var{expression} is false
  3942. @item @var{expression1} @code{-a} @var{expression2}
  3943. both @var{expression1} and @var{expression2} are true
  3944. @item @var{expression1} @var{expression2}
  3945. both @var{expression1} and @var{expression2} are true. This syntax is not POSIX-compliant and is not recommended.
  3946. @item @var{expression1} @code{-o} @var{expression2}
  3947. either @var{expression1} or @var{expression2} is true
  3948. @end table
  3949. @end deffn
  3950. @node true
  3951. @subsection true
  3952. @deffn Command true
  3953. Do nothing, successfully. This is mainly useful in control constructs such
  3954. as @code{if} and @code{while} (@pxref{Shell-like scripting}).
  3955. @end deffn
  3956. @node trust
  3957. @subsection trust
  3958. @deffn Command trust [@option{--skip-sig}] pubkey_file
  3959. Read public key from @var{pubkey_file} and add it to GRUB's internal
  3960. list of trusted public keys. These keys are used to validate digital
  3961. signatures when environment variable @code{check_signatures} is set to
  3962. @code{enforce}. Note that if @code{check_signatures} is set to
  3963. @code{enforce} when @command{trust} executes, then @var{pubkey_file}
  3964. must itself be properly signed. The @option{--skip-sig} option can be
  3965. used to disable signature-checking when reading @var{pubkey_file}
  3966. itself. It is expected that @option{--skip-sig} is useful for testing
  3967. and manual booting. @xref{Using digital signatures}, for more
  3968. information.
  3969. @end deffn
  3970. @node unset
  3971. @subsection unset
  3972. @deffn Command unset envvar
  3973. Unset the environment variable @var{envvar}.
  3974. @end deffn
  3975. @node uppermem
  3976. @subsection uppermem
  3977. This command is not yet implemented for GRUB 2, although it is planned.
  3978. @ignore
  3979. @node vbeinfo
  3980. @subsection vbeinfo
  3981. @deffn Command vbeinfo [[WxH]xD]
  3982. Alias for command @command{videoinfo} (@pxref{videoinfo}). It is available
  3983. only on PC BIOS platforms.
  3984. @end deffn
  3985. @end ignore
  3986. @node verify_detached
  3987. @subsection verify_detached
  3988. @deffn Command verify_detached [@option{--skip-sig}] file signature_file [pubkey_file]
  3989. Verifies a GPG-style detached signature, where the signed file is
  3990. @var{file}, and the signature itself is in file @var{signature_file}.
  3991. Optionally, a specific public key to use can be specified using
  3992. @var{pubkey_file}. When environment variable @code{check_signatures}
  3993. is set to @code{enforce}, then @var{pubkey_file} must itself be
  3994. properly signed by an already-trusted key. An unsigned
  3995. @var{pubkey_file} can be loaded by specifying @option{--skip-sig}.
  3996. If @var{pubkey_file} is omitted, then public keys from GRUB's trusted keys
  3997. (@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}) are
  3998. tried.
  3999. Exit code @code{$?} is set to 0 if the signature validates
  4000. successfully. If validation fails, it is set to a non-zero value.
  4001. @xref{Using digital signatures}, for more information.
  4002. @end deffn
  4003. @node videoinfo
  4004. @subsection videoinfo
  4005. @deffn Command videoinfo [[WxH]xD]
  4006. List available video modes. If resolution is given, show only matching modes.
  4007. @end deffn
  4008. @node xen_hypervisor
  4009. @subsection xen_hypervisor
  4010. @deffn Command xen_hypervisor file [arguments] @dots{}
  4011. Load a Xen hypervisor binary from @var{file}. The rest of the line is passed
  4012. verbatim as the @dfn{kernel command-line}. Any other binaries must be
  4013. reloaded after using this command.
  4014. @end deffn
  4015. @node xen_linux
  4016. @subsection xen_linux
  4017. @deffn Command xen_linux file [arguments]
  4018. Load a dom0 kernel image for xen hypervisor at the booting process of xen.
  4019. The rest of the line is passed verbatim as the module command line.
  4020. @end deffn
  4021. @node xen_initrd
  4022. @subsection xen_initrd
  4023. @deffn Command xen_initrd file
  4024. Load a initrd image for dom0 kernel at the booting process of xen.
  4025. @end deffn
  4026. @node xen_xsm
  4027. @subsection xen_xsm
  4028. @deffn Command xen_xsm file
  4029. Load a xen security module for xen hypervisor at the booting process of xen.
  4030. See @uref{http://wiki.xen.org/wiki/XSM} for more detail.
  4031. @end deffn
  4032. @node Networking commands
  4033. @section The list of networking commands
  4034. @menu
  4035. * net_add_addr:: Add a network address
  4036. * net_add_dns:: Add a DNS server
  4037. * net_add_route:: Add routing entry
  4038. * net_bootp:: Perform a bootp autoconfiguration
  4039. * net_del_addr:: Remove IP address from interface
  4040. * net_del_dns:: Remove a DNS server
  4041. * net_del_route:: Remove a route entry
  4042. * net_get_dhcp_option:: Retrieve DHCP options
  4043. * net_ipv6_autoconf:: Perform IPv6 autoconfiguration
  4044. * net_ls_addr:: List interfaces
  4045. * net_ls_cards:: List network cards
  4046. * net_ls_dns:: List DNS servers
  4047. * net_ls_routes:: List routing entries
  4048. * net_nslookup:: Perform a DNS lookup
  4049. @end menu
  4050. @node net_add_addr
  4051. @subsection net_add_addr
  4052. @deffn Command net_add_addr @var{interface} @var{card} @var{address}
  4053. Configure additional network @var{interface} with @var{address} on a
  4054. network @var{card}. @var{address} can be either IP in dotted decimal notation,
  4055. or symbolic name which is resolved using DNS lookup. If successful, this command
  4056. also adds local link routing entry to the default subnet of @var{address}
  4057. with name @var{interface}@samp{:local} via @var{interface}.
  4058. @end deffn
  4059. @node net_add_dns
  4060. @subsection net_add_dns
  4061. @deffn Command net_add_dns @var{server}
  4062. Resolve @var{server} IP address and add to the list of DNS servers used during
  4063. name lookup.
  4064. @end deffn
  4065. @node net_add_route
  4066. @subsection net_add_route
  4067. @deffn Command net_add_route @var{shortname} @var{ip}[/@var{prefix}] [@var{interface} | @samp{gw} @var{gateway}]
  4068. Add route to network with address @var{ip} as modified by @var{prefix} via
  4069. either local @var{interface} or @var{gateway}. @var{prefix} is optional and
  4070. defaults to 32 for IPv4 address and 128 for IPv6 address. Route is identified
  4071. by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
  4072. @end deffn
  4073. @node net_bootp
  4074. @subsection net_bootp
  4075. @deffn Command net_bootp [@var{card}]
  4076. Perform configuration of @var{card} using DHCP protocol. If no card name
  4077. is specified, try to configure all existing cards. If configuration was
  4078. successful, interface with name @var{card}@samp{:dhcp} and configured
  4079. address is added to @var{card}.
  4080. @comment If server provided gateway information in
  4081. @comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}.
  4082. Additionally the following DHCP options are recognized and processed:
  4083. @table @samp
  4084. @item 1 (Subnet Mask)
  4085. Used to calculate network local routing entry for interface @var{card}@samp{:dhcp}.
  4086. @item 3 (Router)
  4087. Adds default route entry with the name @var{card}@samp{:dhcp:default} via gateway
  4088. from DHCP option. Note that only option with single route is accepted.
  4089. @item 6 (Domain Name Server)
  4090. Adds all servers from option value to the list of servers used during name resolution.
  4091. @item 12 (Host Name)
  4092. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_hostname}
  4093. (@pxref{net_@var{<interface>}_hostname}) to the value of option.
  4094. @item 15 (Domain Name)
  4095. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_domain}
  4096. (@pxref{net_@var{<interface>}_domain}) to the value of option.
  4097. @item 17 (Root Path)
  4098. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_rootpath}
  4099. (@pxref{net_@var{<interface>}_rootpath}) to the value of option.
  4100. @item 18 (Extensions Path)
  4101. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_extensionspath}
  4102. (@pxref{net_@var{<interface>}_extensionspath}) to the value of option.
  4103. @end table
  4104. @end deffn
  4105. @node net_del_addr
  4106. @subsection net_del_addr
  4107. @deffn Command net_del_addr @var{interface}
  4108. Remove configured @var{interface} with associated address.
  4109. @end deffn
  4110. @node net_del_dns
  4111. @subsection net_del_dns
  4112. @deffn Command net_del_dns @var{address}
  4113. Remove @var{address} from list of servers used during name lookup.
  4114. @end deffn
  4115. @node net_del_route
  4116. @subsection net_del_route
  4117. @deffn Command net_del_route @var{shortname}
  4118. Remove route entry identified by @var{shortname}.
  4119. @end deffn
  4120. @node net_get_dhcp_option
  4121. @subsection net_get_dhcp_option
  4122. @deffn Command net_get_dhcp_option @var{var} @var{interface} @var{number} @var{type}
  4123. Request DHCP option @var{number} of @var{type} via @var{interface}. @var{type}
  4124. can be one of @samp{string}, @samp{number} or @samp{hex}. If option is found,
  4125. assign its value to variable @var{var}. Values of types @samp{number} and @samp{hex}
  4126. are converted to string representation.
  4127. @end deffn
  4128. @node net_ipv6_autoconf
  4129. @subsection net_ipv6_autoconf
  4130. @deffn Command net_ipv6_autoconf [@var{card}]
  4131. Perform IPv6 autoconfiguration by adding to the @var{card} interface with name
  4132. @var{card}@samp{:link} and link local MAC-based address. If no card is specified,
  4133. perform autoconfiguration for all existing cards.
  4134. @end deffn
  4135. @node net_ls_addr
  4136. @subsection net_ls_addr
  4137. @deffn Command net_ls_addr
  4138. List all configured interfaces with their MAC and IP addresses.
  4139. @end deffn
  4140. @node net_ls_cards
  4141. @subsection net_ls_cards
  4142. @deffn Command net_ls_cards
  4143. List all detected network cards with their MAC address.
  4144. @end deffn
  4145. @node net_ls_dns
  4146. @subsection net_ls_dns
  4147. @deffn Command net_ls_dns
  4148. List addresses of DNS servers used during name lookup.
  4149. @end deffn
  4150. @node net_ls_routes
  4151. @subsection net_ls_routes
  4152. @deffn Command net_ls_routes
  4153. List routing entries.
  4154. @end deffn
  4155. @node net_nslookup
  4156. @subsection net_nslookup
  4157. @deffn Command net_nslookup @var{name} [@var{server}]
  4158. Resolve address of @var{name} using DNS server @var{server}. If no server
  4159. is given, use default list of servers.
  4160. @end deffn
  4161. @node Internationalisation
  4162. @chapter Internationalisation
  4163. @section Charset
  4164. GRUB uses UTF-8 internally other than in rendering where some GRUB-specific
  4165. appropriate representation is used. All text files (including config) are
  4166. assumed to be encoded in UTF-8.
  4167. @section Filesystems
  4168. NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
  4169. ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
  4170. as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
  4171. minix2, minix3, ROMFS, ReiserFS, XFS, ext2, ext3, ext4, FAT (short names),
  4172. RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed
  4173. to be UTF-8. This might be false on systems configured with legacy charset
  4174. but as long as the charset used is superset of ASCII you should be able to
  4175. access ASCII-named files. And it's recommended to configure your system to use
  4176. UTF-8 to access the filesystem, convmv may help with migration. ISO9660 (plain)
  4177. filenames are specified as being ASCII or being described with unspecified
  4178. escape sequences. GRUB assumes that the ISO9660 names are UTF-8 (since
  4179. any ASCII is valid UTF-8). There are some old CD-ROMs which use CP437
  4180. in non-compliant way. You're still able to access files with names containing
  4181. only ASCII characters on such filesystems though. You're also able to access
  4182. any file if the filesystem contains valid Joliet (UTF-16) or RockRidge (UTF-8).
  4183. AFFS, SFS and HFS never use unicode and GRUB assumes them to be in Latin1,
  4184. Latin1 and MacRoman respectively. GRUB handles filesystem case-insensitivity
  4185. however no attempt is performed at case conversion of international characters
  4186. so e.g. a file named lowercase greek alpha is treated as different from
  4187. the one named as uppercase alpha. The filesystems in questions are
  4188. NTFS (except POSIX namespace), HFS+ (configurable at mkfs time, default
  4189. insensitive), SFS (configurable at mkfs time, default insensitive),
  4190. JFS (configurable at mkfs time, default sensitive), HFS, AFFS, FAT, exFAT
  4191. and ZFS (configurable on per-subvolume basis by property ``casesensitivity'',
  4192. default sensitive). On ZFS subvolumes marked as case insensitive files
  4193. containing lowercase international characters are inaccessible.
  4194. Also like all supported filesystems except HFS+ and ZFS (configurable on
  4195. per-subvolume basis by property ``normalization'', default none) GRUB makes
  4196. no attempt at check of canonical equivalence so a file name u-diaresis is
  4197. treated as distinct from u+combining diaresis. This however means that in
  4198. order to access file on HFS+ its name must be specified in normalisation form D.
  4199. On normalized ZFS subvolumes filenames out of normalisation are inaccessible.
  4200. @section Output terminal
  4201. Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII.
  4202. BIOS firmware console and VGA text are limited to ASCII and some pseudographics.
  4203. None of above mentioned is appropriate for displaying international and any
  4204. unsupported character is replaced with question mark except pseudographics
  4205. which we attempt to approximate with ASCII.
  4206. EFI console on the other hand nominally supports UTF-16 but actual language
  4207. coverage depends on firmware and may be very limited.
  4208. The encoding used on serial can be chosen with @command{terminfo} as
  4209. either ASCII, UTF-8 or ``visual UTF-8''. Last one is against the specification
  4210. but results in correct rendering of right-to-left on some readers which don't
  4211. have own bidi implementation.
  4212. On emu GRUB checks if charset is UTF-8 and uses it if so and uses ASCII
  4213. otherwise.
  4214. When using gfxterm or gfxmenu GRUB itself is responsible for rendering the
  4215. text. In this case GRUB is limited by loaded fonts. If fonts contain all
  4216. required characters then bidirectional text, cursive variants and combining
  4217. marks other than enclosing, half (e.g. left half tilde or combining overline)
  4218. and double ones. Ligatures aren't supported though. This should cover European,
  4219. Middle Eastern (if you don't mind lack of lam-alif ligature in Arabic) and
  4220. East Asian scripts. Notable unsupported scripts are Brahmic family and
  4221. derived as well as Mongolian, Tifinagh, Korean Jamo (precomposed characters
  4222. have no problem) and tonal writing (2e5-2e9). GRUB also ignores deprecated
  4223. (as specified in Unicode) characters (e.g. tags). GRUB also doesn't handle so
  4224. called ``annotation characters'' If you can complete either of
  4225. two lists or, better, propose a patch to improve rendering, please contact
  4226. developer team.
  4227. @section Input terminal
  4228. Firmware console on BIOS, IEEE1275 and ARC doesn't allow you to enter non-ASCII
  4229. characters. EFI specification allows for such but author is unaware of any
  4230. actual implementations. Serial input is currently limited for latin1 (unlikely
  4231. to change). Own keyboard implementations (at_keyboard and usb_keyboard)
  4232. supports any key but work on one-char-per-keystroke.
  4233. So no dead keys or advanced input method. Also there is no keymap change hotkey.
  4234. In practice it makes difficult to enter any text using non-Latin alphabet.
  4235. Moreover all current input consumers are limited to ASCII.
  4236. @section Gettext
  4237. GRUB supports being translated. For this you need to have language *.mo files in $prefix/locale, load gettext module and set ``lang'' variable.
  4238. @section Regexp
  4239. Regexps work on unicode characters, however no attempt at checking cannonical
  4240. equivalence has been made. Moreover the classes like [:alpha:] match only
  4241. ASCII subset.
  4242. @section Other
  4243. Currently GRUB always uses YEAR-MONTH-DAY HOUR:MINUTE:SECOND [WEEKDAY] 24-hour
  4244. datetime format but weekdays are translated.
  4245. GRUB always uses the decimal number format with [0-9] as digits and . as
  4246. descimal separator and no group separator.
  4247. IEEE1275 aliases are matched case-insensitively except non-ASCII which is
  4248. matched as binary. Similar behaviour is for matching OSBundleRequired.
  4249. Since IEEE1275 aliases and OSBundleRequired don't contain any non-ASCII it
  4250. should never be a problem in practice.
  4251. Case-sensitive identifiers are matched as raw strings, no canonical
  4252. equivalence check is performed. Case-insenstive identifiers are matched
  4253. as RAW but additionally [a-z] is equivalent to [A-Z]. GRUB-defined
  4254. identifiers use only ASCII and so should user-defined ones.
  4255. Identifiers containing non-ASCII may work but aren't supported.
  4256. Only the ASCII space characters (space U+0020, tab U+000b, CR U+000d and
  4257. LF U+000a) are recognised. Other unicode space characters aren't a valid
  4258. field separator.
  4259. @command{test} (@pxref{test}) tests <, >, <=, >=, -pgt and -plt compare the strings in the
  4260. lexicographical order of unicode codepoints, replicating the behaviour of
  4261. test from coreutils.
  4262. environment variables and commands are listed in the same order.
  4263. @node Security
  4264. @chapter Security
  4265. @menu
  4266. * Authentication and authorisation:: Users and access control
  4267. * Using digital signatures:: Booting digitally signed code
  4268. @end menu
  4269. @node Authentication and authorisation
  4270. @section Authentication and authorisation in GRUB
  4271. By default, the boot loader interface is accessible to anyone with physical
  4272. access to the console: anyone can select and edit any menu entry, and anyone
  4273. can get direct access to a GRUB shell prompt. For most systems, this is
  4274. reasonable since anyone with direct physical access has a variety of other
  4275. ways to gain full access, and requiring authentication at the boot loader
  4276. level would only serve to make it difficult to recover broken systems.
  4277. However, in some environments, such as kiosks, it may be appropriate to lock
  4278. down the boot loader to require authentication before performing certain
  4279. operations.
  4280. The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
  4281. (@pxref{password_pbkdf2}) commands can be used to define users, each of
  4282. which has an associated password. @samp{password} sets the password in
  4283. plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
  4284. sets the password hashed using the Password-Based Key Derivation Function
  4285. (RFC 2898), requiring the use of @command{grub-mkpasswd-pbkdf2}
  4286. (@pxref{Invoking grub-mkpasswd-pbkdf2}) to generate password hashes.
  4287. In order to enable authentication support, the @samp{superusers} environment
  4288. variable must be set to a list of usernames, separated by any of spaces,
  4289. commas, semicolons, pipes, or ampersands. Superusers are permitted to use
  4290. the GRUB command line, edit menu entries, and execute any menu entry. If
  4291. @samp{superusers} is set, then use of the command line and editing of menu
  4292. entries are automatically restricted to superusers. Setting @samp{superusers}
  4293. to empty string effectively disables both access to CLI and editing of menu
  4294. entries.
  4295. Other users may be allowed to execute specific menu entries by giving a list of
  4296. usernames (as above) using the @option{--users} option to the
  4297. @samp{menuentry} command (@pxref{menuentry}). If the @option{--unrestricted}
  4298. option is used for a menu entry, then that entry is unrestricted.
  4299. If the @option{--users} option is not used for a menu entry, then that
  4300. only superusers are able to use it.
  4301. Putting this together, a typical @file{grub.cfg} fragment might look like
  4302. this:
  4303. @example
  4304. @group
  4305. set superusers="root"
  4306. password_pbkdf2 root grub.pbkdf2.sha512.10000.biglongstring
  4307. password user1 insecure
  4308. menuentry "May be run by any user" --unrestricted @{
  4309. set root=(hd0,1)
  4310. linux /vmlinuz
  4311. @}
  4312. menuentry "Superusers only" --users "" @{
  4313. set root=(hd0,1)
  4314. linux /vmlinuz single
  4315. @}
  4316. menuentry "May be run by user1 or a superuser" --users user1 @{
  4317. set root=(hd0,2)
  4318. chainloader +1
  4319. @}
  4320. @end group
  4321. @end example
  4322. The @command{grub-mkconfig} program does not yet have built-in support for
  4323. generating configuration files with authentication. You can use
  4324. @file{/etc/grub.d/40_custom} to add simple superuser authentication, by
  4325. adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
  4326. commands.
  4327. @node Using digital signatures
  4328. @section Using digital signatures in GRUB
  4329. GRUB's @file{core.img} can optionally provide enforcement that all files
  4330. subsequently read from disk are covered by a valid digital signature.
  4331. This document does @strong{not} cover how to ensure that your
  4332. platform's firmware (e.g., Coreboot) validates @file{core.img}.
  4333. If environment variable @code{check_signatures}
  4334. (@pxref{check_signatures}) is set to @code{enforce}, then every
  4335. attempt by the GRUB @file{core.img} to load another file @file{foo}
  4336. implicitly invokes @code{verify_detached foo foo.sig}
  4337. (@pxref{verify_detached}). @code{foo.sig} must contain a valid
  4338. digital signature over the contents of @code{foo}, which can be
  4339. verified with a public key currently trusted by GRUB
  4340. (@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}). If
  4341. validation fails, then file @file{foo} cannot be opened. This failure
  4342. may halt or otherwise impact the boot process.
  4343. @comment Unfortunately --pubkey is not yet supported by grub-install,
  4344. @comment but we should not bring up internal detail grub-mkimage here
  4345. @comment in the user guide (as opposed to developer's manual).
  4346. @comment An initial trusted public key can be embedded within the GRUB
  4347. @comment @file{core.img} using the @code{--pubkey} option to
  4348. @comment @command{grub-mkimage} (@pxref{Invoking grub-install}). Presently it
  4349. @comment is necessary to write a custom wrapper around @command{grub-mkimage}
  4350. @comment using the @code{--grub-mkimage} flag to @command{grub-install}.
  4351. GRUB uses GPG-style detached signatures (meaning that a file
  4352. @file{foo.sig} will be produced when file @file{foo} is signed), and
  4353. currently supports the DSA and RSA signing algorithms. A signing key
  4354. can be generated as follows:
  4355. @example
  4356. gpg --gen-key
  4357. @end example
  4358. An individual file can be signed as follows:
  4359. @example
  4360. gpg --detach-sign /path/to/file
  4361. @end example
  4362. For successful validation of all of GRUB's subcomponents and the
  4363. loaded OS kernel, they must all be signed. One way to accomplish this
  4364. is the following (after having already produced the desired
  4365. @file{grub.cfg} file, e.g., by running @command{grub-mkconfig}
  4366. (@pxref{Invoking grub-mkconfig}):
  4367. @example
  4368. @group
  4369. # Edit /dev/shm/passphrase.txt to contain your signing key's passphrase
  4370. for i in `find /boot -name "*.cfg" -or -name "*.lst" -or \
  4371. -name "*.mod" -or -name "vmlinuz*" -or -name "initrd*" -or \
  4372. -name "grubenv"`;
  4373. do
  4374. gpg --batch --detach-sign --passphrase-fd 0 $i < \
  4375. /dev/shm/passphrase.txt
  4376. done
  4377. shred /dev/shm/passphrase.txt
  4378. @end group
  4379. @end example
  4380. See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
  4381. @ref{list_trusted}, @ref{distrust}, @ref{load_env}, @ref{save_env}.
  4382. Note that internally signature enforcement is controlled by setting
  4383. the environment variable @code{check_signatures} equal to
  4384. @code{enforce}. Passing one or more @code{--pubkey} options to
  4385. @command{grub-mkimage} implicitly defines @code{check_signatures}
  4386. equal to @code{enforce} in @file{core.img} prior to processing any
  4387. configuration files.
  4388. Note that signature checking does @strong{not} prevent an attacker
  4389. with (serial, physical, ...) console access from dropping manually to
  4390. the GRUB console and executing:
  4391. @example
  4392. set check_signatures=no
  4393. @end example
  4394. To prevent this, password-protection (@pxref{Authentication and
  4395. authorisation}) is essential. Note that even with GRUB password
  4396. protection, GRUB itself cannot prevent someone with physical access to
  4397. the machine from altering that machine's firmware (e.g., Coreboot
  4398. or BIOS) configuration to cause the machine to boot from a different
  4399. (attacker-controlled) device. GRUB is at best only one link in a
  4400. secure boot chain.
  4401. @node Platform limitations
  4402. @chapter Platform limitations
  4403. GRUB2 is designed to be portable and is actually ported across platforms. We
  4404. try to keep all platforms at the level. Unfortunately some platforms are better
  4405. supported than others. This is detailed in current and 2 following sections.
  4406. ARC platform is unable to change datetime (firmware doesn't seem to provide a
  4407. function for it).
  4408. EMU has similar limitation.
  4409. On EMU platform no serial port is available.
  4410. Console charset refers only to firmware-assisted console. gfxterm is always
  4411. Unicode (see Internationalisation section for its limitations). Serial is
  4412. configurable to UTF-8 or ASCII (see Internationalisation). In case of qemu
  4413. and coreboot ports the refered console is vga_text. Loongson always uses
  4414. gfxterm.
  4415. Most limited one is ASCII. CP437 provides additionally pseudographics.
  4416. GRUB2 doesn't use any language characters from CP437 as often CP437 is replaced
  4417. by national encoding compatible only in pseudographics.
  4418. Unicode is the most versatile charset which supports many languages. However
  4419. the actual console may be much more limited depending on firmware
  4420. On BIOS network is supported only if the image is loaded through network.
  4421. On sparc64 GRUB is unable to determine which server it was booted from.
  4422. Direct ATA/AHCI support allows to circumvent various firmware limitations but
  4423. isn't needed for normal operation except on baremetal ports.
  4424. AT keyboard support allows keyboard layout remapping and support for keys not
  4425. available through firmware. It isn't needed for normal operation except
  4426. baremetal ports.
  4427. Speaker allows morse and spkmodem communication.
  4428. USB support provides benefits similar to ATA (for USB disks) or AT (for USB
  4429. keyboards). In addition it allows USBserial.
  4430. Chainloading refers to the ability to load another bootloader through the same protocol
  4431. Hints allow faster disk discovery by already knowing in advance which is the disk in
  4432. question. On some platforms hints are correct unless you move the disk between boots.
  4433. On other platforms it's just an educated guess.
  4434. Note that hint failure results in just reduced performance, not a failure
  4435. BadRAM is the ability to mark some of the RAM as ``bad''. Note: due to protocol
  4436. limitations mips-loongson (with Linux protocol)
  4437. and mips-qemu_mips can use only memory up to first hole.
  4438. Bootlocation is ability of GRUB to automatically detect where it boots from.
  4439. ``disk'' means the detection is limited to detecting the disk with partition
  4440. being discovered on install time. ``partition'' means that disk and partiton
  4441. can be automatically discovered. ``file'' means that boot image file name as
  4442. well as disk and partition can be discovered. For consistency default install ignores
  4443. partition and relies solely on disk detection. If no bootlocation discovery is available
  4444. or boot and grub-root disks are different, UUID is used instead. On ARC if no device
  4445. to install to is specified, UUID is used instead as well.
  4446. @multitable @columnfractions .20 .20 .20 .20 .20
  4447. @item @tab BIOS @tab Coreboot @tab Multiboot @tab Qemu
  4448. @item video @tab yes @tab yes @tab yes @tab yes
  4449. @item console charset @tab CP437 @tab CP437 @tab CP437 @tab CP437
  4450. @item network @tab yes (*) @tab no @tab no @tab no
  4451. @item ATA/AHCI @tab yes @tab yes @tab yes @tab yes
  4452. @item AT keyboard @tab yes @tab yes @tab yes @tab yes
  4453. @item Speaker @tab yes @tab yes @tab yes @tab yes
  4454. @item USB @tab yes @tab yes @tab yes @tab yes
  4455. @item chainloader @tab local @tab yes @tab yes @tab no
  4456. @item cpuid @tab partial @tab partial @tab partial @tab partial
  4457. @item hints @tab guess @tab guess @tab guess @tab guess
  4458. @item PCI @tab yes @tab yes @tab yes @tab yes
  4459. @item badram @tab yes @tab yes @tab yes @tab yes
  4460. @item compression @tab always @tab pointless @tab no @tab no
  4461. @item exit @tab yes @tab no @tab no @tab no
  4462. @item bootlocation @tab disk @tab no @tab no @tab no
  4463. @end multitable
  4464. @multitable @columnfractions .20 .20 .20 .20 .20
  4465. @item @tab ia32 EFI @tab amd64 EFI @tab ia32 IEEE1275 @tab Itanium
  4466. @item video @tab yes @tab yes @tab no @tab no
  4467. @item console charset @tab Unicode @tab Unicode @tab ASCII @tab Unicode
  4468. @item network @tab yes @tab yes @tab yes @tab yes
  4469. @item ATA/AHCI @tab yes @tab yes @tab yes @tab no
  4470. @item AT keyboard @tab yes @tab yes @tab yes @tab no
  4471. @item Speaker @tab yes @tab yes @tab yes @tab no
  4472. @item USB @tab yes @tab yes @tab yes @tab no
  4473. @item chainloader @tab local @tab local @tab no @tab local
  4474. @item cpuid @tab partial @tab partial @tab partial @tab no
  4475. @item hints @tab guess @tab guess @tab good @tab guess
  4476. @item PCI @tab yes @tab yes @tab yes @tab no
  4477. @item badram @tab yes @tab yes @tab no @tab yes
  4478. @item compression @tab no @tab no @tab no @tab no
  4479. @item exit @tab yes @tab yes @tab yes @tab yes
  4480. @item bootlocation @tab file @tab file @tab file, ignored @tab file
  4481. @end multitable
  4482. @multitable @columnfractions .20 .20 .20 .20 .20
  4483. @item @tab Loongson @tab sparc64 @tab Powerpc @tab ARC
  4484. @item video @tab yes @tab no @tab yes @tab no
  4485. @item console charset @tab N/A @tab ASCII @tab ASCII @tab ASCII
  4486. @item network @tab no @tab yes (*) @tab yes @tab no
  4487. @item ATA/AHCI @tab yes @tab no @tab no @tab no
  4488. @item AT keyboard @tab yes @tab no @tab no @tab no
  4489. @item Speaker @tab no @tab no @tab no @tab no
  4490. @item USB @tab yes @tab no @tab no @tab no
  4491. @item chainloader @tab yes @tab no @tab no @tab no
  4492. @item cpuid @tab no @tab no @tab no @tab no
  4493. @item hints @tab good @tab good @tab good @tab no
  4494. @item PCI @tab yes @tab no @tab no @tab no
  4495. @item badram @tab yes (*) @tab no @tab no @tab no
  4496. @item compression @tab configurable @tab no @tab no @tab configurable
  4497. @item exit @tab no @tab yes @tab yes @tab yes
  4498. @item bootlocation @tab no @tab partition @tab file @tab file (*)
  4499. @end multitable
  4500. @multitable @columnfractions .20 .20 .20 .20 .20
  4501. @item @tab MIPS qemu @tab emu @tab xen
  4502. @item video @tab no @tab yes @tab no
  4503. @item console charset @tab CP437 @tab Unicode (*) @tab ASCII
  4504. @item network @tab no @tab yes @tab no
  4505. @item ATA/AHCI @tab yes @tab no @tab no
  4506. @item AT keyboard @tab yes @tab no @tab no
  4507. @item Speaker @tab no @tab no @tab no
  4508. @item USB @tab N/A @tab yes @tab no
  4509. @item chainloader @tab yes @tab no @tab yes
  4510. @item cpuid @tab no @tab no @tab yes
  4511. @item hints @tab guess @tab no @tab no
  4512. @item PCI @tab no @tab no @tab no
  4513. @item badram @tab yes (*) @tab no @tab no
  4514. @item compression @tab configurable @tab no @tab no
  4515. @item exit @tab no @tab yes @tab no
  4516. @item bootlocation @tab no @tab file @tab no
  4517. @end multitable
  4518. @node Platform-specific operations
  4519. @chapter Outline
  4520. Some platforms have features which allows to implement
  4521. some commands useless or not implementable on others.
  4522. Quick summary:
  4523. Information retrieval:
  4524. @itemize
  4525. @item mipsel-loongson: lsspd
  4526. @item mips-arc: lsdev
  4527. @item efi: lsefisystab, lssal, lsefimmap, lsefi
  4528. @item i386-pc: lsapm
  4529. @item i386-coreboot: lscoreboot, coreboot_boottime, cbmemc
  4530. @item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi): lsacpi
  4531. @end itemize
  4532. Workarounds for platform-specific issues:
  4533. @itemize
  4534. @item i386-efi/x86_64-efi: loadbios, fakebios, fix_video
  4535. @item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi):
  4536. acpi (override ACPI tables)
  4537. @item i386-pc: drivemap
  4538. @item i386-pc: sendkey
  4539. @end itemize
  4540. Advanced operations for power users:
  4541. @itemize
  4542. @item x86: iorw (direct access to I/O ports)
  4543. @end itemize
  4544. Miscelaneous:
  4545. @itemize
  4546. @item cmos (x86-*, ieee1275, mips-qemu_mips, mips-loongson): cmostest
  4547. (used on some laptops to check for special power-on key), cmosclean
  4548. @item i386-pc: play
  4549. @end itemize
  4550. @node Supported kernels
  4551. @chapter Supported boot targets
  4552. X86 support is summarised in the following table. ``Yes'' means that the kernel works on the given platform, ``crashes'' means an early kernel crash which we hope will be fixed by concerned kernel developers. ``no'' means GRUB doesn't load the given kernel on a given platform. ``headless'' means that the kernel works but lacks console drivers (you can still use serial or network console). In case of ``no'' and ``crashes'' the reason is given in footnote.
  4553. @multitable @columnfractions .50 .22 .22
  4554. @item @tab BIOS @tab Coreboot
  4555. @item BIOS chainloading @tab yes @tab no (1)
  4556. @item NTLDR @tab yes @tab no (1)
  4557. @item Plan9 @tab yes @tab no (1)
  4558. @item Freedos @tab yes @tab no (1)
  4559. @item FreeBSD bootloader @tab yes @tab crashes (1)
  4560. @item 32-bit kFreeBSD @tab yes @tab crashes (5)
  4561. @item 64-bit kFreeBSD @tab yes @tab crashes (5)
  4562. @item 32-bit kNetBSD @tab yes @tab crashes (1)
  4563. @item 64-bit kNetBSD @tab yes @tab crashes
  4564. @item 32-bit kOpenBSD @tab yes @tab yes
  4565. @item 64-bit kOpenBSD @tab yes @tab yes
  4566. @item Multiboot @tab yes @tab yes
  4567. @item Multiboot2 @tab yes @tab yes
  4568. @item 32-bit Linux (legacy protocol) @tab yes @tab no (1)
  4569. @item 64-bit Linux (legacy protocol) @tab yes @tab no (1)
  4570. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  4571. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  4572. @item 32-bit XNU @tab yes @tab ?
  4573. @item 64-bit XNU @tab yes @tab ?
  4574. @item 32-bit EFI chainloader @tab no (2) @tab no (2)
  4575. @item 64-bit EFI chainloader @tab no (2) @tab no (2)
  4576. @item Appleloader @tab no (2) @tab no (2)
  4577. @end multitable
  4578. @multitable @columnfractions .50 .22 .22
  4579. @item @tab Multiboot @tab Qemu
  4580. @item BIOS chainloading @tab no (1) @tab no (1)
  4581. @item NTLDR @tab no (1) @tab no (1)
  4582. @item Plan9 @tab no (1) @tab no (1)
  4583. @item FreeDOS @tab no (1) @tab no (1)
  4584. @item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
  4585. @item 32-bit kFreeBSD @tab crashes (5) @tab crashes (5)
  4586. @item 64-bit kFreeBSD @tab crashes (5) @tab crashes (5)
  4587. @item 32-bit kNetBSD @tab crashes (1) @tab crashes (1)
  4588. @item 64-bit kNetBSD @tab yes @tab yes
  4589. @item 32-bit kOpenBSD @tab yes @tab yes
  4590. @item 64-bit kOpenBSD @tab yes @tab yes
  4591. @item Multiboot @tab yes @tab yes
  4592. @item Multiboot2 @tab yes @tab yes
  4593. @item 32-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  4594. @item 64-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  4595. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  4596. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  4597. @item 32-bit XNU @tab ? @tab ?
  4598. @item 64-bit XNU @tab ? @tab ?
  4599. @item 32-bit EFI chainloader @tab no (2) @tab no (2)
  4600. @item 64-bit EFI chainloader @tab no (2) @tab no (2)
  4601. @item Appleloader @tab no (2) @tab no (2)
  4602. @end multitable
  4603. @multitable @columnfractions .50 .22 .22
  4604. @item @tab ia32 EFI @tab amd64 EFI
  4605. @item BIOS chainloading @tab no (1) @tab no (1)
  4606. @item NTLDR @tab no (1) @tab no (1)
  4607. @item Plan9 @tab no (1) @tab no (1)
  4608. @item FreeDOS @tab no (1) @tab no (1)
  4609. @item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
  4610. @item 32-bit kFreeBSD @tab headless @tab headless
  4611. @item 64-bit kFreeBSD @tab headless @tab headless
  4612. @item 32-bit kNetBSD @tab crashes (1) @tab crashes (1)
  4613. @item 64-bit kNetBSD @tab yes @tab yes
  4614. @item 32-bit kOpenBSD @tab headless @tab headless
  4615. @item 64-bit kOpenBSD @tab headless @tab headless
  4616. @item Multiboot @tab yes @tab yes
  4617. @item Multiboot2 @tab yes @tab yes
  4618. @item 32-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  4619. @item 64-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  4620. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  4621. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  4622. @item 32-bit XNU @tab yes @tab yes
  4623. @item 64-bit XNU @tab yes (4) @tab yes
  4624. @item 32-bit EFI chainloader @tab yes @tab no (3)
  4625. @item 64-bit EFI chainloader @tab no (3) @tab yes
  4626. @item Appleloader @tab yes @tab yes
  4627. @end multitable
  4628. @multitable @columnfractions .50 .22 .22
  4629. @item @tab ia32 IEEE1275
  4630. @item BIOS chainloading @tab no (1)
  4631. @item NTLDR @tab no (1)
  4632. @item Plan9 @tab no (1)
  4633. @item FreeDOS @tab no (1)
  4634. @item FreeBSD bootloader @tab crashes (1)
  4635. @item 32-bit kFreeBSD @tab crashes (5)
  4636. @item 64-bit kFreeBSD @tab crashes (5)
  4637. @item 32-bit kNetBSD @tab crashes (1)
  4638. @item 64-bit kNetBSD @tab ?
  4639. @item 32-bit kOpenBSD @tab ?
  4640. @item 64-bit kOpenBSD @tab ?
  4641. @item Multiboot @tab ?
  4642. @item Multiboot2 @tab ?
  4643. @item 32-bit Linux (legacy protocol) @tab no (1)
  4644. @item 64-bit Linux (legacy protocol) @tab no (1)
  4645. @item 32-bit Linux (modern protocol) @tab ?
  4646. @item 64-bit Linux (modern protocol) @tab ?
  4647. @item 32-bit XNU @tab ?
  4648. @item 64-bit XNU @tab ?
  4649. @item 32-bit EFI chainloader @tab no (2)
  4650. @item 64-bit EFI chainloader @tab no (2)
  4651. @item Appleloader @tab no (2)
  4652. @end multitable
  4653. @enumerate
  4654. @item Requires BIOS
  4655. @item EFI only
  4656. @item 32-bit and 64-bit EFI have different structures and work in different CPU modes so it's not possible to chainload 32-bit bootloader on 64-bit platform and vice-versa
  4657. @item Some modules may need to be disabled
  4658. @item Requires ACPI
  4659. @end enumerate
  4660. PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
  4661. and multiboot2.
  4662. @section Boot tests
  4663. As you have seen in previous chapter the support matrix is pretty big and some of the configurations are only rarely used. To ensure the quality bootchecks are available for all x86 targets except EFI chainloader, Appleloader and XNU. All x86 platforms have bootcheck facility except ieee1275. Multiboot, multiboot2, BIOS chainloader, ntldr and freebsd-bootloader boot targets are tested only with a fake kernel images. Only Linux is tested among the payloads using Linux protocols.
  4664. Following variables must be defined:
  4665. @multitable @columnfractions .30 .65
  4666. @item GRUB_PAYLOADS_DIR @tab directory containing the required kernels
  4667. @item GRUB_CBFSTOOL @tab cbfstool from Coreboot package (for coreboot platform only)
  4668. @item GRUB_COREBOOT_ROM @tab empty Coreboot ROM
  4669. @item GRUB_QEMU_OPTS @tab additional options to be supplied to QEMU
  4670. @end multitable
  4671. Required files are:
  4672. @multitable @columnfractions .40 .55
  4673. @item kfreebsd_env.i386 @tab 32-bit kFreeBSD device hints
  4674. @item kfreebsd.i386 @tab 32-bit FreeBSD kernel image
  4675. @item kfreebsd.x86_64, kfreebsd_env.x86_64 @tab same from 64-bit kFreeBSD
  4676. @item knetbsd.i386 @tab 32-bit NetBSD kernel image
  4677. @item knetbsd.miniroot.i386 @tab 32-bit kNetBSD miniroot.kmod.
  4678. @item knetbsd.x86_64, knetbsd.miniroot.x86_64 @tab same from 64-bit kNetBSD
  4679. @item kopenbsd.i386 @tab 32-bit OpenBSD kernel bsd.rd image
  4680. @item kopenbsd.x86_64 @tab same from 64-bit kOpenBSD
  4681. @item linux.i386 @tab 32-bit Linux
  4682. @item linux.x86_64 @tab 64-bit Linux
  4683. @end multitable
  4684. @node Troubleshooting
  4685. @chapter Error messages produced by GRUB
  4686. @menu
  4687. * GRUB only offers a rescue shell::
  4688. @end menu
  4689. @node GRUB only offers a rescue shell
  4690. @section GRUB only offers a rescue shell
  4691. GRUB's normal start-up procedure involves setting the @samp{prefix}
  4692. environment variable to a value set in the core image by
  4693. @command{grub-install}, setting the @samp{root} variable to match, loading
  4694. the @samp{normal} module from the prefix, and running the @samp{normal}
  4695. command (@pxref{normal}). This command is responsible for reading
  4696. @file{/boot/grub/grub.cfg}, running the menu, and doing all the useful
  4697. things GRUB is supposed to do.
  4698. If, instead, you only get a rescue shell, this usually means that GRUB
  4699. failed to load the @samp{normal} module for some reason. It may be possible
  4700. to work around this temporarily: for instance, if the reason for the failure
  4701. is that @samp{prefix} is wrong (perhaps it refers to the wrong device, or
  4702. perhaps the path to @file{/boot/grub} was not correctly made relative to the
  4703. device), then you can correct this and enter normal mode manually:
  4704. @example
  4705. @group
  4706. # Inspect the current prefix (and other preset variables):
  4707. set
  4708. # Find out which devices are available:
  4709. ls
  4710. # Set to the correct value, which might be something like this:
  4711. set prefix=(hd0,1)/grub
  4712. set root=(hd0,1)
  4713. insmod normal
  4714. normal
  4715. @end group
  4716. @end example
  4717. However, any problem that leaves you in the rescue shell probably means that
  4718. GRUB was not correctly installed. It may be more useful to try to reinstall
  4719. it properly using @kbd{grub-install @var{device}} (@pxref{Invoking
  4720. grub-install}). When doing this, there are a few things to remember:
  4721. @itemize @bullet{}
  4722. @item
  4723. Drive ordering in your operating system may not be the same as the boot
  4724. drive ordering used by your firmware. Do not assume that your first hard
  4725. drive (e.g. @samp{/dev/sda}) is the one that your firmware will boot from.
  4726. @file{device.map} (@pxref{Device map}) can be used to override this, but it
  4727. is usually better to use UUIDs or file system labels and avoid depending on
  4728. drive ordering entirely.
  4729. @item
  4730. At least on BIOS systems, if you tell @command{grub-install} to install GRUB
  4731. to a partition but GRUB has already been installed in the master boot
  4732. record, then the GRUB installation in the partition will be ignored.
  4733. @item
  4734. If possible, it is generally best to avoid installing GRUB to a partition
  4735. (unless it is a special partition for the use of GRUB alone, such as the
  4736. BIOS Boot Partition used on GPT). Doing this means that GRUB may stop being
  4737. able to read its core image due to a file system moving blocks around, such
  4738. as while defragmenting, running checks, or even during normal operation.
  4739. Installing to the whole disk device is normally more robust.
  4740. @item
  4741. Check that GRUB actually knows how to read from the device and file system
  4742. containing @file{/boot/grub}. It will not be able to read from encrypted
  4743. devices with unsupported encryption scheme, nor from file systems for which
  4744. support has not yet been added to GRUB.
  4745. @end itemize
  4746. @node Invoking grub-install
  4747. @chapter Invoking grub-install
  4748. The program @command{grub-install} generates a GRUB core image using
  4749. @command{grub-mkimage} and installs it on your system. You must specify the
  4750. device name on which you want to install GRUB, like this:
  4751. @example
  4752. grub-install @var{install_device}
  4753. @end example
  4754. The device name @var{install_device} is an OS device name or a GRUB
  4755. device name.
  4756. @command{grub-install} accepts the following options:
  4757. @table @option
  4758. @item --help
  4759. Print a summary of the command-line options and exit.
  4760. @item --version
  4761. Print the version number of GRUB and exit.
  4762. @item --boot-directory=@var{dir}
  4763. Install GRUB images under the directory @file{@var{dir}/grub/}
  4764. This option is useful when you want to install GRUB into a
  4765. separate partition or a removable disk.
  4766. If this option is not specified then it defaults to @file{/boot}, so
  4767. @example
  4768. @kbd{grub-install /dev/sda}
  4769. @end example
  4770. is equivalent to
  4771. @example
  4772. @kbd{grub-install --boot-directory=/boot/ /dev/sda}
  4773. @end example
  4774. Here is an example in which you have a separate @dfn{boot} partition which is
  4775. mounted on
  4776. @file{/mnt/boot}:
  4777. @example
  4778. @kbd{grub-install --boot-directory=/mnt/boot /dev/sdb}
  4779. @end example
  4780. @item --recheck
  4781. Recheck the device map, even if @file{/boot/grub/device.map} already
  4782. exists. You should use this option whenever you add/remove a disk
  4783. into/from your computer.
  4784. @item --no-rs-codes
  4785. By default on x86 BIOS systems, @command{grub-install} will use some
  4786. extra space in the bootloader embedding area for Reed-Solomon
  4787. error-correcting codes. This enables GRUB to still boot successfully
  4788. if some blocks are corrupted. The exact amount of protection offered
  4789. is dependent on available space in the embedding area. R sectors of
  4790. redundancy can tolerate up to R/2 corrupted sectors. This
  4791. redundancy may be cumbersome if attempting to cryptographically
  4792. validate the contents of the bootloader embedding area, or in more
  4793. modern systems with GPT-style partition tables (@pxref{BIOS
  4794. installation}) where GRUB does not reside in any unpartitioned space
  4795. outside of the MBR. Disable the Reed-Solomon codes with this option.
  4796. @end table
  4797. @node Invoking grub-mkconfig
  4798. @chapter Invoking grub-mkconfig
  4799. The program @command{grub-mkconfig} generates a configuration file for GRUB
  4800. (@pxref{Simple configuration}).
  4801. @example
  4802. grub-mkconfig -o /boot/grub/grub.cfg
  4803. @end example
  4804. @command{grub-mkconfig} accepts the following options:
  4805. @table @option
  4806. @item --help
  4807. Print a summary of the command-line options and exit.
  4808. @item --version
  4809. Print the version number of GRUB and exit.
  4810. @item -o @var{file}
  4811. @itemx --output=@var{file}
  4812. Send the generated configuration file to @var{file}. The default is to send
  4813. it to standard output.
  4814. @end table
  4815. @node Invoking grub-mkpasswd-pbkdf2
  4816. @chapter Invoking grub-mkpasswd-pbkdf2
  4817. The program @command{grub-mkpasswd-pbkdf2} generates password hashes for
  4818. GRUB (@pxref{Security}).
  4819. @example
  4820. grub-mkpasswd-pbkdf2
  4821. @end example
  4822. @command{grub-mkpasswd-pbkdf2} accepts the following options:
  4823. @table @option
  4824. @item -c @var{number}
  4825. @itemx --iteration-count=@var{number}
  4826. Number of iterations of the underlying pseudo-random function. Defaults to
  4827. 10000.
  4828. @item -l @var{number}
  4829. @itemx --buflen=@var{number}
  4830. Length of the generated hash. Defaults to 64.
  4831. @item -s @var{number}
  4832. @itemx --salt=@var{number}
  4833. Length of the salt. Defaults to 64.
  4834. @end table
  4835. @node Invoking grub-mkrelpath
  4836. @chapter Invoking grub-mkrelpath
  4837. The program @command{grub-mkrelpath} makes a file system path relative to
  4838. the root of its containing file system. For instance, if @file{/usr} is a
  4839. mount point, then:
  4840. @example
  4841. $ @kbd{grub-mkrelpath /usr/share/grub/unicode.pf2}
  4842. @samp{/share/grub/unicode.pf2}
  4843. @end example
  4844. This is mainly used internally by other GRUB utilities such as
  4845. @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig}), but may
  4846. occasionally also be useful for debugging.
  4847. @command{grub-mkrelpath} accepts the following options:
  4848. @table @option
  4849. @item --help
  4850. Print a summary of the command-line options and exit.
  4851. @item --version
  4852. Print the version number of GRUB and exit.
  4853. @end table
  4854. @node Invoking grub-mkrescue
  4855. @chapter Invoking grub-mkrescue
  4856. The program @command{grub-mkrescue} generates a bootable GRUB rescue image
  4857. (@pxref{Making a GRUB bootable CD-ROM}).
  4858. @example
  4859. grub-mkrescue -o grub.iso
  4860. @end example
  4861. All arguments not explicitly listed as @command{grub-mkrescue} options are
  4862. passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
  4863. Options passed to @command{xorriso} will normally be interpreted as
  4864. @command{mkisofs} options; if the option @samp{--} is used, then anything
  4865. after that will be interpreted as native @command{xorriso} options.
  4866. Non-option arguments specify additional source directories. This is
  4867. commonly used to add extra files to the image:
  4868. @example
  4869. mkdir -p disk/boot/grub
  4870. @r{(add extra files to @file{disk/boot/grub})}
  4871. grub-mkrescue -o grub.iso disk
  4872. @end example
  4873. @command{grub-mkrescue} accepts the following options:
  4874. @table @option
  4875. @item --help
  4876. Print a summary of the command-line options and exit.
  4877. @item --version
  4878. Print the version number of GRUB and exit.
  4879. @item -o @var{file}
  4880. @itemx --output=@var{file}
  4881. Save output in @var{file}. This "option" is required.
  4882. @item --modules=@var{modules}
  4883. Pre-load the named GRUB modules in the image. Multiple entries in
  4884. @var{modules} should be separated by whitespace (so you will probably need
  4885. to quote this for your shell).
  4886. @item --rom-directory=@var{dir}
  4887. If generating images for the QEMU or Coreboot platforms, copy the resulting
  4888. @file{qemu.img} or @file{coreboot.elf} files respectively to the @var{dir}
  4889. directory as well as including them in the image.
  4890. @item --xorriso=@var{file}
  4891. Use @var{file} as the @command{xorriso} program, rather than the built-in
  4892. default.
  4893. @item --grub-mkimage=@var{file}
  4894. Use @var{file} as the @command{grub-mkimage} program, rather than the
  4895. built-in default.
  4896. @end table
  4897. @node Invoking grub-mount
  4898. @chapter Invoking grub-mount
  4899. The program @command{grub-mount} performs a read-only mount of any file
  4900. system or file system image that GRUB understands, using GRUB's file system
  4901. drivers via FUSE. (It is only available if FUSE development files were
  4902. present when GRUB was built.) This has a number of uses:
  4903. @itemize @bullet
  4904. @item
  4905. It provides a convenient way to check how GRUB will view a file system at
  4906. boot time. You can use normal command-line tools to compare that view with
  4907. that of your operating system, making it easy to find bugs.
  4908. @item
  4909. It offers true read-only mounts. Linux does not have these for journalling
  4910. file systems, because it will always attempt to replay the journal at mount
  4911. time; while you can temporarily mark the block device read-only to avoid
  4912. this, that causes the mount to fail. Since GRUB intentionally contains no
  4913. code for writing to file systems, it can easily provide a guaranteed
  4914. read-only mount mechanism.
  4915. @item
  4916. It allows you to examine any file system that GRUB understands without
  4917. needing to load additional modules into your running kernel, which may be
  4918. useful in constrained environments such as installers.
  4919. @item
  4920. Since it can examine file system images (contained in regular files) just as
  4921. easily as file systems on block devices, you can use it to inspect any file
  4922. system image that GRUB understands with only enough privileges to use FUSE,
  4923. even if nobody has yet written a FUSE module specifically for that file
  4924. system type.
  4925. @end itemize
  4926. Using @command{grub-mount} is normally as simple as:
  4927. @example
  4928. grub-mount /dev/sda1 /mnt
  4929. @end example
  4930. @command{grub-mount} must be given one or more images and a mount point as
  4931. non-option arguments (if it is given more than one image, it will treat them
  4932. as a RAID set), and also accepts the following options:
  4933. @table @option
  4934. @item --help
  4935. Print a summary of the command-line options and exit.
  4936. @item --version
  4937. Print the version number of GRUB and exit.
  4938. @item -C
  4939. @itemx --crypto
  4940. Mount encrypted devices, prompting for a passphrase if necessary.
  4941. @item -d @var{string}
  4942. @itemx --debug=@var{string}
  4943. Show debugging output for conditions matching @var{string}.
  4944. @item -K prompt|@var{file}
  4945. @itemx --zfs-key=prompt|@var{file}
  4946. Load a ZFS encryption key. If you use @samp{prompt} as the argument,
  4947. @command{grub-mount} will read a passphrase from the terminal; otherwise, it
  4948. will read key material from the specified file.
  4949. @item -r @var{device}
  4950. @itemx --root=@var{device}
  4951. Set the GRUB root device to @var{device}. You do not normally need to set
  4952. this; @command{grub-mount} will automatically set the root device to the
  4953. root of the supplied file system.
  4954. If @var{device} is just a number, then it will be treated as a partition
  4955. number within the supplied image. This means that, if you have an image of
  4956. an entire disk in @file{disk.img}, then you can use this command to mount
  4957. its second partition:
  4958. @example
  4959. grub-mount -r 2 disk.img mount-point
  4960. @end example
  4961. @item -v
  4962. @itemx --verbose
  4963. Print verbose messages.
  4964. @end table
  4965. @node Invoking grub-probe
  4966. @chapter Invoking grub-probe
  4967. The program @command{grub-probe} probes device information for a given path
  4968. or device.
  4969. @example
  4970. grub-probe --target=fs /boot/grub
  4971. grub-probe --target=drive --device /dev/sda1
  4972. @end example
  4973. @command{grub-probe} must be given a path or device as a non-option
  4974. argument, and also accepts the following options:
  4975. @table @option
  4976. @item --help
  4977. Print a summary of the command-line options and exit.
  4978. @item --version
  4979. Print the version number of GRUB and exit.
  4980. @item -d
  4981. @itemx --device
  4982. If this option is given, then the non-option argument is a system device
  4983. name (such as @samp{/dev/sda1}), and @command{grub-probe} will print
  4984. information about that device. If it is not given, then the non-option
  4985. argument is a filesystem path (such as @samp{/boot/grub}), and
  4986. @command{grub-probe} will print information about the device containing that
  4987. part of the filesystem.
  4988. @item -m @var{file}
  4989. @itemx --device-map=@var{file}
  4990. Use @var{file} as the device map (@pxref{Device map}) rather than the
  4991. default, usually @samp{/boot/grub/device.map}.
  4992. @item -t @var{target}
  4993. @itemx --target=@var{target}
  4994. Print information about the given path or device as defined by @var{target}.
  4995. The available targets and their meanings are:
  4996. @table @samp
  4997. @item fs
  4998. GRUB filesystem module.
  4999. @item fs_uuid
  5000. Filesystem Universally Unique Identifier (UUID).
  5001. @item fs_label
  5002. Filesystem label.
  5003. @item drive
  5004. GRUB device name.
  5005. @item device
  5006. System device name.
  5007. @item partmap
  5008. GRUB partition map module.
  5009. @item abstraction
  5010. GRUB abstraction module (e.g. @samp{lvm}).
  5011. @item cryptodisk_uuid
  5012. Crypto device UUID.
  5013. @item msdos_parttype
  5014. MBR partition type code (two hexadecimal digits).
  5015. @item hints_string
  5016. A string of platform search hints suitable for passing to the
  5017. @command{search} command (@pxref{search}).
  5018. @item bios_hints
  5019. Search hints for the PC BIOS platform.
  5020. @item ieee1275_hints
  5021. Search hints for the IEEE1275 platform.
  5022. @item baremetal_hints
  5023. Search hints for platforms where disks are addressed directly rather than
  5024. via firmware.
  5025. @item efi_hints
  5026. Search hints for the EFI platform.
  5027. @item arc_hints
  5028. Search hints for the ARC platform.
  5029. @item compatibility_hint
  5030. A guess at a reasonable GRUB drive name for this device, which may be
  5031. used as a fallback if the @command{search} command fails.
  5032. @item disk
  5033. System device name for the whole disk.
  5034. @end table
  5035. @item -v
  5036. @itemx --verbose
  5037. Print verbose messages.
  5038. @end table
  5039. @node Invoking grub-script-check
  5040. @chapter Invoking grub-script-check
  5041. The program @command{grub-script-check} takes a GRUB script file
  5042. (@pxref{Shell-like scripting}) and checks it for syntax errors, similar to
  5043. commands such as @command{sh -n}. It may take a @var{path} as a non-option
  5044. argument; if none is supplied, it will read from standard input.
  5045. @example
  5046. grub-script-check /boot/grub/grub.cfg
  5047. @end example
  5048. @command{grub-script-check} accepts the following options:
  5049. @table @option
  5050. @item --help
  5051. Print a summary of the command-line options and exit.
  5052. @item --version
  5053. Print the version number of GRUB and exit.
  5054. @item -v
  5055. @itemx --verbose
  5056. Print each line of input after reading it.
  5057. @end table
  5058. @node Obtaining and Building GRUB
  5059. @appendix How to obtain and build GRUB
  5060. @quotation
  5061. @strong{Caution:} GRUB requires binutils-2.9.1.0.23 or later because the
  5062. GNU assembler has been changed so that it can produce real 16bits
  5063. machine code between 2.9.1 and 2.9.1.0.x. See
  5064. @uref{http://sources.redhat.com/binutils/}, to obtain information on
  5065. how to get the latest version.
  5066. @end quotation
  5067. GRUB is available from the GNU alpha archive site
  5068. @uref{ftp://ftp.gnu.org/gnu/grub} or any of its mirrors. The file
  5069. will be named grub-version.tar.gz. The current version is
  5070. @value{VERSION}, so the file you should grab is:
  5071. @uref{ftp://ftp.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz}
  5072. To unbundle GRUB use the instruction:
  5073. @example
  5074. @kbd{zcat grub-@value{VERSION}.tar.gz | tar xvf -}
  5075. @end example
  5076. which will create a directory called @file{grub-@value{VERSION}} with
  5077. all the sources. You can look at the file @file{INSTALL} for detailed
  5078. instructions on how to build and install GRUB, but you should be able to
  5079. just do:
  5080. @example
  5081. @group
  5082. @kbd{cd grub-@value{VERSION}}
  5083. @kbd{./configure}
  5084. @kbd{make install}
  5085. @end group
  5086. @end example
  5087. Also, the latest version is available using Git. See
  5088. @uref{http://www.gnu.org/software/grub/grub-download.html} for more
  5089. information.
  5090. @node Reporting bugs
  5091. @appendix Reporting bugs
  5092. These are the guideline for how to report bugs. Take a look at this
  5093. list below before you submit bugs:
  5094. @enumerate
  5095. @item
  5096. Before getting unsettled, read this manual through and through. Also,
  5097. see the @uref{http://www.gnu.org/software/grub/grub-faq.html, GNU GRUB FAQ}.
  5098. @item
  5099. Always mention the information on your GRUB. The version number and the
  5100. configuration are quite important. If you build it yourself, write the
  5101. options specified to the configure script and your operating system,
  5102. including the versions of gcc and binutils.
  5103. @item
  5104. If you have trouble with the installation, inform us of how you
  5105. installed GRUB. Don't omit error messages, if any. Just @samp{GRUB hangs
  5106. up when it boots} is not enough.
  5107. The information on your hardware is also essential. These are especially
  5108. important: the geometries and the partition tables of your hard disk
  5109. drives and your BIOS.
  5110. @item
  5111. If GRUB cannot boot your operating system, write down
  5112. @emph{everything} you see on the screen. Don't paraphrase them, like
  5113. @samp{The foo OS crashes with GRUB, even though it can boot with the
  5114. bar boot loader just fine}. Mention the commands you executed, the
  5115. messages printed by them, and information on your operating system
  5116. including the version number.
  5117. @item
  5118. Explain what you wanted to do. It is very useful to know your purpose
  5119. and your wish, and how GRUB didn't satisfy you.
  5120. @item
  5121. If you can investigate the problem yourself, please do. That will give
  5122. you and us much more information on the problem. Attaching a patch is
  5123. even better.
  5124. When you attach a patch, make the patch in unified diff format, and
  5125. write ChangeLog entries. But, even when you make a patch, don't forget
  5126. to explain the problem, so that we can understand what your patch is
  5127. for.
  5128. @item
  5129. Write down anything that you think might be related. Please understand
  5130. that we often need to reproduce the same problem you encountered in our
  5131. environment. So your information should be sufficient for us to do the
  5132. same thing---Don't forget that we cannot see your computer directly. If
  5133. you are not sure whether to state a fact or leave it out, state it!
  5134. Reporting too many things is much better than omitting something
  5135. important.
  5136. @end enumerate
  5137. If you follow the guideline above, submit a report to the
  5138. @uref{http://savannah.gnu.org/bugs/?group=grub, Bug Tracking System}.
  5139. Alternatively, you can submit a report via electronic mail to
  5140. @email{bug-grub@@gnu.org}, but we strongly recommend that you use the
  5141. Bug Tracking System, because e-mail can be passed over easily.
  5142. Once we get your report, we will try to fix the bugs.
  5143. @node Future
  5144. @appendix Where GRUB will go
  5145. GRUB 2 is now quite stable and used in many production systems. We are
  5146. currently working towards a 2.0 release.
  5147. If you are interested in the development of GRUB 2, take a look at
  5148. @uref{http://www.gnu.org/software/grub/grub.html, the homepage}.
  5149. @node Copying This Manual
  5150. @appendix Copying This Manual
  5151. @menu
  5152. * GNU Free Documentation License:: License for copying this manual.
  5153. @end menu
  5154. @include fdl.texi
  5155. @node Index
  5156. @unnumbered Index
  5157. @c Currently, we use only the Concept Index.
  5158. @printindex cp
  5159. @bye
  5160. Some notes:
  5161. This is an attempt to make a manual for GRUB 2. The contents are
  5162. copied from the GRUB manual in GRUB Legacy, so they are not always
  5163. appropriate yet for GRUB 2.