grub.texi 261 KB

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