grub.texi 373 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282
  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. * Modules:: Available modules
  86. * Commands:: Available builtin commands
  87. * Internationalisation:: Topics relating to language support
  88. * Security:: Authentication, authorisation, and signatures
  89. * Platform limitations:: Platform-specific limitations
  90. * Platform-specific operations:: Platform-specific operations
  91. * Supported kernels:: Supported kernels
  92. * Troubleshooting:: Error messages produced by GRUB
  93. * User-space utilities:: Usage of user-space utilities
  94. * Obtaining and Building GRUB:: How to obtain and build GRUB
  95. * Reporting bugs:: Where you should send a bug report
  96. * Future:: Some future plans on GRUB
  97. * Copying This Manual:: Copying This Manual
  98. * Index::
  99. @end menu
  100. @node Introduction
  101. @chapter Introduction to GRUB
  102. @menu
  103. * Overview:: What exactly GRUB is and how to use it
  104. * History:: From maggot to house fly
  105. * Changes from GRUB Legacy:: Differences from previous versions
  106. * Features:: GRUB features
  107. * Role of a boot loader:: The role of a boot loader
  108. @end menu
  109. @node Overview
  110. @section Overview
  111. Briefly, a @dfn{boot loader} is the first software program that runs when
  112. a computer starts. It is responsible for loading and transferring
  113. control to an operating system @dfn{kernel} software (such as Linux or
  114. GNU Mach). The kernel, in turn, initializes the rest of the operating
  115. system (e.g. a GNU system).
  116. GNU GRUB is a very powerful boot loader, which can load a wide variety
  117. of free operating systems, as well as proprietary operating systems with
  118. chain-loading@footnote{@dfn{chain-load} is the mechanism for loading
  119. unsupported operating systems by loading another boot loader. It is
  120. typically used for loading DOS or Windows.}. GRUB is designed to
  121. address the complexity of booting a personal computer; both the
  122. program and this manual are tightly bound to that computer platform,
  123. although porting to other platforms may be addressed in the future.
  124. One of the important features in GRUB is flexibility; GRUB understands
  125. filesystems and kernel executable formats, so you can load an arbitrary
  126. operating system the way you like, without recording the physical
  127. position of your kernel on the disk. Thus you can load the kernel
  128. just by specifying its file name and the drive and partition where the
  129. kernel resides.
  130. When booting with GRUB, you can use either a command-line interface
  131. (@pxref{Command-line interface}), or a menu interface (@pxref{Menu
  132. interface}). Using the command-line interface, you type the drive
  133. specification and file name of the kernel manually. In the menu
  134. interface, you just select an OS using the arrow keys. The menu is
  135. based on a configuration file which you prepare beforehand
  136. (@pxref{Configuration}). While in the menu, you can switch to the
  137. command-line mode, and vice-versa. You can even edit menu entries
  138. before using them.
  139. In the following chapters, you will learn how to specify a drive, a
  140. partition, and a file name (@pxref{Naming convention}) to GRUB, how to
  141. install GRUB on your drive (@pxref{Installation}), and how to boot your
  142. OSes (@pxref{Booting}), step by step.
  143. @node History
  144. @section History of GRUB
  145. GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
  146. Hurd with the University of Utah's Mach 4 microkernel (now known as GNU
  147. Mach). Erich and Brian Ford designed the Multiboot Specification
  148. (@pxref{Top, Multiboot Specification, Motivation, multiboot, The Multiboot
  149. Specification}), because they were determined not to add to the large
  150. number of mutually-incompatible PC boot methods.
  151. Erich then began modifying the FreeBSD boot loader so that it would
  152. understand Multiboot. He soon realized that it would be a lot easier
  153. to write his own boot loader from scratch than to keep working on the
  154. FreeBSD boot loader, and so GRUB was born.
  155. Erich added many features to GRUB, but other priorities prevented him
  156. from keeping up with the demands of its quickly-expanding user base. In
  157. 1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an
  158. official GNU package, and opened its development by making the latest
  159. sources available via anonymous CVS. @xref{Obtaining and Building
  160. GRUB}, for more information.
  161. Over the next few years, GRUB was extended to meet many needs, but it
  162. quickly became clear that its design was not keeping up with the extensions
  163. being made to it, and we reached the point where it was very difficult to
  164. make any further changes without breaking existing features. Around 2002,
  165. Yoshinori K. Okuji started work on PUPA (Preliminary Universal Programming
  166. Architecture for GNU GRUB), aiming to rewrite the core of GRUB to make it
  167. cleaner, safer, more robust, and more powerful. PUPA was eventually renamed
  168. to GRUB 2, and the original version of GRUB was renamed to GRUB Legacy.
  169. Small amounts of maintenance continued to be done on GRUB Legacy, but the
  170. last release (0.97) was made in 2005 and at the time of writing it seems
  171. unlikely that there will be another.
  172. By around 2007, GNU/Linux distributions started to use GRUB 2 to limited
  173. extents, and by the end of 2009 multiple major distributions were installing
  174. it by default.
  175. @node Changes from GRUB Legacy
  176. @section Differences from previous versions
  177. GRUB 2 is a rewrite of GRUB (@pxref{History}), although it shares many
  178. characteristics with the previous version, now known as GRUB Legacy. Users
  179. of GRUB Legacy may need some guidance to find their way around this new
  180. version.
  181. @itemize @bullet
  182. @item
  183. The configuration file has a new name (@file{grub.cfg} rather than
  184. @file{menu.lst} or @file{grub.conf}), new syntax (@pxref{Configuration}) and
  185. many new commands (@pxref{Commands}). Configuration cannot be copied over
  186. directly, although most GRUB Legacy users should not find the syntax too
  187. surprising.
  188. @item
  189. @file{grub.cfg} is typically automatically generated by
  190. @command{grub-mkconfig} (@pxref{Simple configuration}). This makes it
  191. easier to handle versioned kernel upgrades.
  192. @item
  193. Partition numbers in GRUB device names now start at 1, not 0 (@pxref{Naming
  194. convention}).
  195. @item
  196. The configuration file is now written in something closer to a full
  197. scripting language: variables, conditionals, and loops are available.
  198. @item
  199. A small amount of persistent storage is available across reboots, using the
  200. @command{save_env} and @command{load_env} commands in GRUB and the
  201. @command{grub-editenv} utility. This is not available in all configurations
  202. (@pxref{Environment block}).
  203. @item
  204. GRUB 2 has more reliable ways to find its own files and those of target
  205. kernels on multiple-disk systems, and has commands (@pxref{search}) to find
  206. devices using file system labels or Universally Unique Identifiers (UUIDs).
  207. @item
  208. GRUB 2 is available for several other types of system in addition to the PC
  209. BIOS systems supported by GRUB Legacy: PC EFI, PC coreboot, PowerPC, SPARC,
  210. and MIPS Lemote Yeeloong are all supported.
  211. @item
  212. Many more file systems are supported, including but not limited to ext4,
  213. HFS+, and NTFS.
  214. @item
  215. GRUB 2 can read files directly from LVM and RAID devices.
  216. @item
  217. A graphical terminal and a graphical menu system are available.
  218. @item
  219. GRUB 2's interface can be translated, including menu entry names.
  220. @item
  221. The image files (@pxref{Images}) that make up GRUB have been reorganised;
  222. Stage 1, Stage 1.5, and Stage 2 are no more.
  223. @item
  224. GRUB 2 puts many facilities in dynamically loaded modules, allowing the core
  225. image to be smaller, and allowing the core image to be built in more
  226. flexible ways.
  227. @end itemize
  228. @node Features
  229. @section GRUB features
  230. The primary requirement for GRUB is that it be compliant with the
  231. @dfn{Multiboot Specification}, which is described in @ref{Top, Multiboot
  232. Specification, Motivation, multiboot, The Multiboot Specification}.
  233. The other goals, listed in approximate order of importance, are:
  234. @itemize @bullet{}
  235. @item
  236. Basic functions must be straightforward for end-users.
  237. @item
  238. Rich functionality to support kernel experts and designers.
  239. @item
  240. Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and
  241. Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are
  242. supported via a chain-loading function.
  243. @end itemize
  244. Except for specific compatibility modes (chain-loading and the Linux
  245. @dfn{piggyback} format), all kernels will be started in much the same
  246. state as in the Multiboot Specification. Only kernels loaded at 1 megabyte
  247. or above are presently supported. Any attempt to load below that
  248. boundary will simply result in immediate failure and an error message
  249. reporting the problem.
  250. In addition to the requirements above, GRUB has the following features
  251. (note that the Multiboot Specification doesn't require all the features
  252. that GRUB supports):
  253. @table @asis
  254. @item Recognize multiple executable formats
  255. Support many of the @dfn{a.out} variants plus @dfn{ELF}. Symbol
  256. tables are also loaded.
  257. @item Support non-Multiboot kernels
  258. Support many of the various free 32-bit kernels that lack Multiboot
  259. compliance (primarily FreeBSD, NetBSD@footnote{The NetBSD/i386 kernel
  260. is Multiboot-compliant, but lacks support for Multiboot modules.},
  261. OpenBSD, and Linux). Chain-loading of other boot loaders is also
  262. supported.
  263. @item Load multiples modules
  264. Fully support the Multiboot feature of loading multiple modules.
  265. @item Load a configuration file
  266. Support a human-readable text configuration file with preset boot
  267. commands. You can also load another configuration file dynamically and
  268. embed a preset configuration file in a GRUB image file. The list of
  269. commands (@pxref{Commands}) are a superset of those supported on the
  270. command-line. An example configuration file is provided in
  271. @ref{Configuration}.
  272. @item Provide a menu interface
  273. A menu interface listing preset boot commands, with a programmable
  274. timeout, is available. There is no fixed limit on the number of boot
  275. entries, and the current implementation has space for several hundred.
  276. @item Have a flexible command-line interface
  277. A fairly flexible command-line interface, accessible from the menu,
  278. is available to edit any preset commands, or write a new boot command
  279. set from scratch. If no configuration file is present, GRUB drops to
  280. the command-line.
  281. The list of commands (@pxref{Commands}) are a subset of those supported
  282. for configuration files. Editing commands closely resembles the Bash
  283. command-line (@pxref{Command Line Editing, Bash, Command Line Editing,
  284. features, Bash Features}), with @key{TAB}-completion of commands,
  285. devices, partitions, and files in a directory depending on context.
  286. @item Support multiple filesystem types
  287. Support multiple filesystem types transparently, plus a useful explicit
  288. blocklist notation. The currently supported filesystem types are @dfn{Amiga
  289. Fast FileSystem (AFFS)}, @dfn{AtheOS fs}, @dfn{BeFS},
  290. @dfn{BtrFS} (including raid0, raid1, raid10, gzip and lzo),
  291. @dfn{cpio} (little- and big-endian bin, odc and newc variants),
  292. @dfn{EROFS} (only uncompressed support for now),
  293. @dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32},
  294. @dfn{exFAT}, @dfn{F2FS}, @dfn{HFS}, @dfn{HFS+},
  295. @dfn{ISO9660} (including Joliet, Rock-ridge and multi-chunk files),
  296. @dfn{JFS}, @dfn{Minix fs} (versions 1, 2 and 3), @dfn{nilfs2},
  297. @dfn{NTFS} (including compression), @dfn{ReiserFS}, @dfn{ROMFS},
  298. @dfn{Amiga Smart FileSystem (SFS)}, @dfn{Squash4}, @dfn{tar}, @dfn{UDF},
  299. @dfn{BSD UFS/UFS2}, @dfn{XFS}, and @dfn{ZFS} (including lzjb, gzip,
  300. zle, mirror, stripe, raidz1/2/3 and encryption in AES-CCM and AES-GCM).
  301. @xref{Filesystem}, for more information.
  302. @item Support automatic decompression
  303. Can decompress files which were compressed by @command{gzip} or
  304. @command{xz}@footnote{Only CRC32 data integrity check is supported (xz default
  305. is CRC64 so one should use --check=crc32 option). LZMA BCJ filters are
  306. supported.}. This function is both automatic and transparent to the user
  307. (i.e. all functions operate upon the uncompressed contents of the specified
  308. files). This greatly reduces a file size and loading time, a
  309. particularly great benefit for floppies.@footnote{There are a few
  310. pathological cases where loading a very badly organized ELF kernel might
  311. take longer, but in practice this never happen.}
  312. It is conceivable that some kernel modules should be loaded in a
  313. compressed state, so a different module-loading command can be specified
  314. to avoid uncompressing the modules.
  315. @item Access data on any installed device
  316. Support reading data from any or all floppies or hard disk(s) recognized
  317. by the BIOS, independent of the setting of the root device.
  318. @item Be independent of drive geometry translations
  319. Unlike many other boot loaders, GRUB makes the particular drive
  320. translation irrelevant. A drive installed and running with one
  321. translation may be converted to another translation without any adverse
  322. effects or changes in GRUB's configuration.
  323. @item Detect all installed @sc{ram}
  324. GRUB can generally find all the installed @sc{ram} on a PC-compatible
  325. machine. It uses an advanced BIOS query technique for finding all
  326. memory regions. As described on the Multiboot Specification (@pxref{Top,
  327. Multiboot Specification, Motivation, multiboot, The Multiboot
  328. Specification}), not all kernels make use of this information, but GRUB
  329. provides it for those who do.
  330. @item Support Logical Block Address mode
  331. In traditional disk calls (called @dfn{CHS mode}), there is a geometry
  332. translation problem, that is, the BIOS cannot access over 1024
  333. cylinders, so the accessible space is limited to at least 508 MB and to
  334. at most 8GB. GRUB can't universally solve this problem, as there is no
  335. standard interface used in all machines. However, several newer machines
  336. have the new interface, Logical Block Address (@dfn{LBA}) mode. GRUB
  337. automatically detects if LBA mode is available and uses it if
  338. available. In LBA mode, GRUB can access the entire disk.
  339. @item Support network booting
  340. GRUB is basically a disk-based boot loader but also has network
  341. support. You can load OS images from a network by using the @dfn{TFTP}
  342. protocol.
  343. @item Support remote terminals
  344. To support computers with no console, GRUB provides remote terminal
  345. support, so that you can control GRUB from a remote host. Only serial
  346. terminal support is implemented at the moment.
  347. @end table
  348. @node Role of a boot loader
  349. @section The role of a boot loader
  350. The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
  351. @quotation
  352. Some people like to acknowledge both the operating system and kernel when
  353. they talk about their computers, so they might say they use
  354. ``GNU/Linux'' or ``GNU/Hurd''. Other people seem to think that the
  355. kernel is the most important part of the system, so they like to call
  356. their GNU operating systems ``Linux systems.''
  357. I, personally, believe that this is a grave injustice, because the
  358. @emph{boot loader} is the most important software of all. I used to
  359. refer to the above systems as either ``LILO''@footnote{The LInux LOader,
  360. a boot loader that everybody uses, but nobody likes.} or ``GRUB''
  361. systems.
  362. Unfortunately, nobody ever understood what I was talking about; now I
  363. just use the word ``GNU'' as a pseudonym for GRUB.
  364. So, if you ever hear people talking about their alleged ``GNU'' systems,
  365. remember that they are actually paying homage to the best boot loader
  366. around@dots{} GRUB!
  367. @end quotation
  368. We, the GRUB maintainers, do not (usually) encourage Gordon's level of
  369. fanaticism, but it helps to remember that boot loaders deserve
  370. recognition. We hope that you enjoy using GNU GRUB as much as we did
  371. writing it.
  372. @node Naming convention
  373. @chapter Naming convention
  374. The device syntax used in GRUB is a wee bit different from what you may
  375. have seen before in your operating system(s), and you need to know it so
  376. that you can specify a drive/partition.
  377. Look at the following examples and explanations:
  378. @example
  379. (fd0)
  380. @end example
  381. First of all, GRUB requires that the device name be enclosed with
  382. @samp{(} and @samp{)}. The @samp{fd} part means that it is a floppy
  383. disk. The number @samp{0} is the drive number, which is counted from
  384. @emph{zero}. This expression means that GRUB will use the whole floppy
  385. disk.
  386. @example
  387. (hd0,msdos2)
  388. @end example
  389. Here, @samp{hd} means it is a hard disk drive. The first integer
  390. @samp{0} indicates the drive number, that is, the first hard disk,
  391. the string @samp{msdos} indicates the partition scheme, while
  392. the second integer, @samp{2}, indicates the partition number (or the
  393. @sc{pc} slice number in the BSD terminology). The partition numbers are
  394. counted from @emph{one}, not from zero (as was the case in previous
  395. versions of GRUB). This expression means the second partition of the
  396. first hard disk drive. In this case, GRUB uses one partition of the
  397. disk, instead of the whole disk.
  398. @example
  399. (hd0,msdos5)
  400. @end example
  401. This specifies the first @dfn{extended partition} of the first hard disk
  402. drive. Note that the partition numbers for extended partitions are
  403. counted from @samp{5}, regardless of the actual number of primary
  404. partitions on your hard disk.
  405. @example
  406. (hd1,msdos1,bsd1)
  407. @end example
  408. This means the BSD @samp{a} partition on first @sc{pc} slice number
  409. of the second hard disk.
  410. Of course, to actually access the disks or partitions with GRUB, you
  411. need to use the device specification in a command, like @samp{set
  412. root=(fd0)} or @samp{parttool (hd0,msdos3) hidden-}. To help you find out
  413. which number specifies a partition you want, the GRUB command-line
  414. (@pxref{Command-line interface}) options have argument
  415. completion. This means that, for example, you only need to type
  416. @example
  417. set root=(
  418. @end example
  419. followed by a @key{TAB}, and GRUB will display the list of drives,
  420. partitions, or file names. So it should be quite easy to determine the
  421. name of your target partition, even with minimal knowledge of the
  422. syntax.
  423. Note that GRUB does @emph{not} distinguish IDE from SCSI - it simply
  424. counts the drive numbers from zero, regardless of their type. Normally,
  425. any IDE drive number is less than any SCSI drive number, although that
  426. is not true if you change the boot sequence by swapping IDE and SCSI
  427. drives in your BIOS.
  428. Now the question is, how to specify a file? Again, consider an
  429. example:
  430. @example
  431. (hd0,msdos1)/vmlinuz
  432. @end example
  433. This specifies the file named @samp{vmlinuz}, found on the first
  434. partition of the first hard disk drive. Note that the argument
  435. completion works with file names, too.
  436. That was easy, admit it. Now read the next chapter, to find out how to
  437. actually install GRUB on your drive.
  438. @node OS-specific notes about grub tools
  439. @chapter OS-specific notes about grub tools
  440. On OS which have device nodes similar to Unix-like OS GRUB tools use the
  441. OS name. E.g. for GNU/Linux:
  442. @example
  443. # @kbd{grub-install /dev/sda}
  444. @end example
  445. On AROS we use another syntax. For volumes:
  446. @example
  447. //:<volume name>
  448. @end example
  449. E.g.
  450. @example
  451. //:DH0
  452. @end example
  453. For disks we use syntax:
  454. @example
  455. //:<driver name>/unit/flags
  456. @end example
  457. E.g.
  458. @example
  459. # @kbd{grub-install //:ata.device/0/0}
  460. @end example
  461. On Windows we use UNC path. For volumes it's typically
  462. @example
  463. \\?\Volume@{<GUID>@}
  464. \\?\<drive letter>:
  465. @end example
  466. E.g.
  467. @example
  468. \\?\Volume@{17f34d50-cf64-4b02-800e-51d79c3aa2ff@}
  469. \\?\C:
  470. @end example
  471. For disks it's
  472. @example
  473. \\?\PhysicalDrive<number>
  474. @end example
  475. E.g.
  476. @example
  477. # @kbd{grub-install \\?\PhysicalDrive0}
  478. @end example
  479. Beware that you may need to further escape the backslashes depending on your
  480. shell.
  481. When compiled with cygwin support then cygwin drive names are automatically
  482. when needed. E.g.
  483. @example
  484. # @kbd{grub-install /dev/sda}
  485. @end example
  486. @node Installation
  487. @chapter Installation
  488. In order to install GRUB as your boot loader, you need to first
  489. install the GRUB system and utilities under your UNIX-like operating
  490. system (@pxref{Obtaining and Building GRUB}). You can do this either
  491. from the source tarball, or as a package for your OS.
  492. After you have done that, you need to install the boot loader on a
  493. drive (floppy or hard disk) by using the utility
  494. @command{grub-install} (@pxref{Invoking grub-install}) on a UNIX-like OS.
  495. GRUB comes with boot images, which are normally put in the directory
  496. @file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines
  497. @file{/usr/lib/grub/i386-pc}). Hereafter, the directory where GRUB images are
  498. initially placed (normally @file{/usr/lib/grub/<cpu>-<platform>}) will be
  499. called the @dfn{image directory}, and the directory where the boot
  500. loader needs to find them (usually @file{/boot}) will be called
  501. the @dfn{boot directory}.
  502. @menu
  503. * Installing GRUB using grub-install::
  504. * Making a GRUB bootable CD-ROM::
  505. * Device map::
  506. * BIOS installation::
  507. @end menu
  508. @node Installing GRUB using grub-install
  509. @section Installing GRUB using grub-install
  510. For information on where GRUB should be installed on PC BIOS platforms,
  511. @pxref{BIOS installation}.
  512. In order to install GRUB under a UNIX-like OS (such
  513. as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking
  514. grub-install}) as the superuser (@dfn{root}).
  515. The usage is basically very simple. You only need to specify one
  516. argument to the program, namely, where to install the boot loader. The
  517. argument has to be either a device file (like @samp{/dev/hda}).
  518. For example, under Linux the following will install GRUB into the MBR
  519. of the first IDE disk:
  520. @example
  521. # @kbd{grub-install /dev/sda}
  522. @end example
  523. Likewise, under GNU/Hurd, this has the same effect:
  524. @example
  525. # @kbd{grub-install /dev/hd0}
  526. @end example
  527. But all the above examples assume that GRUB should put images under
  528. the @file{/boot} directory. If you want GRUB to put images under a directory
  529. other than @file{/boot}, you need to specify the option
  530. @option{--boot-directory}. The typical usage is that you create a GRUB
  531. boot floppy with a filesystem. Here is an example:
  532. @example
  533. @group
  534. # @kbd{mke2fs /dev/fd0}
  535. # @kbd{mount -t ext2 /dev/fd0 /mnt}
  536. # @kbd{mkdir /mnt/boot}
  537. # @kbd{grub-install --boot-directory=/mnt/boot /dev/fd0}
  538. # @kbd{umount /mnt}
  539. @end group
  540. @end example
  541. Some BIOSes have a bug of exposing the first partition of a USB drive as a
  542. floppy instead of exposing the USB drive as a hard disk (they call it
  543. ``USB-FDD'' boot). In such cases, you need to install like this:
  544. @example
  545. # @kbd{losetup /dev/loop0 /dev/sdb1}
  546. # @kbd{mount /dev/loop0 /mnt/usb}
  547. # @kbd{grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0}
  548. @end example
  549. This install doesn't conflict with standard install as long as they are in
  550. separate directories.
  551. On EFI systems for fixed disk install you have to mount EFI System Partition.
  552. If you mount it at @file{/boot/efi} then you don't need any special arguments:
  553. @example
  554. # @kbd{grub-install}
  555. @end example
  556. Otherwise you need to specify where your EFI System partition is mounted:
  557. @example
  558. # @kbd{grub-install --efi-directory=/mnt/efi}
  559. @end example
  560. For removable installs you have to use @option{--removable} and specify both
  561. @option{--boot-directory} and @option{--efi-directory}:
  562. @example
  563. # @kbd{grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable}
  564. @end example
  565. @node Making a GRUB bootable CD-ROM
  566. @section Making a GRUB bootable CD-ROM
  567. GRUB supports the @dfn{no emulation mode} in the El Torito
  568. specification@footnote{El Torito is a specification for bootable CD
  569. using BIOS functions.}. This means that you can use the whole CD-ROM
  570. from GRUB and you don't have to make a floppy or hard disk image file,
  571. which can cause compatibility problems.
  572. For booting from a CD-ROM, GRUB uses a special image called
  573. @file{cdboot.img}, which is concatenated with @file{core.img}. The
  574. @file{core.img} used for this should be built with at least the
  575. @samp{iso9660} and @samp{biosdisk} modules. Your bootable CD-ROM will
  576. usually also need to include a configuration file @file{grub.cfg} and some
  577. other GRUB modules.
  578. To make a simple generic GRUB rescue CD, you can use the
  579. @command{grub-mkrescue} program (@pxref{Invoking grub-mkrescue}):
  580. @example
  581. $ @kbd{grub-mkrescue -o grub.iso}
  582. @end example
  583. You will often need to include other files in your image. To do this, first
  584. make a top directory for the bootable image, say, @samp{iso}:
  585. @example
  586. $ @kbd{mkdir iso}
  587. @end example
  588. Make a directory for GRUB:
  589. @example
  590. $ @kbd{mkdir -p iso/boot/grub}
  591. @end example
  592. If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub}
  593. (@pxref{Configuration}), and copy any files and directories for the disc to the
  594. directory @file{iso/}.
  595. Finally, make the image:
  596. @example
  597. $ @kbd{grub-mkrescue -o grub.iso iso}
  598. @end example
  599. This produces a file named @file{grub.iso}, which then can be burned
  600. into a CD (or a DVD), or written to a USB mass storage device.
  601. The root device will be set up appropriately on entering your
  602. @file{grub.cfg} configuration file, so you can refer to file names on the CD
  603. without needing to use an explicit device name. This makes it easier to
  604. produce rescue images that will work on both optical drives and USB mass
  605. storage devices.
  606. @node Device map
  607. @section The map between BIOS drives and OS devices
  608. If the device map file exists, the GRUB utilities (@command{grub-probe},
  609. etc.) read it to map BIOS drives to OS devices. This file consists of lines
  610. like this:
  611. @example
  612. (@var{device}) @var{file}
  613. @end example
  614. @var{device} is a drive specified in the GRUB syntax (@pxref{Device
  615. syntax}), and @var{file} is an OS file, which is normally a device file.
  616. Historically, the device map file was used because GRUB device names had to
  617. be used in the configuration file, and they were derived from BIOS drive
  618. numbers. The map between BIOS drives and OS devices cannot always be
  619. guessed correctly: for example, GRUB will get the order wrong if you
  620. exchange the boot sequence between IDE and SCSI in your BIOS.
  621. Unfortunately, even OS device names are not always stable. Modern versions
  622. of the Linux kernel may probe drives in a different order from boot to boot,
  623. and the prefix (@file{/dev/hd*} versus @file{/dev/sd*}) may change depending
  624. on the driver subsystem in use. As a result, the device map file required
  625. frequent editing on some systems.
  626. GRUB avoids this problem nowadays by using UUIDs or file system labels when
  627. generating @file{grub.cfg}, and we advise that you do the same for any
  628. custom menu entries you write. If the device map file does not exist, then
  629. the GRUB utilities will assume a temporary device map on the fly. This is
  630. often good enough, particularly in the common case of single-disk systems.
  631. However, the device map file is not entirely obsolete yet, and it is
  632. used for overriding when current environment is different from the one on boot.
  633. Most common case is if you use a partition or logical volume as a disk for
  634. virtual machine. You can put any comments in the file if needed,
  635. as the GRUB utilities assume that a line is just a comment if
  636. the first character is @samp{#}.
  637. @node BIOS installation
  638. @section BIOS installation
  639. @heading MBR
  640. The partition table format traditionally used on PC BIOS platforms is called
  641. the Master Boot Record (MBR) format; this is the format that allows up to
  642. four primary partitions and additional logical partitions. With this
  643. partition table format, there are two ways to install GRUB: it can be
  644. embedded in the area between the MBR and the first partition (called by
  645. various names, such as the "boot track", "MBR gap", or "embedding area", and
  646. which is usually at least 1000 KiB), or the core image can be installed in a
  647. file system and a list of the blocks that make it up can be stored in the
  648. first sector of that partition.
  649. Modern tools usually leave MBR gap of at least 1023 KiB. This amount is
  650. sufficient to cover most configurations. Hence this value is recommended
  651. by the GRUB team.
  652. Historically many tools left only 31 KiB of space. This is not enough to
  653. parse reliably difficult structures like Btrfs, ZFS, RAID or LVM, or to
  654. use difficult disk access methods like ahci. Hence GRUB will warn if attempted
  655. to install into small MBR gap except in a small number of configurations
  656. that were grandfathered. The grandfathered config must:
  657. @itemize @bullet
  658. @item
  659. use biosdisk as disk access module for @file{/boot}
  660. @item
  661. not use any additional partition maps to access @file{/boot}
  662. @item
  663. @file{/boot} must be on one of following filesystems:
  664. AFFS, AFS, BFS, cpio, newc, odc, ext2/3/4, FAT, exFAT,
  665. F2FS, HFS, uncompressed HFS+, ISO9660, JFS, Minix, Minix2, Minix3, NILFS2,
  666. NTFS, ReiserFS, ROMFS, SFS, tar, UDF, UFS1, UFS2, XFS
  667. @end itemize
  668. MBR gap has few technical problems. There is no way to reserve space in
  669. the embedding area with complete safety, and some proprietary software is
  670. known to use it to make it difficult for users to work around licensing
  671. restrictions. GRUB works around it by detecting sectors by other software and
  672. avoiding them and protecting its own sectors using Reed-Solomon encoding.
  673. GRUB team recommends having MBR gap of at least 1000 KiB.
  674. Should it not be possible, GRUB has support for a fallback solution which is
  675. heavily recommended against. Installing to a filesystem means that GRUB is
  676. vulnerable to its blocks being moved around by filesystem features such as
  677. tail packing, or even by aggressive fsck implementations, so this approach
  678. is quite fragile; and this approach can only be used if the @file{/boot}
  679. filesystem is on the same disk that the BIOS boots from, so that GRUB does
  680. not have to rely on guessing BIOS drive numbers.
  681. The GRUB development team generally recommends embedding GRUB before the
  682. first partition, unless you have special requirements. You must ensure that
  683. the first partition starts at least 1000 KiB (2000 sectors) from the start of
  684. the disk; on modern disks, it is often a performance advantage to align
  685. partitions on larger boundaries anyway, so the first partition might start 1
  686. MiB from the start of the disk.
  687. @heading GPT
  688. Some newer systems use the GUID Partition Table (GPT) format. This was
  689. specified as part of the Extensible Firmware Interface (EFI), but it can
  690. also be used on BIOS platforms if system software supports it; for example,
  691. GRUB and GNU/Linux can be used in this configuration. With this format, it
  692. is possible to reserve a whole partition for GRUB, called the BIOS Boot
  693. Partition. GRUB can then be embedded into that partition without the risk
  694. of being overwritten by other software and without being contained in a
  695. filesystem which might move its blocks around.
  696. When creating a BIOS Boot Partition on a GPT system, you should make sure
  697. that it is at least 31 KiB in size. (GPT-formatted disks are not usually
  698. particularly small, so we recommend that you make it larger than the bare
  699. minimum, such as 1 MiB, to allow plenty of room for growth.) You must also
  700. make sure that it has the proper partition type. Using GNU Parted, you can
  701. set this using a command such as the following:
  702. @example
  703. # @kbd{parted /dev/@var{disk} set @var{partition-number} bios_grub on}
  704. @end example
  705. If you are using gdisk, set the partition type to @samp{0xEF02}. With
  706. partitioning programs that require setting the GUID directly, it should be
  707. @samp{21686148-6449-6e6f-744e656564454649}.
  708. @strong{Caution:} Be very careful which partition you select! When GRUB
  709. finds a BIOS Boot Partition during installation, it will automatically
  710. overwrite part of it. Make sure that the partition does not contain any
  711. other data.
  712. @node Booting
  713. @chapter Booting
  714. GRUB can load Multiboot-compliant kernels in a consistent way,
  715. but for some free operating systems you need to use some OS-specific
  716. magic.
  717. @menu
  718. * General boot methods:: How to boot OSes with GRUB generally
  719. * Loopback booting:: Notes on booting from loopbacks
  720. * LVM cache booting:: Notes on booting from LVM cache logical volume
  721. * OS-specific notes:: Notes on some operating systems
  722. @end menu
  723. @node General boot methods
  724. @section How to boot operating systems
  725. GRUB has three distinct boot methods: loading an operating system
  726. directly, using kexec from userspace, and chainloading another
  727. bootloader. Generally speaking, the first two are more desirable
  728. because you don't need to install or maintain other boot loaders and
  729. GRUB is flexible enough to load an operating system from an arbitrary
  730. disk/partition. However, chainloading is sometimes required, as GRUB
  731. doesn't support all existing operating systems natively.
  732. @menu
  733. * Loading an operating system directly::
  734. * Kexec::
  735. * Chain-loading::
  736. @end menu
  737. @node Loading an operating system directly
  738. @subsection How to boot an OS directly with GRUB
  739. Multiboot (@pxref{Top, Multiboot Specification, Motivation, multiboot,
  740. The Multiboot Specification}) is the native format supported by GRUB.
  741. For the sake of convenience, there is also support for Linux, FreeBSD,
  742. NetBSD and OpenBSD. If you want to boot other operating systems, you
  743. will have to chain-load them (@pxref{Chain-loading}).
  744. FIXME: this section is incomplete.
  745. @enumerate
  746. @item
  747. Run the command @command{boot} (@pxref{boot}).
  748. @end enumerate
  749. However, DOS and Windows have some deficiencies, so you might have to
  750. use more complicated instructions. @xref{DOS/Windows}, for more
  751. information.
  752. @node Kexec
  753. @subsection Kexec with grub2-emu
  754. GRUB can be run in userspace by invoking the grub2-emu tool. It will
  755. read all configuration scripts as if booting directly (see @ref{Loading
  756. an operating system directly}). With the @code{--kexec} flag, and
  757. kexec(8) support from the operating system, the @command{linux} command
  758. will directly boot the target image. For systems that lack working
  759. systemctl(1) support for kexec, passing the @code{--kexec} flag twice
  760. will fallback to invoking kexec(8) directly; note however that this
  761. fallback may be unsafe outside read-only environments, as it does not
  762. invoke shutdown machinery.
  763. @node Chain-loading
  764. @subsection Chain-loading an OS
  765. Operating systems that do not support Multiboot and do not have specific
  766. support in GRUB (specific support is available for Linux, FreeBSD, NetBSD
  767. and OpenBSD) must be chain-loaded, which involves loading another boot
  768. loader and jumping to it in real mode or via the firmware.
  769. The @command{chainloader} command (@pxref{chainloader}) is used to set this
  770. up. It is normally also necessary to load some GRUB modules and set the
  771. appropriate root device. Putting this together, we get something like this,
  772. for a Windows system on the first partition of the first hard disk:
  773. @verbatim
  774. menuentry "Windows" {
  775. insmod chain
  776. insmod ntfs
  777. set root=(hd0,1)
  778. chainloader +1
  779. }
  780. @end verbatim
  781. @c FIXME: document UUIDs.
  782. On systems with multiple hard disks, an additional workaround may be
  783. required. @xref{DOS/Windows}.
  784. Chain-loading is only supported on PC BIOS and EFI platforms.
  785. @node Loopback booting
  786. @section Loopback booting
  787. GRUB is able to read from an image (be it one of CD or HDD) stored on
  788. any of its accessible storages (refer to @pxref{loopback} command).
  789. However the OS itself should be able to find its root. This usually
  790. involves running a userspace program running before the real root
  791. is discovered. This is achieved by GRUB loading a specially made
  792. small image and passing it as ramdisk to the kernel. This is achieved
  793. by commands @command{kfreebsd_module}, @command{knetbsd_module_elf},
  794. @command{kopenbsd_ramdisk}, @command{initrd} (@pxref{initrd}),
  795. @command{initrd16} (@pxref{initrd16}), @command{multiboot_module},
  796. @command{multiboot2_module} or @command{xnu_ramdisk}
  797. depending on the loader. Note that for knetbsd the image must be put
  798. inside miniroot.kmod and the whole miniroot.kmod has to be loaded. In
  799. kopenbsd payload this is disabled by default. Additionally, behaviour of
  800. initial ramdisk depends on command line options. Several distributors provide
  801. the image for this purpose or it's integrated in their standard ramdisk and
  802. activated by special option. Consult your kernel and distribution manual for
  803. more details. Other loaders like @command{appleloader}, @command{chainloader}
  804. (BIOS, EFI, coreboot), @command{freedos}, @command{ntldr}, @command{plan9}
  805. and @command{truecrypt} provide no possibility of loading initial ramdisk and
  806. as far as author is aware the payloads in question don't support either initial
  807. ramdisk or discovering loopback boot in other way and as such not bootable this
  808. way. Please consider alternative boot methods like copying all files
  809. from the image to actual partition. Consult your OS documentation for
  810. more details.
  811. @node LVM cache booting
  812. @section Booting from LVM cache logical volume
  813. The LVM cache logical volume is the logical volume consisting of the original
  814. and the cache pool logical volume. The original is usually on a larger and
  815. slower storage device while the cache pool is on a smaller and faster one. The
  816. performance of the original volume can be improved by storing the frequently
  817. used data on the cache pool to utilize the greater performance of faster
  818. device.
  819. GRUB boots from LVM cache logical volume merely by reading it's original
  820. logical volume so that dirty data in cache pool volume is disregarded. This is
  821. not a problem for "writethrough" cache mode as it ensures that any data written
  822. will be stored both on the cache and the origin LV. For the other cache mode
  823. "writeback", which delays writing from the cache pool back to the origin LV to
  824. boost performance, GRUB may fail to boot in the wake of accidental power outage
  825. due to it's inability to assemble the cache device for reading the required
  826. dirty data left behind. The situation will be improved after adding full
  827. support to the LVM cache logical volume in the future.
  828. @node OS-specific notes
  829. @section Some caveats on OS-specific issues
  830. Here, we describe some caveats on several operating systems.
  831. @menu
  832. * GNU/Hurd::
  833. * GNU/Linux::
  834. * NetBSD::
  835. * DOS/Windows::
  836. @end menu
  837. @node GNU/Hurd
  838. @subsection GNU/Hurd
  839. Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is
  840. nothing special about it. But do not forget that you have to specify a
  841. root partition to the kernel.
  842. @enumerate
  843. @item
  844. Set GRUB's root device to the same drive as GNU/Hurd's. The command
  845. @code{search --set=root --file /boot/gnumach.gz} or similar may help you
  846. (@pxref{search}).
  847. @item
  848. Load the kernel and the modules, like this:
  849. @example
  850. @group
  851. grub> @kbd{multiboot /boot/gnumach.gz root=device:hd0s1}
  852. grub> @kbd{module /hurd/ext2fs.static ext2fs --readonly \
  853. --multiboot-command-line='$@{kernel-command-line@}' \
  854. --host-priv-port='$@{host-port@}' \
  855. --device-master-port='$@{device-port@}' \
  856. --exec-server-task='$@{exec-task@}' -T typed '$@{root@}' \
  857. '$(task-create)' '$(task-resume)'}
  858. grub> @kbd{module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'}
  859. @end group
  860. @end example
  861. @item
  862. Finally, run the command @command{boot} (@pxref{boot}).
  863. @end enumerate
  864. @node GNU/Linux
  865. @subsection GNU/Linux
  866. It is relatively easy to boot GNU/Linux from GRUB, because it somewhat
  867. resembles to boot a Multiboot-compliant OS.
  868. @enumerate
  869. @item
  870. Set GRUB's root device to the same drive as GNU/Linux's. The command
  871. @code{search --set=root --file /vmlinuz} or similar may help you
  872. (@pxref{search}).
  873. @item
  874. Load the kernel using the command @command{linux} (@pxref{linux}):
  875. @example
  876. grub> @kbd{linux /vmlinuz root=/dev/sda1}
  877. @end example
  878. If you need to specify some kernel parameters, just append them to the
  879. command. For example, to set @option{acpi} to @samp{off}, do this:
  880. @example
  881. grub> @kbd{linux /vmlinuz root=/dev/sda1 acpi=off}
  882. @end example
  883. See the documentation in the Linux source tree for complete information on
  884. the available options.
  885. With @command{linux} GRUB uses 32-bit protocol. Some BIOS services like APM
  886. or EDD aren't available with this protocol. In this case you need to use
  887. @command{linux16}
  888. @example
  889. grub> @kbd{linux16 /vmlinuz root=/dev/sda1 acpi=off}
  890. @end example
  891. @item
  892. If you use an initrd, execute the command @command{initrd} (@pxref{initrd})
  893. after @command{linux}:
  894. @example
  895. grub> @kbd{initrd /initrd}
  896. @end example
  897. If you used @command{linux16} you need to use @command{initrd16}:
  898. @example
  899. grub> @kbd{initrd16 /initrd}
  900. @end example
  901. @item
  902. Finally, run the command @command{boot} (@pxref{boot}).
  903. @end enumerate
  904. @node NetBSD
  905. @subsection NetBSD
  906. Booting a NetBSD kernel from GRUB is also relatively easy: first set
  907. GRUB's root device, then load the kernel and the modules, and finally
  908. run @command{boot}.
  909. @enumerate
  910. @item
  911. Set GRUB's root device to the partition holding the NetBSD root file
  912. system. For a disk with a NetBSD disk label, this is usually the first
  913. partition (a:). In that case, and assuming that the partition is on the
  914. first hard disk, set GRUB's root device as follows:
  915. @example
  916. grub> @kbd{insmod part_bsd}
  917. grub> @kbd{set root=(hd0,netbsd1)}
  918. @end example
  919. For a disk with a GUID Partition Table (GPT), and assuming that the
  920. NetBSD root partition is the third GPT partition, do this:
  921. @example
  922. grub> @kbd{insmod part_gpt}
  923. grub> @kbd{set root=(hd0,gpt3)}
  924. @end example
  925. @item
  926. Load the kernel using the command @command{knetbsd}:
  927. @example
  928. grub> @kbd{knetbsd /netbsd}
  929. @end example
  930. Various options may be given to @command{knetbsd}. These options are,
  931. for the most part, the same as in the NetBSD boot loader. For instance,
  932. to boot the system in single-user mode and with verbose messages, do
  933. this:
  934. @example
  935. grub> @kbd{knetbsd /netbsd -s -v}
  936. @end example
  937. @item
  938. If needed, load kernel modules with the command
  939. @command{knetbsd_module_elf}. A typical example is the module for the
  940. root file system:
  941. @example
  942. grub> @kbd{knetbsd_module_elf /stand/amd64/6.0/modules/ffs/ffs.kmod}
  943. @end example
  944. @item
  945. Finally, run the command @command{boot} (@pxref{boot}).
  946. @end enumerate
  947. @node DOS/Windows
  948. @subsection DOS/Windows
  949. GRUB cannot boot DOS or Windows directly, so you must chain-load them
  950. (@pxref{Chain-loading}). However, their boot loaders have some critical
  951. deficiencies, so it may not work to just chain-load them. To overcome
  952. the problems, GRUB provides you with two helper functions.
  953. If you have installed DOS (or Windows) on a non-first hard disk, you
  954. have to use the disk swapping technique, because that OS cannot boot
  955. from any disks but the first one. The workaround used in GRUB is the
  956. command @command{drivemap} (@pxref{drivemap}), like this:
  957. @example
  958. drivemap -s (hd0) (hd1)
  959. @end example
  960. This performs a @dfn{virtual} swap between your first and second hard
  961. drive.
  962. @strong{Caution:} This is effective only if DOS (or Windows) uses BIOS
  963. to access the swapped disks. If that OS uses a special driver for the
  964. disks, this probably won't work.
  965. Another problem arises if you installed more than one set of DOS/Windows
  966. onto one disk, because they could be confused if there are more than one
  967. primary partitions for DOS/Windows. Certainly you should avoid doing
  968. this, but there is a solution if you do want to do so. Use the partition
  969. hiding/unhiding technique.
  970. If GRUB @dfn{hides} a DOS (or Windows) partition (@pxref{parttool}), DOS (or
  971. Windows) will ignore the partition. If GRUB @dfn{unhides} a DOS (or Windows)
  972. partition, DOS (or Windows) will detect the partition. Thus, if you have
  973. installed DOS (or Windows) on the first and the second partition of the
  974. first hard disk, and you want to boot the copy on the first partition, do
  975. the following:
  976. @example
  977. @group
  978. parttool (hd0,1) hidden-
  979. parttool (hd0,2) hidden+
  980. set root=(hd0,1)
  981. chainloader +1
  982. parttool @verb{'${root}'} boot+
  983. boot
  984. @end group
  985. @end example
  986. @node Configuration
  987. @chapter Writing your own configuration file
  988. GRUB is configured using @file{grub.cfg}, usually located under
  989. @file{/boot/grub}. This file is quite flexible, but most users will not
  990. need to write the whole thing by hand.
  991. @menu
  992. * Simple configuration:: Recommended for most users
  993. * Root Identification Heuristics:: Summary on how the root file system is identified.
  994. * Shell-like scripting:: For power users and developers
  995. * Multi-boot manual config:: For non-standard multi-OS scenarios
  996. * Embedded configuration:: Embedding a configuration file into GRUB
  997. @end menu
  998. @node Simple configuration
  999. @section Simple configuration handling
  1000. The program @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig})
  1001. generates @file{grub.cfg} files suitable for most cases. It is suitable for
  1002. use when upgrading a distribution, and will discover available kernels and
  1003. attempt to generate menu entries for them.
  1004. @command{grub-mkconfig} does have some limitations. While adding extra
  1005. custom menu entries to the end of the list can be done by editing
  1006. @file{/etc/grub.d/40_custom} or creating @file{/boot/grub/custom.cfg},
  1007. changing the order of menu entries or changing their titles may require
  1008. making complex changes to shell scripts stored in @file{/etc/grub.d/}. This
  1009. may be improved in the future. In the meantime, those who feel that it
  1010. would be easier to write @file{grub.cfg} directly are encouraged to do so
  1011. (@pxref{Booting}, and @ref{Shell-like scripting}), and to disable any system
  1012. provided by their distribution to automatically run @command{grub-mkconfig}.
  1013. The file @file{/etc/default/grub} controls the operation of
  1014. @command{grub-mkconfig}. It is sourced by a shell script, and so must be
  1015. valid POSIX shell input; normally, it will just be a sequence of
  1016. @samp{KEY=value} lines, but if the value contains spaces or other special
  1017. characters then it must be quoted. For example:
  1018. @example
  1019. GRUB_TERMINAL_INPUT="console serial"
  1020. @end example
  1021. Valid keys in @file{/etc/default/grub} are as follows:
  1022. @table @samp
  1023. @item GRUB_DEFAULT
  1024. The default menu entry. This may be a number, in which case it identifies
  1025. the Nth entry in the generated menu counted from zero, or the title of a
  1026. menu entry, or the special string @samp{saved}. Using the id may be
  1027. useful if you want to set a menu entry as the default even though there may
  1028. be a variable number of entries before it.
  1029. For example, if you have:
  1030. @verbatim
  1031. menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
  1032. ...
  1033. }
  1034. @end verbatim
  1035. then you can make this the default using:
  1036. @example
  1037. GRUB_DEFAULT=example-gnu-linux
  1038. @end example
  1039. Previously it was documented the way to use entry title. While this still
  1040. works it's not recommended since titles often contain unstable device names
  1041. and may be translated
  1042. If you set this to @samp{saved}, then the default menu entry will be that
  1043. saved by @samp{GRUB_SAVEDEFAULT} or @command{grub-set-default}. This relies on
  1044. the environment block, which may not be available in all situations
  1045. (@pxref{Environment block}).
  1046. The default is @samp{0}.
  1047. @item GRUB_SAVEDEFAULT
  1048. If this option is set to @samp{true}, then, when an entry is selected, save
  1049. it as a new default entry for use by future runs of GRUB. This is only
  1050. useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
  1051. @samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
  1052. @command{grub-set-default}. Unset by default.
  1053. This option relies on the environment block, which may not be available in
  1054. all situations (@pxref{Environment block}).
  1055. @item GRUB_TIMEOUT
  1056. Boot the default entry this many seconds after the menu is displayed, unless
  1057. a key is pressed. The default is @samp{5}. Set to @samp{0} to boot
  1058. immediately without displaying the menu, or to @samp{-1} to wait
  1059. indefinitely.
  1060. If @samp{GRUB_TIMEOUT_STYLE} is set to @samp{countdown} or @samp{hidden},
  1061. the timeout is instead counted before the menu is displayed.
  1062. @item GRUB_TIMEOUT_STYLE
  1063. If this option is unset or set to @samp{menu}, then GRUB will display the
  1064. menu and then wait for the timeout set by @samp{GRUB_TIMEOUT} to expire
  1065. before booting the default entry. Pressing a key interrupts the timeout.
  1066. If this option is set to @samp{countdown} or @samp{hidden}, then, before
  1067. displaying the menu, GRUB will wait for the timeout set by @samp{GRUB_TIMEOUT}
  1068. to expire. If @key{ESC} or @key{F4} are pressed, or @key{SHIFT} is held down
  1069. during that time, it will display the menu and wait for input. If a hotkey
  1070. associated with a menu entry is pressed, it will boot the associated menu entry
  1071. immediately. If the timeout expires before either of these happens, it will
  1072. boot the default entry. In the @samp{countdown} case, it will show a one-line
  1073. indication of the remaining time.
  1074. @item GRUB_DEFAULT_BUTTON
  1075. @itemx GRUB_TIMEOUT_BUTTON
  1076. @itemx GRUB_TIMEOUT_STYLE_BUTTON
  1077. @itemx GRUB_BUTTON_CMOS_ADDRESS
  1078. Variants of the corresponding variables without the @samp{_BUTTON} suffix,
  1079. used to support vendor-specific power buttons. @xref{Vendor power-on keys}.
  1080. @item GRUB_DISTRIBUTOR
  1081. Set by distributors of GRUB to their identifying name. This is used to
  1082. generate more informative menu entry titles.
  1083. @item GRUB_TERMINAL_INPUT
  1084. Select the terminal input device. You may select multiple devices here,
  1085. separated by spaces.
  1086. Valid terminal input names depend on the platform, but may include
  1087. @samp{console} (native platform console), @samp{serial} (serial terminal),
  1088. @samp{serial_<port>} (serial terminal with explicit port selection),
  1089. @samp{at_keyboard} (PC AT keyboard), or @samp{usb_keyboard} (USB keyboard
  1090. using the HID Boot Protocol, for cases where the firmware does not handle
  1091. this).
  1092. The default is to use the platform's native terminal input.
  1093. @item GRUB_TERMINAL_OUTPUT
  1094. Select the terminal output device. You may select multiple devices here,
  1095. separated by spaces.
  1096. Valid terminal output names depend on the platform, but may include
  1097. @samp{console} (native platform console), @samp{serial} (serial terminal),
  1098. @samp{serial_<port>} (serial terminal with explicit port selection),
  1099. @samp{gfxterm} (graphics-mode output), @samp{vga_text} (VGA text output),
  1100. @samp{mda_text} (MDA text output), @samp{morse} (Morse-coding using system
  1101. beeper) or @samp{spkmodem} (simple data protocol using system speaker).
  1102. @samp{spkmodem} is useful when no serial port is available. Connect the output
  1103. of sending system (where GRUB is running) to line-in of receiving system
  1104. (usually developer machine).
  1105. On receiving system compile @samp{spkmodem-recv} from
  1106. @samp{util/spkmodem-recv.c} and run:
  1107. @example
  1108. parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv
  1109. @end example
  1110. The default is to use the platform's native terminal output.
  1111. @item GRUB_TERMINAL
  1112. If this option is set, it overrides both @samp{GRUB_TERMINAL_INPUT} and
  1113. @samp{GRUB_TERMINAL_OUTPUT} to the same value.
  1114. @item GRUB_SERIAL_COMMAND
  1115. A command to configure the serial port when using the serial console.
  1116. @xref{serial}. Defaults to @samp{serial}.
  1117. @item GRUB_CMDLINE_LINUX
  1118. Command-line arguments to add to menu entries for the Linux kernel.
  1119. @item GRUB_CMDLINE_LINUX_DEFAULT
  1120. Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu
  1121. entries will be generated for each Linux kernel: one default entry and one
  1122. entry for recovery mode. This option lists command-line arguments to add
  1123. only to the default menu entry, after those listed in
  1124. @samp{GRUB_CMDLINE_LINUX}.
  1125. @item GRUB_CMDLINE_LINUX_RECOVERY
  1126. Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu
  1127. entries will be generated for each Linux kernel: one default entry and one
  1128. entry for recovery mode. This option lists command-line arguments to add
  1129. only to the recovery menu entry, before those listed in @samp{GRUB_CMDLINE_LINUX}.
  1130. The default is @samp{single}.
  1131. @item GRUB_CMDLINE_NETBSD
  1132. @itemx GRUB_CMDLINE_NETBSD_DEFAULT
  1133. As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
  1134. NetBSD.
  1135. @item GRUB_CMDLINE_GNUMACH
  1136. As @samp{GRUB_CMDLINE_LINUX}, but for GNU Mach.
  1137. @item GRUB_CMDLINE_XEN
  1138. @itemx GRUB_CMDLINE_XEN_DEFAULT
  1139. The values of these options are passed to Xen hypervisor Xen menu entries,
  1140. for all respectively normal entries.
  1141. @item GRUB_CMDLINE_LINUX_XEN_REPLACE
  1142. @item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
  1143. The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
  1144. and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
  1145. @item GRUB_TOP_LEVEL
  1146. @item GRUB_TOP_LEVEL_XEN
  1147. This option should be an absolute path to a kernel image. If provided, the
  1148. image specified will be made the top-level entry if it is found in the scan.
  1149. @item GRUB_TOP_LEVEL_OS_PROBER
  1150. This option should be a line of output from @command{os-prober}. As
  1151. @samp{GRUB_TOP_LEVEL}, if provided, the image specified will be made the
  1152. top-level entry if it is found in the scan.
  1153. @item GRUB_EARLY_INITRD_LINUX_CUSTOM
  1154. @itemx GRUB_EARLY_INITRD_LINUX_STOCK
  1155. List of space-separated early initrd images to be loaded from @samp{/boot}.
  1156. This is for loading things like CPU microcode, firmware, ACPI tables, crypto
  1157. keys, and so on. These early images will be loaded in the order declared,
  1158. and all will be loaded before the actual functional initrd image.
  1159. @samp{GRUB_EARLY_INITRD_LINUX_STOCK} is for your distribution to declare
  1160. images that are provided by the distribution. It should not be modified
  1161. without understanding the consequences. They will be loaded first.
  1162. @samp{GRUB_EARLY_INITRD_LINUX_CUSTOM} is for your custom created images.
  1163. The default stock images are as follows, though they may be overridden by
  1164. your distribution:
  1165. @example
  1166. intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode.cpio
  1167. @end example
  1168. @item GRUB_DISABLE_LINUX_UUID
  1169. Normally, @command{grub-mkconfig} will generate menu entries that use
  1170. universally-unique identifiers (UUIDs) to identify the root filesystem to
  1171. the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
  1172. usually more reliable, but in some cases it may not be appropriate. To
  1173. disable the use of UUIDs, set this option to @samp{true}.
  1174. @item GRUB_DISABLE_LINUX_PARTUUID
  1175. If @command{grub-mkconfig} cannot identify the root filesystem via its
  1176. universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID
  1177. of the partition containing the filesystem to identify the root filesystem to
  1178. the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not
  1179. as reliable as using the filesystem UUID, but is more reliable than using the
  1180. Linux device names. When @samp{GRUB_DISABLE_LINUX_PARTUUID} is set to
  1181. @samp{false}, the Linux kernel version must be 2.6.37 (3.10 for systems using
  1182. the MSDOS partition scheme) or newer. This option defaults to @samp{true}. To
  1183. enable the use of partition UUIDs, set this option to @samp{false}.
  1184. @item GRUB_DISABLE_RECOVERY
  1185. If this option is set to @samp{true}, disable the generation of recovery
  1186. mode menu entries.
  1187. @item GRUB_DISABLE_UUID
  1188. Normally, @command{grub-mkconfig} will generate menu entries that use
  1189. universally-unique identifiers (UUIDs) to identify various filesystems to
  1190. search for files. This is usually more reliable, but in some cases it may
  1191. not be appropriate. To disable this use of UUIDs, set this option to
  1192. @samp{true}. Setting this option to @samp{true}, will also set the options
  1193. @samp{GRUB_DISABLE_LINUX_UUID} and @samp{GRUB_DISABLE_LINUX_PARTUUID} to
  1194. @samp{true}, unless they have been explicitly set to @samp{false}.
  1195. @item GRUB_VIDEO_BACKEND
  1196. If graphical video support is required, either because the @samp{gfxterm}
  1197. graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
  1198. then @command{grub-mkconfig} will normally load all available GRUB video
  1199. drivers and use the one most appropriate for your hardware. If you need to
  1200. override this for some reason, then you can set this option.
  1201. After @command{grub-install} has been run, the available video drivers are
  1202. listed in @file{/boot/grub/video.lst}.
  1203. @item GRUB_GFXMODE
  1204. Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
  1205. you can only use modes which your graphics card supports via VESA BIOS
  1206. Extensions (VBE), so for example native LCD panel resolutions may not be
  1207. available. The default is @samp{auto}, which tries to select a preferred
  1208. resolution. @xref{gfxmode}.
  1209. @item GRUB_BACKGROUND
  1210. Set a background image for use with the @samp{gfxterm} graphical terminal.
  1211. The value of this option must be a file readable by GRUB at boot time, and
  1212. it must end with @file{.png}, @file{.tga}, @file{.jpg}, or @file{.jpeg}.
  1213. The image will be scaled if necessary to fit the screen. Image height and
  1214. width will be restricted by an artificial limit of 16384.
  1215. @item GRUB_THEME
  1216. Set a theme for use with the @samp{gfxterm} graphical terminal.
  1217. @item GRUB_GFXPAYLOAD_LINUX
  1218. Set to @samp{text} to force the Linux kernel to boot in normal text mode,
  1219. @samp{keep} to preserve the graphics mode set using @samp{GRUB_GFXMODE},
  1220. @samp{@var{width}x@var{height}}[@samp{x@var{depth}}] to set a particular
  1221. graphics mode, or a sequence of these separated by commas or semicolons to
  1222. try several modes in sequence. @xref{gfxpayload}.
  1223. Depending on your kernel, your distribution, your graphics card, and the
  1224. phase of the moon, note that using this option may cause GNU/Linux to suffer
  1225. from various display problems, particularly during the early part of the
  1226. boot sequence. If you have problems, set this option to @samp{text} and
  1227. GRUB will tell Linux to boot in normal text mode.
  1228. @item GRUB_DISABLE_OS_PROBER
  1229. The @command{grub-mkconfig} has a feature to use the external
  1230. @command{os-prober} program to discover other operating systems installed on
  1231. the same machine and generate appropriate menu entries for them. It is disabled
  1232. by default since automatic and silent execution of @command{os-prober}, and
  1233. creating boot entries based on that data, is a potential attack vector. Set
  1234. this option to @samp{false} to enable this feature in the
  1235. @command{grub-mkconfig} command.
  1236. @item GRUB_OS_PROBER_SKIP_LIST
  1237. List of space-separated FS UUIDs of filesystems to be ignored from os-prober
  1238. output. For efi chainloaders it's <UUID>@@<EFI FILE>
  1239. @item GRUB_DISABLE_SUBMENU
  1240. Normally, @command{grub-mkconfig} will generate top level menu entry for
  1241. the kernel with highest version number and put all other found kernels
  1242. or alternative menu entries for recovery mode in submenu. For entries returned
  1243. by @command{os-prober} first entry will be put on top level and all others
  1244. in submenu. If this option is set to @samp{true}, flat menu with all entries
  1245. on top level will be generated instead. Changing this option will require
  1246. changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
  1247. and @samp{default} (@pxref{default}) environment variables as well as saved
  1248. default entry using @command{grub-set-default} and value used with
  1249. @command{grub-reboot}.
  1250. @item GRUB_ENABLE_CRYPTODISK
  1251. If set to @samp{y}, @command{grub-mkconfig} and @command{grub-install} will
  1252. check for encrypted disks and generate additional commands needed to access
  1253. them during boot. Note that in this case unattended boot is not possible
  1254. because GRUB will wait for passphrase to unlock encrypted container.
  1255. @item GRUB_INIT_TUNE
  1256. Play a tune on the speaker when GRUB starts. This is particularly useful
  1257. for users unable to see the screen. The value of this option is passed
  1258. directly to @ref{play}.
  1259. @item GRUB_BADRAM
  1260. If this option is set, GRUB will issue a @ref{badram} command to filter
  1261. out specified regions of RAM.
  1262. @item GRUB_PRELOAD_MODULES
  1263. This option may be set to a list of GRUB module names separated by spaces.
  1264. Each module will be loaded as early as possible, at the start of
  1265. @file{grub.cfg}.
  1266. @end table
  1267. The following options are still accepted for compatibility with existing
  1268. configurations, but have better replacements:
  1269. @table @samp
  1270. @item GRUB_HIDDEN_TIMEOUT
  1271. Wait this many seconds before displaying the menu. If @key{ESC} or @key{F4} are
  1272. pressed, or @key{SHIFT} is held down during that time, display the menu and wait
  1273. for input according to @samp{GRUB_TIMEOUT}. If a hotkey associated with a menu
  1274. entry is pressed, boot the associated menu entry immediately. If the timeout
  1275. expires before either of these happens, display the menu for the number of
  1276. seconds specified in @samp{GRUB_TIMEOUT} before booting the default entry.
  1277. If you set @samp{GRUB_HIDDEN_TIMEOUT}, you should also set
  1278. @samp{GRUB_TIMEOUT=0} so that the menu is not displayed at all unless
  1279. @key{ESC} or @key{F4} are pressed, or @key{SHIFT} is held down.
  1280. This option is unset by default, and is deprecated in favour of the less
  1281. confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
  1282. @samp{GRUB_TIMEOUT_STYLE=hidden}.
  1283. @item GRUB_HIDDEN_TIMEOUT_QUIET
  1284. In conjunction with @samp{GRUB_HIDDEN_TIMEOUT}, set this to @samp{true} to
  1285. suppress the verbose countdown while waiting for a key to be pressed before
  1286. displaying the menu.
  1287. This option is unset by default, and is deprecated in favour of the less
  1288. confusing @samp{GRUB_TIMEOUT_STYLE=countdown}.
  1289. @item GRUB_HIDDEN_TIMEOUT_BUTTON
  1290. Variant of @samp{GRUB_HIDDEN_TIMEOUT}, used to support vendor-specific power
  1291. buttons. @xref{Vendor power-on keys}.
  1292. This option is unset by default, and is deprecated in favour of the less
  1293. confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
  1294. @samp{GRUB_TIMEOUT_STYLE=hidden}.
  1295. @end table
  1296. For more detailed customisation of @command{grub-mkconfig}'s output, you may
  1297. edit the scripts in @file{/etc/grub.d} directly.
  1298. @file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
  1299. menu entries; simply type the menu entries you want to add at the end of
  1300. that file, making sure to leave at least the first two lines intact.
  1301. @node Root Identification Heuristics
  1302. @section Root Identification Heuristics
  1303. If the target operating system uses the Linux kernel, @command{grub-mkconfig}
  1304. attempts to identify the root file system via a heuristic algoirthm. This
  1305. algorithm selects the identification method of the root file system by
  1306. considering three factors. The first is if an initrd for the target operating
  1307. system is also present. The second is @samp{GRUB_DISABLE_LINUX_UUID} and if set
  1308. to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
  1309. system by its UUID. The third is @samp{GRUB_DISABLE_LINUX_PARTUUID} and if set
  1310. to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
  1311. system via the UUID of its enclosing partition. If the variables are assigned
  1312. any other value, that value is considered equivalent to @samp{false}. The
  1313. variables are also considered to be set to @samp{false} if they are not set.
  1314. When booting, the Linux kernel will delegate the task of mounting the root
  1315. filesystem to the initrd. Most initrd images determine the root file system by
  1316. checking the Linux kernel's command-line for the @samp{root} key and use its
  1317. value as the identification method of the root file system. To improve the
  1318. reliability of booting, most initrd images also allow the root file system to be
  1319. identified by its UUID. Because of this behavior, the @command{grub-mkconfig}
  1320. command will set @samp{root} to @samp{root=UUID=...} to provide the initrd with
  1321. the filesystem UUID of the root file system.
  1322. If no initrd is detected or @samp{GRUB_DISABLE_LINUX_UUID} is set to @samp{true}
  1323. then @command{grub-command} will identify the root filesystem by setting the
  1324. kernel command-line variable @samp{root} to @samp{root=PARTUUID=...} unless
  1325. @samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}. If
  1326. @samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true},
  1327. @command{grub-command} will identify by its Linux device name.
  1328. The following table summarizes the behavior of the @command{grub-mkconfig}
  1329. command.
  1330. @multitable {detected} {GRUB_DISABLE_LINUX_PARTUUID} {GRUB_DISABLE_LINUX_UUID} {Linux Root}
  1331. @headitem Initrd detected @tab GRUB_DISABLE_LINUX_PARTUUID Set To @tab GRUB_DISABLE_LINUX_UUID Set To @tab Linux Root ID Method
  1332. @item false @tab false @tab false @tab part UUID
  1333. @item false @tab false @tab true @tab part UUID
  1334. @item false @tab true @tab false @tab dev name
  1335. @item false @tab true @tab true @tab dev name
  1336. @item true @tab false @tab false @tab fs UUID
  1337. @item true @tab false @tab true @tab part UUID
  1338. @item true @tab true @tab false @tab fs UUID
  1339. @item true @tab true @tab true @tab dev name
  1340. @end multitable
  1341. Remember, @samp{GRUB_DISABLE_LINUX_PARTUUID} and @samp{GRUB_DISABLE_LINUX_UUID}
  1342. are also considered to be set to @samp{true} and @samp{false}, respectively,
  1343. when they are unset.
  1344. @node Shell-like scripting
  1345. @section Writing full configuration files directly
  1346. @c Some of this section is derived from the GNU Bash manual page, also
  1347. @c copyrighted by the FSF.
  1348. @file{grub.cfg} is written in GRUB's built-in scripting language, which has
  1349. a syntax quite similar to that of GNU Bash and other Bourne shell
  1350. derivatives.
  1351. @heading Words
  1352. A @dfn{word} is a sequence of characters considered as a single unit by
  1353. GRUB. Words are separated by @dfn{metacharacters}, which are the following
  1354. plus space, tab, and newline:
  1355. @example
  1356. @{ @} | & $ ; < >
  1357. @end example
  1358. Quoting may be used to include metacharacters in words; see below.
  1359. @heading Reserved words
  1360. Reserved words have a special meaning to GRUB. The following words are
  1361. recognised as reserved when unquoted and either the first word of a simple
  1362. command or the third word of a @code{for} command:
  1363. @example
  1364. ! [[ ]] @{ @}
  1365. case do done elif else esac fi for function
  1366. if in menuentry select then time until while
  1367. @end example
  1368. Not all of these reserved words have a useful purpose yet; some are reserved
  1369. for future expansion.
  1370. @heading Quoting
  1371. Quoting is used to remove the special meaning of certain characters or
  1372. words. It can be used to treat metacharacters as part of a word, to prevent
  1373. reserved words from being recognised as such, and to prevent variable
  1374. expansion.
  1375. There are three quoting mechanisms: the escape character, single quotes, and
  1376. double quotes.
  1377. A non-quoted backslash (\) is the @dfn{escape character}. It preserves the
  1378. literal value of the next character that follows, with the exception of
  1379. newline.
  1380. Enclosing characters in single quotes preserves the literal value of each
  1381. character within the quotes. A single quote may not occur between single
  1382. quotes, even when preceded by a backslash.
  1383. Enclosing characters in double quotes preserves the literal value of all
  1384. characters within the quotes, with the exception of @samp{$} and @samp{\}.
  1385. The @samp{$} character retains its special meaning within double quotes.
  1386. The backslash retains its special meaning only when followed by one of the
  1387. following characters: @samp{$}, @samp{"}, @samp{\}, or newline. A
  1388. backslash-newline pair is treated as a line continuation (that is, it is
  1389. removed from the input stream and effectively ignored@footnote{Currently a
  1390. backslash-newline pair within a variable name is not handled properly, so
  1391. use this feature with some care.}). A double quote may be quoted within
  1392. double quotes by preceding it with a backslash.
  1393. @heading Variable expansion
  1394. The @samp{$} character introduces variable expansion. The variable name to
  1395. be expanded may be enclosed in braces, which are optional but serve to
  1396. protect the variable to be expanded from characters immediately following it
  1397. which could be interpreted as part of the name.
  1398. Normal variable names begin with an alphabetic character, followed by zero
  1399. or more alphanumeric characters. These names refer to entries in the GRUB
  1400. environment (@pxref{Environment}).
  1401. Positional variable names consist of one or more digits. They represent
  1402. parameters passed to function calls, with @samp{$1} representing the first
  1403. parameter, and so on.
  1404. The special variable name @samp{?} expands to the exit status of the most
  1405. recently executed command. When positional variable names are active, other
  1406. special variable names @samp{@@}, @samp{*} and @samp{#} are defined and they
  1407. expand to all positional parameters with necessary quoting, positional
  1408. parameters without any quoting, and positional parameter count respectively.
  1409. @heading Comments
  1410. A word beginning with @samp{#} causes that word and all remaining characters
  1411. on that line to be ignored.
  1412. @heading Simple commands
  1413. A @dfn{simple command} is a sequence of words separated by spaces or tabs
  1414. and terminated by a semicolon or a newline. The first word specifies the
  1415. command to be executed. The remaining words are passed as arguments to the
  1416. invoked command.
  1417. The return value of a simple command is its exit status. If the reserved
  1418. word @code{!} precedes the command, then the return value is instead the
  1419. logical negation of the command's exit status.
  1420. @heading Compound commands
  1421. A @dfn{compound command} is one of the following:
  1422. @table @asis
  1423. @item for @var{name} in @var{word} @dots{}; do @var{list}; done
  1424. The list of words following @code{in} is expanded, generating a list of
  1425. items. The variable @var{name} is set to each element of this list in turn,
  1426. and @var{list} is executed each time. The return value is the exit status
  1427. of the last command that executes. If the expansion of the items following
  1428. @code{in} results in an empty list, no commands are executed, and the return
  1429. status is 0.
  1430. @item if @var{list}; then @var{list}; [elif @var{list}; then @var{list};] @dots{} [else @var{list};] fi
  1431. The @code{if} @var{list} is executed, where @var{list} is a series of
  1432. @dfn{simple command}s separated by a ";". If its exit status of the last
  1433. command is zero, the @code{then} @var{list} is executed. Otherwise, each
  1434. @code{elif} @var{list} is executed in turn, and if its last command's exit
  1435. status is zero, the corresponding @code{then} @var{list} is executed and the
  1436. command completes. Otherwise, the @code{else} @var{list} is executed, if
  1437. present. The exit status is the exit status of the last command executed, or
  1438. zero if no condition tested true.
  1439. @item while @var{cond}; do @var{list}; done
  1440. @itemx until @var{cond}; do @var{list}; done
  1441. The @code{while} command continuously executes the @code{do} @var{list} as
  1442. long as the last command in @var{cond} returns an exit status of zero, where
  1443. @var{cond} is a list of @dfn{simple command}s separated by a ";". The
  1444. @code{until} command is identical to the @code{while} command, except that
  1445. the test is negated; the @code{do} @var{list} is executed as long as the
  1446. last command in @var{cond} returns a non-zero exit status. The exit status
  1447. of the @code{while} and @code{until} commands is the exit status of the last
  1448. @code{do} @var{list} command executed, or zero if none was executed.
  1449. @item function @var{name} @{ @var{command}; @dots{} @}
  1450. This defines a function named @var{name}. The @dfn{body} of the function is
  1451. the list of commands within braces, each of which must be terminated with a
  1452. semicolon or a newline. This list of commands will be executed whenever
  1453. @var{name} is specified as the name of a simple command. Function
  1454. definitions do not affect the exit status in @code{$?}. When executed, the
  1455. exit status of a function is the exit status of the last command executed in
  1456. the body.
  1457. @item menuentry @var{title} [@option{--class=class} @dots{}] [@option{--users=users}] [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @{ @var{command}; @dots{} @}
  1458. @xref{menuentry}.
  1459. @end table
  1460. @heading Built-in Commands
  1461. Some built-in commands are also provided by GRUB script to help script
  1462. writers perform actions that are otherwise not possible. For example, these
  1463. include commands to jump out of a loop without fully completing it, etc.
  1464. @table @asis
  1465. @item break [@code{n}]
  1466. Exit from within a @code{for}, @code{while}, or @code{until} loop. If
  1467. @code{n} is specified, break @code{n} levels. @code{n} must be greater than
  1468. or equal to 1. If @code{n} is greater than the number of enclosing loops,
  1469. all enclosing loops are exited. The return value is 0 unless @code{n} is
  1470. not greater than or equal to 1.
  1471. @item continue [@code{n}]
  1472. Resume the next iteration of the enclosing @code{for}, @code{while} or
  1473. @code{until} loop. If @code{n} is specified, resume at the @code{n}th
  1474. enclosing loop. @code{n} must be greater than or equal to 1. If @code{n}
  1475. is greater than the number of enclosing loops, the last enclosing loop (the
  1476. @dfn{top-level} loop) is resumed. The return value is 0 unless @code{n} is
  1477. not greater than or equal to 1.
  1478. @item return [@code{n}]
  1479. Causes a function to exit with the return value specified by @code{n}. If
  1480. @code{n} is omitted, the return status is that of the last command executed
  1481. in the function body. If used outside a function the return status is
  1482. false.
  1483. @item setparams [@code{arg}] @dots{}
  1484. Replace positional parameters starting with @code{$1} with arguments to
  1485. @command{setparams}.
  1486. @item shift [@code{n}]
  1487. The positional parameters from @code{n}+1 @dots{} are renamed to
  1488. @code{$1}@dots{}. Parameters represented by the numbers @code{$#} down to
  1489. @code{$#}-@code{n}+1 are unset. @code{n} must be a non-negative number less
  1490. than or equal to @code{$#}. If @code{n} is 0, no parameters are changed.
  1491. If @code{n} is not given, it is assumed to be 1. If @code{n} is greater
  1492. than @code{$#}, the positional parameters are not changed. The return
  1493. status is greater than zero if @code{n} is greater than @code{$#} or less
  1494. than zero; otherwise 0.
  1495. @end table
  1496. @node Multi-boot manual config
  1497. @section Multi-boot manual config
  1498. Currently autogenerating config files for multi-boot environments depends on
  1499. os-prober and has several shortcomings. Due to that it is disabled by default.
  1500. It is advised to use the power of GRUB syntax and do it yourself. A possible
  1501. configuration is detailed here, feel free to adjust to your needs.
  1502. First create a separate GRUB partition, big enough to hold GRUB. Some of the
  1503. following entries show how to load OS installer images from this same partition,
  1504. for that you obviously need to make the partition large enough to hold those
  1505. images as well.
  1506. Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
  1507. install self-compiled latest GRUB with:
  1508. @code{grub-install --boot-directory=/mnt/boot /dev/sda}
  1509. In all the OSes install GRUB tools but disable installing GRUB in bootsector,
  1510. so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
  1511. use by setting:
  1512. @code{GRUB_DISABLE_OS_PROBER=true}
  1513. in /etc/default/grub
  1514. Then write a grub.cfg (/mnt/boot/grub/grub.cfg):
  1515. @example
  1516. menuentry "OS using grub2" @{
  1517. insmod xfs
  1518. search --set=root --label OS1 --hint hd0,msdos8
  1519. configfile /boot/grub/grub.cfg
  1520. @}
  1521. menuentry "OS using grub2-legacy" @{
  1522. insmod ext2
  1523. search --set=root --label OS2 --hint hd0,msdos6
  1524. legacy_configfile /boot/grub/menu.lst
  1525. @}
  1526. menuentry "Windows XP" @{
  1527. insmod ntfs
  1528. search --set=root --label WINDOWS_XP --hint hd0,msdos1
  1529. ntldr /ntldr
  1530. @}
  1531. menuentry "Windows 7" @{
  1532. insmod ntfs
  1533. search --set=root --label WINDOWS_7 --hint hd0,msdos2
  1534. ntldr /bootmgr
  1535. @}
  1536. menuentry "FreeBSD" @{
  1537. insmod zfs
  1538. search --set=root --label freepool --hint hd0,msdos7
  1539. kfreebsd /freebsd@@/boot/kernel/kernel
  1540. kfreebsd_module_elf /freebsd@@/boot/kernel/opensolaris.ko
  1541. kfreebsd_module_elf /freebsd@@/boot/kernel/zfs.ko
  1542. kfreebsd_module /freebsd@@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
  1543. set kFreeBSD.vfs.root.mountfrom=zfs:freepool/freebsd
  1544. set kFreeBSD.hw.psm.synaptics_support=1
  1545. @}
  1546. menuentry "experimental GRUB" @{
  1547. search --set=root --label GRUB --hint hd0,msdos5
  1548. multiboot /experimental/grub/i386-pc/core.img
  1549. @}
  1550. menuentry "Fedora 16 installer" @{
  1551. search --set=root --label GRUB --hint hd0,msdos5
  1552. linux /fedora/vmlinuz lang=en_US keymap=sg resolution=1280x800
  1553. initrd /fedora/initrd.img
  1554. @}
  1555. menuentry "Fedora rawhide installer" @{
  1556. search --set=root --label GRUB --hint hd0,msdos5
  1557. linux /fedora/vmlinuz repo=ftp://mirror.switch.ch/mirror/fedora/linux/development/rawhide/x86_64 lang=en_US keymap=sg resolution=1280x800
  1558. initrd /fedora/initrd.img
  1559. @}
  1560. menuentry "Debian sid installer" @{
  1561. search --set=root --label GRUB --hint hd0,msdos5
  1562. linux /debian/dists/sid/main/installer-amd64/current/images/hd-media/vmlinuz
  1563. initrd /debian/dists/sid/main/installer-amd64/current/images/hd-media/initrd.gz
  1564. @}
  1565. @end example
  1566. Notes:
  1567. @itemize
  1568. @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.
  1569. @end itemize
  1570. @node Embedded configuration
  1571. @section Embedding a configuration file into GRUB
  1572. GRUB supports embedding a configuration file directly into the core image,
  1573. so that it is loaded before entering normal mode. This is useful, for
  1574. example, when it is not straightforward to find the real configuration file,
  1575. or when you need to debug problems with loading that file.
  1576. @command{grub-install} uses this feature when it is not using BIOS disk
  1577. functions or when installing to a different disk from the one containing
  1578. @file{/boot/grub}, in which case it needs to use the @command{search}
  1579. command (@pxref{search}) to find @file{/boot/grub}.
  1580. To embed a configuration file, use the @option{-c} option to
  1581. @command{grub-mkimage}. The file is copied into the core image, so it may
  1582. reside anywhere on the file system, and may be removed after running
  1583. @command{grub-mkimage}.
  1584. After the embedded configuration file (if any) is executed, GRUB will load
  1585. the @samp{normal} module (@pxref{normal}), which will then read the real
  1586. configuration file from @file{$prefix/grub.cfg}. By this point, the
  1587. @code{root} variable will also have been set to the root device name. For
  1588. example, @code{prefix} might be set to @samp{(hd0,1)/boot/grub}, and
  1589. @code{root} might be set to @samp{hd0,1}. Thus, in most cases, the embedded
  1590. configuration file only needs to set the @code{prefix} and @code{root}
  1591. variables, and then drop through to GRUB's normal processing. A typical
  1592. example of this might look like this:
  1593. @example
  1594. @group
  1595. search.fs_uuid 01234567-89ab-cdef-0123-456789abcdef root
  1596. set prefix=($root)/boot/grub
  1597. @end group
  1598. @end example
  1599. (The @samp{search_fs_uuid} module must be included in the core image for this
  1600. example to work.)
  1601. In more complex cases, it may be useful to read other configuration files
  1602. directly from the embedded configuration file. This allows such things as
  1603. reading files not called @file{grub.cfg}, or reading files from a directory
  1604. other than that where GRUB's loadable modules are installed. To do this,
  1605. include the @samp{configfile} and @samp{normal} modules in the core image,
  1606. and embed a configuration file that uses the @command{configfile} command to
  1607. load another file. The following example of this also requires the
  1608. @command{echo}, @command{search_label}, and @command{test} modules to be
  1609. included in the core image:
  1610. @example
  1611. @group
  1612. search.fs_label grub root
  1613. if [ -e /boot/grub/example/test1.cfg ]; then
  1614. set prefix=($root)/boot/grub
  1615. configfile /boot/grub/example/test1.cfg
  1616. else
  1617. if [ -e /boot/grub/example/test2.cfg ]; then
  1618. set prefix=($root)/boot/grub
  1619. configfile /boot/grub/example/test2.cfg
  1620. else
  1621. echo "Could not find an example configuration file!"
  1622. fi
  1623. fi
  1624. @end group
  1625. @end example
  1626. The embedded configuration file may not contain menu entries directly, but
  1627. may only read them from elsewhere using @command{configfile}.
  1628. @node Theme file format
  1629. @chapter Theme file format
  1630. @section Introduction
  1631. The GRUB graphical menu supports themes that can customize the layout and
  1632. appearance of the GRUB boot menu. The theme is configured through a plain
  1633. text file that specifies the layout of the various GUI components (including
  1634. the boot menu, timeout progress bar, and text messages) as well as the
  1635. appearance using colors, fonts, and images. Example is available in docs/example_theme.txt
  1636. @section Theme Elements
  1637. @subsection Colors
  1638. Colors can be specified in several ways:
  1639. @itemize
  1640. @item HTML-style ``#RRGGBB'' or ``#RGB'' format, where *R*, *G*, and *B* are hexadecimal digits (e.g., ``#8899FF'')
  1641. @item as comma-separated decimal RGB values (e.g., ``128, 128, 255'')
  1642. @item with ``SVG 1.0 color names'' (e.g., ``cornflowerblue'') which must be specified in lowercase.
  1643. @end itemize
  1644. @subsection Fonts
  1645. The fonts GRUB uses ``PFF2 font format'' bitmap fonts. Fonts are specified
  1646. with full font names. Currently there is no
  1647. provision for a preference list of fonts, or deriving one font from another.
  1648. Fonts are loaded with the ``loadfont'' command in GRUB (@ref{loadfont}). To see the list of
  1649. loaded fonts, execute the ``lsfonts'' command (@ref{lsfonts}). If there are too many fonts to
  1650. fit on screen, do ``set pager=1'' before executing ``lsfonts''.
  1651. @subsection Progress Bar
  1652. @float Figure, Pixmap-styled progress bar
  1653. @c @image{Theme_progress_bar,,,,png}
  1654. @end float
  1655. @float Figure, Plain progress bar, drawn with solid color.
  1656. @c @image{Theme_progress_bar_filled,,,,png}
  1657. @end float
  1658. Progress bars are used to display the remaining time before GRUB boots the
  1659. default menu entry. To create a progress bar that will display the remaining
  1660. time before automatic boot, simply create a ``progress_bar'' component with
  1661. the id ``__timeout__''. This indicates to GRUB that the progress bar should
  1662. be updated as time passes, and it should be made invisible if the countdown to
  1663. automatic boot is interrupted by the user.
  1664. Progress bars may optionally have text displayed on them. This text is
  1665. controlled by variable ``text'' which contains a printf template with the
  1666. only argument %d is the number of seconds remaining. Additionally special
  1667. values ``@@TIMEOUT_NOTIFICATION_SHORT@@'', ``@@TIMEOUT_NOTIFICATION_MIDDLE@@'',
  1668. ``@@TIMEOUT_NOTIFICATION_LONG@@'' are replaced with standard and translated
  1669. templates.
  1670. @subsection Circular Progress Indicator
  1671. @c @image{Theme_circular_progress,,,,.png}
  1672. The circular progress indicator functions similarly to the progress bar. When
  1673. given an id of ``__timeout__'', GRUB updates the circular progress indicator's
  1674. value to indicate the time remaining. For the circular progress indicator,
  1675. there are two images used to render it: the *center* image, and the *tick*
  1676. image. The center image is rendered in the center of the component, while the
  1677. tick image is used to render each mark along the circumference of the
  1678. indicator.
  1679. @subsection Labels
  1680. Text labels can be placed on the boot screen. The font, color, and horizontal
  1681. alignment can be specified for labels. If a label is given the id
  1682. ``__timeout__'', then the ``text'' property for that label is also updated
  1683. with a message informing the user of the number of seconds remaining until
  1684. automatic boot. This is useful in case you want the text displayed somewhere
  1685. else instead of directly on the progress bar.
  1686. @subsection Boot Menu
  1687. @c @image{Theme_boot_menu,,,,.png}
  1688. The boot menu where GRUB displays the menu entries from the ``grub.cfg'' file.
  1689. It is a list of items, where each item has a title and an optional icon. The
  1690. icon is selected based on the *classes* specified for the menu entry. If
  1691. there is a PNG file named ``myclass.png'' in the ``grub/themes/icons''
  1692. directory, it will be displayed for items which have the class *myclass*. The
  1693. boot menu can be customized in several ways, such as the font and color used
  1694. for the menu entry title, and by specifying styled boxes for the menu itself
  1695. and for the selected item highlight.
  1696. @subsection Styled Boxes
  1697. One of the most important features for customizing the layout is the use of
  1698. *styled boxes*. A styled box is composed of 9 rectangular (and potentially
  1699. empty) regions, which are used to seamlessly draw the styled box on screen:
  1700. @multitable @columnfractions 0.3 0.3 0.3
  1701. @item Northwest (nw) @tab North (n) @tab Northeast (ne)
  1702. @item West (w) @tab Center (c) @tab East (e)
  1703. @item Southwest (sw) @tab South (s) @tab Southeast (se)
  1704. @end multitable
  1705. To support any size of box on screen, the center slice and the slices for the
  1706. top, bottom, and sides are all scaled to the correct size for the component on
  1707. screen, using the following rules:
  1708. @enumerate
  1709. @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.
  1710. @item The corner slices (northwest, northeast, southeast, and southwest) are not scaled.
  1711. @item The center slice is scaled to fill the remaining space in the middle.
  1712. @end enumerate
  1713. As an example of how an image might be sliced up, consider the styled box
  1714. used for a terminal view.
  1715. @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.
  1716. @c @image{Box_slice_example_terminal,,,,.png}
  1717. @end float
  1718. @subsection Creating Styled Box Images
  1719. The Inkscape_ scalable vector graphics editor is a very useful tool for
  1720. creating styled box images. One process that works well for slicing a drawing
  1721. into the necessary image slices is:
  1722. @enumerate
  1723. @item Create or open the drawing you'd like use.
  1724. @item Create a new layer on the top of the layer stack. Make it visible. Select this layer as the current layer.
  1725. @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.
  1726. @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.
  1727. @item Save the drawing.
  1728. @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.
  1729. @item Click the layer hide icon for the slice layer in the layer palette. The rectangles will remain selected, even though they are hidden.
  1730. @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.
  1731. @end enumerate
  1732. @section Theme File Manual
  1733. The theme file is a plain text file. Lines that begin with ``#`` are ignored
  1734. and considered comments. (Note: This may not be the case if the previous line
  1735. ended where a value was expected.)
  1736. The theme file contains two types of statements:
  1737. @enumerate
  1738. @item Global properties.
  1739. @item Component construction.
  1740. @end enumerate
  1741. @subsection Global Properties
  1742. @subsection Format
  1743. Global properties are specified with the simple format:
  1744. @itemize
  1745. @item name1: value1
  1746. @item name2: "value which may contain spaces"
  1747. @item name3: #88F
  1748. @end itemize
  1749. In this example, name3 is assigned a color value.
  1750. @subsection Global Property List
  1751. @multitable @columnfractions 0.3 0.6
  1752. @item title-text
  1753. @tab Specifies the text to display at the top center of the screen as a title.
  1754. @item title-font
  1755. @tab Defines the font used for the title message at the top of the screen.
  1756. @item title-color
  1757. @tab Defines the color of the title message.
  1758. @item message-font
  1759. @tab Currently unused. Left for backward compatibility.
  1760. @item message-color
  1761. @tab Currently unused. Left for backward compatibility.
  1762. @item message-bg-color
  1763. @tab Currently unused. Left for backward compatibility.
  1764. @item desktop-image
  1765. @tab Specifies the image to use as the background. It will be scaled
  1766. to fit the screen size or proportionally scaled depending on the scale
  1767. method.
  1768. @item desktop-image-scale-method
  1769. @tab Specifies the scaling method for the *desktop-image*. Options are
  1770. ``stretch``, ``crop``, ``padding``, ``fitwidth``, ``fitheight``.
  1771. ``stretch`` for fitting the screen size. Otherwise it is proportional
  1772. scaling of a part of *desktop-image* to the part of the screen.
  1773. ``crop`` part of the *desktop-image* will be proportionally scaled to
  1774. fit the screen sizes. ``padding`` the entire *desktop-image* will be
  1775. contained on the screen. ``fitwidth`` for fitting the *desktop-image*'s
  1776. width with screen width. ``fitheight`` for fitting the *desktop-image*'s
  1777. height with the screen height. Default is ``stretch``.
  1778. @item desktop-image-h-align
  1779. @tab Specifies the horizontal alignment of the *desktop-image* if
  1780. *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
  1781. ``left``, ``center``, ``right``. Default is ``center``.
  1782. @item desktop-image-v-align
  1783. @tab Specifies the vertical alignment of the *desktop-image* if
  1784. *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
  1785. ``top``, ``center``, ``bottom``. Default is ``center``.
  1786. @item desktop-color
  1787. @tab Specifies the color for the background if *desktop-image* is not
  1788. specified.
  1789. @item terminal-box
  1790. @tab Specifies the file name pattern for the styled box slices used for the
  1791. command line terminal window. For example, ``terminal-box: terminal_*.png``
  1792. will use the images ``terminal_c.png`` as the center area, ``terminal_n.png``
  1793. as the north (top) edge, ``terminal_nw.png`` as the northwest (upper left)
  1794. corner, and so on. If the image for any slice is not found, it will simply
  1795. be left empty.
  1796. @item terminal-border
  1797. @tab Specifies the border width of the terminal window.
  1798. @item terminal-left
  1799. @tab Specifies the left coordinate of the terminal window.
  1800. @item terminal-top
  1801. @tab Specifies the top coordinate of the terminal window.
  1802. @item terminal-width
  1803. @tab Specifies the width of the terminal window.
  1804. @item terminal-height
  1805. @tab Specifies the height of the terminal window.
  1806. @end multitable
  1807. @subsection Component Construction
  1808. Greater customizability comes is provided by components. A tree of components
  1809. forms the user interface. *Containers* are components that can contain other
  1810. components, and there is always a single root component which is an instance
  1811. of a *canvas* container.
  1812. Components are created in the theme file by prefixing the type of component
  1813. with a '+' sign:
  1814. @code{ + label @{ text="GRUB" font="aqui 11" color="#8FF" @} }
  1815. properties of a component are specified as "name = value" (whitespace
  1816. surrounding tokens is optional and is ignored) where *value* may be:
  1817. @itemize
  1818. @item a single word (e.g., ``align = center``, ``color = #FF8080``),
  1819. @item a quoted string (e.g., ``text = "Hello, World!"``), or
  1820. @item a tuple (e.g., ``preferred_size = (120, 80)``).
  1821. @end itemize
  1822. @subsection Component List
  1823. The following is a list of the components and the properties they support.
  1824. @itemize
  1825. @item label
  1826. A label displays a line of text.
  1827. Properties:
  1828. @multitable @columnfractions 0.2 0.7
  1829. @item id
  1830. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1831. boot of the default entry.
  1832. @item text
  1833. @tab The text to display. If ``id`` is set to ``__timeout__`` and no
  1834. ``text`` property is set then the amount of seconds will be shown.
  1835. If set to ``@@KEYMAP_SHORT@@``, ``@@KEYMAP_MIDDLE@@`` or
  1836. ``@@KEYMAP_LONG@@`` then predefined hotkey information will be shown.
  1837. @item font
  1838. @tab The font to use for text display.
  1839. @item color
  1840. @tab The color of the text.
  1841. @item align
  1842. @tab The horizontal alignment of the text within the component.
  1843. Options are ``left``, ``center`` and ``right``.
  1844. @item visible
  1845. @tab Set to ``false`` to hide the label.
  1846. @end multitable
  1847. @item image
  1848. A component that displays an image. The image is scaled to fit
  1849. the component.
  1850. Properties:
  1851. @multitable @columnfractions 0.2 0.7
  1852. @item file
  1853. @tab The full path to the image file to load.
  1854. @end multitable
  1855. @item progress_bar
  1856. Displays a horizontally oriented progress bar. It can be rendered using
  1857. simple solid filled rectangles, or using a pair of pixmap styled boxes.
  1858. Properties:
  1859. @multitable @columnfractions 0.2 0.7
  1860. @item id
  1861. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1862. boot of the default entry.
  1863. @item fg_color
  1864. @tab The foreground color for plain solid color rendering.
  1865. @item bg_color
  1866. @tab The background color for plain solid color rendering.
  1867. @item border_color
  1868. @tab The border color for plain solid color rendering.
  1869. @item text_color
  1870. @tab The text color.
  1871. @item bar_style
  1872. @tab The styled box specification for the frame of the progress bar.
  1873. Example: ``progress_frame_*.png``
  1874. If the value is equal to ``highlight_style`` then no styled boxes
  1875. will be shown.
  1876. @item highlight_style
  1877. @tab The styled box specification for the highlighted region of the
  1878. progress bar. This box will be used to paint just the highlighted region
  1879. of the bar, and will be increased in size as the bar nears completion.
  1880. Example: ``progress_hl_*.png``.
  1881. If the value is equal to ``bar_style`` then no styled boxes
  1882. will be shown.
  1883. @item highlight_overlay
  1884. @tab If this option is set to ``true`` then the highlight box
  1885. side slices (every slice except the center slice) will overlay the
  1886. frame box side slices. And the center slice of the highlight box
  1887. can move all the way (from top to bottom), being drawn on the center
  1888. slice of the frame box. That way we can make a progress bar with
  1889. round-shaped edges so there won't be a free space from the highlight to
  1890. the frame in top and bottom scrollbar positions. Default is ``false``.
  1891. @item font
  1892. @tab The font to use for progress bar.
  1893. @item text
  1894. @tab The text to display on the progress bar. If the progress bar's ID
  1895. is set to ``__timeout__`` and the value of this property is set to
  1896. ``@@TIMEOUT_NOTIFICATION_SHORT@@``, ``@@TIMEOUT_NOTIFICATION_MIDDLE@@``
  1897. or ``@@TIMEOUT_NOTIFICATION_LONG@@``, then GRUB will update this
  1898. property with an informative message as the timeout approaches.
  1899. @end multitable
  1900. @item circular_progress
  1901. Displays a circular progress indicator. The appearance of this component
  1902. is determined by two images: the *center* image and the *tick* image. The
  1903. center image is generally larger and will be drawn in the center of the
  1904. component. Around the circumference of a circle within the component, the
  1905. tick image will be drawn a certain number of times, depending on the
  1906. properties of the component.
  1907. Properties:
  1908. @multitable @columnfractions 0.3 0.6
  1909. @item id
  1910. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1911. boot of the default entry.
  1912. @item center_bitmap
  1913. @tab The file name of the image to draw in the center of the component.
  1914. @item tick_bitmap
  1915. @tab The file name of the image to draw for the tick marks.
  1916. @item num_ticks
  1917. @tab The number of ticks that make up a full circle.
  1918. @item ticks_disappear
  1919. @tab Boolean value indicating whether tick marks should progressively appear,
  1920. or progressively disappear as *value* approaches *end*. Specify
  1921. ``true`` or ``false``. Default is ``false``.
  1922. @item start_angle
  1923. @tab The position of the first tick mark to appear or disappear.
  1924. Measured in "parrots", 1 "parrot" = 1 / 256 of the full circle.
  1925. Use values ``xxx deg`` or ``xxx \xc2\xb0`` to set the angle in degrees.
  1926. @end multitable
  1927. @item boot_menu
  1928. Displays the GRUB boot menu. It allows selecting items and executing them.
  1929. Properties:
  1930. @multitable @columnfractions 0.4 0.5
  1931. @item item_font
  1932. @tab The font to use for the menu item titles.
  1933. @item selected_item_font
  1934. @tab The font to use for the selected menu item, or ``inherit`` (the default)
  1935. to use ``item_font`` for the selected menu item as well.
  1936. @item item_color
  1937. @tab The color to use for the menu item titles.
  1938. @item selected_item_color
  1939. @tab The color to use for the selected menu item, or ``inherit`` (the default)
  1940. to use ``item_color`` for the selected menu item as well.
  1941. @item icon_width
  1942. @tab The width of menu item icons. Icons are scaled to the specified size.
  1943. @item icon_height
  1944. @tab The height of menu item icons.
  1945. @item item_height
  1946. @tab The height of each menu item in pixels.
  1947. @item item_padding
  1948. @tab The amount of space in pixels to leave on each side of the menu item
  1949. contents.
  1950. @item item_icon_space
  1951. @tab The space between an item's icon and the title text, in pixels.
  1952. @item item_spacing
  1953. @tab The amount of space to leave between menu items, in pixels.
  1954. @item menu_pixmap_style
  1955. @tab The image file pattern for the menu frame styled box.
  1956. Example: ``menu_*.png`` (this will use images such as ``menu_c.png``,
  1957. ``menu_w.png``, `menu_nw.png``, etc.)
  1958. @item item_pixmap_style
  1959. @tab The image file pattern for the item styled box.
  1960. @item selected_item_pixmap_style
  1961. @tab The image file pattern for the selected item highlight styled box.
  1962. @item scrollbar
  1963. @tab Boolean value indicating whether the scroll bar should be drawn if the
  1964. frame and thumb styled boxes are configured.
  1965. @item scrollbar_frame
  1966. @tab The image file pattern for the entire scroll bar.
  1967. Example: ``scrollbar_*.png``
  1968. @item scrollbar_thumb
  1969. @tab The image file pattern for the scroll bar thumb (the part of the scroll
  1970. bar that moves as scrolling occurs).
  1971. Example: ``scrollbar_thumb_*.png``
  1972. @item scrollbar_thumb_overlay
  1973. @tab If this option is set to ``true`` then the scrollbar thumb
  1974. side slices (every slice except the center slice) will overlay the
  1975. scrollbar frame side slices. And the center slice of the scrollbar_thumb
  1976. can move all the way (from top to bottom), being drawn on the center
  1977. slice of the scrollbar frame. That way we can make a scrollbar with
  1978. round-shaped edges so there won't be a free space from the thumb to
  1979. the frame in top and bottom scrollbar positions. Default is ``false``.
  1980. @item scrollbar_slice
  1981. @tab The menu frame styled box's slice in which the scrollbar will be
  1982. drawn. Possible values are ``west``, ``center``, ``east`` (default).
  1983. ``west`` - the scrollbar will be drawn in the west slice (right-aligned).
  1984. ``east`` - the scrollbar will be drawn in the east slice (left-aligned).
  1985. ``center`` - the scrollbar will be drawn in the center slice.
  1986. Note: in case of ``center`` slice:
  1987. a) If the scrollbar should be drawn then boot menu entry's width is
  1988. decreased by the scrollbar's width and the scrollbar is drawn at the
  1989. right side of the center slice.
  1990. b) If the scrollbar won't be drawn then the boot menu entry's width
  1991. is the width of the center slice.
  1992. c) We don't necessary need the menu pixmap box to display the scrollbar.
  1993. @item scrollbar_left_pad
  1994. @tab The left scrollbar padding in pixels.
  1995. Unused if ``scrollbar_slice`` is ``west``.
  1996. @item scrollbar_right_pad
  1997. @tab The right scrollbar padding in pixels.
  1998. Unused if ``scrollbar_slice`` is ``east``.
  1999. @item scrollbar_top_pad
  2000. @tab The top scrollbar padding in pixels.
  2001. @item scrollbar_bottom_pad
  2002. @tab The bottom scrollbar padding in pixels.
  2003. @item visible
  2004. @tab Set to ``false`` to hide the boot menu.
  2005. @end multitable
  2006. @item canvas
  2007. Canvas is a container that allows manual placement of components within it.
  2008. It does not alter the positions of its child components. It assigns all
  2009. child components their preferred sizes.
  2010. @item hbox
  2011. The *hbox* container lays out its children from left to right, giving each
  2012. one its preferred width. The height of each child is set to the maximum of
  2013. the preferred heights of all children.
  2014. @item vbox
  2015. The *vbox* container lays out its children from top to bottom, giving each
  2016. one its preferred height. The width of each child is set to the maximum of
  2017. the preferred widths of all children.
  2018. @end itemize
  2019. @subsection Common properties
  2020. The following properties are supported by all components:
  2021. @table @samp
  2022. @item left
  2023. The distance from the left border of container to left border of the object in either of three formats:
  2024. @multitable @columnfractions 0.2 0.7
  2025. @item x @tab Value in pixels
  2026. @item p% @tab Percentage
  2027. @item p%+x @tab mixture of both
  2028. @end multitable
  2029. @item top
  2030. The distance from the left border of container to left border of the object in same format.
  2031. @item width
  2032. The width of object in same format.
  2033. @item height
  2034. The height of object in same format.
  2035. @item id
  2036. The identifier for the component. This can be any arbitrary string.
  2037. The ID can be used by scripts to refer to various components in the GUI
  2038. component tree. Currently, there is one special ID value that GRUB
  2039. recognizes:
  2040. @multitable @columnfractions 0.2 0.7
  2041. @item ``__timeout__``
  2042. @tab Component with this ID will be updated by GRUB and will indicate
  2043. time elapsed to an automatical boot of the default entry.
  2044. Affected components: ``label``, ``circular_progress``, ``progress_bar``.
  2045. @end multitable
  2046. @end table
  2047. @node Network
  2048. @chapter Booting GRUB from the network
  2049. The following instructions don't work for *-emu, i386-qemu, i386-coreboot,
  2050. i386-multiboot, mips_loongson, mips-arc and mips_qemu_mips
  2051. To generate a netbootable directory, run:
  2052. @example
  2053. @group
  2054. grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/<platform>
  2055. @end group
  2056. @end example
  2057. E.g. for i386-pc:
  2058. @example
  2059. @group
  2060. grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i386-pc
  2061. @end group
  2062. @end example
  2063. Then follow instructions printed out by grub-mknetdir on configuring your DHCP
  2064. server.
  2065. The grub.cfg file is placed in the same directory as the path output by
  2066. grub-mknetdir hereafter referred to as FWPATH. GRUB will search for its
  2067. configuration files in order using the following rules where the appended
  2068. value corresponds to a value on the client machine.
  2069. @example
  2070. @group
  2071. @samp{(FWPATH)}/grub.cfg-@samp{(UUID OF MACHINE)}
  2072. @samp{(FWPATH)}/grub.cfg-01-@samp{(MAC ADDRESS OF NIC)}
  2073. @samp{(FWPATH)}/grub.cfg-@samp{(IPv4 OR IPv6 ADDRESS)}
  2074. @samp{(FWPATH)}/grub.cfg
  2075. @end group
  2076. @end example
  2077. The UUID is the Client Machine Identifier Option Definition as specified in
  2078. RFC 4578. The client will only attempt to look up a UUID config file if it
  2079. was provided by the DHCP server.
  2080. The client will only attempt to look up an IPv6 address config once, however,
  2081. it will try the IPv4 multiple times. The concrete example below shows what
  2082. would happen under the IPv4 case.
  2083. @example
  2084. @group
  2085. UUID: 7726a678-7fc0-4853-a4f6-c85ac36a120a
  2086. MAC: 52:54:00:ec:33:81
  2087. IPV4: 10.0.0.130 (0A000082)
  2088. @end group
  2089. @end example
  2090. @example
  2091. @group
  2092. @samp{(FWPATH)}/grub.cfg-7726a678-7fc0-4853-a4f6-c85ac36a120a
  2093. @samp{(FWPATH)}/grub.cfg-01-52-54-00-ec-33-81
  2094. @samp{(FWPATH)}/grub.cfg-0A000082
  2095. @samp{(FWPATH)}/grub.cfg-0A00008
  2096. @samp{(FWPATH)}/grub.cfg-0A0000
  2097. @samp{(FWPATH)}/grub.cfg-0A000
  2098. @samp{(FWPATH)}/grub.cfg-0A00
  2099. @samp{(FWPATH)}/grub.cfg-0A0
  2100. @samp{(FWPATH)}/grub.cfg-0A
  2101. @samp{(FWPATH)}/grub.cfg-0
  2102. @samp{(FWPATH)}/grub.cfg
  2103. @end group
  2104. @end example
  2105. This feature is enabled by default but it can be disabled by setting the
  2106. @samp{feature_net_search_cfg} to @samp{n}. Since this happens before the
  2107. configuration file is read by GRUB, this option has to be disabled in an
  2108. embedded configuration file (@pxref{Embedded configuration}).
  2109. After GRUB has started, files on the TFTP server will be accessible via the
  2110. @samp{(tftp)} device.
  2111. The server IP address can be controlled by changing the
  2112. @samp{(tftp)} device name to @samp{(tftp,@var{server-ip})}. Note that
  2113. this should be changed both in the prefix and in any references to the
  2114. device name in the configuration file.
  2115. GRUB provides several environment variables which may be used to inspect or
  2116. change the behaviour of the PXE device. In the following description
  2117. @var{<interface>} is placeholder for the name of network interface (platform
  2118. dependent):
  2119. @table @samp
  2120. @item net_@var{<interface>}_ip
  2121. The network interface's IP address. Read-only.
  2122. @item net_@var{<interface>}_mac
  2123. The network interface's MAC address. Read-only.
  2124. @item net_@var{<interface>}_clientid
  2125. The client id provided by DHCP. Read-only.
  2126. @item net_@var{<interface>}_clientuuid
  2127. The client uuid provided by DHCP. Read-only.
  2128. @item net_@var{<interface>}_hostname
  2129. The client host name provided by DHCP. Read-only.
  2130. @item net_@var{<interface>}_domain
  2131. The client domain name provided by DHCP. Read-only.
  2132. @item net_@var{<interface>}_rootpath
  2133. The path to the client's root disk provided by DHCP. Read-only.
  2134. @item net_@var{<interface>}_extensionspath
  2135. The path to additional DHCP vendor extensions provided by DHCP. Read-only.
  2136. @item net_@var{<interface>}_boot_file
  2137. The boot file name provided by DHCP. Read-only.
  2138. @item net_@var{<interface>}_dhcp_server_name
  2139. The name of the DHCP server responsible for these boot parameters.
  2140. Read-only.
  2141. @item net_@var{<interface>}_next_server
  2142. The IP address of the next (usually, TFTP) server provided by DHCP.
  2143. Read-only.
  2144. @item net_default_interface
  2145. Initially set to name of network interface that was used to load grub.
  2146. Read-write, although setting it affects only interpretation of
  2147. @samp{net_default_ip} and @samp{net_default_mac}
  2148. @item net_default_ip
  2149. The IP address of default interface. Read-only. This is alias for the
  2150. @samp{net_$@{net_default_interface@}_ip}.
  2151. @item net_default_mac
  2152. The default interface's MAC address. Read-only. This is alias for the
  2153. @samp{net_$@{net_default_interface@}_mac}.
  2154. @item net_default_server
  2155. The default server used by network drives (@pxref{Device syntax}). Read-write,
  2156. although setting this is only useful before opening a network device.
  2157. @item pxe_default_server
  2158. This performs the same function as @samp{net_default_server}.
  2159. @end table
  2160. @node Serial terminal
  2161. @chapter Using GRUB via a serial line
  2162. This chapter describes how to use the serial terminal support in GRUB.
  2163. If you have many computers or computers with no display/keyboard, it
  2164. could be very useful to control the computers through serial
  2165. communications. To connect one computer with another via a serial line,
  2166. you need to prepare a null-modem (cross) serial cable, and you may need
  2167. to have multiport serial boards, if your computer doesn't have extra
  2168. serial ports. In addition, a terminal emulator is also required, such as
  2169. minicom. Refer to a manual of your operating system, for more
  2170. information.
  2171. As for GRUB, the instruction to set up a serial terminal is quite
  2172. simple. Here is an example:
  2173. @example
  2174. @group
  2175. grub> @kbd{serial --unit=0 --speed=9600}
  2176. grub> @kbd{terminal_input serial; terminal_output serial}
  2177. @end group
  2178. @end example
  2179. The command @command{serial} initializes the serial unit 0 with the
  2180. speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if
  2181. you want to use COM2, you must specify @samp{--unit=1} instead. This
  2182. command accepts many other options, @pxref{serial} for more details.
  2183. Without argument or with @samp{--port=auto}, GRUB will attempt to use
  2184. ACPI when available to auto-detect the default serial port and its
  2185. configuration.
  2186. The commands @command{terminal_input} (@pxref{terminal_input}) and
  2187. @command{terminal_output} (@pxref{terminal_output}) choose which type of
  2188. terminal you want to use. In the case above, the terminal will be a
  2189. serial terminal, but you can also pass @code{console} to the command,
  2190. as @samp{terminal_input serial console}. In this case, a terminal in which
  2191. you press any key will be selected as a GRUB terminal. In the example above,
  2192. note that you need to put both commands on the same command line, as you
  2193. will lose the ability to type commands on the console after the first
  2194. command.
  2195. However, note that GRUB assumes that your terminal emulator is
  2196. compatible with VT100 by default. This is true for most terminal
  2197. emulators nowadays, but you should pass the option @option{--dumb} to
  2198. the command if your terminal emulator is not VT100-compatible or
  2199. implements few VT100 escape sequences. If you specify this option then
  2200. GRUB provides you with an alternative menu interface, because the normal
  2201. menu requires several fancy features of your terminal.
  2202. @node Vendor power-on keys
  2203. @chapter Using GRUB with vendor power-on keys
  2204. Some laptop vendors provide an additional power-on button which boots
  2205. another OS. GRUB supports such buttons with the @samp{GRUB_TIMEOUT_BUTTON},
  2206. @samp{GRUB_TIMEOUT_STYLE_BUTTON}, @samp{GRUB_DEFAULT_BUTTON}, and
  2207. @samp{GRUB_BUTTON_CMOS_ADDRESS} variables in default/grub (@pxref{Simple
  2208. configuration}). @samp{GRUB_TIMEOUT_BUTTON},
  2209. @samp{GRUB_TIMEOUT_STYLE_BUTTON}, and @samp{GRUB_DEFAULT_BUTTON} are used
  2210. instead of the corresponding variables without the @samp{_BUTTON} suffix
  2211. when powered on using the special button. @samp{GRUB_BUTTON_CMOS_ADDRESS}
  2212. is vendor-specific and partially model-specific. Values known to the GRUB
  2213. team are:
  2214. @table @key
  2215. @item Dell XPS M1330M
  2216. 121:3
  2217. @item Dell XPS M1530
  2218. 85:3
  2219. @item Dell Latitude E4300
  2220. 85:3
  2221. @item Asus EeePC 1005PE
  2222. 84:1 (unconfirmed)
  2223. @item LENOVO ThinkPad T410s (2912W1C)
  2224. 101:3
  2225. @end table
  2226. To take full advantage of this function, install GRUB into the MBR
  2227. (@pxref{Installing GRUB using grub-install}).
  2228. If you have a laptop which has a similar feature and not in the above list
  2229. could you figure your address and contribute?
  2230. To discover the address do the following:
  2231. @itemize
  2232. @item boot normally
  2233. @item
  2234. @example
  2235. sudo modprobe nvram
  2236. sudo cat /dev/nvram | xxd > normal_button.txt
  2237. @end example
  2238. @item boot using vendor button
  2239. @item
  2240. @example
  2241. sudo modprobe nvram
  2242. sudo cat /dev/nvram | xxd > normal_vendor.txt
  2243. @end example
  2244. @end itemize
  2245. Then compare these text files and find where a bit was toggled. E.g. in
  2246. case of Dell XPS it was:
  2247. @example
  2248. byte 0x47: 20 --> 28
  2249. @end example
  2250. It's a bit number 3 as seen from following table:
  2251. @multitable @columnfractions .2 .2
  2252. @item 0 @tab 01
  2253. @item 1 @tab 02
  2254. @item 2 @tab 04
  2255. @item 3 @tab 08
  2256. @item 4 @tab 10
  2257. @item 5 @tab 20
  2258. @item 6 @tab 40
  2259. @item 7 @tab 80
  2260. @end multitable
  2261. 0x47 is decimal 71. Linux nvram implementation cuts first 14 bytes of
  2262. CMOS. So the real byte address in CMOS is 71+14=85
  2263. So complete address is 85:3
  2264. @node Images
  2265. @chapter GRUB image files
  2266. @c FIXME: parts of this section are specific to PC BIOS right now.
  2267. GRUB consists of several images: a variety of bootstrap images for starting
  2268. GRUB in various ways, a kernel image, and a set of modules which are
  2269. combined with the kernel image to form a core image. Here is a short
  2270. overview of them.
  2271. @table @file
  2272. @item boot.img
  2273. On PC BIOS systems, this image is the first part of GRUB to start. It is
  2274. written to a master boot record (MBR) or to the boot sector of a partition.
  2275. Because a PC boot sector is 512 bytes, the size of this image is exactly 512
  2276. bytes.
  2277. The sole function of @file{boot.img} is to read the first sector of the core
  2278. image from a local disk and jump to it. Because of the size restriction,
  2279. @file{boot.img} cannot understand any file system structure, so
  2280. @command{grub-install} hardcodes the location of the first sector of the
  2281. core image into @file{boot.img} when installing GRUB.
  2282. @item diskboot.img
  2283. This image is used as the first sector of the core image when booting from a
  2284. hard disk. It reads the rest of the core image into memory and starts the
  2285. kernel. Since file system handling is not yet available, it encodes the
  2286. location of the core image using a block list format.
  2287. @item cdboot.img
  2288. This image is used as the first sector of the core image when booting from a
  2289. CD-ROM drive. It performs a similar function to @file{diskboot.img}.
  2290. @item pxeboot.img
  2291. This image is used as the start of the core image when booting from the
  2292. network using PXE. @xref{Network}.
  2293. @item lnxboot.img
  2294. This image may be placed at the start of the core image in order to make
  2295. GRUB look enough like a Linux kernel that it can be booted by LILO using an
  2296. @samp{image=} section.
  2297. @item kernel.img
  2298. This image contains GRUB's basic run-time facilities: frameworks for device
  2299. and file handling, environment variables, the rescue mode command-line
  2300. parser, and so on. It is rarely used directly, but is built into all core
  2301. images.
  2302. @item core.img
  2303. This is the core image of GRUB. It is built dynamically from the kernel
  2304. image and an arbitrary list of modules by the @command{grub-mkimage}
  2305. program. Usually, it contains enough modules to access @file{/boot/grub},
  2306. and loads everything else (including menu handling, the ability to load
  2307. target operating systems, and so on) from the file system at run-time. The
  2308. modular design allows the core image to be kept small, since the areas of
  2309. disk where it must be installed are often as small as 32KB.
  2310. @xref{BIOS installation}, for details on where the core image can be
  2311. installed on PC systems.
  2312. @item *.mod
  2313. Everything else in GRUB resides in dynamically loadable modules. These are
  2314. often loaded automatically, or built into the core image if they are
  2315. essential, but may also be loaded manually using the @command{insmod}
  2316. command (@pxref{insmod}).
  2317. @end table
  2318. @heading For GRUB Legacy users
  2319. GRUB 2 has a different design from GRUB Legacy, and so correspondences with
  2320. the images it used cannot be exact. Nevertheless, GRUB Legacy users often
  2321. ask questions in the terms they are familiar with, and so here is a brief
  2322. guide to how GRUB 2's images relate to that.
  2323. @table @file
  2324. @item stage1
  2325. Stage 1 from GRUB Legacy was very similar to @file{boot.img} in GRUB 2, and
  2326. they serve the same function.
  2327. @item *_stage1_5
  2328. In GRUB Legacy, Stage 1.5's function was to include enough filesystem code
  2329. to allow the much larger Stage 2 to be read from an ordinary filesystem. In
  2330. this respect, its function was similar to @file{core.img} in GRUB 2.
  2331. However, @file{core.img} is much more capable than Stage 1.5 was; since it
  2332. offers a rescue shell, it is sometimes possible to recover manually in the
  2333. event that it is unable to load any other modules, for example if partition
  2334. numbers have changed. @file{core.img} is built in a more flexible way,
  2335. allowing GRUB 2 to support reading modules from advanced disk types such as
  2336. LVM and RAID.
  2337. GRUB Legacy could run with only Stage 1 and Stage 2 in some limited
  2338. configurations, while GRUB 2 requires @file{core.img} and cannot work
  2339. without it.
  2340. @item stage2
  2341. GRUB 2 has no single Stage 2 image. Instead, it loads modules from
  2342. @file{/boot/grub} at run-time.
  2343. @item stage2_eltorito
  2344. In GRUB 2, images for booting from CD-ROM drives are now constructed using
  2345. @file{cdboot.img} and @file{core.img}, making sure that the core image
  2346. contains the @samp{iso9660} module. It is usually best to use the
  2347. @command{grub-mkrescue} program for this.
  2348. @item nbgrub
  2349. There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by
  2350. Etherboot and some other network boot loaders.
  2351. @item pxegrub
  2352. In GRUB 2, images for PXE network booting are now constructed using
  2353. @file{pxeboot.img} and @file{core.img}, making sure that the core image
  2354. contains the @samp{pxe} and @samp{pxecmd} modules. @xref{Network}.
  2355. @end table
  2356. @node Core image size limitation
  2357. @chapter Core image size limitation
  2358. Heavily limited platforms:
  2359. @itemize
  2360. @item i386-pc (normal and PXE): the core image size (compressed) is limited by 458240 bytes.
  2361. kernel.img (.text + .data + .bss, uncompressed) is limited by 392704 bytes.
  2362. module size (uncompressed) + kernel.img (.text + .data, uncompressed) is limited by the size of contiguous chunk at 1M address.
  2363. @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.
  2364. @item i386-ieee1275: kernel.img (.text + .data + .bss) + modules is limited by memory available at 0x10000, at most 596K
  2365. @end itemize
  2366. Lightly limited platforms:
  2367. @itemize
  2368. @item *-xen: limited only by adress space and RAM size.
  2369. @item i386-qemu: kernel.img (.text + .data + .bss) is limited by 392704 bytes.
  2370. (core.img would be limited by ROM size but it's unlimited on qemu
  2371. @item All EFI platforms: limited by contiguous RAM size and possibly firmware bugs
  2372. @item Coreboot and multiboot. kernel.img (.text + .data + .bss) is limited by 392704 bytes.
  2373. module size is limited by the size of contiguous chunk at 1M address.
  2374. @item mipsel-loongson (ELF), mips(el)-qemu_mips (ELF): if uncompressed:
  2375. kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
  2376. if compressed:
  2377. kernel.img (.text + .data, uncompressed) + modules (uncompressed)
  2378. + (modules + kernel.img (.text + .data)) (compressed)
  2379. + decompressor is limited by the space from 80200000 forward
  2380. @item mipsel-loongson (Flash), mips(el)-qemu_mips (Flash): kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
  2381. core.img (final) is limited by flash size (512K on yeeloong and fulooong)
  2382. @item mips-arc: if uncompressed:
  2383. kernel.img (.text + .data) is limited by the space from 8bd00000 forward
  2384. modules + dummy decompressor is limited by the space from 8bd00000 backward
  2385. if compressed:
  2386. kernel.img (.text + .data, uncompressed) is limited by the space from 8bd00000 forward
  2387. modules (uncompressed) + (modules + kernel.img (.text + .data)) (compressed, aligned to 1M)
  2388. + 1M (decompressor + scratch space) is limited by the space from 8bd00000 backward
  2389. @item powerpc-ieee1275: kernel.img (.text + .data + .bss) + modules is limited by space available at 0x200000
  2390. @end itemize
  2391. @node Filesystem
  2392. @chapter Filesystem syntax and semantics
  2393. GRUB uses a special syntax for specifying disk drives which can be
  2394. accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
  2395. between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
  2396. device is equivalent to which OS device. Normally, that will be clear if
  2397. you see the files in a device or use the command @command{search}
  2398. (@pxref{search}).
  2399. @menu
  2400. * Device syntax:: How to specify devices
  2401. * File name syntax:: How to specify files
  2402. * Block list syntax:: How to specify block lists
  2403. @end menu
  2404. @node Device syntax
  2405. @section How to specify devices
  2406. The device syntax is like this:
  2407. @example
  2408. @code{(@var{device}[,@var{partmap-name1}@var{part-num1}[,@var{partmap-name2}@var{part-num2}[,...]]])}
  2409. @end example
  2410. @samp{[]} means the parameter is optional. @var{device} depends on the disk
  2411. driver in use. BIOS and EFI disks use either @samp{fd} or @samp{hd} followed
  2412. by a digit, like @samp{fd0}, or @samp{cd}.
  2413. AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
  2414. Memdisk and host are limited to one disk and so it's referred just by driver
  2415. name.
  2416. RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM, virtio (vdsk)
  2417. and arcdisk (arc) use intrinsic name of disk prefixed by driver name.
  2418. Additionally just ``nand'' refers to the disk aliased as ``nand''.
  2419. Conflicts are solved by suffixing a number if necessary.
  2420. Commas need to be escaped.
  2421. Loopback uses whatever name specified to @command{loopback} command.
  2422. Hostdisk uses names specified in device.map as long as it's of the form
  2423. [fhc]d[0-9]* or hostdisk/<OS DEVICE>.
  2424. For crypto and RAID (md) additionally you can use the syntax
  2425. <driver name>uuid/<uuid>. For LVM additionally you can use the syntax
  2426. lvmid/<volume-group-uuid>/<volume-uuid>.
  2427. @example
  2428. (fd0)
  2429. (hd0)
  2430. (cd)
  2431. (ahci0)
  2432. (ata0)
  2433. (crypto0)
  2434. (usb0)
  2435. (cryptouuid/123456789abcdef0123456789abcdef0)
  2436. (mduuid/123456789abcdef0123456789abcdef0)
  2437. (lvm/system-root)
  2438. (lvmid/F1ikgD-2RES-306G-il9M-7iwa-4NKW-EbV1NV/eLGuCQ-L4Ka-XUgR-sjtJ-ffch-bajr-fCNfz5)
  2439. (md/myraid)
  2440. (md/0)
  2441. (ieee1275/disk2)
  2442. (ieee1275//pci@@1f\,0/ide@@d/disk@@2)
  2443. (nand)
  2444. (memdisk)
  2445. (host)
  2446. (myloop)
  2447. (hostdisk//dev/sda)
  2448. @end example
  2449. @var{part-num} represents the partition number of @var{device}, starting
  2450. from one. @var{partname} is optional but is recommended since disk may have
  2451. several top-level partmaps. Specifying third and later component you can access
  2452. to subpartitions.
  2453. The syntax @samp{(hd0)} represents using the entire disk (or the
  2454. MBR when installing GRUB), while the syntax @samp{(hd0,1)}
  2455. represents using the first partition of the disk (or the boot sector
  2456. of the partition when installing GRUB).
  2457. @example
  2458. (hd0,msdos1)
  2459. (hd0,msdos1,msdos5)
  2460. (hd0,msdos1,bsd3)
  2461. (hd0,netbsd1)
  2462. (hd0,gpt1)
  2463. (hd0,1,3)
  2464. @end example
  2465. If you enabled the network support, the special drives
  2466. @code{(@var{protocol}[,@var{server}])} are also available. Supported protocols
  2467. are @samp{http} and @samp{tftp}. If @var{server} is omitted, value of
  2468. environment variable @samp{net_default_server} is used.
  2469. Before using the network drive, you must initialize the network.
  2470. @xref{Network}, for more information.
  2471. When using @samp{http} or @samp{tftp}, ports other than @samp{80} can be
  2472. specified using a colon (@samp{:}) after the address. To avoid parsing
  2473. conflicts, when using IPv6 addresses with custom ports, the addresses
  2474. must be enclosed with square brackets (@samp{[]}), as is standard
  2475. practice.
  2476. @example
  2477. (http,grub.example.com:31337)
  2478. (http,192.0.2.1:339)
  2479. (http,[2001:db8::1]:11235)
  2480. @end example
  2481. If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making
  2482. a GRUB bootable CD-ROM}, for details.
  2483. @node File name syntax
  2484. @section How to specify files
  2485. There are two ways to specify files, by @dfn{absolute file name} and by
  2486. @dfn{block list}.
  2487. An absolute file name resembles a Unix absolute file name, using
  2488. @samp{/} for the directory separator (not @samp{\} as in DOS). One
  2489. example is @samp{(hd0,1)/boot/grub/grub.cfg}. This means the file
  2490. @file{/boot/grub/grub.cfg} in the first partition of the first hard
  2491. disk. If you omit the device name in an absolute file name, GRUB uses
  2492. GRUB's @dfn{root device} implicitly. So if you set the root device to,
  2493. say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}),
  2494. then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
  2495. On ZFS filesystem the first path component must be
  2496. @var{volume}@samp{@@}[@var{snapshot}].
  2497. So @samp{/rootvol@@snap-129/boot/grub/grub.cfg} refers to file
  2498. @samp{/boot/grub/grub.cfg} in snapshot of volume @samp{rootvol} with name
  2499. @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if
  2500. snapshot name is omitted.
  2501. @node Block list syntax
  2502. @section How to specify block lists
  2503. A block list is used for specifying a file that doesn't appear in the
  2504. filesystem, like a chainloader. The syntax is
  2505. @code{[@var{offset}]+[@var{length}][,[@var{offset}]+[@var{length}]]@dots{}}.
  2506. Here is an example:
  2507. @example
  2508. @code{0+100,200+1,300+300,800+}
  2509. @end example
  2510. This represents that GRUB should read blocks 0 through 99, block 200,
  2511. blocks 300 through 599, and blocks 800 until the end of the device.
  2512. If you omit an offset, then GRUB assumes the offset is zero. If the
  2513. length is omitted, then GRUB assumes the block list extends until the
  2514. end of the device.
  2515. Like the file name syntax (@pxref{File name syntax}), if a blocklist
  2516. does not contain a device name, then GRUB uses GRUB's @dfn{root
  2517. device}. So @code{(hd0,2)+1} is the same as @code{+1} when the root
  2518. device is @samp{(hd0,2)}.
  2519. @node Interface
  2520. @chapter GRUB's user interface
  2521. GRUB has both a simple menu interface for choosing preset entries from a
  2522. configuration file, and a highly flexible command-line for performing
  2523. any desired combination of boot commands.
  2524. GRUB looks for its configuration file as soon as it is loaded. If one
  2525. is found, then the full menu interface is activated using whatever
  2526. entries were found in the file. If you choose the @dfn{command-line} menu
  2527. option, or if the configuration file was not found, then GRUB drops to
  2528. the command-line interface.
  2529. @menu
  2530. * Command-line interface:: The flexible command-line interface
  2531. * Menu interface:: The simple menu interface
  2532. * Menu entry editor:: Editing a menu entry
  2533. @end menu
  2534. @node Command-line interface
  2535. @section The flexible command-line interface
  2536. The command-line interface provides a prompt and after it an editable
  2537. text area much like a command-line in Unix or DOS. Each command is
  2538. immediately executed after it is entered@footnote{However, this
  2539. behavior will be changed in the future version, in a user-invisible
  2540. way.}. The commands (@pxref{Commands}) are a subset of those available
  2541. in the configuration file, used with exactly the same syntax.
  2542. Cursor movement and editing of the text on the line can be done via a
  2543. subset of the functions available in the Bash shell:
  2544. @table @key
  2545. @item C-f
  2546. @itemx PC right key
  2547. Move forward one character.
  2548. @item C-b
  2549. @itemx PC left key
  2550. Move back one character.
  2551. @item C-a
  2552. @itemx HOME
  2553. Move to the start of the line.
  2554. @item C-e
  2555. @itemx END
  2556. Move the the end of the line.
  2557. @item C-d
  2558. @itemx DEL
  2559. Delete the character underneath the cursor.
  2560. @item C-h
  2561. @itemx BS
  2562. Delete the character to the left of the cursor.
  2563. @item C-k
  2564. Kill the text from the current cursor position to the end of the line.
  2565. @item C-u
  2566. Kill backward from the cursor to the beginning of the line.
  2567. @item C-y
  2568. Yank the killed text back into the buffer at the cursor.
  2569. @item C-p
  2570. @itemx PC up key
  2571. Move up through the history list.
  2572. @item C-n
  2573. @itemx PC down key
  2574. Move down through the history list.
  2575. @end table
  2576. When typing commands interactively, if the cursor is within or before
  2577. the first word in the command-line, pressing the @key{TAB} key (or
  2578. @key{C-i}) will display a listing of the available commands, and if the
  2579. cursor is after the first word, the @kbd{@key{TAB}} will provide a
  2580. completion listing of disks, partitions, and file names depending on the
  2581. context. Note that to obtain a list of drives, one must open a
  2582. parenthesis, as @command{root (}.
  2583. Note that you cannot use the completion functionality in the TFTP
  2584. filesystem. This is because TFTP doesn't support file name listing for
  2585. the security.
  2586. @node Menu interface
  2587. @section The simple menu interface
  2588. The menu interface is quite easy to use. Its commands are both
  2589. reasonably intuitive and described on screen.
  2590. Basically, the menu interface provides a list of @dfn{boot entries} to
  2591. the user to choose from. Use the arrow keys to select the entry of
  2592. choice, then press @key{RET} to run it. An optional timeout is
  2593. available to boot the default entry (the first one if not set), which is
  2594. aborted by pressing any key.
  2595. Commands are available to enter a bare command-line by pressing @key{c}
  2596. (which operates exactly like the non-config-file version of GRUB, but
  2597. allows one to return to the menu if desired by pressing @key{ESC}) or to
  2598. edit any of the @dfn{boot entries} by pressing @key{e}.
  2599. If you protect the menu interface with a password (@pxref{Security}),
  2600. all you can do is choose an entry by pressing @key{RET}, or press
  2601. @key{p} to enter the password.
  2602. Pressing @key{Ctrl-l} will refresh the menu, which can be useful when
  2603. connecting via serial after the menu has been drawn.
  2604. @node Menu entry editor
  2605. @section Editing a menu entry
  2606. The menu entry editor looks much like the main menu interface, but the
  2607. lines in the menu are individual commands in the selected entry instead
  2608. of entry names.
  2609. If an @key{ESC} is pressed in the editor, it aborts all the changes made
  2610. to the configuration entry and returns to the main menu interface.
  2611. Each line in the menu entry can be edited freely, and you can add new lines
  2612. by pressing @key{RET} at the end of a line. To boot the edited entry, press
  2613. @key{Ctrl-x}.
  2614. Although GRUB unfortunately does not support @dfn{undo}, you can do almost
  2615. the same thing by just returning to the main menu using @key{ESC}.
  2616. @node Environment
  2617. @chapter GRUB environment variables
  2618. GRUB supports environment variables which are rather like those offered by
  2619. all Unix-like systems. Environment variables have a name, which is unique
  2620. and is usually a short identifier, and a value, which is an arbitrary string
  2621. of characters. They may be set (@pxref{set}), unset (@pxref{unset}), or
  2622. looked up (@pxref{Shell-like scripting}) by name.
  2623. A number of environment variables have special meanings to various parts of
  2624. GRUB. Others may be used freely in GRUB configuration files.
  2625. @menu
  2626. * Special environment variables::
  2627. * Environment block::
  2628. @end menu
  2629. @node Special environment variables
  2630. @section Special environment variables
  2631. These variables have special meaning to GRUB.
  2632. @menu
  2633. * biosnum::
  2634. * check_signatures::
  2635. * chosen::
  2636. * cmdpath::
  2637. * color_highlight::
  2638. * color_normal::
  2639. * config_directory::
  2640. * config_file::
  2641. * cryptodisk_passphrase_tries::
  2642. * debug::
  2643. * default::
  2644. * fallback::
  2645. * gfxmode::
  2646. * gfxpayload::
  2647. * gfxterm_font::
  2648. * grub_cpu::
  2649. * grub_platform::
  2650. * icondir::
  2651. * lang::
  2652. * locale_dir::
  2653. * lockdown::
  2654. * menu_color_highlight::
  2655. * menu_color_normal::
  2656. * net_@var{<interface>}_boot_file::
  2657. * net_@var{<interface>}_clientid::
  2658. * net_@var{<interface>}_clientuuid::
  2659. * net_@var{<interface>}_dhcp_server_name::
  2660. * net_@var{<interface>}_domain::
  2661. * net_@var{<interface>}_extensionspath::
  2662. * net_@var{<interface>}_hostname::
  2663. * net_@var{<interface>}_ip::
  2664. * net_@var{<interface>}_mac::
  2665. * net_@var{<interface>}_next_server::
  2666. * net_@var{<interface>}_rootpath::
  2667. * net_default_interface::
  2668. * net_default_ip::
  2669. * net_default_mac::
  2670. * net_default_server::
  2671. * pager::
  2672. * prefix::
  2673. * pxe_default_server::
  2674. * root::
  2675. * shim_lock::
  2676. * superusers::
  2677. * theme::
  2678. * timeout::
  2679. * timeout_style::
  2680. * tpm_fail_fatal::
  2681. @end menu
  2682. @node biosnum
  2683. @subsection biosnum
  2684. When chain-loading another boot loader (@pxref{Chain-loading}), GRUB may
  2685. need to know what BIOS drive number corresponds to the root device
  2686. (@pxref{root}) so that it can set up registers properly. If the
  2687. @var{biosnum} variable is set, it overrides GRUB's own means of guessing
  2688. this.
  2689. For an alternative approach which also changes BIOS drive mappings for the
  2690. chain-loaded system, @pxref{drivemap}.
  2691. @node check_signatures
  2692. @subsection check_signatures
  2693. This variable controls whether GRUB enforces digital signature
  2694. validation on loaded files. @xref{Using digital signatures}.
  2695. @node chosen
  2696. @subsection chosen
  2697. When executing a menu entry, GRUB sets the @var{chosen} variable to the
  2698. title of the entry being executed.
  2699. If the menu entry is in one or more submenus, then @var{chosen} is set to
  2700. the titles of each of the submenus starting from the top level followed by
  2701. the title of the menu entry itself, separated by @samp{>}.
  2702. @node cmdpath
  2703. @subsection cmdpath
  2704. The location from which @file{core.img} was loaded as an absolute
  2705. directory name (@pxref{File name syntax}). This is set by GRUB at
  2706. startup based on information returned by platform firmware. Not every
  2707. platform provides this information and some may return only device
  2708. without path name.
  2709. @node color_highlight
  2710. @subsection color_highlight
  2711. This variable contains the ``highlight'' foreground and background terminal
  2712. colors, separated by a slash (@samp{/}). Setting this variable changes
  2713. those colors. For the available color names, @pxref{color_normal}.
  2714. The default is @samp{black/light-gray}.
  2715. @node color_normal
  2716. @subsection color_normal
  2717. This variable contains the ``normal'' foreground and background terminal
  2718. colors, separated by a slash (@samp{/}). Setting this variable changes
  2719. those colors. Each color must be a name from the following list:
  2720. @itemize @bullet
  2721. @item black
  2722. @item blue
  2723. @item green
  2724. @item cyan
  2725. @item red
  2726. @item magenta
  2727. @item brown
  2728. @item light-gray
  2729. @item dark-gray
  2730. @item light-blue
  2731. @item light-green
  2732. @item light-cyan
  2733. @item light-red
  2734. @item light-magenta
  2735. @item yellow
  2736. @item white
  2737. @end itemize
  2738. The default is @samp{light-gray/black}.
  2739. The color support support varies from terminal to terminal.
  2740. @samp{morse} has no color support at all.
  2741. @samp{mda_text} color support is limited to highlighting by
  2742. black/white reversal.
  2743. @samp{console} on ARC, EMU and IEEE1275, @samp{serial_*} and
  2744. @samp{spkmodem} are governed by terminfo and support
  2745. only 8 colors if in modes @samp{vt100-color} (default for console on emu),
  2746. @samp{arc} (default for console on ARC), @samp{ieee1275} (default
  2747. for console on IEEE1275). When in mode @samp{vt100}
  2748. then the color support is limited to highlighting by black/white
  2749. reversal. When in mode @samp{dumb} there is no color support.
  2750. When console supports no colors this setting is ignored.
  2751. When console supports 8 colors, then the colors from the
  2752. second half of the previous list are mapped to the
  2753. matching colors of first half.
  2754. @samp{console} on EFI and BIOS and @samp{vga_text} support all 16 colors.
  2755. @samp{gfxterm} supports all 16 colors and would be theoretically extendable
  2756. to support whole rgb24 palette but currently there is no compelling reason
  2757. to go beyond the current 16 colors.
  2758. @node config_directory
  2759. @subsection config_directory
  2760. This variable is automatically set by GRUB to the directory part of
  2761. current configuration file name (@pxref{config_file}).
  2762. @node config_file
  2763. @subsection config_file
  2764. This variable is automatically set by GRUB to the name of configuration file that is being
  2765. processed by commands @command{configfile} (@pxref{configfile}) or @command{normal}
  2766. (@pxref{normal}). It is restored to the previous value when command completes.
  2767. @node cryptodisk_passphrase_tries
  2768. @subsection cryptodisk_passphrase_tries
  2769. When prompting the user for a cryptodisk passphrase, allow this many attempts
  2770. before giving up. Defaults to @samp{3} if unset or set to an invalid value.
  2771. (The user can give up early by entering an empty passphrase.)
  2772. @node debug
  2773. @subsection debug
  2774. This variable may be set to enable debugging output from various components
  2775. of GRUB. The value is an ordered list of debug facility names separated by
  2776. whitespace or @samp{,}. If the special facility named @samp{all} is present
  2777. then debugging output of all facility names is enabled at the start of
  2778. processing the value of this variable. A facility's debug output can then be
  2779. disabled by prefixing its name with a @samp{-}. The last occurence facility
  2780. name with or without a leading @samp{-} takes precendent over any previous
  2781. occurence. This allows the easy enabling or disabling of facilities by
  2782. appending a @samp{,} and then the facility name with or without the leading
  2783. @samp{-}, which will preserve the state of the rest of the facilities.
  2784. The facility names are the first argument to grub_dprintf. Consult the
  2785. source for more details.
  2786. @node default
  2787. @subsection default
  2788. If this variable is set, it identifies a menu entry that should be
  2789. selected by default, possibly after a timeout (@pxref{timeout}). The
  2790. entry may be identified by number (starting from 0 at each level of
  2791. the hierarchy), by title, or by id.
  2792. For example, if you have:
  2793. @verbatim
  2794. menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
  2795. ...
  2796. }
  2797. @end verbatim
  2798. then you can make this the default using:
  2799. @example
  2800. default=example-gnu-linux
  2801. @end example
  2802. If the entry is in a submenu, then it must be identified using the
  2803. number, title, or id of each of the submenus starting from the top
  2804. level, followed by the number, title, or id of the menu entry itself,
  2805. with each element separated by @samp{>}. For example, take the
  2806. following menu structure:
  2807. @example
  2808. GNU/Hurd --id gnu-hurd
  2809. Standard Boot --id=gnu-hurd-std
  2810. Rescue shell --id=gnu-hurd-rescue
  2811. Other platforms --id=other
  2812. Minix --id=minix
  2813. Version 3.4.0 --id=minix-3.4.0
  2814. Version 3.3.0 --id=minix-3.3.0
  2815. GRUB Invaders --id=grub-invaders
  2816. @end example
  2817. The more recent release of Minix would then be identified as
  2818. @samp{Other platforms>Minix>Version 3.4.0}, or as @samp{1>0>0}, or as
  2819. @samp{other>minix>minix-3.4.0}.
  2820. This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
  2821. configuration}), @command{grub-set-default}, or @command{grub-reboot}.
  2822. @node fallback
  2823. @subsection fallback
  2824. If this variable is set, it identifies a menu entry that should be selected
  2825. if the default menu entry fails to boot. Entries are identified in the same
  2826. way as for @samp{default} (@pxref{default}).
  2827. @node gfxmode
  2828. @subsection gfxmode
  2829. If this variable is set, it sets the resolution used on the @samp{gfxterm}
  2830. graphical terminal. Note that you can only use modes which your graphics
  2831. card supports via VESA BIOS Extensions (VBE), so for example native LCD
  2832. panel resolutions may not be available. The default is @samp{auto}, which
  2833. selects a platform-specific default that should look reasonable. Supported
  2834. modes can be listed by @samp{videoinfo} command in GRUB.
  2835. The resolution may be specified as a sequence of one or more modes,
  2836. separated by commas (@samp{,}) or semicolons (@samp{;}); each will be tried
  2837. in turn until one is found. Each mode should be either @samp{auto},
  2838. @samp{@var{width}x@var{height}}, or
  2839. @samp{@var{width}x@var{height}x@var{depth}}.
  2840. @node gfxpayload
  2841. @subsection gfxpayload
  2842. If this variable is set, it controls the video mode in which the Linux
  2843. kernel starts up, replacing the @samp{vga=} boot option (@pxref{linux}). It
  2844. may be set to @samp{text} to force the Linux kernel to boot in normal text
  2845. mode, @samp{keep} to preserve the graphics mode set using @samp{gfxmode}, or
  2846. any of the permitted values for @samp{gfxmode} to set a particular graphics
  2847. mode (@pxref{gfxmode}).
  2848. Depending on your kernel, your distribution, your graphics card, and the
  2849. phase of the moon, note that using this option may cause GNU/Linux to suffer
  2850. from various display problems, particularly during the early part of the
  2851. boot sequence. If you have problems, set this variable to @samp{text} and
  2852. GRUB will tell Linux to boot in normal text mode.
  2853. The default is platform-specific. On platforms with a native text mode
  2854. (such as PC BIOS platforms), the default is @samp{text}. Otherwise the
  2855. default may be @samp{auto} or a specific video mode.
  2856. This variable is often set by @samp{GRUB_GFXPAYLOAD_LINUX} (@pxref{Simple
  2857. configuration}).
  2858. @node gfxterm_font
  2859. @subsection gfxterm_font
  2860. If this variable is set, it names a font to use for text on the
  2861. @samp{gfxterm} graphical terminal. Otherwise, @samp{gfxterm} may use any
  2862. available font.
  2863. @node grub_cpu
  2864. @subsection grub_cpu
  2865. In normal mode (@pxref{normal}), GRUB sets the @samp{grub_cpu} variable to
  2866. the CPU type for which GRUB was built (e.g. @samp{i386} or @samp{powerpc}).
  2867. @node grub_platform
  2868. @subsection grub_platform
  2869. In normal mode (@pxref{normal}), GRUB sets the @samp{grub_platform} variable
  2870. to the platform for which GRUB was built (e.g. @samp{pc} or @samp{efi}).
  2871. @node icondir
  2872. @subsection icondir
  2873. If this variable is set, it names a directory in which the GRUB graphical
  2874. menu should look for icons after looking in the theme's @samp{icons}
  2875. directory. @xref{Theme file format}.
  2876. @node lang
  2877. @subsection lang
  2878. If this variable is set, it names the language code that the
  2879. @command{gettext} command (@pxref{gettext}) uses to translate strings. For
  2880. example, French would be named as @samp{fr}, and Simplified Chinese as
  2881. @samp{zh_CN}.
  2882. @command{grub-mkconfig} (@pxref{Simple configuration}) will try to set a
  2883. reasonable default for this variable based on the system locale.
  2884. @node locale_dir
  2885. @subsection locale_dir
  2886. If this variable is set, it names the directory where translation files may
  2887. be found (@pxref{gettext}), usually @file{/boot/grub/locale}. Otherwise,
  2888. internationalization is disabled.
  2889. @command{grub-mkconfig} (@pxref{Simple configuration}) will set a reasonable
  2890. default for this variable if internationalization is needed and any
  2891. translation files are available.
  2892. @node lockdown
  2893. @subsection lockdown
  2894. If this variable is set to @samp{y}, it means that GRUB has entered
  2895. @pxref{Lockdown} mode.
  2896. @node menu_color_highlight
  2897. @subsection menu_color_highlight
  2898. This variable contains the foreground and background colors to be used for
  2899. the highlighted menu entry, separated by a slash (@samp{/}). Setting this
  2900. variable changes those colors. For the available color names,
  2901. @pxref{color_normal}.
  2902. The default is the value of @samp{color_highlight}
  2903. (@pxref{color_highlight}).
  2904. @node menu_color_normal
  2905. @subsection menu_color_normal
  2906. This variable contains the foreground and background colors to be used for
  2907. non-highlighted menu entries, separated by a slash (@samp{/}). Setting this
  2908. variable changes those colors. For the available color names,
  2909. @pxref{color_normal}.
  2910. The default is the value of @samp{color_normal} (@pxref{color_normal}).
  2911. @node net_@var{<interface>}_boot_file
  2912. @subsection net_@var{<interface>}_boot_file
  2913. @xref{Network}.
  2914. @node net_@var{<interface>}_clientid
  2915. @subsection net_@var{<interface>}_clientid
  2916. @xref{Network}.
  2917. @node net_@var{<interface>}_clientuuid
  2918. @subsection net_@var{<interface>}_clientuuid
  2919. @xref{Network}.
  2920. @node net_@var{<interface>}_dhcp_server_name
  2921. @subsection net_@var{<interface>}_dhcp_server_name
  2922. @xref{Network}.
  2923. @node net_@var{<interface>}_domain
  2924. @subsection net_@var{<interface>}_domain
  2925. @xref{Network}.
  2926. @node net_@var{<interface>}_extensionspath
  2927. @subsection net_@var{<interface>}_extensionspath
  2928. @xref{Network}.
  2929. @node net_@var{<interface>}_hostname
  2930. @subsection net_@var{<interface>}_hostname
  2931. @xref{Network}.
  2932. @node net_@var{<interface>}_ip
  2933. @subsection net_@var{<interface>}_ip
  2934. @xref{Network}.
  2935. @node net_@var{<interface>}_mac
  2936. @subsection net_@var{<interface>}_mac
  2937. @xref{Network}.
  2938. @node net_@var{<interface>}_next_server
  2939. @subsection net_@var{<interface>}_next_server
  2940. @xref{Network}.
  2941. @node net_@var{<interface>}_rootpath
  2942. @subsection net_@var{<interface>}_rootpath
  2943. @xref{Network}.
  2944. @node net_default_interface
  2945. @subsection net_default_interface
  2946. @xref{Network}.
  2947. @node net_default_ip
  2948. @subsection net_default_ip
  2949. @xref{Network}.
  2950. @node net_default_mac
  2951. @subsection net_default_mac
  2952. @xref{Network}.
  2953. @node net_default_server
  2954. @subsection net_default_server
  2955. @xref{Network}.
  2956. @node pager
  2957. @subsection pager
  2958. If set to @samp{1}, pause output after each screenful and wait for keyboard
  2959. input. The default is not to pause output.
  2960. @node prefix
  2961. @subsection prefix
  2962. The location of the @samp{/boot/grub} directory as an absolute file name
  2963. (@pxref{File name syntax}). This is normally set by GRUB at startup based
  2964. on information provided by @command{grub-install}. GRUB modules are
  2965. dynamically loaded from this directory, so it must be set correctly in order
  2966. for many parts of GRUB to work.
  2967. @node pxe_default_server
  2968. @subsection pxe_default_server
  2969. @xref{Network}.
  2970. @node root
  2971. @subsection root
  2972. The root device name (@pxref{Device syntax}). Any file names that do not
  2973. specify an explicit device name are read from this device. The default is
  2974. normally set by GRUB at startup based on the value of @samp{prefix}
  2975. (@pxref{prefix}).
  2976. For example, if GRUB was installed to the first partition of the first hard
  2977. disk, then @samp{prefix} might be set to @samp{(hd0,msdos1)/boot/grub} and
  2978. @samp{root} to @samp{hd0,msdos1}.
  2979. @node shim_lock
  2980. @subsection shim_lock
  2981. If this variable is set to @samp{y}, it means that the shim_lock verifier
  2982. is registered (see @pxref{UEFI secure boot and shim}).
  2983. @node superusers
  2984. @subsection superusers
  2985. This variable may be set to a list of superuser names to enable
  2986. authentication support. @xref{Security}.
  2987. @node theme
  2988. @subsection theme
  2989. This variable may be set to a directory containing a GRUB graphical menu
  2990. theme. @xref{Theme file format}.
  2991. This variable is often set by @samp{GRUB_THEME} (@pxref{Simple
  2992. configuration}).
  2993. @node timeout
  2994. @subsection timeout
  2995. If this variable is set, it specifies the time in seconds to wait for
  2996. keyboard input before booting the default menu entry. A timeout of @samp{0}
  2997. means to boot the default entry immediately without displaying the menu; a
  2998. timeout of @samp{-1} (or unset) means to wait indefinitely.
  2999. If @samp{timeout_style} (@pxref{timeout_style}) is set to @samp{countdown}
  3000. or @samp{hidden}, the timeout is instead counted before the menu is
  3001. displayed.
  3002. This variable is often set by @samp{GRUB_TIMEOUT} (@pxref{Simple
  3003. configuration}).
  3004. @node timeout_style
  3005. @subsection timeout_style
  3006. This variable may be set to @samp{menu}, @samp{countdown}, or @samp{hidden}
  3007. to control the way in which the timeout (@pxref{timeout}) interacts with
  3008. displaying the menu. See the documentation of @samp{GRUB_TIMEOUT_STYLE}
  3009. (@pxref{Simple configuration}) for details.
  3010. @node tpm_fail_fatal
  3011. @subsection tpm_fail_fatal
  3012. If this variable is set and true (i.e., not set to ``0'', ``false'',
  3013. ``disable'', or ``no''), TPM measurements that fail will be treated as
  3014. fatal. Otherwise, they will merely be debug-logged and boot will
  3015. continue.
  3016. Call to EFI firmware, like hash_log_extend_event(), can return an unknown
  3017. error, i.e. due to bug present in firmware. When this variable is set and
  3018. true (same values as with TPM measurements) this situation will be considered
  3019. to be fatal and error-logged as ``unknown TPM error''. If not set, booting
  3020. the OS will be enabled.
  3021. @node Environment block
  3022. @section The GRUB environment block
  3023. It is often useful to be able to remember a small amount of information from
  3024. one boot to the next. For example, you might want to set the default menu
  3025. entry based on what was selected the last time. GRUB deliberately does not
  3026. implement support for writing files in order to minimise the possibility of
  3027. the boot loader being responsible for file system corruption, so a GRUB
  3028. configuration file cannot just create a file in the ordinary way. However,
  3029. GRUB provides an ``environment block'' which can be used to save a small
  3030. amount of state.
  3031. The environment block is a preallocated 1024-byte file, which normally lives
  3032. in @file{/boot/grub/grubenv} (although you should not assume this). At boot
  3033. time, the @command{load_env} command (@pxref{load_env}) loads environment
  3034. variables from it, and the @command{save_env} (@pxref{save_env}) command
  3035. saves environment variables to it. From a running system, the
  3036. @command{grub-editenv} utility can be used to edit the environment block.
  3037. For safety reasons, this storage is only available when installed on a plain
  3038. disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and
  3039. using BIOS or EFI functions (no ATA, USB or IEEE1275).
  3040. @command{grub-mkconfig} uses this facility to implement
  3041. @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
  3042. @node Modules
  3043. @chapter Modules
  3044. In this chapter, we list all modules that are available in GRUB.
  3045. Modules can be loaded via the @command{insmod} (@pxref{insmod}) command.
  3046. @menu
  3047. * acpi_module::
  3048. * adler32_module::
  3049. * affs_module::
  3050. * afs_module::
  3051. * afsplitter_module::
  3052. * ahci_module::
  3053. * all_video_module::
  3054. * aout_module::
  3055. * appleldr_module::
  3056. * archelp_module::
  3057. * at_keyboard_module::
  3058. * ata_module::
  3059. * backtrace_module::
  3060. * bfs_module::
  3061. * biosdisk_module::
  3062. * bitmap_module::
  3063. * bitmap_scale_module::
  3064. * bli_module::
  3065. * blocklist_module::
  3066. * boot_module::
  3067. * boottime_module::
  3068. * bsd_module::
  3069. * bswap_test_module::
  3070. * btrfs_module::
  3071. * bufio_module::
  3072. * cacheinfo_module::
  3073. * cat_module::
  3074. * cbfs_module::
  3075. * cbls_module::
  3076. * cbmemc_module::
  3077. * cbtable_module::
  3078. * cbtime_module::
  3079. * chain_module::
  3080. * cmdline_cat_test_module::
  3081. * cmosdump_module::
  3082. * cmostest_module::
  3083. * cmp_module::
  3084. * cmp_test_module::
  3085. * configfile_module::
  3086. * cpio_module::
  3087. * cpio_be_module::
  3088. * cpuid_module::
  3089. * crc64_module::
  3090. * crypto_module::
  3091. * cryptodisk_module::
  3092. * cs5536_module::
  3093. * ctz_test_module::
  3094. * date_module::
  3095. * datehook_module::
  3096. * datetime_module::
  3097. * disk_module::
  3098. * diskfilter_module::
  3099. * div_module::
  3100. * div_test_module::
  3101. * dm_nv_module::
  3102. * drivemap_module::
  3103. * echo_module::
  3104. * efi_gop_module::
  3105. * efi_uga_module::
  3106. * efiemu_module::
  3107. * efifwsetup_module::
  3108. * efinet_module::
  3109. * efitextmode_module::
  3110. * ehci_module::
  3111. * elf_module::
  3112. * emunet_module::
  3113. * emupci_module::
  3114. * erofs_module::
  3115. * escc_module::
  3116. * eval_module::
  3117. * exfat_module::
  3118. * exfctest_module::
  3119. * ext2_module::
  3120. * extcmd_module::
  3121. * f2fs_module::
  3122. * fat_module::
  3123. * fdt_module::
  3124. * file_module::
  3125. * fixvideo_module::
  3126. * font_module::
  3127. * freedos_module::
  3128. * fshelp_module::
  3129. * functional_test_module::
  3130. * gcry_arcfour_module::
  3131. * gcry_blowfish_module::
  3132. * gcry_camellia_module::
  3133. * gcry_cast5_module::
  3134. * gcry_crc_module::
  3135. * gcry_des_module::
  3136. * gcry_dsa_module::
  3137. * gcry_idea_module::
  3138. * gcry_md4_module::
  3139. * gcry_md5_module::
  3140. * gcry_rfc2268_module::
  3141. * gcry_rijndael_module::
  3142. * gcry_rmd160_module::
  3143. * gcry_rsa_module::
  3144. * gcry_seed_module::
  3145. * gcry_serpent_module::
  3146. * gcry_sha1_module::
  3147. * gcry_sha256_module::
  3148. * gcry_sha512_module::
  3149. * gcry_tiger_module::
  3150. * gcry_twofish_module::
  3151. * gcry_whirlpool_module::
  3152. * gdb_module::
  3153. * geli_module::
  3154. * gettext_module::
  3155. * gfxmenu_module::
  3156. * gfxterm_module::
  3157. * gfxterm_background_module::
  3158. * gfxterm_menu_module::
  3159. * gptsync_module::
  3160. * gzio_module::
  3161. * halt_module::
  3162. * hashsum_module::
  3163. * hdparm_module::
  3164. * hello_module::
  3165. * help_module::
  3166. * hexdump_module::
  3167. * hfs_module::
  3168. * hfsplus_module::
  3169. * hfspluscomp_module::
  3170. * http_module::
  3171. * ieee1275_fb_module::
  3172. * iorw_module::
  3173. * iso9660_module::
  3174. * jfs_module::
  3175. * jpeg_module::
  3176. * json_module::
  3177. * keylayouts_module::
  3178. * keystatus_module::
  3179. * ldm_module::
  3180. * legacy_password_test_module::
  3181. * legacycfg_module::
  3182. * linux_module::
  3183. * linux16_module::
  3184. * loadbios_module::
  3185. * loadenv_module::
  3186. * loopback_module::
  3187. * ls_module::
  3188. * lsacpi_module::
  3189. * lsapm_module::
  3190. * lsdev_module::
  3191. * lsefi_module::
  3192. * lsefimmap_module::
  3193. * lsefisystab_module::
  3194. * lsmmap_module::
  3195. * lspci_module::
  3196. * lssal_module::
  3197. * lsspd_module::
  3198. * lsxen_module::
  3199. * luks_module::
  3200. * luks2_module::
  3201. * lvm_module::
  3202. * lzopio_module::
  3203. * macbless_module::
  3204. * macho_module::
  3205. * mda_text_module::
  3206. * mdraid09_module::
  3207. * mdraid09_be_module::
  3208. * mdraid1x_module::
  3209. * memdisk_module::
  3210. * memrw_module::
  3211. * memtools_module::
  3212. * minicmd_module::
  3213. * minix_module::
  3214. * minix2_module::
  3215. * minix2_be_module::
  3216. * minix3_module::
  3217. * minix3_be_module::
  3218. * minix_be_module::
  3219. * mmap_module::
  3220. * morse_module::
  3221. * mpi_module::
  3222. * msdospart_module::
  3223. * mul_test_module::
  3224. * multiboot_module::
  3225. * multiboot2_module::
  3226. * nand_module::
  3227. * nativedisk_module::
  3228. * net_module::
  3229. * newc_module::
  3230. * nilfs2_module::
  3231. * normal_module::
  3232. * ntfs_module::
  3233. * ntfscomp_module::
  3234. * ntldr_module::
  3235. * odc_module::
  3236. * offsetio_module::
  3237. * ofnet_module::
  3238. * ohci_module::
  3239. * part_acorn_module::
  3240. * part_amiga_module::
  3241. * part_apple_module::
  3242. * part_bsd_module::
  3243. * part_dfly_module::
  3244. * part_dvh_module::
  3245. * part_gpt_module::
  3246. * part_msdos_module::
  3247. * part_plan_module::
  3248. * part_sun_module::
  3249. * part_sunpc_module::
  3250. * parttool_module::
  3251. * password_module::
  3252. * password_pbkdf2_module::
  3253. * pata_module::
  3254. * pbkdf2_module::
  3255. * pbkdf2_test_module::
  3256. * pci_module::
  3257. * pcidump_module::
  3258. * pgp_module::
  3259. * plainmount_module::
  3260. * plan9_module::
  3261. * play_module::
  3262. * png_module::
  3263. * priority_queue_module::
  3264. * probe_module::
  3265. * procfs_module::
  3266. * progress_module::
  3267. * pxe_module::
  3268. * pxechain_module::
  3269. * raid5rec_module::
  3270. * raid6rec_module::
  3271. * random_module::
  3272. * rdmsr_module::
  3273. * read_module::
  3274. * reboot_module::
  3275. * regexp_module::
  3276. * reiserfs_module::
  3277. * relocator_module::
  3278. * romfs_module::
  3279. * scsi_module::
  3280. * sdl_module::
  3281. * search_module::
  3282. * search_fs_file_module::
  3283. * search_fs_uuid_module::
  3284. * search_label_module::
  3285. * sendkey_module::
  3286. * serial_module::
  3287. * setjmp_module::
  3288. * setjmp_test_module::
  3289. * setpci_module::
  3290. * sfs_module::
  3291. * shift_test_module::
  3292. * signature_test_module::
  3293. * sleep_module::
  3294. * sleep_test_module::
  3295. * smbios_module::
  3296. * spkmodem_module::
  3297. * squash4_module::
  3298. * strtoull_test_module::
  3299. * suspend_module::
  3300. * syslinuxcfg_module::
  3301. * tar_module::
  3302. * terminal_module::
  3303. * terminfo_module::
  3304. * test_module::
  3305. * test_blockarg_module::
  3306. * testload_module::
  3307. * testspeed_module::
  3308. * tftp_module::
  3309. * tga_module::
  3310. * time_module::
  3311. * tpm_module::
  3312. * tr_module::
  3313. * trig_module::
  3314. * true_module::
  3315. * truecrypt_module::
  3316. * ubootnet_module::
  3317. * udf_module::
  3318. * ufs1_module::
  3319. * ufs1_be_module::
  3320. * ufs2_module::
  3321. * uhci_module::
  3322. * usb_module::
  3323. * usb_keyboard_module::
  3324. * usbms_module::
  3325. * usbserial_common_module::
  3326. * usbserial_ftdi_module::
  3327. * usbserial_pl2303_module::
  3328. * usbserial_usbdebug_module::
  3329. * usbtest_module::
  3330. * vbe_module::
  3331. * verifiers_module::
  3332. * vga_module::
  3333. * vga_text_module::
  3334. * video_module::
  3335. * video_bochs_module::
  3336. * video_cirrus_module::
  3337. * video_colors_module::
  3338. * video_fb_module::
  3339. * videoinfo_module::
  3340. * videotest_module::
  3341. * videotest_checksum_module::
  3342. * wrmsr_module::
  3343. * xen_boot_module::
  3344. * xfs_module::
  3345. * xnu_module::
  3346. * xnu_uuid_module::
  3347. * xnu_uuid_test_module::
  3348. * xzio_module::
  3349. * zfs_module::
  3350. * zfscrypt_module::
  3351. * zfsinfo_module::
  3352. * zstd_module::
  3353. @end menu
  3354. @node acpi_module
  3355. @section acpi
  3356. This module provides the command @command{acpi} for loading / replacing Advanced
  3357. Configuration and Power Interface (ACPI) tables. Please @pxref{acpi} for more
  3358. information.
  3359. @node adler32_module
  3360. @section adler32
  3361. This module provides the library implementation for the adler32 checksum.
  3362. This is used as part of LZO decompression / compression.
  3363. @node affs_module
  3364. @section affs
  3365. This module provides support for the Amiga Fast FileSystem (AFFS).
  3366. @node afs_module
  3367. @section afs
  3368. This module provides support for the AtheOS File System (AFS).
  3369. @node afsplitter_module
  3370. @section afsplitter
  3371. This module provides library support for the Anti forensic information splitter
  3372. (AFS) operation @code{AF_merge}. This is used by LUKS and LUKS2.
  3373. @node ahci_module
  3374. @section ahci
  3375. This module provides support for the Advanced Host Controller Interface protocol
  3376. to access disks supporting this standard. AHCI is often an option for Serial
  3377. ATA (SATA) controllers (meant to replace the older IDE protocol).
  3378. @node all_video_module
  3379. @section all_video
  3380. This is a "dummy module" with no actual function except to load all other video
  3381. modules as dependencies (a convenient way to load all video modules).
  3382. @node aout_module
  3383. @section aout
  3384. This module provides support for loading files packaged in the "a.out" format.
  3385. The "a.out" format is considered to be an older format than some alternatives
  3386. such as "ELF", for example support for the "a.out" format was removed from the
  3387. Linux kernel in 5.18.
  3388. @node appleldr_module
  3389. @section appleldr
  3390. This module provides support for loading files on a BIOS / EFI based Apple Mac
  3391. computer (Intel based Macs).
  3392. @node archelp_module
  3393. @section archelp
  3394. This module provides Archive Helper functions for archive based file systems
  3395. such as TAR and CPIO archives.
  3396. @node at_keyboard_module
  3397. @section at_keyboard
  3398. This module provides support for the AT keyboard input for the GRUB terminal.
  3399. @node ata_module
  3400. @section ata
  3401. This modules provides support for direct ATA and ATAPI access to compatible
  3402. disks.
  3403. @node backtrace_module
  3404. @section backtrace
  3405. This module provides the command @command{backtrace} for printing a backtrace
  3406. to the terminal for the current call stack.
  3407. @node bfs_module
  3408. @section bfs
  3409. This module provides support for the BeOS "Be File System" (BFS).
  3410. @node biosdisk_module
  3411. @section biosdisk
  3412. This module provides support for booting from a bootable removable disk such
  3413. as a CD-ROM, BD-ROM, etc.
  3414. @node bitmap_module
  3415. @section bitmap
  3416. This module provides support for reading and interacting with bitmap image
  3417. files.
  3418. @node bitmap_scale_module
  3419. @section bitmap_scale
  3420. This module provides support for scaling bitmap image files.
  3421. @node bli_module
  3422. @section bli
  3423. This module provides basic support for the Boot Loader Interface. The Boot
  3424. Loader Interface specifies a set of EFI variables that are used to communicate
  3425. boot-time information between the bootloader and the operating system.
  3426. The following variables are placed under the vendor UUID
  3427. @code{4a67b082-0a4c-41cf-b6c7-440b29bb8c4f} when the module is loaded:
  3428. The GPT partition UUID of the EFI System Partition used during boot is
  3429. published via the @code{LoaderDevicePartUUID} variable. The Boot Loader
  3430. Interface specification requires GPT formatted drives. The bli module
  3431. ignores drives/partitions in any other format. If GRUB is loaded from
  3432. a non-GPT partition, e.g. from an MSDOS formatted drive or network,
  3433. this variable will not be set.
  3434. A string identifying GRUB as the active bootloader including the version
  3435. number is stored in @code{LoaderInfo}.
  3436. This module is only available on UEFI platforms.
  3437. @node blocklist_module
  3438. @section blocklist
  3439. This module provides support for the command @command{blocklist} to list
  3440. blocks for a given file. Please @pxref{blocklist} for more information.
  3441. @node boot_module
  3442. @section boot
  3443. This module provides support for the command @command{boot} to boot an
  3444. operating system. Please @pxref{boot} for more information.
  3445. @node boottime_module
  3446. @section boottime
  3447. This module provides support for the command @command{boottime} to display
  3448. time taken to perform various GRUB operations. This module is only available
  3449. when GRUB is built with the conditional compile option @code{BOOT_TIME_STATS}.
  3450. @node bsd_module
  3451. @section bsd
  3452. This module provides support for loading BSD operating system images via
  3453. commands such as: @command{kfreebsd_loadenv}, @command{kfreebsd_module_elf},
  3454. @command{kfreebsd_module}, @command{kfreebsd}, @command{knetbsd_module_elf},
  3455. @command{knetbsd_module}, @command{knetbsd}, @command{kopenbsd}, and
  3456. @command{kopenbsd_ramdisk}. Please @pxref{Loader commands} for more info.
  3457. @node bswap_test_module
  3458. @section bswap_test
  3459. This module is intended for performing a functional test of the byte swapping
  3460. functionality of GRUB.
  3461. @node btrfs_module
  3462. @section btrfs
  3463. This module provides support for the B-Tree File System (BTRFS).
  3464. @node bufio_module
  3465. @section bufio
  3466. This module is a library module for support buffered I/O of files to support
  3467. file reads performed in other modules.
  3468. @node cacheinfo_module
  3469. @section cacheinfo
  3470. This module provides support for the command @command{cacheinfo} which provides
  3471. statistics on disk cache accesses. This module is only built if
  3472. @code{DISK_CACHE_STATS} is enabled.
  3473. @node cat_module
  3474. @section cat
  3475. This module provides support for the command @command{cat} which outputs the
  3476. content of a file to the terminal. Please @pxref{cat} for more info.
  3477. @node cbfs_module
  3478. @section cbfs
  3479. This module provides support for the Coreboot File System (CBFS) which is an
  3480. archive based file system.
  3481. @node cbls_module
  3482. @section cbls
  3483. This module provides support for the command @command{lscoreboot} to list the
  3484. Coreboot tables.
  3485. @node cbmemc_module
  3486. @section cbmemc
  3487. This module provides support for the command @command{cbmemc} to show the
  3488. content of the Coreboot Memory console.
  3489. @node cbtable_module
  3490. @section cbtable
  3491. This module provides support for accessing the Coreboot tables.
  3492. @node cbtime_module
  3493. @section cbtime
  3494. This module provides support for the command @command{coreboot_boottime} to show
  3495. the Coreboot boot time statistics.
  3496. @node chain_module
  3497. @section chain
  3498. This module provides support for the command @command{chainloader} to boot
  3499. another bootloader. Please @pxref{chainloader} for more information.
  3500. @node cmdline_cat_test_module
  3501. @section cmdline_cat_test
  3502. This module is intended for performing a functional test of the @command{cat}
  3503. command of GRUB.
  3504. @node cmosdump_module
  3505. @section cmosdump
  3506. This module provides support for the command @command{cmosdump} to show a raw
  3507. dump of the CMOS contents. Please @pxref{cmosdump} for more information.
  3508. @node cmostest_module
  3509. @section cmostest
  3510. This module provides support for the commands @command{cmostest},
  3511. @command{cmosclean}, and @command{cmosset} to interact with a CMOS.
  3512. @xref{cmostest} / @pxref{cmosclean} for more information.
  3513. @node cmp_module
  3514. @section cmp
  3515. This module provides support for the command @command{cmp} to compare the
  3516. content of two files. @xref{cmp} for more information.
  3517. @node cmp_test_module
  3518. @section cmp_test
  3519. This module is intended for performing a functional test of relational
  3520. operations in GRUB. Note that this module is *not* associated with the
  3521. @command{cmp} command and does not test the @command{cmp} command.
  3522. @node configfile_module
  3523. @section configfile
  3524. This module provides support for the commands: @command{configfile},
  3525. @command{source}, @command{extract_entries_source},
  3526. @command{extract_entries_configfile}, @command{.} (dot command).
  3527. @xref{configfile} / @pxref{source}.
  3528. @node cpio_module
  3529. @section cpio
  3530. This module provides support for the CPIO archive file format. This module is
  3531. for the "bin" version of CPIO (default of GNU CPIO) supporting around 2GB.
  3532. @node cpio_be_module
  3533. @section cpio_be
  3534. This module provides support for the CPIO archive file format in big-endian
  3535. format. This module is for the "bin" version of CPIO (default of GNU CPIO)
  3536. supporting around 2GB.
  3537. @node cpuid_module
  3538. @section cpuid
  3539. This module provides support for the command @command{cpuid} to test for
  3540. various CPU features. @xref{cpuid} for more information.
  3541. @node crc64_module
  3542. @section crc64
  3543. This module provides support for the CRC64 operation.
  3544. @node crypto_module
  3545. @section crypto
  3546. This module provides library support for various base cryptography operations
  3547. in GRUB.
  3548. @node cryptodisk_module
  3549. @section cryptodisk
  3550. This module provides support for the command @command{cryptomount} to interact
  3551. with encrypted file systems. @xref{cryptomount} for more information.
  3552. @node cs5536_module
  3553. @section cs5536
  3554. This module provides support for the AMD Geode CS5536 companion device.
  3555. @node ctz_test_module
  3556. @section ctz_test
  3557. This module is intended for performing a functional test of the ctz functions
  3558. in GRUB used to Count Trailing Zeros.
  3559. @node date_module
  3560. @section date
  3561. This module provides support for the command @command{date} to get the date/time
  3562. or set the date/time. @xref{date} for more information.
  3563. @node datehook_module
  3564. @section datehook
  3565. This module provides support for populating / providing the environment
  3566. variables @code{YEAR}, @code{MONTH}, @code{DAY}, @code{HOUR}, @code{MINUTE},
  3567. @code{SECOND}, @code{WEEKDAY}.
  3568. @node datetime_module
  3569. @section datetime
  3570. This module provides library support for getting and setting the date / time
  3571. from / to a hardware clock device.
  3572. @node disk_module
  3573. @section disk
  3574. This module provides library support for writing to a storage disk.
  3575. @node diskfilter_module
  3576. @section diskfilter
  3577. This module provides library support for reading a disk RAID array.
  3578. @node div_module
  3579. @section div
  3580. This module provides library support for some operations such as divmod.
  3581. @node div_test_module
  3582. @section div_test
  3583. This module is intended for performing a functional test of the divmod function
  3584. in GRUB.
  3585. @node dm_nv_module
  3586. @section dm_nv
  3587. This module provides support for handling some Nvidia "fakeraid" disk devices.
  3588. @node drivemap_module
  3589. @section drivemap
  3590. This module provides support for the @command{drivemap} to manage BIOS drive
  3591. mappings. @xref{drivemap} for more information.
  3592. @node echo_module
  3593. @section echo
  3594. This module provides support for the @command{echo} to display a line of text.
  3595. @xref{echo} for more information.
  3596. @node efi_gop_module
  3597. @section efi_gop
  3598. This module provides support for the UEFI video output protocol "Graphics
  3599. Output Protocol" (GOP).
  3600. @node efi_uga_module
  3601. @section efi_uga
  3602. This module provides support for the EFI video protocol "Universal Graphic
  3603. Adapter" (UGA).
  3604. @node efiemu_module
  3605. @section efiemu
  3606. This module provides support for the commands @command{efiemu_loadcore},
  3607. @command{efiemu_prepare}, and @command{efiemu_unload}. This provides an EFI
  3608. emulation.
  3609. @node efifwsetup_module
  3610. @section efifwsetup
  3611. This modules provides support for the command @command{fwsetup} to reboot into
  3612. the firmware setup menu. @xref{fwsetup} for more information.
  3613. @node efinet_module
  3614. @section efinet
  3615. This module provides support for UEFI Network Booting for loading images and
  3616. data from the network.
  3617. @node efitextmode_module
  3618. @section efitextmode
  3619. This module provides support for command @command{efitextmode} to get and set
  3620. output mode resolution. @xref{efitextmode} for more information.
  3621. @node ehci_module
  3622. @section ehci
  3623. This module provides support for the USB Enhanced Host Controller Interface
  3624. (EHCI) specification (USB 2.0).
  3625. @node elf_module
  3626. @section elf
  3627. This module provides support for loading Executable and Linkable Format (ELF)
  3628. files.
  3629. @node emunet_module
  3630. @section emunet
  3631. This module provides support for networking in GRUB on the emu platform.
  3632. @node emupci_module
  3633. @section emupci
  3634. This module provides support for accessing the PCI bus in GRUB on the emu
  3635. platform.
  3636. @node erofs_module
  3637. @section erofs
  3638. This module provides support for the Enhanced Read Only File System (EROFS).
  3639. @node escc_module
  3640. @section escc
  3641. This module provides support for the "mac-io" terminal device on PowerPC.
  3642. @node eval_module
  3643. @section eval
  3644. This module provides support for command @command{eval} to evaluate the provided
  3645. input as a sequence of GRUB commands. @xref{eval} for more information.
  3646. @node exfat_module
  3647. @section exfat
  3648. This module provides support for the Extensible File Allocation Table (exFAT)
  3649. file system in GRUB.
  3650. @node exfctest_module
  3651. @section exfctest
  3652. This module is intended to provide an Example Functional Test of GRUB functions
  3653. to use as a template for developing other GRUB functional tests.
  3654. @node ext2_module
  3655. @section ext2
  3656. This module provides support for the Extended File System versions 2, 3, and 4
  3657. (ext2, ext3, and ext4) file systems in GRUB.
  3658. @node extcmd_module
  3659. @section extcmd
  3660. This module is a support module to provide wrapper functions for registering
  3661. other module commands depending on the state of the lockdown variable.
  3662. @node f2fs_module
  3663. @section f2fs
  3664. This module provides support for the Flash-Friendly File System (F2FS) in GRUB.
  3665. @node fat_module
  3666. @section fat
  3667. This module provides support for the File Allocation Table 12-bit, 16-bit, and
  3668. 32-bit (FAT12, FAT16, and FAT32) file systems in GRUB.
  3669. @node fdt_module
  3670. @section fdt
  3671. This module provides support for the commands @command{fdtdump} and
  3672. @command{devicetree} to dump the contents of a device tree blob (.dtb) to the
  3673. console and to load a device tree blob (.dtb) from a filesystem, for
  3674. later use by a Linux kernel, respectively. @xref{devicetree} and
  3675. @pxref{fdtdump} for more information.
  3676. @node file_module
  3677. @section file
  3678. This module provides support for the command @command{file} to test if the
  3679. provided filename is of the specified type. @xref{file} for more information.
  3680. @node fixvideo_module
  3681. @section fixvideo
  3682. This module provides support for the command @command{fix_video} to fix video
  3683. problems in specific PCIe video devices by "patching" specific device register
  3684. settings. Currently supports Intel 945GM (PCI ID @code{0x27a28086}) and Intel
  3685. 965GM (PCI ID @code{0x2a028086}).
  3686. @node font_module
  3687. @section font
  3688. This module provides support for the commands @command{loadfont} and
  3689. @command{lsfonts} to load a given font or list the loaded fonts. @xref{loadfont}
  3690. and @pxref{lsfonts} for more information.
  3691. @node freedos_module
  3692. @section freedos
  3693. This module provides support for command @command{freedos} for loading a FreeDOS
  3694. kernel.
  3695. @node fshelp_module
  3696. @section fshelp
  3697. This module provides support functions (helper functions) for file systems.
  3698. @node functional_test_module
  3699. @section functional_test
  3700. This module provides support for running the GRUB functional tests using
  3701. commands @command{functional_test} and @command{all_functional_test}.
  3702. @node gcry_arcfour_module
  3703. @section gcry_arcfour
  3704. This module provides support for the arcfour stream cipher also known as RC4.
  3705. If security is a concern, RC4 / arcfour cipher is consider broken (multiple
  3706. known vulnerabilities make this insecure).
  3707. This GRUB module is based on libgcrypt.
  3708. @node gcry_blowfish_module
  3709. @section gcry_blowfish
  3710. This module provides support for the Blowfish cipher.
  3711. This GRUB module is based on libgcrypt.
  3712. @node gcry_camellia_module
  3713. @section gcry_camellia
  3714. This module provides support for the Camellia cipher.
  3715. This GRUB module is based on libgcrypt.
  3716. @node gcry_cast5_module
  3717. @section gcry_cast5
  3718. This module provides support for the CAST5 (RFC2144, also known as CAST-128)
  3719. cipher. This GRUB module is based on libgcrypt.
  3720. @node gcry_crc_module
  3721. @section gcry_crc
  3722. This module provides support for the CRC32, CRC32 RFC1510, and CRC24 RFC2440
  3723. cyclic redundancy checks.
  3724. This GRUB module is based on libgcrypt.
  3725. @node gcry_des_module
  3726. @section gcry_des
  3727. This module provides support for the Data Encryption Standard (DES) and
  3728. Triple-DES ciphers.
  3729. If security is a concern, DES has known vulnerabilities and is not recommended,
  3730. and Triple-DES is no longer recommended by NIST.
  3731. This GRUB module is based on libgcrypt.
  3732. @node gcry_dsa_module
  3733. @section gcry_dsa
  3734. This module provides support for the Digital Signature Algorithm (DSA) cipher.
  3735. This GRUB module is based on libgcrypt.
  3736. @node gcry_idea_module
  3737. @section gcry_idea
  3738. This module provides support for the International Data Encryption Algorithm
  3739. (IDEA) cipher.
  3740. This GRUB module is based on libgcrypt.
  3741. @node gcry_md4_module
  3742. @section gcry_md4
  3743. This module provides support for the Message Digest 4 (MD4) message digest.
  3744. If security is a concern, MD4 has known vulnerabilities and is not recommended.
  3745. This GRUB module is based on libgcrypt.
  3746. @node gcry_md5_module
  3747. @section gcry_md5
  3748. This module provides support for the Message Digest 5 (MD5) message digest.
  3749. If security is a concern, MD5 has known vulnerabilities and is not recommended.
  3750. This GRUB module is based on libgcrypt.
  3751. @node gcry_rfc2268_module
  3752. @section gcry_rfc2268
  3753. This module provides support for the RFC2268 (RC2 / Ron's Cipher 2) cipher.
  3754. If security is a concern, RC2 has known vulnerabilities and is not recommended.
  3755. This GRUB module is based on libgcrypt.
  3756. @node gcry_rijndael_module
  3757. @section gcry_rijndael
  3758. This module provides support for the Advanced Encryption Standard (AES-128,
  3759. AES-192, and AES-256) ciphers.
  3760. This GRUB module is based on libgcrypt.
  3761. @node gcry_rmd160_module
  3762. @section gcry_rmd160
  3763. This module provides support for the RIPEMD-160 message digest.
  3764. This GRUB module is based on libgcrypt.
  3765. @node gcry_rsa_module
  3766. @section gcry_rsa
  3767. This module provides support for the Rivest–Shamir–Adleman (RSA) cipher.
  3768. This GRUB module is based on libgcrypt.
  3769. @node gcry_seed_module
  3770. @section gcry_seed
  3771. This module provides support for the SEED cipher.
  3772. This GRUB module is based on libgcrypt.
  3773. @node gcry_serpent_module
  3774. @section gcry_serpent
  3775. This module provides support for the Serpent (128, 192, and 256) ciphers.
  3776. This GRUB module is based on libgcrypt.
  3777. @node gcry_sha1_module
  3778. @section gcry_sha1
  3779. This module provides support for the Secure Hash Algorithm 1 (SHA-1) message
  3780. digest.
  3781. If security is a concern, SHA-1 has known vulnerabilities and is not
  3782. recommended.
  3783. This GRUB module is based on libgcrypt.
  3784. @node gcry_sha256_module
  3785. @section gcry_sha256
  3786. This module provides support for the Secure Hash Algorithm 2 (224 and 256 bit)
  3787. (SHA-224 / SHA-256) message digests.
  3788. This GRUB module is based on libgcrypt.
  3789. @node gcry_sha512_module
  3790. @section gcry_sha512
  3791. This module provides support for the Secure Hash Algorithm 2 (384 and 512 bit)
  3792. (SHA-384 / SHA-512) message digests.
  3793. This GRUB module is based on libgcrypt.
  3794. @node gcry_tiger_module
  3795. @section gcry_tiger
  3796. This module provides support for the Tiger, Tiger 1, and Tiger 2 message
  3797. digests.
  3798. This GRUB module is based on libgcrypt.
  3799. @node gcry_twofish_module
  3800. @section gcry_twofish
  3801. This module provides support for the Twofish (128 and 256) ciphers.
  3802. This GRUB module is based on libgcrypt.
  3803. @node gcry_whirlpool_module
  3804. @section gcry_whirlpool
  3805. This module provides support for the Whirlpool message digest.
  3806. This GRUB module is based on libgcrypt.
  3807. @node gdb_module
  3808. @section gdb
  3809. This module provides support for remotely debugging GRUB using the GNU
  3810. Debugger (GDB) over serial. This is typically done when troubleshooting GRUB
  3811. during development and not required for normal GRUB operation. This module adds
  3812. support for commands required by the GDB remote debug function including
  3813. @command{gdbstub} to start GDB stub on given serial port,
  3814. @command{gdbstub_break} to break into GDB, @command{gdbstub_stop} to stop the
  3815. GDB stub.
  3816. @node geli_module
  3817. @section geli
  3818. This module provides support for the GEOM ELI (GELI) disk encryption /
  3819. decryption protocol used by FreeBSD. This module supports the following ciphers
  3820. using the associated "gcry" modules: DES, Triple-DES, Blowfish, CAST5, AES, and
  3821. Camellia 128.
  3822. @node gettext_module
  3823. @section gettext
  3824. This module provides support for the @command{gettext} command to support
  3825. translating information displayed / output by GRUB. @xref{gettext} for more
  3826. information.
  3827. @node gfxmenu_module
  3828. @section gfxmenu
  3829. This module provides support for displaying a graphical menu / user interface
  3830. from GRUB. This includes features such as graphical font support, theme support,
  3831. image support, and icon support.
  3832. @node gfxterm_module
  3833. @section gfxterm
  3834. This module provides support for displaying a terminal and menu interface from
  3835. GRUB using graphics mode.
  3836. @node gfxterm_background_module
  3837. @section gfxterm_background
  3838. This module provides support for setting the gfxterm background color and
  3839. background image using commands @command{background_color} and
  3840. @command{background_image}. @xref{background_color} and @pxref{background_image}
  3841. for more information.
  3842. @node gfxterm_menu_module
  3843. @section gfxterm_menu
  3844. This module is intended for performing a functional test of the gfxmenu function
  3845. in GRUB.
  3846. @node gptsync_module
  3847. @section gptsync
  3848. This module provides support for the @command{gptsync} command.. @xref{gptsync}
  3849. for more information.
  3850. @node gzio_module
  3851. @section gzio
  3852. This module provides support for decompression (inflate) of files compressed
  3853. with the GZ compression algorithm. This supports only the "DEFLATE" method for
  3854. GZIP. Unsupported flags (will result in failure to inflate) include:
  3855. @code{GRUB_GZ_CONTINUATION}, @code{GRUB_GZ_ENCRYPTED},
  3856. @code{GRUB_GZ_RESERVED}, and @code{GRUB_GZ_EXTRA_FIELD}.
  3857. @node halt_module
  3858. @section halt
  3859. This module provides support for the @command{halt} command to shutdown / halt
  3860. the system. @xref{halt} for more information.
  3861. @node hashsum_module
  3862. @section hashsum
  3863. This module provide support for the commands @command{hashsum},
  3864. @command{md5sum}, @command{sha1sum}, @command{sha256sum}, @command{sha512sum},
  3865. and @command{crc} to calculate or check hashes of files using various methods.
  3866. @xref{hashsum}, @pxref{md5sum} @pxref{sha1sum}, @pxref{sha256sum},
  3867. @pxref{sha512sum}, and @pxref{crc}.
  3868. @node hdparm_module
  3869. @section hdparm
  3870. This module provides support for the @command{hdparm} command to get or set
  3871. various ATA disk parameters. This includes controlling Advanced Power Management
  3872. (APM), displaying power mode, freezing ATA security settings until reset,
  3873. displaying SMART status, controlling automatic acoustic management, setting
  3874. standby timeout, setting the drive to standby mode, setting the drive to sleep
  3875. mode, displaying the drive identification and settings, and enable/disable
  3876. SMART.
  3877. @node hello_module
  3878. @section hello
  3879. This provides support for the @command{hello} command to simply output
  3880. "Hello World". This is intended for testing GRUB module loading / functionality.
  3881. @node help_module
  3882. @section help
  3883. This module provides support for the @command{help} command to output help
  3884. text. @xref{help} for more information.
  3885. @node hexdump_module
  3886. @section hexdump
  3887. This module provides support for the @command{hexdump} command to dump the
  3888. contents of a file in hexadecimal. @xref{hexdump} for more information.
  3889. @node hfs_module
  3890. @section hfs
  3891. This module provides support for the Hierarchical File System (HFS) file system
  3892. in GRUB.
  3893. @node hfsplus_module
  3894. @section hfsplus
  3895. This module provides support for the Hierarchical File System Plus (HFS+) file
  3896. system in GRUB.
  3897. @node hfspluscomp_module
  3898. @section hfspluscomp
  3899. This module provides support for the Hierarchical File System Plus Compressed
  3900. (HFS+ Compressed) file system in GRUB.
  3901. @node http_module
  3902. @section http
  3903. This module provides support for getting data over the HTTP network protocol in
  3904. GRUB (using the HTTP GET method). This may be used, for example, to obtain
  3905. an operating system over HTTP (network boot).
  3906. @node ieee1275_fb_module
  3907. @section ieee1275_fb
  3908. This module provides support for the IEEE1275 video driver output for PowerPC
  3909. with a IEEE-1275 platform.
  3910. @node iorw_module
  3911. @section iorw
  3912. This module provides support for commands @command{inb}, @command{inw},
  3913. @command{inl}, @command{outb}, @command{outw}, and @command{outl} to read /
  3914. write data to physical I/O ports. The "in" commands accept one
  3915. parameter to specify the source port. The "out" commands require either two
  3916. or three parameters, with the order: port, value, <optional mask>.
  3917. @node iso9660_module
  3918. @section iso9660
  3919. This module provides support for the ISO9660 file system (often associated with
  3920. optical disks such as CD-ROMs and DVD-ROMs, with extensions:
  3921. System Use Sharing Protocol (SUSP), Rock Ridge (UNIX style permissions and
  3922. longer names)
  3923. @node jfs_module
  3924. @section jfs
  3925. This module provides support for the Journaled File System (JFS) file system.
  3926. @node jpeg_module
  3927. @section jpeg
  3928. This module provides support for reading JPEG image files in GRUB, such as
  3929. to support displaying a JPEG image as a background image of the gfxmenu.
  3930. @node json_module
  3931. @section json
  3932. This module provides library support for parsing / processing JavaScript Object
  3933. Notation (JSON) formatted data. This is used, for example, to support LUKS2
  3934. disk encryption / decryption as metadata is encoded in JSON.
  3935. @node keylayouts_module
  3936. @section keylayouts
  3937. This module provides support for the @command{keymap} command. This command
  3938. accepts one parameter to specify either the @var{layout_name} or the
  3939. @var{filename}.
  3940. When specifying the @var{layout_name}, this command will attempt to open the
  3941. GRUB keymap file based on the following logic:
  3942. Get the "prefix" from environment variable @var{prefix}
  3943. Open keymap file @var{prefix}/layouts/@var{layout_name}.gkb
  3944. When specifying the @var{filename}, the full path to the ".gkb" file should be
  3945. provided. The ".gkb" file can be generated by grub-kbdcomp.
  3946. @node keystatus_module
  3947. @section keystatus
  3948. This module provides support for the @command{keystatus} command to check key
  3949. modifier status. @xref{keystatus} for more information.
  3950. @node ldm_module
  3951. @section ldm
  3952. This module provides support for the Logical Disk Manager (LDM) disk format.
  3953. LDM is used to add support for logical volumes most often with Microsoft
  3954. Windows systems. A logical volume can be defined to span more than one physical
  3955. disk.
  3956. @node legacy_password_test_module
  3957. @section legacy_password_test
  3958. This module is intended for performing a functional test of the legacy password
  3959. function in GRUB.
  3960. @node legacycfg_module
  3961. @section legacycfg
  3962. This module provides support for commands @command{legacy_source},
  3963. @command{legacy_configfile}, @command{extract_legacy_entries_source},
  3964. @command{extract_legacy_entries_configfile}, @command{legacy_kernel},
  3965. @command{legacy_initrd}, @command{legacy_initrd_nounzip},
  3966. @command{legacy_password}, and @command{legacy_check_password}. For new uses /
  3967. configurations of GRUB other commands / modules offer the modern equivalents.
  3968. @node linux_module
  3969. @section linux
  3970. This module provides support for the commands @command{linux} and
  3971. @command{initrd} to load Linux and an Initial RAM Disk respectively.
  3972. @xref{linux} and @pxref{initrd} for more information.
  3973. @node linux16_module
  3974. @section linux16
  3975. This module provides support for the commands @command{linux16} and
  3976. @command{initrd16} to load Linux in 16-bit mode and an Initial RAM Disk
  3977. in 16-bit mode respectively.
  3978. @xref{linux16} and @pxref{initrd16} for more information.
  3979. @node loadbios_module
  3980. @section loadbios
  3981. This module provides support for the commands @command{fakebios} and
  3982. @command{loadbios}. These commands may only be useful on platforms with
  3983. issues requiring work-arounds. Command @command{fakebios} is used to create
  3984. BIOS-like structures for backward compatibility with existing OS. Command
  3985. @command{loadbios} is used to load a BIOS dump.
  3986. @node loadenv_module
  3987. @section loadenv
  3988. This module provides support for commands @command{load_env},
  3989. @command{list_env}, and @command{save_env}. These commands can be used to
  3990. load environment variables from a file, list environment variables in a file,
  3991. and save environment variables to a file. @xref{load_env}, @pxref{list_env}, and
  3992. @pxref{save_env}.
  3993. @node loopback_module
  3994. @section loopback
  3995. This module provides support for the @command{loopback} command.
  3996. @xref{loopback} for more information.
  3997. @node ls_module
  3998. @section ls
  3999. This module provides support for the @command{ls} command.
  4000. @xref{ls} for more information.
  4001. @node lsacpi_module
  4002. @section lsacpi
  4003. This module provides support for the @command{lsacpi} command. This command
  4004. can be used to display Advanced Configuration and Power Interface (ACPI) tables.
  4005. @node lsapm_module
  4006. @section lsapm
  4007. This module provides support for the @command{lsapm} command. This command
  4008. can be used to display Advanced power management (APM) information.
  4009. @node lsdev_module
  4010. @section lsdev
  4011. This module provides support for the @command{lsdev} command. This command
  4012. can be used on MIPS Advanced RISC Computing (ARC) platforms to display devices.
  4013. @node lsefi_module
  4014. @section lsefi
  4015. This module provides support for the @command{lsefi} command. This command
  4016. can be used on EFI platforms to display EFI handles.
  4017. @node lsefimmap_module
  4018. @section lsefimmap
  4019. This module provides support for the @command{lsefimmap} command. This command
  4020. can be used on EFI platforms to display the EFI memory map.
  4021. @node lsefisystab_module
  4022. @section lsefisystab
  4023. This module provides support for the @command{lsefisystab} command. This
  4024. command can be used on EFI platforms to display the EFI system tables.
  4025. @node lsmmap_module
  4026. @section lsmmap
  4027. This module provides support for the @command{lsmmap} command. This
  4028. command can be used to display the memory map provided by firmware.
  4029. @node lspci_module
  4030. @section lspci
  4031. This module provides support for the @command{lspci} command. This
  4032. command can be used to display the PCI / PCIe devices.
  4033. @node lssal_module
  4034. @section lssal
  4035. This module provides support for the @command{lsefisystab} command. This
  4036. command can be used on Itanium (IA-64) EFI platforms to display the EFI
  4037. System Abstraction Layer system table.
  4038. @node lsspd_module
  4039. @section lsspd
  4040. This module provides support for the @command{lsspd} command. This
  4041. command can be used on MIPS Loongson platforms to display the DDR RAM Serial
  4042. Presence Detect (SPD) EEPROM data.
  4043. @node lsxen_module
  4044. @section lsxen
  4045. This module provides support for the commands @command{xen_ls} and
  4046. @command{xen_cat} on Xen platforms to list Xen storage.
  4047. @node luks_module
  4048. @section luks
  4049. This module provides support for the Linux Unified Key Setup (LUKS) (version 1)
  4050. disk encryption / decryption protocol.
  4051. @node luks2_module
  4052. @section luks2
  4053. This module provides support for the Linux Unified Key Setup 2 (LUKS2)
  4054. disk encryption / decryption protocol.
  4055. @node lvm_module
  4056. @section lvm
  4057. This module provides support for reading Logical Volume Management "logical"
  4058. disks. For example, a single "logical" disk may be mapped to span more than one
  4059. physical disk. This would be used when booting from a LVM formatted disk as may
  4060. be setup in Linux.
  4061. @node lzopio_module
  4062. @section lzopio
  4063. This module provides support for decompressing LZO / LZOP compressed files /
  4064. archives.
  4065. @node macbless_module
  4066. @section macbless
  4067. This module provides support for commands @command{mactelbless} and
  4068. @command{macppcbless} for "blessing" a bootloader on Intel / PPC based MACs
  4069. using the HFS or HFS+ file system. On HFS / HFS+ - "blessing" makes a file
  4070. run as the bootloader.
  4071. @node macho_module
  4072. @section macho
  4073. This module provides support for Mach Object (Mach-O) object / executable files
  4074. in GRUB often used in MacOS.
  4075. @node mda_text_module
  4076. @section mda_text
  4077. This module provides support for the Monochrome Display Adapter (MDA) terminal
  4078. output device. MDA is a predecessor to VGA.
  4079. @node mdraid09_module
  4080. @section mdraid09
  4081. This module provides support for handling Linux compatible "version 0.9"
  4082. software-based RAID disks in little-endian format. The "version 0.9" format
  4083. was largely replaced around the year 2009 with the "version 1.x" format
  4084. (@pxref{mdraid1x_module} for more information).
  4085. @node mdraid09_be_module
  4086. @section mdraid09_be
  4087. This module provides support for handling Linux compatible "version 0.9"
  4088. software-based RAID disks in bid-endian format. The "version 0.9" format
  4089. was largely replaced around the year 2009 with the "version 1.x" format
  4090. (@pxref{mdraid1x_module} for more information).
  4091. @node mdraid1x_module
  4092. @section mdraid1x
  4093. This module provides support for handling Linux compatible "version 1.x"
  4094. software-based RAID disks. This includes the current version used by Linux
  4095. at the time of writing.
  4096. @node memdisk_module
  4097. @section memdisk
  4098. This module provides support for a memdisk device. A memdisk is a memory mapped
  4099. emulated disk.
  4100. @node memrw_module
  4101. @section memrw
  4102. This module provides support for commands @command{read_byte},
  4103. @command{read_word}, @command{read_dword}, @command{write_byte},
  4104. @command{write_word}, and @command{write_dword} to read /
  4105. write data to physical memory (addresses). The "read" commands accept one
  4106. parameter to specify the source address. The "write" commands require either two
  4107. or three parameters, with the order: address, value, <optional mask>.
  4108. @node memtools_module
  4109. @section memtools
  4110. This module provides support for GRUB development / debugging commands
  4111. @command{lsmem}, @command{lsfreemem}, and @command{stress_big_allocs}.
  4112. @node minicmd_module
  4113. @section minicmd
  4114. This module provides support for a subset of commands for GRUB rescue mode
  4115. including: @command{cat}, @command{help}, @command{dump}, @command{rmmod},
  4116. @command{lsmod}, and @command{exit}. The version of the commands in this module
  4117. are similar to their full-fledged counterparts implemented in other GRUB
  4118. modules.
  4119. @node minix_module
  4120. @section minix
  4121. This module provides support for the Minix filesystem, version 1.
  4122. @node minix2_module
  4123. @section minix2
  4124. This module provides support for the Minix filesystem, version 2.
  4125. @node minix2_be_module
  4126. @section minix2_be
  4127. This module provides support for the Minix filesystem, version 2 big-endian.
  4128. @node minix3_module
  4129. @section minix3
  4130. This module provides support for the Minix filesystem, version 3.
  4131. @node minix3_be_module
  4132. @section minix3_be
  4133. This module provides support for the Minix filesystem, version 3 big-endian.
  4134. @node minix_be_module
  4135. @section minix_be
  4136. This module provides support for the Minix filesystem, version 1 big-endian.
  4137. @node mmap_module
  4138. @section mmap
  4139. This module provides support for mapping or unmapping devices or files into
  4140. memory as well as commands @command{badram} and @command{cutmem}.
  4141. @xref{badram} and @ref{cutmem}.
  4142. @node morse_module
  4143. @section morse
  4144. This module provides support for outputting terminal output via Morse code
  4145. to an audio speaker output.
  4146. @node mpi_module
  4147. @section mpi
  4148. This module provides support for multi-precision-integers (MPIs) in GRUB. MPIs
  4149. are used by the crypto functions as many depend on mathematics of large numbers.
  4150. This GRUB module is based on libgcrypt.
  4151. @node msdospart_module
  4152. @section msdospart
  4153. This module provides support for modifying MSDOS formatted disk partitions
  4154. through the separate @command{parttool} command.
  4155. @node mul_test_module
  4156. @section mul_test
  4157. This module is intended for performing a functional test of the multiplication
  4158. operations in GRUB.
  4159. @node multiboot_module
  4160. @section multiboot
  4161. This module provides support for commands @command{multiboot} and
  4162. @command{module} to load a multiboot kernel and load a multiboot module,
  4163. respectively. @xref{multiboot} and @ref{module} for more information. This
  4164. is for loading data formatted per the GNU Multiboot specification.
  4165. @node multiboot2_module
  4166. @section multiboot2
  4167. This module provides support for commands @command{multiboot2} and
  4168. @command{module2} to load a multiboot kernel and load a multiboot module,
  4169. respectively. This is for loading data formatted per the GNU Multiboot
  4170. specification.
  4171. @node nand_module
  4172. @section nand
  4173. This module provides support for accessing an IEEE-1275 compliant NAND disk
  4174. from GRUB.
  4175. @node nativedisk_module
  4176. @section nativedisk
  4177. This module provides support for the @command{nativedisk} command.
  4178. @xref{nativedisk} for more information.
  4179. @node net_module
  4180. @section net
  4181. This module provides support for networking protocols including ARP, BOOTP,
  4182. DNS, Ethernet, ICMPv6, ICMP, IP, TCP, and UDP. Support is included for both
  4183. IPv4 and IPv6.
  4184. This includes the following commands:
  4185. @itemize @bullet
  4186. @item
  4187. @command{net_bootp} - @pxref{net_bootp}
  4188. @item
  4189. @command{net_dhcp} - @pxref{net_dhcp}
  4190. @item
  4191. @command{net_get_dhcp_option} - @pxref{net_get_dhcp_option}
  4192. @item
  4193. @command{net_nslookup} - @pxref{net_nslookup}
  4194. @item
  4195. @command{net_add_dns} - @pxref{net_add_dns}
  4196. @item
  4197. @command{net_del_dns} - @pxref{net_del_dns}
  4198. @item
  4199. @command{net_ls_dns} - @pxref{net_ls_dns}
  4200. @item
  4201. @command{net_add_addr} - @pxref{net_add_addr}
  4202. @item
  4203. @command{net_ipv6_autoconf} - @pxref{net_ipv6_autoconf}
  4204. @item
  4205. @command{net_del_addr} - @pxref{net_del_addr}
  4206. @item
  4207. @command{net_add_route} - @pxref{net_add_route}
  4208. @item
  4209. @command{net_del_route} - @pxref{net_del_route}
  4210. @item
  4211. @command{net_set_vlan} - @pxref{net_set_vlan}
  4212. @item
  4213. @command{net_ls_routes} - @pxref{net_ls_routes}
  4214. @item
  4215. @command{net_ls_cards} - @pxref{net_ls_cards}
  4216. @item
  4217. @command{net_ls_addr} - @pxref{net_ls_addr}
  4218. @end itemize
  4219. @node newc_module
  4220. @section newc
  4221. This module provides support for accessing a CPIO archive as a file system
  4222. from GRUB. This module is for the following newer variants of the CPIO archive
  4223. supported by GNU CPIO (but GNU CPIO defaults to the "bin" format which is
  4224. handled by the module @ref{cpio_module}).
  4225. These are the variants supported by this module:
  4226. @itemize @bullet
  4227. @item
  4228. "newc" - SVR4 portable format without CRC. GNU file utility will identify these
  4229. as something like "ASCII cpio archive (SVR4 with no CRC)"
  4230. @item
  4231. ‘crc’ - SVR4 portable format with CRC. GNU file utility will identify these as
  4232. something like "ASCII cpio archive (SVR4 with CRC)"
  4233. @end itemize
  4234. @node nilfs2_module
  4235. @section nilfs2
  4236. This module provides support for the New Implementation of Log filesystem
  4237. (nilfs2).
  4238. @node normal_module
  4239. @section normal
  4240. This module provides support for the normal mode in GRUB. @xref{normal} for
  4241. more information.
  4242. @node ntfs_module
  4243. @section ntfs
  4244. This module provides support for the New Technology File System (NTFS) in GRUB.
  4245. @node ntfscomp_module
  4246. @section ntfscomp
  4247. This module provides support for compression with the New Technology File
  4248. System (NTFS) in GRUB.
  4249. @node ntldr_module
  4250. @section ntldr
  4251. This module provides support for the @command{ntldr} command. This is may be
  4252. used to boot a Windows boot loader such as NTLDR or BootMGR.
  4253. @node odc_module
  4254. @section odc
  4255. This module provides support for accessing a CPIO archive as a file system
  4256. from GRUB. This module is for "odc" variant of the CPIO archive
  4257. supported by GNU CPIO (but GNU CPIO defaults to the "bin" format which is
  4258. handled by the module @ref{cpio_module}).
  4259. GNU file utility will identify these as something like "ASCII cpio archive
  4260. (pre-SVR4 or odc)"
  4261. @node offsetio_module
  4262. @section offsetio
  4263. This module provides support for reading from a file / archive at specified
  4264. offsets in GRUB.
  4265. @node ofnet_module
  4266. @section ofnet
  4267. This module provides support for the Open Firmware (IEEE-1275) network device
  4268. support in GRUB.
  4269. @node ohci_module
  4270. @section ohci
  4271. This module provides support for the Open Host Controller Interface (OHCI) for
  4272. USB 1 / USB 1.1 support in GRUB.
  4273. @node part_acorn_module
  4274. @section part_acorn
  4275. This module provides support for reading from disks partitioned with the
  4276. Acorn Disc Filing System (ADFS) used on RiscOS.
  4277. @node part_amiga_module
  4278. @section part_amiga
  4279. This module provides support for reading from disks partitioned with the
  4280. Amiga partition table.
  4281. @node part_apple_module
  4282. @section part_apple
  4283. This module provides support for reading from disks partitioned with the
  4284. Macintosh partition table.
  4285. @node part_bsd_module
  4286. @section part_bsd
  4287. This module provides support for reading from disks partitioned with BSD
  4288. style partition tables.
  4289. @node part_dfly_module
  4290. @section part_dfly
  4291. This module provides support for reading from disks partitioned with the
  4292. DragonFly BSD partition table.
  4293. @node part_dvh_module
  4294. @section part_dvh
  4295. This module provides support for reading from disks partitioned with the
  4296. SGI Disk Volume Header partition table.
  4297. @node part_gpt_module
  4298. @section part_gpt
  4299. This module provides support for reading from disks partitioned with the
  4300. GUID Partition Tables (GPT) partition table.
  4301. @node part_msdos_module
  4302. @section part_msdos
  4303. This module provides support for reading from disks partitioned with the
  4304. MSDOS (Master Boot Record / MBR) style partition tables.
  4305. @node part_plan_module
  4306. @section part_plan
  4307. This module provides support for reading from disk partitioned with the
  4308. Plan9 style partition table.
  4309. @node part_sun_module
  4310. @section part_sun
  4311. This module provides support for reading from disk partitioned with the
  4312. Sun style partition table.
  4313. @node part_sunpc_module
  4314. @section part_sunpc
  4315. This module provides support for reading from disk partitioned with the
  4316. Sun PC style partition table.
  4317. @node parttool_module
  4318. @section parttool
  4319. This module provides support for the @command{parttool} command. @xref{parttool}
  4320. for more information.
  4321. @node password_module
  4322. @section password
  4323. This module provides support for the @command{password} command. Please note
  4324. that this uses the password in plain text, if security is a concern consider
  4325. using @ref{password_pbkdf2_module} instead. @xref{password} for more
  4326. information.
  4327. @node password_pbkdf2_module
  4328. @section password_pbkdf2
  4329. This module provides support for the @command{password_pbkdf2} command.
  4330. @xref{password_pbkdf2} for more information.
  4331. @node pata_module
  4332. @section pata
  4333. This module provides support for Parallel ATA (PATA) disk device interfaces.
  4334. @node pbkdf2_module
  4335. @section pbkdf2
  4336. This module provides support for the Password-Based Key Derivation Function 2
  4337. (PBKDF2) / PKCS#5 PBKDF2 as per RFC 2898.
  4338. @node pbkdf2_test_module
  4339. @section pbkdf2_test
  4340. This module is intended for performing a functional test of the PBKDF2
  4341. operation in GRUB.
  4342. @node pci_module
  4343. @section pci
  4344. This module provides support for generic Peripheral Component Interconnect (PCI)
  4345. bus in GRUB.
  4346. @node pcidump_module
  4347. @section pcidump
  4348. This module provides support for the @command{pcidump} command in GRUB to dump
  4349. the PCI configuration registers in hexadecimal of a specified PCI device
  4350. (vendor / device ID) or by position on the bus.
  4351. @node pgp_module
  4352. @section pgp
  4353. This module provides support for the commands: @command{verify_detached},
  4354. @command{trust}, @command{list_trusted}, @command{distrust} associated with
  4355. digital signature checking via the "Open Pretty Good Privacy" (PGP) protocol /
  4356. RFC 4880 using a provided public key. This module also uses / sets
  4357. environment variable @code{check_signatures}. @xref{verify_detached},
  4358. @ref{trust}, @ref{list_trusted}, @ref{distrust}, and @ref{check_signatures}.
  4359. @node plainmount_module
  4360. @section plainmount
  4361. This module provides support for accessing / mounting partitions encrypted
  4362. by "cryptsetup" operating in "plain mode". @xref{plainmount} for more
  4363. information.
  4364. @node plan9_module
  4365. @section plan9
  4366. This module provides support for the @command{plan9} command to load a Plan9
  4367. kernel.
  4368. @node play_module
  4369. @section play
  4370. This module provides support for the @command{play} command to play a tune
  4371. through the PC speaker. @xref{play} for more information.
  4372. @node png_module
  4373. @section png
  4374. This module provides support for reading Portable Network Graphics (PNG) image
  4375. files in GRUB.
  4376. @node priority_queue_module
  4377. @section priority_queue
  4378. This module provides support for a priority queue function within GRUB such as
  4379. to support networking functions.
  4380. @node probe_module
  4381. @section probe
  4382. This module provides support for the @command{probe} command to retrieve device
  4383. information. @xref{probe} for more information.
  4384. @node procfs_module
  4385. @section procfs
  4386. This module provides support for a Proc File System to provide a file system
  4387. like interface to some GRUB internal data.
  4388. @node progress_module
  4389. @section progress
  4390. This module provides support for showing file loading progress to the terminal.
  4391. @node pxe_module
  4392. @section pxe
  4393. This module provides support for Preboot Execution Environment (PXE) network
  4394. boot services as a file system driver for other GRUB modules.
  4395. @node pxechain_module
  4396. @section pxechain
  4397. This module provides support for the @command{pxechainloader} command to load
  4398. another bootloader by PXE.
  4399. @node raid5rec_module
  4400. @section raid5rec
  4401. This module provides support for recovering from faulty RAID4/5 disk arrays
  4402. @node raid6rec_module
  4403. @section raid6rec
  4404. This module provides support for recovering from faulty RAID6 disk arrays.
  4405. @node random_module
  4406. @section random
  4407. This module provides support for library functions to get random data via
  4408. the hardware ACPI Power Management Timer and the TSC time source (Timestamp
  4409. Counter).
  4410. @node rdmsr_module
  4411. @section rdmsr
  4412. This module provides support for the @command{rdmsr} command to read CPU
  4413. Model Specific Registers. @xref{rdmsr} for more information.
  4414. @node read_module
  4415. @section read
  4416. This module provides support for the @command{read} command for getting user
  4417. input. @xref{read} for more information.
  4418. @node reboot_module
  4419. @section reboot
  4420. This module provides support for the @command{reboot} command to reboot the
  4421. computer. @xref{reboot} for more information.
  4422. @node regexp_module
  4423. @section regexp
  4424. This module provides support for the @command{regexp} command to check if a
  4425. regular expression matches a string. This module also provides support for the
  4426. GRUB script wildcard translator. @xref{regexp} for more information.
  4427. @node reiserfs_module
  4428. @section reiserfs
  4429. This module provides support for the ReiserFS File System in GRUB.
  4430. @node relocator_module
  4431. @section relocator
  4432. This module provides support for relocating the image / executable being loaded
  4433. to the expected memory location(s) and jumping to (invoking) the executable.
  4434. @node romfs_module
  4435. @section romfs
  4436. This module provides support for the Read-Only Memory File System (ROMFS).
  4437. @node scsi_module
  4438. @section scsi
  4439. This module provides support for the Small Computer System Interface (SCSI)
  4440. protocol used for some types of disk communication include some modern ones
  4441. such as USB Mass Storage Devices supporting "USB Attached SCSI" (UAS).
  4442. @node sdl_module
  4443. @section sdl
  4444. This module provides support for Simple DirectMedia Layer (SDL) video / image
  4445. output from the grub-emu tool used to preview the GRUB menu from a running
  4446. Operating System such as Linux (useful to test GRUB menu configuration changes
  4447. without rebooting). When available in the compilation target environment, SDL2
  4448. will be used instead of SDL1.
  4449. @node search_module
  4450. @section search
  4451. This module provides support for the @command{search} command to search devices
  4452. by file, filesystem label, or filesystem UUID. @xref{search} for more
  4453. information.
  4454. @node search_fs_file_module
  4455. @section search_fs_file
  4456. This module provides support for the @command{search.file} command which
  4457. is an alias for the corresponding @command{search} command. @xref{search} for
  4458. more information.
  4459. @node search_fs_uuid_module
  4460. @section search_fs_uuid
  4461. This module provides support for the @command{search.fs_uuid} command which
  4462. is an alias for the corresponding @command{search} command. @xref{search} for
  4463. more information.
  4464. @node search_label_module
  4465. @section search_label
  4466. This module provides support for the @command{search.fs_label} command which
  4467. is an alias for the corresponding @command{search} command. @xref{search} for
  4468. more information.
  4469. @node sendkey_module
  4470. @section sendkey
  4471. This module provides support for the @command{sendkey} command to send
  4472. emulated keystrokes. @xref{sendkey} for more information.
  4473. @node serial_module
  4474. @section serial
  4475. This module provides support for the @command{serial} command and associated
  4476. driver support for communication over a serial interface from GRUB.
  4477. @xref{serial} for more information.
  4478. @node setjmp_module
  4479. @section setjmp
  4480. This module provides support for the @code{setjmp} and @code{longjmp} functions
  4481. used within GRUB.
  4482. @node setjmp_test_module
  4483. @section setjmp_test
  4484. This module is intended for performing a functional test of the @code{setjmp}
  4485. and @code{longjmp} functions in GRUB.
  4486. @node setpci_module
  4487. @section setpci
  4488. This module provides support for the @command{setpci} command to get / set
  4489. values from / to specified PCI / PCIe devices.
  4490. @node sfs_module
  4491. @section sfs
  4492. This module provides support for the Amiga Smart File System (SFS) in GRUB.
  4493. @node shift_test_module
  4494. @section shift_test
  4495. This module is intended for performing a functional test of the bit-wise shift
  4496. operations in GRUB.
  4497. @node signature_test_module
  4498. @section signature_test
  4499. This module is intended for performing a functional test of the digital
  4500. signature verification functions in GRUB.
  4501. @node sleep_module
  4502. @section sleep
  4503. This module provides support for the @command{sleep} command to wait a specified
  4504. number of seconds in GRUB. @xref{sleep} for more information.
  4505. @node sleep_test_module
  4506. @section sleep_test
  4507. This module is intended for performing a functional test of the sleep function
  4508. in GRUB.
  4509. @node smbios_module
  4510. @section smbios
  4511. This module provides support for the @command{smbios} command to retrieve SMBIOS
  4512. information in GRUB. @xref{smbios} for more information.
  4513. @node spkmodem_module
  4514. @section spkmodem
  4515. This module provides support for outputting GRUB console information over an
  4516. audio output. This output can be fed into another computer's sound input
  4517. and decoded using the @code{spkmodem_recv} utility. Note that this will slow
  4518. down GRUB's performance.
  4519. @node squash4_module
  4520. @section squash4
  4521. This module provides support for the SquashFS compressed read-only file system
  4522. in GRUB.
  4523. @node strtoull_test_module
  4524. @section strtoull_test
  4525. This module is intended for performing a functional test of the strtoull
  4526. function in GRUB.
  4527. @node suspend_module
  4528. @section suspend
  4529. This module provides support for the @command{suspend} command in GRUB to
  4530. return to IEEE1275 prompt on "Open Firmware" systems.
  4531. @node syslinuxcfg_module
  4532. @section syslinuxcfg
  4533. This module provides support for commands @command{syslinux_source},
  4534. @command{syslinux_configfile}, @command{extract_syslinux_entries_source},
  4535. and @command{extract_syslinux_entries_configfile} in GRUB. These commands
  4536. can be used to parse and display GRUB menu entries based on a Syslinux based
  4537. configuration (used for SYSLINUX, ISOLINUX, and PXELINUX). It can also
  4538. be used to execute the Syslinux loader from GRUB.
  4539. @node tar_module
  4540. @section tar
  4541. This module provides support for the GNU Tar and POSIX Tar file archives as a
  4542. file system in GRUB.
  4543. @node terminal_module
  4544. @section terminal
  4545. This module provides support for the commands @command{terminal_input} and
  4546. @command{terminal_output} in GRUB. @xref{terminal_input} and
  4547. @ref{terminal_output} for more information.
  4548. @node terminfo_module
  4549. @section terminfo
  4550. This module provides support for the @command{terminfo} command in GRUB to
  4551. set various terminal modes / options. @xref{terminfo} for more information.
  4552. @node test_module
  4553. @section test
  4554. This module provides support for the commands @command{test} and @command{[}.
  4555. These commands can be used to evaluate (test) an expression. @xref{test} for
  4556. more information.
  4557. @node test_blockarg_module
  4558. @section test_blockarg
  4559. This module is intended for performing a functional test of the "block" command
  4560. argument function in GRUB internal functions via a test command
  4561. @command{test_blockarg}.
  4562. @node testload_module
  4563. @section testload
  4564. This module is intended for performing a functional test of some file reading /
  4565. seeking functions in GRUB internals via a test command @command{testload}.
  4566. @node testspeed_module
  4567. @section testspeed
  4568. This module provides support for the @command{testspeed} command to test and
  4569. print file read speed of a specified file.
  4570. @node tftp_module
  4571. @section tftp
  4572. This module provides support for the Trivial File Transfer Protocol (TFTP) for
  4573. receiving files via the network to GRUB. TFTP may be used along with PXE for
  4574. network booting for example.
  4575. @node tga_module
  4576. @section tga
  4577. This module provides support for reading Truevision Graphics Adapter (TGA)
  4578. image files in GRUB.
  4579. @node time_module
  4580. @section time
  4581. This module provides support for the @command{time} command to measure the
  4582. time taken by a given command and output it to the terminal.
  4583. @node tpm_module
  4584. @section tpm
  4585. This module provides support for interacting with a Trusted Platform Module
  4586. (TPM) with GRUB to perform Measured Boot. @xref{Measured Boot} for more
  4587. information.
  4588. @node tr_module
  4589. @section tr
  4590. This module provides support for the @command{tr} command in GRUB. This can be
  4591. used to translate characters in a string according to the provided arguments.
  4592. For example this can be used to convert upper-case to lower-case and visa-versa.
  4593. @node trig_module
  4594. @section trig
  4595. This module provides support for internal trig functions @code{grub_cos} and
  4596. @code{grub_sin} using lookup based computation. Currently these trig functions
  4597. are used by the gfxmenu circular progress bar.
  4598. @node true_module
  4599. @section true
  4600. This module provides support for the commands @command{true} and
  4601. @command{false}. @xref{true} and @ref{false} for more information.
  4602. @node truecrypt_module
  4603. @section truecrypt
  4604. This module provides support for the @command{truecrypt} command. This can be
  4605. used to load a Truecrypt ISO image.
  4606. @node ubootnet_module
  4607. @section ubootnet
  4608. This module provides support for configuring network interfaces in GRUB using
  4609. information provided by a U-Boot bootloader.
  4610. @node udf_module
  4611. @section udf
  4612. This module provides support for the Universal Disk Format (UDF) used on some
  4613. newer optical disks.
  4614. @node ufs1_module
  4615. @section ufs1
  4616. This module provides support for the Unix File System version 1 in GRUB.
  4617. @node ufs1_be_module
  4618. @section ufs1_be
  4619. This module provides support for the Unix File System version 1 (big-endian) in
  4620. GRUB.
  4621. @node ufs2_module
  4622. @section ufs2
  4623. This module provides support for the Unix File System version 2 in GRUB.
  4624. @node uhci_module
  4625. @section uhci
  4626. This module provides support for the Universal Host Controller Interface (UHCI)
  4627. for USB 1.x.
  4628. @node usb_module
  4629. @section usb
  4630. This module provides support for USB interfaces, USB hubs, and USB transfers
  4631. in GRUB.
  4632. @node usb_keyboard_module
  4633. @section usb_keyboard
  4634. This module provides support for a USB keyboard in GRUB.
  4635. @node usbms_module
  4636. @section usbms
  4637. This module provides support for USB Mass Storage devices in GRUB.
  4638. @node usbserial_common_module
  4639. @section usbserial_common
  4640. This module provides support for common operations needed to support USB Serial
  4641. port adapters in GRUB (to support a model / type specific USB to serial
  4642. adapter defined in another module).
  4643. @node usbserial_ftdi_module
  4644. @section usbserial_ftdi
  4645. This module provides support for USB to serial adapters with vendor ID 0x0403
  4646. and product ID 0x6001 (often associated with FTDI devices).
  4647. @node usbserial_pl2303_module
  4648. @section usbserial_pl2303
  4649. This module provides support for USB to serial adapters with vendor ID 0x067b
  4650. and product ID 0x2303 (PL2303 USB to Serial adapter).
  4651. @node usbserial_usbdebug_module
  4652. @section usbserial_usbdebug
  4653. This module provides support for debugging GRUB via a "USB 2.0 Debug Cable".
  4654. The USB 2.0 specification includes a "USB2 Debug Device Functional
  4655. Specification" that this driver is intended to support for GRUB. This may
  4656. integrate with GDB server function in GRUB (@pxref{gdb_module}).
  4657. @node usbtest_module
  4658. @section usbtest
  4659. This module provides support for the @command{usb} command in GRUB to test USB
  4660. functionality by iterating through all connected USB devices and printing
  4661. information for each to the terminal.
  4662. @node vbe_module
  4663. @section vbe
  4664. This module provides support for the VESA BIOS Extension (VBE) Video Driver in
  4665. GRUB.
  4666. @node verifiers_module
  4667. @section verifiers
  4668. This module is a built-in kernel module to provide a framework for GRUB file
  4669. verifiers and string verifiers.
  4670. @node vga_module
  4671. @section vga
  4672. This module provides support for the Video Graphics Array (VGA) Video Driver in
  4673. GRUB.
  4674. @node vga_text_module
  4675. @section vga_text
  4676. This module provides support for the Video Graphics Array (VGA) terminal
  4677. output device.
  4678. @node video_module
  4679. @section video
  4680. This module provides support for video output support functions within GRUB.
  4681. @node video_bochs_module
  4682. @section video_bochs
  4683. This module provides support for the Bochs PCI Video Driver (also known as
  4684. Bochs Graphics Adapter / BGA) in GRUB.
  4685. @node video_cirrus_module
  4686. @section video_cirrus
  4687. This module provides support for the Cirrus CLGD 5446 PCI Video Driver (Cirrus
  4688. Video) in GRUB.
  4689. @node video_colors_module
  4690. @section video_colors
  4691. This module provides support for interpreting named colors and parsing RBG
  4692. hexadecimal values.
  4693. @node video_fb_module
  4694. @section video_fb
  4695. This module provides support for video frame buffer (FB) support in GRUB.
  4696. @node videoinfo_module
  4697. @section videoinfo
  4698. This module provides support for the @command{videoinfo} command and (depending
  4699. on architecture) the @command{vbeinfo} command. @xref{videoinfo} for more
  4700. information.
  4701. @node videotest_module
  4702. @section videotest
  4703. This module provides support for the @command{videotest} command and (depending
  4704. on architecture) the @command{vbetest} to test the video subsystem in the
  4705. specified width and height.
  4706. @node videotest_checksum_module
  4707. @section videotest_checksum
  4708. This module is intended for performing a functional test of the video
  4709. functions in GRUB by displaying a test image and capturing a checksum.
  4710. @node wrmsr_module
  4711. @section wrmsr
  4712. This module provides support for the @command{wrmsr} command to write to CPU
  4713. model-specific registers. @xref{wrmsr} for more information.
  4714. @node xen_boot_module
  4715. @section xen_boot
  4716. This module provides support for the commands @command{xen_hypervisor} and
  4717. @command{xen_module} to load a XEN hypervisor and module respectively.
  4718. @node xfs_module
  4719. @section xfs
  4720. This module provides support for the XFS file system in GRUB.
  4721. @node xnu_module
  4722. @section xnu
  4723. This module provides support for the commands: @command{xnu_devprop_load},
  4724. @command{xnu_kernel}, @command{xnu_kernel64}, @command{xnu_mkext},
  4725. @command{xnu_kext}, @command{xnu_kextdir}, @command{xnu_ramdisk},
  4726. @command{xnu_splash}, and @command{xnu_resume} (only for emulated machine).
  4727. These commands support loading and interacting with a XNU (MacOS / Apple) based
  4728. system / kernel.
  4729. @node xnu_uuid_module
  4730. @section xnu_uuid
  4731. This module provides support for the @command{xnu_uuid} command to transform
  4732. a 64-bit UUID to a format suitable for XNU.
  4733. @node xnu_uuid_test_module
  4734. @section xnu_uuid_test
  4735. This module is intended for performing a functional test of the XNU UUID
  4736. conversion function.
  4737. @node xzio_module
  4738. @section xzio
  4739. This module provides support for decompression of XZ compressed data.
  4740. @node zfs_module
  4741. @section zfs
  4742. This module provides support for the ZFS file system in GRUB.
  4743. @node zfscrypt_module
  4744. @section zfscrypt
  4745. This module provides support for the @command{zfskey} to import a decryption
  4746. key as well as decryption support for encrypted ZFS file systems.
  4747. @node zfsinfo_module
  4748. @section zfsinfo
  4749. This module provides support for the commands @command{zfsinfo} to output ZFS
  4750. info about a device and @command{zfs-bootfs} to output ZFS-BOOTFSOBJ or store
  4751. it into a variable.
  4752. @node zstd_module
  4753. @section zstd
  4754. This module provides support for the Zstandard (zstd) decompression algorithm
  4755. in GRUB.
  4756. @node Commands
  4757. @chapter Available commands
  4758. In this chapter, we list all commands that are available in GRUB.
  4759. Commands belong to different groups. A few can only be used in
  4760. the global section of the configuration file (or ``menu''); most
  4761. of them can be entered on the command-line and can be used either
  4762. anywhere in the menu or specifically in the menu entries.
  4763. In rescue mode, only the @command{insmod} (@pxref{insmod}), @command{ls}
  4764. (@pxref{ls}), @command{set} (@pxref{set}), and @command{unset}
  4765. (@pxref{unset}) commands are normally available. If you end up in rescue
  4766. mode and do not know what to do, then @pxref{GRUB only offers a rescue
  4767. shell}.
  4768. @menu
  4769. * Menu-specific commands::
  4770. * Loader commands::
  4771. * General commands::
  4772. * Command-line commands::
  4773. * Networking commands::
  4774. * Undocumented commands::
  4775. @end menu
  4776. @node Menu-specific commands
  4777. @section Commands for the menu only
  4778. The semantics used in parsing the configuration file are the following:
  4779. @itemize @bullet
  4780. @item
  4781. The files @emph{must} be in plain-text format.
  4782. @item
  4783. @samp{#} at the beginning of a line in a configuration file means it is
  4784. only a comment.
  4785. @item
  4786. Options are separated by spaces.
  4787. @item
  4788. All numbers can be either decimal or hexadecimal. A hexadecimal number
  4789. must be preceded by @samp{0x}, and is case-insensitive.
  4790. @end itemize
  4791. These commands can only be used in the menu:
  4792. @menu
  4793. * menuentry:: Start a menu entry
  4794. * submenu:: Group menu entries
  4795. @end menu
  4796. @node menuentry
  4797. @subsection menuentry
  4798. @deffn Command menuentry @var{title} @
  4799. [@option{--class=class} @dots{}] [@option{--users=users}] @
  4800. [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
  4801. [@var{arg} @dots{}] @{ @var{command}; @dots{} @}
  4802. This defines a GRUB menu entry named @var{title}. When this entry is
  4803. selected from the menu, GRUB will set the @var{chosen} environment variable
  4804. to value of @option{--id} if @option{--id} is given, execute the list of
  4805. commands given within braces, and if the last command in the list returned
  4806. successfully and a kernel was loaded it will execute the @command{boot} command.
  4807. The @option{--class} option may be used any number of times to group menu
  4808. entries into classes. Menu themes may display different classes using
  4809. different styles.
  4810. The @option{--users} option grants specific users access to specific menu
  4811. entries. @xref{Security}.
  4812. The @option{--unrestricted} option grants all users access to specific menu
  4813. entries. @xref{Security}.
  4814. The @option{--hotkey} option associates a hotkey with a menu entry.
  4815. @var{key} may be a single letter, or one of the aliases @samp{backspace},
  4816. @samp{tab}, or @samp{delete}.
  4817. The @option{--id} may be used to associate unique identifier with a menu entry.
  4818. @var{id} is string of ASCII aphanumeric characters, underscore and hyphen
  4819. and should not start with a digit.
  4820. All other arguments including @var{title} are passed as positional parameters
  4821. when list of commands is executed with @var{title} always assigned to @code{$1}.
  4822. @end deffn
  4823. @node submenu
  4824. @subsection submenu
  4825. @deffn Command submenu @var{title} @
  4826. [@option{--class=class} @dots{}] [@option{--users=users}] @
  4827. [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
  4828. @{ @var{menu entries} @dots{} @}
  4829. This defines a submenu. An entry called @var{title} will be added to the
  4830. menu; when that entry is selected, a new menu will be displayed showing all
  4831. the entries within this submenu.
  4832. All options are the same as in the @command{menuentry} command
  4833. (@pxref{menuentry}).
  4834. @end deffn
  4835. @node Loader commands
  4836. @section Various loader commands
  4837. These commands are used to load necessary components to boot desired OS.
  4838. Many of the loader commands are not sufficiently documented. The following is
  4839. a list of commands that could use more documentation:
  4840. @itemize @bullet
  4841. @item @command{appleloader} - Boot BIOS-based system.
  4842. @item @command{freedos} - Load FreeDOS kernel.sys.
  4843. @item @command{kfreebsd_loadenv} - Load FreeBSD env.
  4844. @item @command{kfreebsd_module_elf} - Load FreeBSD kernel module (ELF).
  4845. @item @command{kfreebsd_module} - Load FreeBSD kernel module.
  4846. @item @command{kfreebsd} - Load kernel of FreeBSD.
  4847. @item @command{knetbsd_module_elf} - Load NetBSD kernel module (ELF).
  4848. @item @command{knetbsd_module} - Load NetBSD kernel module.
  4849. @item @command{knetbsd} - Load kernel of NetBSD.
  4850. @item @command{kopenbsd} - Load kernel of OpenBSD.
  4851. @item @command{kopenbsd_ramdisk} - Load kOpenBSD ramdisk.
  4852. @item @command{legacy_initrd_nounzip} - Simulate grub-legacy `modulenounzip' command
  4853. @item @command{legacy_initrd} - Simulate grub-legacy `initrd' command
  4854. @item @command{legacy_kernel} - Simulate grub-legacy `kernel' command
  4855. @item @command{module2} - Load a multiboot 2 module.
  4856. @item @command{module} - Load a multiboot module.
  4857. @item @command{multiboot2} - Load a multiboot 2 kernel.
  4858. @item @command{multiboot} - Load a multiboot kernel.
  4859. @item @command{ntldr} - Load NTLDR or BootMGR.
  4860. @item @command{plan9} - Load Plan9 kernel.
  4861. @item @command{pxechainloader} - Load a PXE image.
  4862. @item @command{truecrypt} - Load Truecrypt ISO.
  4863. @item @command{xnu_kernel64} - Load 64-bit XNU image.
  4864. @item @command{xnu_kernel} - Load XNU image.
  4865. @item @command{xnu_kextdir} - Load XNU extension directory.
  4866. @item @command{xnu_kext} - Load XNU extension.
  4867. @item @command{xnu_mkext} - Load XNU extension package.
  4868. @item @command{xnu_ramdisk} - Load XNU ramdisk. It will be available in OS as md0.
  4869. @item @command{xnu_resume} - Load an image of hibernated XNU.
  4870. @item @command{xnu_splash} - Load a splash image for XNU.
  4871. @end itemize
  4872. @menu
  4873. * chainloader:: Chain-load another boot loader
  4874. * initrd:: Load a Linux initrd
  4875. * initrd16:: Load a Linux initrd (16-bit mode)
  4876. * linux:: Load a Linux kernel
  4877. * linux16:: Load a Linux kernel (16-bit mode)
  4878. @comment * xen_*:: Xen boot commands for AArch64
  4879. * xen_hypervisor:: Load xen hypervisor binary (only on AArch64)
  4880. * xen_module:: Load xen modules for xen hypervisor (only on AArch64)
  4881. @end menu
  4882. @node chainloader
  4883. @subsection chainloader
  4884. @deffn Command chainloader [@option{--force}] file [args...]
  4885. Load @var{file} as a chain-loader. Like any other file loaded by the
  4886. filesystem code, it can use the blocklist notation (@pxref{Block list
  4887. syntax}) to grab the first sector of the current partition with @samp{+1}.
  4888. On EFI platforms, any arguments after @var{file} will be sent to the loaded
  4889. image.
  4890. If you specify the option @option{--force}, then load @var{file} forcibly,
  4891. whether it has a correct signature or not. This is required when you want to
  4892. load a defective boot loader, such as SCO UnixWare 7.1.
  4893. @end deffn
  4894. @node initrd
  4895. @subsection initrd
  4896. @deffn Command initrd file [file @dots{}]
  4897. Load, in order, all initrds for a Linux kernel image, and set the
  4898. appropriate parameters in the Linux setup area in memory. This may only
  4899. be used after the @command{linux} command (@pxref{linux}) has been run.
  4900. See @ref{GNU/Linux} for more info on booting GNU/Linux. For more
  4901. information on initrds see the GNU/Linux kernel
  4902. @uref{https://docs.kernel.org/filesystems/ramfs-rootfs-initramfs.html,
  4903. documentation}.
  4904. A new-style initrd (for kernels newer than 2.6) containing one file
  4905. with leading path components can also be generated at run time. This
  4906. can be done by prefixing an argument with @code{newc:} followed by the
  4907. path of the file in the new initrd, a @code{:}, and then the GRUB file
  4908. path to the file data to be be included.
  4909. For example:
  4910. @example
  4911. initrd newc:/etc/ssh/config:(hd0,2)/home/user/.ssh/config \
  4912. newc:/etc/ssh/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key \
  4913. /boot/initrd.gz \
  4914. newc:/init:/home/user/init.fixed
  4915. @end example
  4916. This command will generate two new-style initrds on the fly. The first
  4917. contains the path @samp{/etc/ssh/config} with the contents of
  4918. @samp{(hd0,2)/home/user/.ssh/config} and the path
  4919. @samp{/etc/ssh/ssh_host_rsa_key} with the contents of
  4920. @samp{/etc/ssh/ssh_host_rsa_key} on the @var{root} device. Parent directory
  4921. paths will automatically be generated as needed. This first generated initrd
  4922. will then have @samp{/boot/initrd.gz} concatenated after it. Next, another
  4923. new-style archive will be generated with the contents of @samp{/home/user/init.fixed}
  4924. in the path @samp{/init} and appended to the previous concatenation. Finally,
  4925. the result will be sent to the kernel when booted.
  4926. Keep in mind that paths that come later will take precedence. So in the
  4927. example above, the generated path @samp{/init} will overwrite any @samp{/init}
  4928. in @samp{/boot/initrd.gz}. This can be useful when changing the main initrd
  4929. is undesirable or difficult.
  4930. @end deffn
  4931. @node initrd16
  4932. @subsection initrd16
  4933. @deffn Command initrd16 file [file @dots{}]
  4934. Load, in order, all initrds for a Linux kernel image to be booted in
  4935. 16-bit mode, and set the appropriate parameters in the Linux setup area in
  4936. memory. This may only be used after the @command{linux16} command
  4937. (@pxref{linux16}) has been run. See also @ref{GNU/Linux} and the @command{initrd}
  4938. command (@pxref{initrd}) for more details on arguments.
  4939. This command is only available on the pc platform for x86 systems.
  4940. @end deffn
  4941. @node linux
  4942. @subsection linux
  4943. @deffn Command linux file @dots{}
  4944. Load a Linux kernel image from @var{file}. The rest of the line is passed
  4945. verbatim as the @dfn{kernel command-line}. Any initrd must be reloaded
  4946. after using this command (@pxref{initrd}).
  4947. On x86 systems, the kernel will be booted using the 32-bit boot protocol.
  4948. Note that this means that the @samp{vga=} boot option will not work; if you
  4949. want to set a special video mode, you will need to use GRUB commands such as
  4950. @samp{set gfxpayload=1024x768} or @samp{set gfxpayload=keep} (to keep the
  4951. same mode as used in GRUB) instead. GRUB can automatically detect some uses
  4952. of @samp{vga=} and translate them to appropriate settings of
  4953. @samp{gfxpayload}. The @command{linux16} command (@pxref{linux16}) avoids
  4954. this restriction.
  4955. @end deffn
  4956. @node linux16
  4957. @subsection linux16
  4958. @deffn Command linux16 file @dots{}
  4959. Load a Linux kernel image from @var{file} in 16-bit mode. The rest of the
  4960. line is passed verbatim as the @dfn{kernel command-line}. Any initrd must
  4961. be reloaded after using this command (@pxref{initrd16}).
  4962. The kernel will be booted using the traditional 16-bit boot protocol. As
  4963. well as bypassing problems with @samp{vga=} described in @ref{linux}, this
  4964. permits booting some other programs that implement the Linux boot protocol
  4965. for the sake of convenience.
  4966. This command is only available on x86 systems.
  4967. @end deffn
  4968. @node xen_hypervisor
  4969. @subsection xen_hypervisor
  4970. @deffn Command xen_hypervisor file [arguments] @dots{}
  4971. Load a Xen hypervisor binary from @var{file}. The rest of the line is passed
  4972. verbatim as the @dfn{kernel command-line}. Any other binaries must be
  4973. reloaded after using this command.
  4974. This command is only available on AArch64 systems.
  4975. @end deffn
  4976. @node xen_module
  4977. @subsection xen_module
  4978. @deffn Command xen_module [--nounzip] file [arguments]
  4979. Load a module for xen hypervisor at the booting process of xen.
  4980. The rest of the line is passed verbatim as the module command line.
  4981. Modules should be loaded in the following order:
  4982. - dom0 kernel image
  4983. - dom0 ramdisk if present
  4984. - XSM policy if present
  4985. This command is only available on AArch64 systems.
  4986. @end deffn
  4987. @node General commands
  4988. @section General commands
  4989. Commands usable anywhere in the menu and in the command-line.
  4990. @menu
  4991. * serial:: Set up a serial device
  4992. * terminal_input:: Manage input terminals
  4993. * terminal_output:: Manage output terminals
  4994. * terminfo:: Define terminal type
  4995. @end menu
  4996. @node serial
  4997. @subsection serial
  4998. @deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}]
  4999. Initialize a serial device. @var{unit} is a number in the range 0-3
  5000. specifying which serial port to use; default is 0, which corresponds to
  5001. the port often called COM1.
  5002. @var{port} is the I/O port where the UART is to be found or, if prefixed
  5003. with @samp{mmio,}, the MMIO address of the UART. If specified it takes
  5004. precedence over @var{unit}.
  5005. Additionally, an MMIO address can be suffixed with:
  5006. @itemize @bullet
  5007. @item
  5008. @samp{.b} for bytes access (default)
  5009. @item
  5010. @samp{.w} for 16-bit word access
  5011. @item
  5012. @samp{.l} for 32-bit long word access or
  5013. @item
  5014. @samp{.q} for 64-bit long long word access
  5015. @end itemize
  5016. Also, @var{port} can be of the form @samp{pci,XX:XX.X} to indicate a serial
  5017. device exposed on the PCI bus.
  5018. @var{speed} is the transmission speed; default is 9600. @var{word} and
  5019. @var{stop} are the number of data bits and stop bits. Data bits must
  5020. be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
  5021. bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd},
  5022. @samp{even} and defaults to @samp{no}.
  5023. If passed no @var{unit} nor @var{port}, or if @var{port} is set to
  5024. @samp{auto} then GRUB will attempt to use ACPI to automatically detect
  5025. the system default serial port and its configuration. If this information
  5026. is not available, it will default to @var{unit} 0.
  5027. The serial port is not used as a communication channel unless the
  5028. @command{terminal_input} or @command{terminal_output} command is used
  5029. (@pxref{terminal_input}, @pxref{terminal_output}).
  5030. Note, valid @var{port} values, excluding IO port addresses, can be found
  5031. by listing terminals with @command{terminal_output}, selecting all names
  5032. prefixed by @samp{serial_} and removing that prefix.
  5033. Examples:
  5034. @example
  5035. serial --port=0x3f8 --speed=9600
  5036. serial --port=mmio,fefb0000.l --speed=115200
  5037. serial --port=pci,00:16.3 --speed=115200
  5038. @end example
  5039. See also @ref{Serial terminal}.
  5040. @end deffn
  5041. @node terminal_input
  5042. @subsection terminal_input
  5043. @deffn Command terminal_input [@option{--append}|@option{--remove}] @
  5044. [terminal1] [terminal2] @dots{}
  5045. List or select an input terminal.
  5046. With no arguments, list the active and available input terminals.
  5047. With @option{--append}, add the named terminals to the list of active input
  5048. terminals; any of these may be used to provide input to GRUB.
  5049. With @option{--remove}, remove the named terminals from the active list.
  5050. With no options but a list of terminal names, make only the listed terminal
  5051. names active.
  5052. @end deffn
  5053. @node terminal_output
  5054. @subsection terminal_output
  5055. @deffn Command terminal_output [@option{--append}|@option{--remove}] @
  5056. [terminal1] [terminal2] @dots{}
  5057. List or select an output terminal.
  5058. With no arguments, list the active and available output terminals.
  5059. With @option{--append}, add the named terminals to the list of active output
  5060. terminals; all of these will receive output from GRUB.
  5061. With @option{--remove}, remove the named terminals from the active list.
  5062. With no options but a list of terminal names, make only the listed terminal
  5063. names active.
  5064. @end deffn
  5065. @node terminfo
  5066. @subsection terminfo
  5067. @deffn Command terminfo [@option{-a}|@option{-u}|@option{-v}] [@option{-g WxH}] [term] [type]
  5068. Define the capabilities of your terminal by giving the name of an entry in
  5069. the terminfo database, which should correspond roughly to a @samp{TERM}
  5070. environment variable in Unix.
  5071. The currently available terminal types are @samp{vt100}, @samp{vt100-color},
  5072. @samp{ieee1275}, and @samp{dumb}. If you need other terminal types, please
  5073. contact us to discuss the best way to include support for these in GRUB.
  5074. The @option{-a} (@option{--ascii}), @option{-u} (@option{--utf8}), and
  5075. @option{-v} (@option{--visual-utf8}) options control how non-ASCII text is
  5076. displayed. @option{-a} specifies an ASCII-only terminal; @option{-u}
  5077. specifies logically-ordered UTF-8; and @option{-v} specifies
  5078. "visually-ordered UTF-8" (in other words, arranged such that a terminal
  5079. emulator without bidirectional text support will display right-to-left text
  5080. in the proper order; this is not really proper UTF-8, but a workaround).
  5081. The @option{-g} (@option{--geometry}) can be used to specify terminal geometry.
  5082. If no option or terminal type is specified, the current terminal type is
  5083. printed.
  5084. @end deffn
  5085. @node Command-line commands
  5086. @section Command-line commands
  5087. These commands are usable in the command-line and in menu entries. If
  5088. you forget a command, you can run the command @command{help}
  5089. (@pxref{help}).
  5090. @menu
  5091. * [:: Check file types and compare values
  5092. * acpi:: Load ACPI tables
  5093. * authenticate:: Check whether user is in user list
  5094. * background_color:: Set background color for active terminal
  5095. * background_image:: Load background image for active terminal
  5096. * badram:: Filter out bad regions of RAM
  5097. * blocklist:: Print a block list
  5098. * boot:: Start up your operating system
  5099. * cat:: Show the contents of a file
  5100. * clear:: Clear the screen
  5101. * cmosclean:: Clear bit in CMOS
  5102. * cmosdump:: Dump CMOS contents
  5103. * cmostest:: Test bit in CMOS
  5104. * cmp:: Compare two files
  5105. * configfile:: Load a configuration file
  5106. * cpuid:: Check for CPU features
  5107. * crc:: Compute or check CRC32 checksums
  5108. * cryptomount:: Mount a crypto device
  5109. * cutmem:: Remove memory regions
  5110. * date:: Display or set current date and time
  5111. * devicetree:: Load a device tree blob
  5112. * distrust:: Remove a pubkey from trusted keys
  5113. * drivemap:: Map a drive to another
  5114. * echo:: Display a line of text
  5115. * efitextmode:: Set/Get text output mode resolution
  5116. * eval:: Evaluate agruments as GRUB commands
  5117. * export:: Export an environment variable
  5118. * false:: Do nothing, unsuccessfully
  5119. * fdtdump:: Retrieve device tree information
  5120. * file:: Test the provided file against a type
  5121. * fwsetup:: Reboot into the firmware setup menu
  5122. * gdbinfo:: Provide info for debugging with GDB
  5123. * gettext:: Translate a string
  5124. * gptsync:: Fill an MBR based on GPT entries
  5125. * halt:: Shut down your computer
  5126. * hashsum:: Compute or check hash checksum
  5127. * help:: Show help messages
  5128. * hexdump:: Show raw contents of a file or memory
  5129. * insmod:: Insert a module
  5130. * keystatus:: Check key modifier status
  5131. * list_env:: List variables in environment block
  5132. * list_trusted:: List trusted public keys
  5133. * load_env:: Load variables from environment block
  5134. * loadfont:: Load font files
  5135. * loopback:: Make a device from a filesystem image
  5136. * ls:: List devices or files
  5137. * lsfonts:: List loaded fonts
  5138. * lsmod:: Show loaded modules
  5139. * md5sum:: Compute or check MD5 hash
  5140. * module:: Load module for multiboot kernel
  5141. * multiboot:: Load multiboot compliant kernel
  5142. * nativedisk:: Switch to native disk drivers
  5143. * normal:: Enter normal mode
  5144. * normal_exit:: Exit from normal mode
  5145. * parttool:: Modify partition table entries
  5146. * password:: Set a clear-text password
  5147. * password_pbkdf2:: Set a hashed password
  5148. * plainmount:: Open device encrypted in plain mode
  5149. * play:: Play a tune
  5150. * probe:: Retrieve device info
  5151. * rdmsr:: Read values from model-specific registers
  5152. * read:: Read user input
  5153. * reboot:: Reboot your computer
  5154. * regexp:: Test if regular expression matches string
  5155. * rmmod:: Remove a module
  5156. * save_env:: Save variables to environment block
  5157. * search:: Search devices by file, label, or UUID
  5158. * sendkey:: Emulate keystrokes
  5159. * set:: Set an environment variable
  5160. * sha1sum:: Compute or check SHA1 hash
  5161. * sha256sum:: Compute or check SHA256 hash
  5162. * sha512sum:: Compute or check SHA512 hash
  5163. * sleep:: Wait for a specified number of seconds
  5164. * smbios:: Retrieve SMBIOS information
  5165. * source:: Read a configuration file in same context
  5166. * test:: Check file types and compare values
  5167. * tpm2_key_protector_init:: Initialize the TPM2 key protector
  5168. * tpm2_key_protector_clear:: Clear the TPM2 key protector
  5169. * true:: Do nothing, successfully
  5170. * trust:: Add public key to list of trusted keys
  5171. * unset:: Unset an environment variable
  5172. @comment * vbeinfo:: List available video modes
  5173. * verify_detached:: Verify detached digital signature
  5174. * videoinfo:: List available video modes
  5175. * wrmsr:: Write values to model-specific registers
  5176. @end menu
  5177. @node [
  5178. @subsection [
  5179. @deffn Command @code{[} expression @code{]}
  5180. Alias for @code{test @var{expression}} (@pxref{test}).
  5181. @end deffn
  5182. @node acpi
  5183. @subsection acpi
  5184. @deffn Command acpi [@option{-1}|@option{-2}] @
  5185. [@option{--exclude=table1,@dots{}}|@option{--load-only=table1,@dots{}}] @
  5186. [@option{--oemid=id}] [@option{--oemtable=table}] @
  5187. [@option{--oemtablerev=rev}] [@option{--oemtablecreator=creator}] @
  5188. [@option{--oemtablecreatorrev=rev}] [@option{--no-ebda}] @
  5189. filename @dots{}
  5190. Modern BIOS systems normally implement the Advanced Configuration and Power
  5191. Interface (ACPI), and define various tables that describe the interface
  5192. between an ACPI-compliant operating system and the firmware. In some cases,
  5193. the tables provided by default only work well with certain operating
  5194. systems, and it may be necessary to replace some of them.
  5195. Normally, this command will replace the Root System Description Pointer
  5196. (RSDP) in the Extended BIOS Data Area to point to the new tables. If the
  5197. @option{--no-ebda} option is used, the new tables will be known only to
  5198. GRUB, but may be used by GRUB's EFI emulation.
  5199. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5200. Otherwise an attacker can instruct the GRUB to load an SSDT table to
  5201. overwrite the kernel lockdown configuration and later load and execute
  5202. unsigned code.
  5203. @end deffn
  5204. @node authenticate
  5205. @subsection authenticate
  5206. @deffn Command authenticate [userlist]
  5207. Check whether user is in @var{userlist} or listed in the value of variable
  5208. @samp{superusers}. See @pxref{superusers} for valid user list format.
  5209. If @samp{superusers} is empty, this command returns true. @xref{Security}.
  5210. @end deffn
  5211. @node background_color
  5212. @subsection background_color
  5213. @deffn Command background_color color
  5214. Set background color for active terminal. For valid color specifications see
  5215. @pxref{Theme file format, ,Colors}. Background color can be changed only when
  5216. using @samp{gfxterm} for terminal output.
  5217. This command sets color of empty areas without text. Text background color
  5218. is controlled by environment variables @var{color_normal}, @var{color_highlight},
  5219. @var{menu_color_normal}, @var{menu_color_highlight}. @xref{Special environment variables}.
  5220. @end deffn
  5221. @node background_image
  5222. @subsection background_image
  5223. @deffn Command background_image [[@option{--mode} @samp{stretch}|@samp{normal}] file]
  5224. Load background image for active terminal from @var{file}. Image is stretched
  5225. to fill up entire screen unless option @option{--mode} @samp{normal} is given.
  5226. Without arguments remove currently loaded background image. Background image
  5227. can be changed only when using @samp{gfxterm} for terminal output.
  5228. @end deffn
  5229. @node badram
  5230. @subsection badram
  5231. @deffn Command badram addr,mask[,addr,mask...]
  5232. Filter out bad RAM.
  5233. This command notifies the memory manager that specified regions of
  5234. RAM ought to be filtered out (usually, because they're damaged). This
  5235. remains in effect after a payload kernel has been loaded by GRUB, as
  5236. long as the loaded kernel obtains its memory map from GRUB. Kernels that
  5237. support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
  5238. kernels in general.
  5239. Syntax is the same as provided by the @uref{http://www.memtest.org/,
  5240. Memtest86+ utility}: a list of address/mask pairs. Given a page-aligned
  5241. address and a base address / mask pair, if all the bits of the page-aligned
  5242. address that are enabled by the mask match with the base address, it means
  5243. this page is to be filtered. This syntax makes it easy to represent patterns
  5244. that are often result of memory damage, due to physical distribution of memory
  5245. cells.
  5246. The command is similar to @command{cutmem} command.
  5247. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5248. This prevents removing EFI memory regions to potentially subvert the
  5249. security mechanisms provided by the UEFI secure boot.
  5250. @end deffn
  5251. @node blocklist
  5252. @subsection blocklist
  5253. @deffn Command blocklist file
  5254. Print a block list (@pxref{Block list syntax}) for @var{file}.
  5255. @end deffn
  5256. @node boot
  5257. @subsection boot
  5258. @deffn Command boot
  5259. Boot the OS or chain-loader which has been loaded. Only necessary if
  5260. running the fully interactive command-line (it is implicit at the end of
  5261. a menu entry).
  5262. @end deffn
  5263. @node cat
  5264. @subsection cat
  5265. @deffn Command cat [@option{--dos}] file
  5266. Display the contents of the file @var{file}. This command may be useful
  5267. to remind you of your OS's root partition:
  5268. @example
  5269. grub> @kbd{cat /etc/fstab}
  5270. @end example
  5271. If the @option{--dos} option is used, then carriage return / new line pairs
  5272. will be displayed as a simple new line. Otherwise, the carriage return will
  5273. be displayed as a control character (@samp{<d>}) to make it easier to see
  5274. when boot problems are caused by a file formatted using DOS-style line
  5275. endings.
  5276. Note: @command{cat} can be used to view the contents of devices using the
  5277. block list syntax (@pxref{Block list syntax}). However, it is not advised
  5278. to view binary data because it will try to decode UTF-8 strings, which can
  5279. lead to some bytes missing or added in the output. Instead, use the
  5280. @command{hexdump} command (@pxref{hexdump}).
  5281. @end deffn
  5282. @node clear
  5283. @subsection clear
  5284. @deffn Command clear
  5285. Clear the screen.
  5286. @end deffn
  5287. @node cmosclean
  5288. @subsection cmosclean
  5289. @deffn Command cmosclean byte:bit
  5290. Clear value of bit in CMOS at location @var{byte}:@var{bit}. This command
  5291. is available only on platforms that support CMOS.
  5292. @end deffn
  5293. @node cmosdump
  5294. @subsection cmosdump
  5295. @deffn Dump CMOS contents
  5296. Dump full CMOS contents as hexadecimal values. This command is available only
  5297. on platforms that support CMOS.
  5298. @end deffn
  5299. @node cmostest
  5300. @subsection cmostest
  5301. @deffn Command cmostest byte:bit
  5302. Test value of bit in CMOS at location @var{byte}:@var{bit}. Exit status
  5303. is zero if bit is set, non zero otherwise. This command is available only
  5304. on platforms that support CMOS.
  5305. @end deffn
  5306. @node cmp
  5307. @subsection cmp
  5308. @deffn Command cmp [@option{-v}] file1 file2
  5309. Compare the file @var{file1} with the file @var{file2}. If they are completely
  5310. identical, @code{$?} will be set to 0. Otherwise, if the files are not identical,
  5311. @code{$?} will be set to a nonzero value.
  5312. By default nothing will be output. If the @option{-v} is used, verbose mode is
  5313. enabled. In this mode when when the files differ in size, print the sizes like
  5314. this:
  5315. @example
  5316. Differ in size: 0x1234 [foo], 0x4321 [bar]
  5317. @end example
  5318. If the sizes are equal but the bytes at an offset differ, then print the
  5319. bytes like this:
  5320. @example
  5321. Differ at the offset 777: 0xbe [foo], 0xef [bar]
  5322. @end example
  5323. @end deffn
  5324. @node configfile
  5325. @subsection configfile
  5326. @deffn Command configfile file
  5327. Load @var{file} as a configuration file. If @var{file} defines any menu
  5328. entries, then show a menu containing them immediately. Any environment
  5329. variable changes made by the commands in @var{file} will not be preserved
  5330. after @command{configfile} returns.
  5331. @end deffn
  5332. @node cpuid
  5333. @subsection cpuid
  5334. @deffn Command cpuid [-l] [-p]
  5335. Check for CPU features. This command is only available on x86 systems.
  5336. With the @option{-l} option, return true if the CPU supports long mode
  5337. (64-bit).
  5338. With the @option{-p} option, return true if the CPU supports Physical
  5339. Address Extension (PAE).
  5340. If invoked without options, this command currently behaves as if it had been
  5341. invoked with @option{-l}. This may change in the future.
  5342. @end deffn
  5343. @node crc
  5344. @subsection crc
  5345. @deffn Command crc arg @dots{}
  5346. Alias for @code{hashsum --hash crc32 arg @dots{}}. See command @command{hashsum}
  5347. (@pxref{hashsum}) for full description.
  5348. @end deffn
  5349. @node cryptomount
  5350. @subsection cryptomount
  5351. @deffn Command cryptomount [ [@option{-p} password] | [@option{-k} keyfile [@option{-O} keyoffset] [@option{-S} keysize] ] | [@option{-P} protector] ] [@option{-H} file] device|@option{-u} uuid|@option{-a}|@option{-b}
  5352. Setup access to encrypted device. A passphrase will be requested interactively,
  5353. if neither the @option{-p} nor @option{-k} options are given. The option
  5354. @option{-p} can be used to supply a passphrase (useful for scripts).
  5355. Alternatively the @option{-k} option can be used to supply a keyfile with
  5356. options @option{-O} and @option{-S} optionally supplying the offset and size,
  5357. respectively, of the key data in the given key file. Besides the keyfile,
  5358. the key can be stored in a key protector, and option @option{-P} configures
  5359. specific key protector, e.g. tpm2, to retrieve the key from.
  5360. The @option{-H} options can be used to supply cryptomount backends with an
  5361. alternative header file (aka detached header). Not all backends have headers
  5362. nor support alternative header files (currently only LUKS1 and LUKS2 support them).
  5363. Argument @var{device} configures specific grub device
  5364. (@pxref{Naming convention}); option @option{-u} @var{uuid} configures device
  5365. with specified @var{uuid}; option @option{-a} configures all detected encrypted
  5366. devices; option @option{-b} configures all geli containers that have boot flag set.
  5367. Devices are not allowed to be given as key files nor as detached header files.
  5368. However, this limitation can be worked around by using blocklist syntax. So
  5369. for instance, @code{(hd1,gpt2)} can not be used, but @code{(hd1,gpt2)0+} will
  5370. achieve the desired result.
  5371. GRUB supports devices encrypted using LUKS, LUKS2 and geli. Note that necessary
  5372. modules (@var{luks}, @var{luks2} and @var{geli}) have to be loaded manually
  5373. before this command can be used. For LUKS2 only the PBKDF2 key derivation
  5374. function is supported, as Argon2 is not yet supported.
  5375. Successfully decrypted disks are named as (cryptoX) and have increasing numeration
  5376. suffix for each new decrypted disk. If the encrypted disk hosts some higher level
  5377. of abstraction (like LVM2 or MDRAID) it will be created under a separate device
  5378. namespace in addition to the cryptodisk namespace.
  5379. Support for plain encryption mode (plain dm-crypt) is provided via separate
  5380. @command{@pxref{plainmount}} command.
  5381. @end deffn
  5382. @node cutmem
  5383. @subsection cutmem
  5384. @deffn Command cutmem from[K|M|G] to[K|M|G]
  5385. Remove any memory regions in specified range.
  5386. This command notifies the memory manager that specified regions of RAM ought to
  5387. be filtered out. This remains in effect after a payload kernel has been loaded
  5388. by GRUB, as long as the loaded kernel obtains its memory map from GRUB. Kernels
  5389. that support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
  5390. kernels in general.
  5391. The command is similar to @command{badram} command.
  5392. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5393. This prevents removing EFI memory regions to potentially subvert the
  5394. security mechanisms provided by the UEFI secure boot.
  5395. @end deffn
  5396. @node date
  5397. @subsection date
  5398. @deffn Command date [[year-]month-day] [hour:minute[:second]]
  5399. With no arguments, print the current date and time.
  5400. Otherwise, take the current date and time, change any elements specified as
  5401. arguments, and set the result as the new date and time. For example, `date
  5402. 01-01' will set the current month and day to January 1, but leave the year,
  5403. hour, minute, and second unchanged.
  5404. @end deffn
  5405. @node devicetree
  5406. @subsection devicetree
  5407. @deffn Command devicetree file
  5408. Load a device tree blob (.dtb) from a filesystem, for later use by a Linux
  5409. kernel. Does not perform merging with any device tree supplied by firmware,
  5410. but rather replaces it completely.
  5411. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5412. This is done to prevent subverting various security mechanisms.
  5413. @end deffn
  5414. @node distrust
  5415. @subsection distrust
  5416. @deffn Command distrust pubkey_id
  5417. Remove public key @var{pubkey_id} from GRUB's keyring of trusted keys.
  5418. @var{pubkey_id} is the last four bytes (eight hexadecimal digits) of
  5419. the GPG v4 key id, which is also the output of @command{list_trusted}
  5420. (@pxref{list_trusted}). Outside of GRUB, the key id can be obtained
  5421. using @code{gpg --fingerprint}).
  5422. These keys are used to validate signatures when environment variable
  5423. @code{check_signatures} is set to @code{enforce}
  5424. (@pxref{check_signatures}), and by some invocations of
  5425. @command{verify_detached} (@pxref{verify_detached}). @xref{Using
  5426. digital signatures}, for more information.
  5427. @end deffn
  5428. @node drivemap
  5429. @subsection drivemap
  5430. @deffn Command drivemap @option{-l}|@option{-r}|[@option{-s}] @
  5431. from_drive to_drive
  5432. Without options, map the drive @var{from_drive} to the drive @var{to_drive}.
  5433. This is necessary when you chain-load some operating systems, such as DOS,
  5434. if such an OS resides at a non-first drive. For convenience, any partition
  5435. suffix on the drive is ignored, so you can safely use @verb{'${root}'} as a
  5436. drive specification.
  5437. With the @option{-s} option, perform the reverse mapping as well, swapping
  5438. the two drives.
  5439. With the @option{-l} option, list the current mappings.
  5440. With the @option{-r} option, reset all mappings to the default values.
  5441. For example:
  5442. @example
  5443. drivemap -s (hd0) (hd1)
  5444. @end example
  5445. NOTE: Only available on i386-pc.
  5446. @end deffn
  5447. @node echo
  5448. @subsection echo
  5449. @deffn Command echo [@option{-n}] [@option{-e}] string @dots{}
  5450. Display the requested text and, unless the @option{-n} option is used, a
  5451. trailing new line. If there is more than one string, they are separated by
  5452. spaces in the output. As usual in GRUB commands, variables may be
  5453. substituted using @samp{$@{var@}}.
  5454. The @option{-e} option enables interpretation of backslash escapes. The
  5455. following sequences are recognised:
  5456. @table @code
  5457. @item \\
  5458. backslash
  5459. @item \a
  5460. alert (BEL)
  5461. @item \c
  5462. suppress trailing new line
  5463. @item \f
  5464. form feed
  5465. @item \n
  5466. new line
  5467. @item \r
  5468. carriage return
  5469. @item \t
  5470. horizontal tab
  5471. @item \v
  5472. vertical tab
  5473. @end table
  5474. When interpreting backslash escapes, backslash followed by any other
  5475. character will print that character.
  5476. @end deffn
  5477. @node efitextmode
  5478. @subsection efitextmode
  5479. @deffn Command efitextmode [min | max | <mode_num> | <cols> <rows>]
  5480. When used with no arguments displays all available text output modes. The
  5481. set mode determines the columns and rows of the text display when in
  5482. text mode. An asterisk, @samp{*}, will be at the end of the line of the
  5483. currently set mode.
  5484. If given a single parameter, it must be @samp{min}, @samp{max}, or a mode
  5485. number given by the listing when run with no arguments. These arguments set
  5486. the mode to the minimum, maximum, and particular mode respectively.
  5487. Otherwise, the command must be given two numerical arguments specifying the
  5488. columns and rows of the desired mode. Specifying a columns and rows
  5489. combination that corresponds to no supported mode, will return error, but
  5490. otherwise have no effect.
  5491. By default GRUB will start in whatever mode the EFI firmware defaults to.
  5492. There are firmwares known to set up the default mode such that output
  5493. behaves strangely, for example the cursor in the GRUB shell never reaches
  5494. the bottom of the screen or, when typing characters at the prompt,
  5495. characters from previous command output are overwritten. Setting the mode
  5496. may fix this.
  5497. The EFI specification says that mode 0 must be available and have
  5498. columns and rows of 80 and 25 respectively. Mode 1 may be defined and if
  5499. so must have columns and rows of 80 and 50 respectively. Any other modes
  5500. may have columns and rows arbitrarily defined by the firmware. This means
  5501. that a mode with columns and rows of 100 and 31 on one firmware may be
  5502. a different mode number on a different firmware or not exist at all.
  5503. Likewise, mode number 2 on one firmware may have a different number of
  5504. columns and rows than mode 2 on a different firmware. So one should not
  5505. rely on a particular mode number or a mode of a certain number of columns
  5506. and rows existing on all firmwares, except for mode 0.
  5507. Note: This command is only available on EFI platforms and is similar to
  5508. EFI shell "mode" command.
  5509. @end deffn
  5510. @node eval
  5511. @subsection eval
  5512. @deffn Command eval string ...
  5513. Concatenate arguments together using single space as separator and evaluate
  5514. result as sequence of GRUB commands.
  5515. @end deffn
  5516. @node export
  5517. @subsection export
  5518. @deffn Command export envvar
  5519. Export the environment variable @var{envvar}. Exported variables are visible
  5520. to subsidiary configuration files loaded using @command{configfile}.
  5521. @end deffn
  5522. @node false
  5523. @subsection false
  5524. @deffn Command false
  5525. Do nothing, unsuccessfully. This is mainly useful in control constructs
  5526. such as @code{if} and @code{while} (@pxref{Shell-like scripting}).
  5527. @end deffn
  5528. @node fdtdump
  5529. @subsection fdtdump
  5530. @deffn Command fdtdump @
  5531. [@option{--prop} @var{prop}] @
  5532. [@option{--set} @var{variable}]
  5533. Retrieve device tree information.
  5534. The @command{fdtdump} command returns the value of a property in the device
  5535. tree provided by the firmware. The @option{--prop} option determines which
  5536. property to select.
  5537. The default action is to print the value of the requested field to the console,
  5538. but a variable name can be specified with @option{--set} to store the value
  5539. instead of printing it.
  5540. For example, this will store and then display the model string.
  5541. @example
  5542. fdtdump --prop model --set machine_model
  5543. echo $machine_model
  5544. @end example
  5545. @end deffn
  5546. @node file
  5547. @subsection file
  5548. @deffn Command file is_file_type filename
  5549. The @command{file} command tests whether the provided @var{filename} is the
  5550. type provided by @var{is_file_type}. When the @command{file} is of type
  5551. @var{is_file_type} this command will return 0, otherwise it will return
  5552. non-zero (no output is provided to the terminal).
  5553. @var{is_file_type} may be one of the following options:
  5554. @itemize @bullet
  5555. @item
  5556. @option{--is-i386-xen-pae-domu} Check if @var{filename} can be booted as i386
  5557. PAE Xen unprivileged guest kernel
  5558. @item
  5559. @option{--is-x86_64-xen-domu} Check if @var{filename} can be booted as x86_64
  5560. Xen unprivileged guest kernel
  5561. @item
  5562. @option{--is-x86-xen-dom0} Check if @var{filename} can be used as Xen x86
  5563. privileged guest kernel
  5564. @item
  5565. @option{--is-x86-multiboot} Check if @var{filename} can be used as x86
  5566. multiboot kernel
  5567. @item
  5568. @option{--is-x86-multiboot2} Check if @var{filename} can be used as x86
  5569. multiboot2 kernel
  5570. @item
  5571. @option{--is-arm-linux} Check if @var{filename} is ARM Linux
  5572. @item
  5573. @option{--is-arm64-linux} Check if @var{filename} is ARM64 Linux
  5574. @item
  5575. @option{--is-ia64-linux} Check if @var{filename} is IA64 Linux
  5576. @item
  5577. @option{--is-mips-linux} Check if @var{filename} is MIPS Linux
  5578. @item
  5579. @option{--is-mipsel-linux} Check if @var{filename} is MIPSEL Linux
  5580. @item
  5581. @option{--is-sparc64-linux} Check if @var{filename} is SPARC64 Linux
  5582. @item
  5583. @option{--is-powerpc-linux} Check if @var{filename} is POWERPC Linux
  5584. @item
  5585. @option{--is-x86-linux} Check if @var{filename} is x86 Linux
  5586. @item
  5587. @option{--is-x86-linux32} Check if @var{filename} is x86 Linux supporting
  5588. 32-bit protocol
  5589. @item
  5590. @option{--is-x86-kfreebsd} Check if @var{filename} is x86 kFreeBSD
  5591. @item
  5592. @option{--is-i386-kfreebsd} Check if @var{filename} is i386 kFreeBSD
  5593. @item
  5594. @option{--is-x86_64-kfreebsd} Check if @var{filename} is x86_64 kFreeBSD
  5595. @item
  5596. @option{--is-x86-knetbsd} Check if @var{filename} is x86 kNetBSD
  5597. @item
  5598. @option{--is-i386-knetbsd} Check if @var{filename} is i386 kNetBSD
  5599. @item
  5600. @option{--is-x86_64-knetbsd} Check if @var{filename} is x86_64 kNetBSD
  5601. @item
  5602. @option{--is-i386-efi} Check if @var{filename} is i386 EFI file
  5603. @item
  5604. @option{--is-x86_64-efi} Check if @var{filename} is x86_64 EFI file
  5605. @item
  5606. @option{--is-ia64-efi} Check if @var{filename} is IA64 EFI file
  5607. @item
  5608. @option{--is-arm64-efi} Check if @var{filename} is ARM64 EFI file
  5609. @item
  5610. @option{--is-arm-efi} Check if @var{filename} is ARM EFI file
  5611. @item
  5612. @option{--is-riscv32-efi} Check if @var{filename} is RISC-V 32bit EFI file
  5613. @item
  5614. @option{--is-riscv64-efi} Check if @var{filename} is RISC-V 64bit EFI file
  5615. @item
  5616. @option{--is-hibernated-hiberfil} Check if @var{filename} is hiberfil.sys in
  5617. hibernated state
  5618. @item
  5619. @option{--is-x86_64-xnu} Check if @var{filename} is x86_64 XNU (Mac OS X kernel)
  5620. @item
  5621. @option{--is-i386-xnu} Check if @var{filename} is i386 XNU (Mac OS X kernel)
  5622. @item
  5623. @option{--is-xnu-hibr} Check if @var{filename} is XNU (Mac OS X kernel)
  5624. hibernated image
  5625. @item
  5626. @option{--is-x86-bios-bootsector} Check if @var{filename} is BIOS bootsector
  5627. @end itemize
  5628. @end deffn
  5629. @node fwsetup
  5630. @subsection fwsetup
  5631. @deffn Command fwsetup [@option{--is-supported}]
  5632. Reboot into the firmware setup menu. If @option{--is-supported} option is
  5633. specified, instead check whether the firmware supports a setup menu and
  5634. exit successfully if so.
  5635. @end deffn
  5636. @node gdbinfo
  5637. @subsection gdbinfo
  5638. @deffn Command gdbinfo
  5639. Output text to be used as a GDB command for a GDB session using the gdb_grub
  5640. script and attached to a running GRUB instance. The GDB command that is
  5641. output will tell GDB how to load debugging symbols to their proper runtime
  5642. address. Currently this is only available for EFI platforms. See the Debugging
  5643. in the developer documentation for more information.
  5644. @end deffn
  5645. @node gettext
  5646. @subsection gettext
  5647. @deffn Command gettext string
  5648. Translate @var{string} into the current language.
  5649. The current language code is stored in the @samp{lang} variable in GRUB's
  5650. environment (@pxref{lang}). Translation files in MO format are read from
  5651. @samp{locale_dir} (@pxref{locale_dir}), usually @file{/boot/grub/locale}.
  5652. @end deffn
  5653. @node gptsync
  5654. @subsection gptsync
  5655. @deffn Command gptsync device [partition[+/-[type]]] @dots{}
  5656. Disks using the GUID Partition Table (GPT) also have a legacy Master Boot
  5657. Record (MBR) partition table for compatibility with the BIOS and with older
  5658. operating systems. The legacy MBR can only represent a limited subset of
  5659. GPT partition entries.
  5660. This command populates the legacy MBR with the specified @var{partition}
  5661. entries on @var{device}. Up to three partitions may be used.
  5662. @var{type} is an MBR partition type code; prefix with @samp{0x} if you want
  5663. to enter this in hexadecimal. The separator between @var{partition} and
  5664. @var{type} may be @samp{+} to make the partition active, or @samp{-} to make
  5665. it inactive; only one partition may be active. If both the separator and
  5666. type are omitted, then the partition will be inactive.
  5667. @end deffn
  5668. @node halt
  5669. @subsection halt
  5670. @deffn Command halt [@option{--no-apm}]
  5671. The command halts the computer. On the i386-pc target, the @option{--no-apm}
  5672. option, or short @option{-n}, is specified, no APM BIOS call is performed.
  5673. Otherwise, the computer is shut down using APM on that target.
  5674. @end deffn
  5675. @node hashsum
  5676. @subsection hashsum
  5677. @deffn Command hashsum @option{--hash} hash @option{--keep-going} @option{--uncompress} @option{--check} file [@option{--prefix} dir]|file @dots{}
  5678. Compute or verify file hashes. Hash type is selected with option @option{--hash}.
  5679. Supported hashes are: @samp{adler32}, @samp{crc64}, @samp{crc32},
  5680. @samp{crc32rfc1510}, @samp{crc24rfc2440}, @samp{md4}, @samp{md5},
  5681. @samp{ripemd160}, @samp{sha1}, @samp{sha224}, @samp{sha256}, @samp{sha512},
  5682. @samp{sha384}, @samp{tiger192}, @samp{tiger}, @samp{tiger2}, @samp{whirlpool}.
  5683. Option @option{--uncompress} uncompresses files before computing hash.
  5684. When list of files is given, hash of each file is computed and printed,
  5685. followed by file name, each file on a new line.
  5686. When option @option{--check} is given, it points to a file that contains
  5687. list of @var{hash name} pairs in the same format as used by UNIX
  5688. @command{md5sum} command. Option @option{--prefix}
  5689. may be used to give directory where files are located. Hash verification
  5690. stops after the first mismatch was found unless option @option{--keep-going}
  5691. was given. The exit code @code{$?} is set to 0 if hash verification
  5692. is successful. If it fails, @code{$?} is set to a nonzero value.
  5693. @end deffn
  5694. @node help
  5695. @subsection help
  5696. @deffn Command help [pattern @dots{}]
  5697. Display helpful information about builtin commands. If you do not
  5698. specify @var{pattern}, this command shows short descriptions of all
  5699. available commands.
  5700. If you specify any @var{patterns}, it displays longer information
  5701. about each of the commands whose names begin with those @var{patterns}.
  5702. @end deffn
  5703. @node hexdump
  5704. @subsection hexdump
  5705. @deffn Command hexdump [--skip offset] [--length len] FILE_OR_DEVICE
  5706. Show raw contents of a file or memory. When option @option{--skip} is given,
  5707. @samp{offset} number of bytes are skipped from the start of the device or
  5708. file given. And @option{--length} allows specifying a maximum number of bytes
  5709. to be shown.
  5710. If given the special device named @samp{(mem)}, then the @samp{offset} given to
  5711. @option{--skip} is treated as the address of a memory location to dump from.
  5712. @end deffn
  5713. @node insmod
  5714. @subsection insmod
  5715. @deffn Command insmod module
  5716. Insert the dynamic GRUB module called @var{module}.
  5717. @end deffn
  5718. @node keystatus
  5719. @subsection keystatus
  5720. @deffn Command keystatus [@option{--shift}] [@option{--ctrl}] [@option{--alt}]
  5721. Return true if the Shift, Control, or Alt modifier keys are held down, as
  5722. requested by options. This is useful in scripting, to allow some user
  5723. control over behaviour without having to wait for a keypress.
  5724. Checking key modifier status is only supported on some platforms. If invoked
  5725. without any options, the @command{keystatus} command returns true if and
  5726. only if checking key modifier status is supported.
  5727. @end deffn
  5728. @node list_env
  5729. @subsection list_env
  5730. @deffn Command list_env [@option{--file} file]
  5731. List all variables in the environment block file. @xref{Environment block}.
  5732. The @option{--file} option overrides the default location of the
  5733. environment block.
  5734. @end deffn
  5735. @node list_trusted
  5736. @subsection list_trusted
  5737. @deffn Command list_trusted
  5738. List all public keys trusted by GRUB for validating signatures.
  5739. The output is in GPG's v4 key fingerprint format (i.e., the output of
  5740. @code{gpg --fingerprint}). The least significant four bytes (last
  5741. eight hexadecimal digits) can be used as an argument to
  5742. @command{distrust} (@pxref{distrust}).
  5743. @xref{Using digital signatures}, for more information about uses for
  5744. these keys.
  5745. @end deffn
  5746. @node load_env
  5747. @subsection load_env
  5748. @deffn Command load_env [@option{--file} file] [@option{--skip-sig}] [whitelisted_variable_name] @dots{}
  5749. Load all variables from the environment block file into the environment.
  5750. @xref{Environment block}.
  5751. The @option{--file} option overrides the default location of the environment
  5752. block.
  5753. The @option{--skip-sig} option skips signature checking even when the
  5754. value of environment variable @code{check_signatures} is set to
  5755. @code{enforce} (@pxref{check_signatures}).
  5756. If one or more variable names are provided as arguments, they are
  5757. interpreted as a whitelist of variables to load from the environment
  5758. block file. Variables set in the file but not present in the
  5759. whitelist are ignored.
  5760. The @option{--skip-sig} option should be used with care, and should
  5761. always be used in concert with a whitelist of acceptable variables
  5762. whose values should be set. Failure to employ a carefully constructed
  5763. whitelist could result in reading a malicious value into critical
  5764. environment variables from the file, such as setting
  5765. @code{check_signatures=no}, modifying @code{prefix} to boot from an
  5766. unexpected location or not at all, etc.
  5767. When used with care, @option{--skip-sig} and the whitelist enable an
  5768. administrator to configure a system to boot only signed
  5769. configurations, but to allow the user to select from among multiple
  5770. configurations, and to enable ``one-shot'' boot attempts and
  5771. ``savedefault'' behavior. @xref{Using digital signatures}, for more
  5772. information.
  5773. @end deffn
  5774. @node loadfont
  5775. @subsection loadfont
  5776. @deffn Command loadfont file @dots{}
  5777. Load specified font files. Unless absolute pathname is given, @var{file}
  5778. is assumed to be in directory @samp{$prefix/fonts} with
  5779. suffix @samp{.pf2} appended. @xref{Theme file format,,Fonts}.
  5780. @end deffn
  5781. @node loopback
  5782. @subsection loopback
  5783. @deffn Command loopback [@option{-d}] [@option{-D}] device file
  5784. Make the device named @var{device} correspond to the contents of the
  5785. filesystem image in @var{file}. For example:
  5786. @example
  5787. loopback loop0 /path/to/image
  5788. ls (loop0)/
  5789. @end example
  5790. Specifying the @option{-D} option allows the loopback file to be tranparently
  5791. decompressed if there is an appropriate decompressor loaded.
  5792. With the @option{-d} option, delete a device previously created using this
  5793. command.
  5794. @end deffn
  5795. @node ls
  5796. @subsection ls
  5797. @deffn Command ls [arg @dots{}]
  5798. List devices or files.
  5799. With no arguments, print all devices known to GRUB.
  5800. If the argument is a device name enclosed in parentheses (@pxref{Device
  5801. syntax}), then print the name of the filesystem of that device.
  5802. If the argument is a directory given as an absolute file name (@pxref{File
  5803. name syntax}), then list the contents of that directory.
  5804. @end deffn
  5805. @node lsfonts
  5806. @subsection lsfonts
  5807. @deffn Command lsfonts
  5808. List loaded fonts.
  5809. @end deffn
  5810. @node lsmod
  5811. @subsection lsmod
  5812. @deffn Command lsmod
  5813. Show list of loaded modules.
  5814. @end deffn
  5815. @node md5sum
  5816. @subsection md5sum
  5817. @deffn Command md5sum arg @dots{}
  5818. Alias for @code{hashsum --hash md5 arg @dots{}}. See command @command{hashsum}
  5819. (@pxref{hashsum}) for full description.
  5820. @end deffn
  5821. @node module
  5822. @subsection module
  5823. @deffn Command module [--nounzip] file [arguments]
  5824. Load a module for multiboot kernel image. The rest of the
  5825. line is passed verbatim as the module command line.
  5826. @end deffn
  5827. @node multiboot
  5828. @subsection multiboot
  5829. @deffn Command multiboot [--quirk-bad-kludge] [--quirk-modules-after-kernel] file @dots{}
  5830. Load a multiboot kernel image from @var{file}. The rest of the
  5831. line is passed verbatim as the @dfn{kernel command-line}. Any module must
  5832. be reloaded after using this command (@pxref{module}).
  5833. Some kernels have known problems. You need to specify --quirk-* for those.
  5834. --quirk-bad-kludge is a problem seen in several products that they include
  5835. loading kludge information with invalid data in ELF file. GRUB prior to 0.97
  5836. and some custom builds preferred ELF information while 0.97 and GRUB 2
  5837. use kludge. Use this option to ignore kludge.
  5838. Known affected systems: old Solaris, SkyOS.
  5839. --quirk-modules-after-kernel is needed for kernels which load at relatively
  5840. high address e.g. 16MiB mark and can't cope with modules stuffed between
  5841. 1MiB mark and beginning of the kernel.
  5842. Known afftected systems: VMWare.
  5843. @end deffn
  5844. @node nativedisk
  5845. @subsection nativedisk
  5846. @deffn Command nativedisk
  5847. Switch from firmware disk drivers to native ones.
  5848. Really useful only on platforms where both
  5849. firmware and native disk drives are available.
  5850. Currently i386-pc, i386-efi, i386-ieee1275 and
  5851. x86_64-efi.
  5852. @end deffn
  5853. @node normal
  5854. @subsection normal
  5855. @deffn Command normal [file]
  5856. Enter normal mode and display the GRUB menu.
  5857. In normal mode, commands, filesystem modules, and cryptography modules are
  5858. automatically loaded, and the full GRUB script parser is available. Other
  5859. modules may be explicitly loaded using @command{insmod} (@pxref{insmod}).
  5860. If a @var{file} is given, then commands will be read from that file.
  5861. Otherwise, they will be read from @file{$prefix/grub.cfg} if it exists.
  5862. @command{normal} may be called from within normal mode, creating a nested
  5863. environment. It is more usual to use @command{configfile}
  5864. (@pxref{configfile}) for this.
  5865. @end deffn
  5866. @node normal_exit
  5867. @subsection normal_exit
  5868. @deffn Command normal_exit
  5869. Exit normal mode (@pxref{normal}). If this instance of normal mode was not
  5870. nested within another one, then return to rescue mode.
  5871. @end deffn
  5872. @node parttool
  5873. @subsection parttool
  5874. @deffn Command parttool partition commands
  5875. Make various modifications to partition table entries.
  5876. Each @var{command} is either a boolean option, in which case it must be
  5877. followed with @samp{+} or @samp{-} (with no intervening space) to enable or
  5878. disable that option, or else it takes a value in the form
  5879. @samp{@var{command}=@var{value}}.
  5880. Currently, @command{parttool} is only useful on DOS partition tables (also
  5881. known as Master Boot Record, or MBR). On these partition tables, the
  5882. following commands are available:
  5883. @table @asis
  5884. @item @samp{boot} (boolean)
  5885. When enabled, this makes the selected partition be the active (bootable)
  5886. partition on its disk, clearing the active flag on all other partitions.
  5887. This command is limited to @emph{primary} partitions.
  5888. @item @samp{type} (value)
  5889. Change the type of an existing partition. The value must be a number in the
  5890. range 0-0xFF (prefix with @samp{0x} to enter it in hexadecimal).
  5891. @item @samp{hidden} (boolean)
  5892. When enabled, this hides the selected partition by setting the @dfn{hidden}
  5893. bit in its partition type code; when disabled, unhides the selected
  5894. partition by clearing this bit. This is useful only when booting DOS or
  5895. Windows and multiple primary FAT partitions exist in one disk. See also
  5896. @ref{DOS/Windows}.
  5897. @end table
  5898. @end deffn
  5899. @node password
  5900. @subsection password
  5901. @deffn Command password user clear-password
  5902. Define a user named @var{user} with password @var{clear-password}.
  5903. @xref{Security}.
  5904. @end deffn
  5905. @node password_pbkdf2
  5906. @subsection password_pbkdf2
  5907. @deffn Command password_pbkdf2 user hashed-password
  5908. Define a user named @var{user} with password hash @var{hashed-password}.
  5909. Use @command{grub-mkpasswd-pbkdf2} (@pxref{Invoking grub-mkpasswd-pbkdf2})
  5910. to generate password hashes. @xref{Security}.
  5911. @end deffn
  5912. @node plainmount
  5913. @subsection plainmount
  5914. @deffn Command plainmount device @option{-c} cipher @option{-s} key size [@option{-h} hash]
  5915. [@option{-S} sector size] [@option{-p} password] [@option{-u} uuid]
  5916. [[@option{-d} keyfile] [@option{-O} keyfile offset]]
  5917. Setup access to the encrypted device in plain mode. Offset of the encrypted
  5918. data at the device is specified in terms of 512 byte sectors using the blocklist
  5919. syntax and loopback device. The following example shows how to specify 1MiB
  5920. offset:
  5921. @example
  5922. loopback node (hd0,gpt1)2048+
  5923. plainmount node @var{...}
  5924. @end example
  5925. The @command{plainmount} command can be used to open LUKS encrypted volume
  5926. if its master key and parameters (key size, cipher, offset, etc) are known.
  5927. There are two ways to specify a password: a keyfile and a secret passphrase.
  5928. The keyfile path parameter has higher priority than the secret passphrase
  5929. parameter and is specified with the option @option{-d}. Password data obtained
  5930. from keyfiles is not hashed and is used directly as a cipher key. An optional
  5931. offset of password data in the keyfile can be specified with the option
  5932. @option{-O} or directly with the option @option{-d} and GRUB blocklist syntax,
  5933. if the keyfile data can be accessed from a device and is 512 byte aligned.
  5934. The following example shows both methods to specify password data in the
  5935. keyfile at offset 1MiB:
  5936. @example
  5937. plainmount -d (hd0,gpt1)2048+ @var{...}
  5938. plainmount -d (hd0,gpt1)+ -O 1048576 @var{...}
  5939. @end example
  5940. If no keyfile is specified then the password is set to the string specified
  5941. by option @option{-p} or is requested interactively from the console. In both
  5942. cases the provided password is hashed with the algorithm specified by the
  5943. option @option{-h}. This option is mandatory if no keyfile is specified, but
  5944. it can be set to @samp{plain} which means that no hashing is done and such
  5945. password is used directly as a key.
  5946. Cipher @option{-c} and keysize @option{-s} options specify the cipher algorithm
  5947. and the key size respectively and are mandatory options. Cipher must be specified
  5948. with the mode separated by a dash (for example, @samp{aes-xts-plain64}). Key size
  5949. option @option{-s} is the key size of the cipher in bits, not to be confused with
  5950. the offset of the key data in a keyfile specified with the @option{-O} option. It
  5951. must not exceed 1024 bits, so a 32 byte key would be specified as 256 bits
  5952. The optional parameter @option{-S} specifies encrypted device sector size. It
  5953. must be at least 512 bytes long (default value) and a power of 2. @footnote{Current
  5954. implementation of cryptsetup supports only 512/1024/2048/4096 byte sectors}.
  5955. Disk sector size is configured when creating the encrypted volume. Attempting
  5956. to decrypt volumes with a different sector size than it was created with will
  5957. not result in an error, but will decrypt to random bytes and thus prevent
  5958. accessing the volume (in some cases the filesystem driver can detect the presence
  5959. of a filesystem, but nevertheless will refuse to mount it).
  5960. By default new plainmount devices will be given a UUID starting with
  5961. '109fea84-a6b7-34a8-4bd1-1c506305a401' where the last digits are incremented
  5962. by one for each plainmounted device beyond the first up to 2^10 devices.
  5963. All encryption arguments (cipher, hash, key size, disk offset and disk sector
  5964. size) must match the parameters used to create the volume. If any of them does
  5965. not match the actual arguments used during the initial encryption, plainmount
  5966. will create virtual device with the garbage data and GRUB will report unknown
  5967. filesystem for such device.
  5968. @end deffn
  5969. @node play
  5970. @subsection play
  5971. @deffn Command play file | tempo [pitch1 duration1] [pitch2 duration2] @dots{}
  5972. Plays a tune
  5973. If the argument is a file name (@pxref{File name syntax}), play the tune
  5974. recorded in it. The file format is first the tempo as an unsigned 32bit
  5975. little-endian number, then pairs of unsigned 16bit little-endian numbers for
  5976. pitch and duration pairs.
  5977. If the arguments are a series of numbers, play the inline tune.
  5978. The tempo is the base for all note durations. 60 gives a 1-second base, 120
  5979. gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
  5980. a rest.
  5981. @end deffn
  5982. @node probe
  5983. @subsection probe
  5984. @deffn Command probe [@option{--set} var] @option{--driver}|@option{--partmap}|@option{--fs}|@option{--fs-uuid}|@option{--label}|@option{--part-uuid} device
  5985. Retrieve device information. If option @option{--set} is given, assign result
  5986. to variable @var{var}, otherwise print information on the screen.
  5987. The option @option{--part-uuid} is currently only implemented for MSDOS and GPT formatted disks.
  5988. @end deffn
  5989. @node rdmsr
  5990. @subsection rdmsr
  5991. @deffn Command: rdmsr 0xADDR [-v VARNAME]
  5992. Read a model-specific register at address 0xADDR. If the parameter
  5993. @option{-v} is used and an environment variable @var{VARNAME} is
  5994. given, set that environment variable to the value that was read.
  5995. Please note that on SMP systems, reading from a MSR that has a
  5996. scope per hardware thread, implies that the value that is returned
  5997. only applies to the particular cpu/core/thread that runs the command.
  5998. Also, if you specify a reserved or unimplemented MSR address, it will
  5999. cause a general protection exception (which is not currently being handled)
  6000. and the system will reboot.
  6001. @end deffn
  6002. @node read
  6003. @subsection read
  6004. @deffn Command read [-s] [var]
  6005. Read a line of input from the user. If an environment variable @var{var} is
  6006. given, set that environment variable to the line of input that was read,
  6007. with no terminating newline. If the parameter @option{-s} is used, enable
  6008. silent mode where input is not printed to the terminal.
  6009. @end deffn
  6010. @node reboot
  6011. @subsection reboot
  6012. @deffn Command reboot
  6013. Reboot the computer.
  6014. @end deffn
  6015. @node regexp
  6016. @subsection regexp
  6017. @deffn Command regexp [@option{--set} [number:]var] regexp string
  6018. Test if regular expression @var{regexp} matches @var{string}. Supported
  6019. regular expressions are POSIX.2 Extended Regular Expressions. If option
  6020. @option{--set} is given, store @var{number}th matched subexpression in
  6021. variable @var{var}. Subexpressions are numbered in order of their opening
  6022. parentheses starting from @samp{1}. @var{number} defaults to @samp{1}.
  6023. @end deffn
  6024. @node rmmod
  6025. @subsection rmmod
  6026. @deffn Command rmmod module
  6027. Remove a loaded @var{module}.
  6028. @end deffn
  6029. @node save_env
  6030. @subsection save_env
  6031. @deffn Command save_env [@option{--file} file] var @dots{}
  6032. Save the named variables from the environment to the environment block file.
  6033. @xref{Environment block}.
  6034. The @option{--file} option overrides the default location of the environment
  6035. block.
  6036. This command will operate successfully even when environment variable
  6037. @code{check_signatures} is set to @code{enforce}
  6038. (@pxref{check_signatures}), since it writes to disk and does not alter
  6039. the behavior of GRUB based on any contents of disk that have been
  6040. read. It is possible to modify a digitally signed environment block
  6041. file from within GRUB using this command, such that its signature will
  6042. no longer be valid on subsequent boots. Care should be taken in such
  6043. advanced configurations to avoid rendering the system
  6044. unbootable. @xref{Using digital signatures}, for more information.
  6045. @end deffn
  6046. @node search
  6047. @subsection search
  6048. @deffn Command search @
  6049. [@option{--file}|@option{--label}|@option{--fs-uuid}] @
  6050. [@option{--set} [var]] [@option{--no-floppy}|@option{--efidisk-only}] name
  6051. Search devices by file (@option{-f}, @option{--file}), filesystem label
  6052. (@option{-l}, @option{--label}), or filesystem UUID (@option{-u},
  6053. @option{--fs-uuid}).
  6054. If the (@option{-s}, @option{--set}) option is used, the first device found is
  6055. set as the value of environment variable @var{var}. The default variable is
  6056. @samp{root}.
  6057. The (@option{-n}, @option{--no-floppy}) option prevents searching floppy
  6058. devices, which can be slow.
  6059. The (@option{--efidisk-only}) option prevents searching any other devices then
  6060. EFI disks. This is typically used when chainloading to local EFI partition.
  6061. The @samp{search.file}, @samp{search.fs_label}, and @samp{search.fs_uuid}
  6062. commands are aliases for @samp{search --file}, @samp{search --label}, and
  6063. @samp{search --fs-uuid} respectively.
  6064. Also hints as to which device may be the most likely to contain the item
  6065. searched for may be given via the (@option{-h}, @option{--hint}) option with
  6066. a device name as an argument. If the argument ends with a comma, then partitions
  6067. on the device are also searched. Furthermore, platform specific hints may be
  6068. given via the options @option{--hint-ieee1275}, @option{--hint-bios},
  6069. @option{--hint-baremetal}, @option{--hint-efi}, and @option{--hint-arc}. When
  6070. specified, these options take an argument and operate like @option{--hint}, but
  6071. only on the specified platform.
  6072. @end deffn
  6073. @node sendkey
  6074. @subsection sendkey
  6075. @deffn Command sendkey @
  6076. [@option{--num}|@option{--caps}|@option{--scroll}|@option{--insert}|@
  6077. @option{--pause}|@option{--left-shift}|@option{--right-shift}|@
  6078. @option{--sysrq}|@option{--numkey}|@option{--capskey}|@option{--scrollkey}|@
  6079. @option{--insertkey}|@option{--left-alt}|@option{--right-alt}|@
  6080. @option{--left-ctrl}|@option{--right-ctrl} @
  6081. @samp{on}|@samp{off}]@dots{} @
  6082. [@option{no-led}] @
  6083. keystroke
  6084. Insert keystrokes into the keyboard buffer when booting. Sometimes an
  6085. operating system or chainloaded boot loader requires particular keys to be
  6086. pressed: for example, one might need to press a particular key to enter
  6087. "safe mode", or when chainloading another boot loader one might send
  6088. keystrokes to it to navigate its menu.
  6089. Note: This command is currently only available on the i386-pc target.
  6090. You may provide up to 16 keystrokes (the length of the BIOS keyboard
  6091. buffer). Keystroke names may be upper-case or lower-case letters, digits,
  6092. or taken from the following table:
  6093. @c Please keep this table in the same order as in
  6094. @c commands/i386/pc/sendkey.c, for ease of maintenance.
  6095. @c Exception: The function and numeric keys are sorted, for aesthetics.
  6096. @multitable @columnfractions .4 .5
  6097. @headitem Name @tab Key
  6098. @item escape @tab Escape
  6099. @item exclam @tab !
  6100. @item at @tab @@
  6101. @item numbersign @tab #
  6102. @item dollar @tab $
  6103. @item percent @tab %
  6104. @item caret @tab ^
  6105. @item ampersand @tab &
  6106. @item asterisk @tab *
  6107. @item parenleft @tab (
  6108. @item parenright @tab )
  6109. @item minus @tab -
  6110. @item underscore @tab _
  6111. @item equal @tab =
  6112. @item plus @tab +
  6113. @item backspace @tab Backspace
  6114. @item tab @tab Tab
  6115. @item bracketleft @tab [
  6116. @item braceleft @tab @{
  6117. @item bracketright @tab ]
  6118. @item braceright @tab @}
  6119. @item enter @tab Enter
  6120. @item control @tab press and release Control
  6121. @item semicolon @tab ;
  6122. @item colon @tab :
  6123. @item quote @tab '
  6124. @item doublequote @tab "
  6125. @item backquote @tab `
  6126. @item tilde @tab ~
  6127. @item shift @tab press and release left Shift
  6128. @item backslash @tab \
  6129. @item bar @tab |
  6130. @item comma @tab ,
  6131. @item less @tab <
  6132. @item period @tab .
  6133. @item greater @tab >
  6134. @item slash @tab /
  6135. @item question @tab ?
  6136. @item rshift @tab press and release right Shift
  6137. @item alt @tab press and release Alt
  6138. @item space @tab space bar
  6139. @item capslock @tab Caps Lock
  6140. @item F1 @tab F1
  6141. @item F2 @tab F2
  6142. @item F3 @tab F3
  6143. @item F4 @tab F4
  6144. @item F5 @tab F5
  6145. @item F6 @tab F6
  6146. @item F7 @tab F7
  6147. @item F8 @tab F8
  6148. @item F9 @tab F9
  6149. @item F10 @tab F10
  6150. @item F11 @tab F11
  6151. @item F12 @tab F12
  6152. @item num1 @tab 1 (numeric keypad)
  6153. @item num2 @tab 2 (numeric keypad)
  6154. @item num3 @tab 3 (numeric keypad)
  6155. @item num4 @tab 4 (numeric keypad)
  6156. @item num5 @tab 5 (numeric keypad)
  6157. @item num6 @tab 6 (numeric keypad)
  6158. @item num7 @tab 7 (numeric keypad)
  6159. @item num8 @tab 8 (numeric keypad)
  6160. @item num9 @tab 9 (numeric keypad)
  6161. @item num0 @tab 0 (numeric keypad)
  6162. @item numperiod @tab . (numeric keypad)
  6163. @item numend @tab End (numeric keypad)
  6164. @item numdown @tab Down (numeric keypad)
  6165. @item numpgdown @tab Page Down (numeric keypad)
  6166. @item numleft @tab Left (numeric keypad)
  6167. @item numcenter @tab 5 with Num Lock inactive (numeric keypad)
  6168. @item numright @tab Right (numeric keypad)
  6169. @item numhome @tab Home (numeric keypad)
  6170. @item numup @tab Up (numeric keypad)
  6171. @item numpgup @tab Page Up (numeric keypad)
  6172. @item numinsert @tab Insert (numeric keypad)
  6173. @item numdelete @tab Delete (numeric keypad)
  6174. @item numasterisk @tab * (numeric keypad)
  6175. @item numminus @tab - (numeric keypad)
  6176. @item numplus @tab + (numeric keypad)
  6177. @item numslash @tab / (numeric keypad)
  6178. @item numenter @tab Enter (numeric keypad)
  6179. @item delete @tab Delete
  6180. @item insert @tab Insert
  6181. @item home @tab Home
  6182. @item end @tab End
  6183. @item pgdown @tab Page Down
  6184. @item pgup @tab Page Up
  6185. @item down @tab Down
  6186. @item up @tab Up
  6187. @item left @tab Left
  6188. @item right @tab Right
  6189. @end multitable
  6190. As well as keystrokes, the @command{sendkey} command takes various options
  6191. that affect the BIOS keyboard status flags. These options take an @samp{on}
  6192. or @samp{off} parameter, specifying that the corresponding status flag be
  6193. set or unset; omitting the option for a given status flag will leave that
  6194. flag at its initial state at boot. The @option{--num}, @option{--caps},
  6195. @option{--scroll}, and @option{--insert} options emulate setting the
  6196. corresponding mode, while the @option{--numkey}, @option{--capskey},
  6197. @option{--scrollkey}, and @option{--insertkey} options emulate pressing and
  6198. holding the corresponding key. The other status flag options are
  6199. self-explanatory.
  6200. If the @option{--no-led} option is given, the status flag options will have
  6201. no effect on keyboard LEDs.
  6202. If the @command{sendkey} command is given multiple times, then only the last
  6203. invocation has any effect.
  6204. Since @command{sendkey} manipulates the BIOS keyboard buffer, it may cause
  6205. hangs, reboots, or other misbehaviour on some systems. If the operating
  6206. system or boot loader that runs after GRUB uses its own keyboard driver
  6207. rather than the BIOS keyboard functions, then @command{sendkey} will have no
  6208. effect.
  6209. This command is only available on PC BIOS systems.
  6210. @end deffn
  6211. @node set
  6212. @subsection set
  6213. @deffn Command set [envvar=value]
  6214. Set the environment variable @var{envvar} to @var{value}. If invoked with no
  6215. arguments, print all environment variables with their values. For the list of
  6216. environment variables currently used by GRUB itself see the relevant section
  6217. @pxref{Environment}.
  6218. @end deffn
  6219. @node sha1sum
  6220. @subsection sha1sum
  6221. @deffn Command sha1sum arg @dots{}
  6222. Alias for @code{hashsum --hash sha1 arg @dots{}}. See command @command{hashsum}
  6223. (@pxref{hashsum}) for full description.
  6224. @end deffn
  6225. @node sha256sum
  6226. @subsection sha256sum
  6227. @deffn Command sha256sum arg @dots{}
  6228. Alias for @code{hashsum --hash sha256 arg @dots{}}. See command @command{hashsum}
  6229. (@pxref{hashsum}) for full description.
  6230. @end deffn
  6231. @node sha512sum
  6232. @subsection sha512sum
  6233. @deffn Command sha512sum arg @dots{}
  6234. Alias for @code{hashsum --hash sha512 arg @dots{}}. See command @command{hashsum}
  6235. (@pxref{hashsum}) for full description.
  6236. @end deffn
  6237. @node sleep
  6238. @subsection sleep
  6239. @deffn Command sleep [@option{--verbose}] [@option{--interruptible}] count
  6240. Sleep for @var{count} seconds. If option @option{--interruptible} is given,
  6241. allow pressing @key{ESC}, @key{F4} or holding down @key{SHIFT} to interrupt
  6242. sleep. With @option{--verbose} show countdown of remaining seconds. Exit code
  6243. is set to 0 if timeout expired and to 1 if timeout was interrupted using any
  6244. of the mentioned keys.
  6245. @end deffn
  6246. @node smbios
  6247. @subsection smbios
  6248. @deffn Command smbios @
  6249. [@option{--type} @var{type}] @
  6250. [@option{--handle} @var{handle}] @
  6251. [@option{--match} @var{match}] @
  6252. (@option{--get-byte} | @option{--get-word} | @option{--get-dword} | @
  6253. @option{--get-qword} | @option{--get-string} | @option{--get-uuid}) @
  6254. @var{offset} @
  6255. [@option{--set} @var{variable}]
  6256. Retrieve SMBIOS information.
  6257. The @command{smbios} command returns the value of a field in an SMBIOS
  6258. structure. The following options determine which structure to select.
  6259. @itemize @bullet
  6260. @item
  6261. Specifying @option{--type} will select structures with a matching
  6262. @var{type}. The type can be any integer from 0 to 255.
  6263. @item
  6264. Specifying @option{--handle} will select structures with a matching
  6265. @var{handle}. The handle can be any integer from 0 to 65535.
  6266. @item
  6267. Specifying @option{--match} will select structure number @var{match} in the
  6268. filtered list of structures; e.g. @code{smbios --type 4 --match 2} will select
  6269. the second Process Information (Type 4) structure. The list is always ordered
  6270. the same as the hardware's SMBIOS table. The match number must be a positive
  6271. integer. If unspecified, the first matching structure will be selected.
  6272. @end itemize
  6273. The remaining options determine which field in the selected SMBIOS structure to
  6274. return. Only one of these options may be specified at a time.
  6275. @itemize @bullet
  6276. @item
  6277. When given @option{--get-byte}, return the value of the byte
  6278. at @var{offset} bytes into the selected SMBIOS structure.
  6279. It will be formatted as an unsigned decimal integer.
  6280. @item
  6281. When given @option{--get-word}, return the value of the word (two bytes)
  6282. at @var{offset} bytes into the selected SMBIOS structure.
  6283. It will be formatted as an unsigned decimal integer.
  6284. @item
  6285. When given @option{--get-dword}, return the value of the dword (four bytes)
  6286. at @var{offset} bytes into the selected SMBIOS structure.
  6287. It will be formatted as an unsigned decimal integer.
  6288. @item
  6289. When given @option{--get-qword}, return the value of the qword (eight bytes)
  6290. at @var{offset} bytes into the selected SMBIOS structure.
  6291. It will be formatted as an unsigned decimal integer.
  6292. @item
  6293. When given @option{--get-string}, return the string with its index found
  6294. at @var{offset} bytes into the selected SMBIOS structure.
  6295. @item
  6296. When given @option{--get-uuid}, return the value of the UUID (sixteen bytes)
  6297. at @var{offset} bytes into the selected SMBIOS structure.
  6298. It will be formatted as lower-case hyphenated hexadecimal digits, with the
  6299. first three fields as little-endian, and the rest printed byte-by-byte.
  6300. @end itemize
  6301. The default action is to print the value of the requested field to the console,
  6302. but a variable name can be specified with @option{--set} to store the value
  6303. instead of printing it.
  6304. For example, this will store and then display the system manufacturer's name.
  6305. @example
  6306. smbios --type 1 --get-string 4 --set system_manufacturer
  6307. echo $system_manufacturer
  6308. @end example
  6309. @end deffn
  6310. @node source
  6311. @subsection source
  6312. @deffn Command source file
  6313. Read @var{file} as a configuration file, as if its contents had been
  6314. incorporated directly into the sourcing file. Unlike @command{configfile}
  6315. (@pxref{configfile}), this executes the contents of @var{file} without
  6316. changing context: any environment variable changes made by the commands in
  6317. @var{file} will be preserved after @command{source} returns, and the menu
  6318. will not be shown immediately.
  6319. @end deffn
  6320. @node test
  6321. @subsection test
  6322. @deffn Command test expression
  6323. Evaluate @var{expression} and return zero exit status if result is true,
  6324. non zero status otherwise.
  6325. @var{expression} is one of:
  6326. @table @asis
  6327. @item @var{string1} @code{==} @var{string2}
  6328. the strings are equal
  6329. @item @var{string1} @code{!=} @var{string2}
  6330. the strings are not equal
  6331. @item @var{string1} @code{<} @var{string2}
  6332. @var{string1} is lexicographically less than @var{string2}
  6333. @item @var{string1} @code{<=} @var{string2}
  6334. @var{string1} is lexicographically less or equal than @var{string2}
  6335. @item @var{string1} @code{>} @var{string2}
  6336. @var{string1} is lexicographically greater than @var{string2}
  6337. @item @var{string1} @code{>=} @var{string2}
  6338. @var{string1} is lexicographically greater or equal than @var{string2}
  6339. @item @var{integer1} @code{-eq} @var{integer2}
  6340. @var{integer1} is equal to @var{integer2}
  6341. @item @var{integer1} @code{-ge} @var{integer2}
  6342. @var{integer1} is greater than or equal to @var{integer2}
  6343. @item @var{integer1} @code{-gt} @var{integer2}
  6344. @var{integer1} is greater than @var{integer2}
  6345. @item @var{integer1} @code{-le} @var{integer2}
  6346. @var{integer1} is less than or equal to @var{integer2}
  6347. @item @var{integer1} @code{-lt} @var{integer2}
  6348. @var{integer1} is less than @var{integer2}
  6349. @item @var{integer1} @code{-ne} @var{integer2}
  6350. @var{integer1} is not equal to @var{integer2}
  6351. @item @var{prefix}@var{integer1} @code{-pgt} @var{prefix}@var{integer2}
  6352. @var{integer1} is greater than @var{integer2} after stripping off common non-numeric @var{prefix}.
  6353. @item @var{prefix}@var{integer1} @code{-plt} @var{prefix}@var{integer2}
  6354. @var{integer1} is less than @var{integer2} after stripping off common non-numeric @var{prefix}.
  6355. @item @var{file1} @code{-nt} @var{file2}
  6356. @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.
  6357. @item @var{file1} @code{-ot} @var{file2}
  6358. @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.
  6359. @item @code{-d} @var{file}
  6360. @var{file} exists and is a directory
  6361. @item @code{-e} @var{file}
  6362. @var{file} exists
  6363. @item @code{-f} @var{file}
  6364. @var{file} exists and is not a directory
  6365. @item @code{-s} @var{file}
  6366. @var{file} exists and has a size greater than zero
  6367. @item @code{-n} @var{string}
  6368. the length of @var{string} is nonzero
  6369. @item @var{string}
  6370. @var{string} is equivalent to @code{-n @var{string}}
  6371. @item @code{-z} @var{string}
  6372. the length of @var{string} is zero
  6373. @item @code{(} @var{expression} @code{)}
  6374. @var{expression} is true
  6375. @item @code{!} @var{expression}
  6376. @var{expression} is false
  6377. @item @var{expression1} @code{-a} @var{expression2}
  6378. both @var{expression1} and @var{expression2} are true
  6379. @item @var{expression1} @var{expression2}
  6380. both @var{expression1} and @var{expression2} are true. This syntax is not POSIX-compliant and is not recommended.
  6381. @item @var{expression1} @code{-o} @var{expression2}
  6382. either @var{expression1} or @var{expression2} is true
  6383. @end table
  6384. @end deffn
  6385. @node tpm2_key_protector_init
  6386. @subsection tpm2_key_protector_init
  6387. @deffn Command tpm2_key_protector_init [@option{-m} mode] | [@option{-p} pcrlist] | [@option{-b} pcrbank] | [ [@option{-T} tpm2key_file] | [@option{-k} keyfile] ] | [@option{-s} handle] | [@option{-a} srk_type] | [@option{-n} nv_index]
  6388. Initialize the TPM2 key protector to unseal the key for the @command{cryptomount}
  6389. (@pxref{cryptomount}) command. There are two supported modes,
  6390. SRK(@kbd{srk}) and NV index(@kbd{nv}), to be specified by the option
  6391. @option{-m}. The default mode is SRK. The main difference between SRK mode
  6392. and NV index mode is the storage of the sealed key. For SRK mode, the sealed
  6393. key is stored in a file while NV index mode stores the sealed key in the
  6394. non-volatile memory inside TPM with a given NV index.
  6395. The @option{-p} and @option{-b} options are used to supply the PCR list and
  6396. bank that the key is sealed with. The PCR list is a comma-separated list, e.g.,
  6397. '0,2,4,7,9', to represent the involved PCRs, and the default is '7'. The PCR
  6398. bank is chosen by selecting a hash algorithm. The current supported PCR banks
  6399. are SHA1, SHA256, SHA384, and SHA512, and the default is SHA256.
  6400. Some options are only available for the specific mode. The SRK-specific
  6401. options are @option{-T}, @option{-k}, @option{-a}, and @option{-s}. On the
  6402. other hand, the NV index-specific option is @option{-n}.
  6403. The key file for SRK mode can be supplied with either @option{-T} or
  6404. @option{-k}. The @option{-T} option is for the path to the key file in
  6405. TPM 2.0 Key File format. Since the parameters for the TPM commands are written
  6406. in the file, there is no need to set the PCR list(@option{-p}) and
  6407. bank(@option{-b}) when using the @option{-T} option. The @option{-k} option
  6408. is for the key file in the raw format, and the @option{-p} and @option{-b}
  6409. options are necessary for the non-default PCR list or bank. In general,
  6410. TPM 2.0 Key File format is preferred due to the simplified GRUB command
  6411. options and the authorized policy support
  6412. Besides the key file, there are two options, @option{-a} and @option{-s}, to
  6413. tweak the TPM Storage Root Key (SRK). The SRK can be either created at
  6414. runtime or stored in the non-volatile memory. When creating SRK at runtime,
  6415. GRUB provides the SRK template to the TPM to create the key. There are two SRK
  6416. templates for the @option{-a} option, ECC and RSA, and the default is ECC.
  6417. If the SRK is stored in a specific handle, e.g. @code{0x81000001}, the
  6418. @option{-s} option can be used to set the handle to notify GRUB to load
  6419. the SRK from the given handle.
  6420. The only NV index-specific option is the @option{-n} option which is used to
  6421. set the NV index containing the sealed key. Then GRUB can load the sealed
  6422. key and unseal it with the given PCR list and bank.
  6423. @end deffn
  6424. @node tpm2_key_protector_clear
  6425. @subsection tpm2_key_protector_clear
  6426. @deffn Command tpm2_key_protector_clear
  6427. Clear the TPM2 key protector if previously initialized.
  6428. @end deffn
  6429. @node true
  6430. @subsection true
  6431. @deffn Command true
  6432. Do nothing, successfully. This is mainly useful in control constructs such
  6433. as @code{if} and @code{while} (@pxref{Shell-like scripting}).
  6434. @end deffn
  6435. @node trust
  6436. @subsection trust
  6437. @deffn Command trust [@option{--skip-sig}] pubkey_file
  6438. Read public key from @var{pubkey_file} and add it to GRUB's internal
  6439. list of trusted public keys. These keys are used to validate digital
  6440. signatures when environment variable @code{check_signatures} is set to
  6441. @code{enforce}. Note that if @code{check_signatures} is set to
  6442. @code{enforce} when @command{trust} executes, then @var{pubkey_file}
  6443. must itself be properly signed. The @option{--skip-sig} option can be
  6444. used to disable signature-checking when reading @var{pubkey_file}
  6445. itself. It is expected that @option{--skip-sig} is useful for testing
  6446. and manual booting. @xref{Using digital signatures}, for more
  6447. information.
  6448. @end deffn
  6449. @node unset
  6450. @subsection unset
  6451. @deffn Command unset envvar
  6452. Unset the environment variable @var{envvar}.
  6453. @end deffn
  6454. @ignore
  6455. @node vbeinfo
  6456. @subsection vbeinfo
  6457. @deffn Command vbeinfo [[WxH]xD]
  6458. Alias for command @command{videoinfo} (@pxref{videoinfo}). It is available
  6459. only on PC BIOS platforms.
  6460. @end deffn
  6461. @end ignore
  6462. @node verify_detached
  6463. @subsection verify_detached
  6464. @deffn Command verify_detached [@option{--skip-sig}] file signature_file [pubkey_file]
  6465. Verifies a GPG-style detached signature, where the signed file is
  6466. @var{file}, and the signature itself is in file @var{signature_file}.
  6467. Optionally, a specific public key to use can be specified using
  6468. @var{pubkey_file}. When environment variable @code{check_signatures}
  6469. is set to @code{enforce}, then @var{pubkey_file} must itself be
  6470. properly signed by an already-trusted key. An unsigned
  6471. @var{pubkey_file} can be loaded by specifying @option{--skip-sig}.
  6472. If @var{pubkey_file} is omitted, then public keys from GRUB's trusted keys
  6473. (@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}) are
  6474. tried.
  6475. Exit code @code{$?} is set to 0 if the signature validates
  6476. successfully. If validation fails, it is set to a non-zero value.
  6477. @xref{Using digital signatures}, for more information.
  6478. @end deffn
  6479. @node videoinfo
  6480. @subsection videoinfo
  6481. @deffn Command videoinfo [[WxH]xD]
  6482. List available video modes. If resolution is given, show only matching modes.
  6483. @end deffn
  6484. @node wrmsr
  6485. @subsection wrmsr
  6486. @deffn Command: wrmsr 0xADDR 0xVALUE
  6487. Write a 0xVALUE to a model-specific register at address 0xADDR.
  6488. Please note that on SMP systems, writing to a MSR that has a scope
  6489. per hardware thread, implies that the value that is written
  6490. only applies to the particular cpu/core/thread that runs the command.
  6491. Also, if you specify a reserved or unimplemented MSR address, it will
  6492. cause a general protection exception (which is not currently being handled)
  6493. and the system will reboot.
  6494. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  6495. This is done to prevent subverting various security mechanisms.
  6496. @end deffn
  6497. @node Networking commands
  6498. @section Networking commands
  6499. @menu
  6500. * net_add_addr:: Add a network address
  6501. * net_add_dns:: Add a DNS server
  6502. * net_add_route:: Add routing entry
  6503. * net_bootp:: Perform a bootp/DHCP autoconfiguration
  6504. * net_del_addr:: Remove IP address from interface
  6505. * net_del_dns:: Remove a DNS server
  6506. * net_del_route:: Remove a route entry
  6507. * net_dhcp:: Perform a DHCP autoconfiguration
  6508. * net_get_dhcp_option:: Retrieve DHCP options
  6509. * net_ipv6_autoconf:: Perform IPv6 autoconfiguration
  6510. * net_ls_addr:: List interfaces
  6511. * net_ls_cards:: List network cards
  6512. * net_ls_dns:: List DNS servers
  6513. * net_ls_routes:: List routing entries
  6514. * net_nslookup:: Perform a DNS lookup
  6515. * net_set_vlan:: Set vlan id on an interface
  6516. @end menu
  6517. @node net_add_addr
  6518. @subsection net_add_addr
  6519. @deffn Command net_add_addr @var{interface} @var{card} @var{address}
  6520. Configure additional network @var{interface} with @var{address} on a
  6521. network @var{card}. @var{address} can be either IP in dotted decimal notation,
  6522. or symbolic name which is resolved using DNS lookup. If successful, this command
  6523. also adds local link routing entry to the default subnet of @var{address}
  6524. with name @var{interface}@samp{:local} via @var{interface}.
  6525. @end deffn
  6526. @node net_add_dns
  6527. @subsection net_add_dns
  6528. @deffn Command net_add_dns @var{server}
  6529. Resolve @var{server} IP address and add to the list of DNS servers used during
  6530. name lookup.
  6531. @end deffn
  6532. @node net_add_route
  6533. @subsection net_add_route
  6534. @deffn Command net_add_route @var{shortname} @var{ip}[/@var{prefix}] [@var{interface} | @samp{gw} @var{gateway}]
  6535. Add route to network with address @var{ip} as modified by @var{prefix} via
  6536. either local @var{interface} or @var{gateway}. @var{prefix} is optional and
  6537. defaults to 32 for IPv4 address and 128 for IPv6 address. Route is identified
  6538. by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
  6539. @end deffn
  6540. @node net_bootp
  6541. @subsection net_bootp
  6542. @deffn Command net_bootp [@var{card}]
  6543. Alias for net_dhcp, for compatibility with older Grub versions. Will perform
  6544. the same DHCP handshake with potential fallback to BOOTP as the net_dhcp
  6545. command (@pxref{net_dhcp}).
  6546. @end deffn
  6547. @node net_del_addr
  6548. @subsection net_del_addr
  6549. @deffn Command net_del_addr @var{interface}
  6550. Remove configured @var{interface} with associated address.
  6551. @end deffn
  6552. @node net_del_dns
  6553. @subsection net_del_dns
  6554. @deffn Command net_del_dns @var{address}
  6555. Remove @var{address} from list of servers used during name lookup.
  6556. @end deffn
  6557. @node net_del_route
  6558. @subsection net_del_route
  6559. @deffn Command net_del_route @var{shortname}
  6560. Remove route entry identified by @var{shortname}.
  6561. @end deffn
  6562. @node net_dhcp
  6563. @subsection net_dhcp
  6564. @deffn Command net_dhcp [@var{card}]
  6565. Perform configuration of @var{card} using DHCP protocol. If no card name
  6566. is specified, try to configure all existing cards.
  6567. Falls back to the BOOTP protocol, if needed. If configuration was
  6568. successful, interface with name @var{card}@samp{:dhcp} and configured
  6569. address is added to @var{card}.
  6570. @comment If server provided gateway information in
  6571. @comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}.
  6572. Additionally the following DHCP options are recognized and processed:
  6573. @table @samp
  6574. @item 1 (Subnet Mask)
  6575. Used to calculate network local routing entry for interface @var{card}@samp{:dhcp}.
  6576. @item 3 (Router)
  6577. Adds default route entry with the name @var{card}@samp{:dhcp:default} via gateway
  6578. from DHCP option. Note that only option with single route is accepted.
  6579. @item 6 (Domain Name Server)
  6580. Adds all servers from option value to the list of servers used during name resolution.
  6581. @item 12 (Host Name)
  6582. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_hostname}
  6583. (@pxref{net_@var{<interface>}_hostname}) to the value of option.
  6584. @item 15 (Domain Name)
  6585. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_domain}
  6586. (@pxref{net_@var{<interface>}_domain}) to the value of option.
  6587. @item 17 (Root Path)
  6588. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_rootpath}
  6589. (@pxref{net_@var{<interface>}_rootpath}) to the value of option.
  6590. @item 18 (Extensions Path)
  6591. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_extensionspath}
  6592. (@pxref{net_@var{<interface>}_extensionspath}) to the value of option.
  6593. @item 66 (TFTP Server Name)
  6594. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_server_name}
  6595. (@pxref{net_@var{<interface>}_dhcp_server_name}) to the value of option.
  6596. @item 67 (Filename)
  6597. Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
  6598. (@pxref{net_@var{<interface>}_boot_file}) to the value of option.
  6599. @end table
  6600. @end deffn
  6601. @node net_get_dhcp_option
  6602. @subsection net_get_dhcp_option
  6603. @deffn Command net_get_dhcp_option @var{var} @var{interface} @var{number} @var{type}
  6604. Request DHCP option @var{number} of @var{type} via @var{interface}. @var{type}
  6605. can be one of @samp{string}, @samp{number} or @samp{hex}. If option is found,
  6606. assign its value to variable @var{var}. Values of types @samp{number} and @samp{hex}
  6607. are converted to string representation.
  6608. @end deffn
  6609. @node net_ipv6_autoconf
  6610. @subsection net_ipv6_autoconf
  6611. @deffn Command net_ipv6_autoconf [@var{card}]
  6612. Perform IPv6 autoconfiguration by adding to the @var{card} interface with name
  6613. @var{card}@samp{:link} and link local MAC-based address. If no card is specified,
  6614. perform autoconfiguration for all existing cards.
  6615. @end deffn
  6616. @node net_ls_addr
  6617. @subsection net_ls_addr
  6618. @deffn Command net_ls_addr
  6619. List all configured interfaces with their MAC and IP addresses.
  6620. @end deffn
  6621. @node net_ls_cards
  6622. @subsection net_ls_cards
  6623. @deffn Command net_ls_cards
  6624. List all detected network cards with their MAC address.
  6625. @end deffn
  6626. @node net_ls_dns
  6627. @subsection net_ls_dns
  6628. @deffn Command net_ls_dns
  6629. List addresses of DNS servers used during name lookup.
  6630. @end deffn
  6631. @node net_ls_routes
  6632. @subsection net_ls_routes
  6633. @deffn Command net_ls_routes
  6634. List routing entries.
  6635. @end deffn
  6636. @node net_nslookup
  6637. @subsection net_nslookup
  6638. @deffn Command net_nslookup @var{name} [@var{server}]
  6639. Resolve address of @var{name} using DNS server @var{server}. If no server
  6640. is given, use default list of servers.
  6641. @end deffn
  6642. @node net_set_vlan
  6643. @subsection net_set_vlan
  6644. @deffn Command net_set_vlan @var{interface} @var{vlanid}
  6645. Set the 802.1Q VLAN identifier on @var{interface} to @var{vlanid}. For example,
  6646. to set the VLAN identifier on interface @samp{efinet1} to @samp{100}:
  6647. @example
  6648. net_set_vlan efinet1 100
  6649. @end example
  6650. The VLAN identifier can be removed by setting it to @samp{0}:
  6651. @example
  6652. net_set_vlan efinet1 0
  6653. @end example
  6654. @end deffn
  6655. @node Undocumented commands
  6656. @section Commands currently undocumented
  6657. Unfortunately, not all GRUB commands are documented at this time due to
  6658. developer resource constraints. One way to contribute back to the GRUB
  6659. project would be to help document these commands, and submit patches or
  6660. ideas to the mailing list. The following is a (most likely incomplete)
  6661. list of undocumented or poorly documented commands and not all of them
  6662. are allowed for all platforms. Running the command help from within the
  6663. GRUB shell may provide more information on parameters and usage.
  6664. @itemize @bullet
  6665. @item @command{all_functional_test} - Run all functional tests.
  6666. @item @command{backtrace} - Print backtrace.
  6667. @item @command{boottime} - Show boot time statistics.
  6668. @item @command{cacheinfo} - Get disk cache info.
  6669. @item @command{cbmemc} - Show CBMEM console content.
  6670. @item @command{cmosset} - Set bit at BYTE:BIT in CMOS.
  6671. @item @command{coreboot_boottime} - Show coreboot boot time statistics.
  6672. @item @command{dump} - Show memory contents.
  6673. @item @command{efiemu_loadcore} - Load and initialize EFI emulator.
  6674. @item @command{efiemu_prepare} - Finalize loading of EFI emulator.
  6675. @item @command{efiemu_unload} - Unload EFI emulator.
  6676. @item @command{exit} - Exit from GRUB.
  6677. @item @command{extract_entries_configfile} - Load another config file but take only menu entries.
  6678. @item @command{extract_entries_source} - Load another config file without changing context but take only menu entries.
  6679. @item @command{extract_legacy_entries_configfile} - Parse legacy config in new context taking only menu entries
  6680. @item @command{extract_legacy_entries_source} - Parse legacy config in same context taking only menu entries
  6681. @item @command{extract_syslinux_entries_configfile} - Execute syslinux config in new context taking only menu entries
  6682. @item @command{extract_syslinux_entries_source} - Execute syslinux config in same context taking only menu entries
  6683. @item @command{fakebios} - Create BIOS-like structures for backward compatibility with existing OS.
  6684. @item @command{fix_video} - Fix video problem.
  6685. @item @command{fpswa} - Display FPSWA version.
  6686. @item @command{functional_test} - Run all loaded functional tests.
  6687. @item @command{gdbstub_break} - Break into GDB
  6688. @item @command{gdbstub} - Start GDB stub on given port
  6689. @item @command{gdbstub_stop} - Stop GDB stub
  6690. @item @command{hdparm} - Get/set ATA disk parameters.
  6691. @item @command{hexdump_random} - Hexdump random data.
  6692. @item @command{inb} - Read 8-bit value from PORT.
  6693. @item @command{inl} - Read 32-bit value from PORT.
  6694. @item @command{inw} - Read 16-bit value from PORT.
  6695. @item @command{jpegtest} - Tests loading of JPEG bitmap.
  6696. @item @command{keymap} - Load a keyboard layout.
  6697. @item @command{legacy_check_password} - Simulate grub-legacy `password' command in menu entry mode
  6698. @item @command{legacy_configfile} - Parse legacy config in new context
  6699. @item @command{legacy_password} - Simulate grub-legacy `password' command
  6700. @item @command{legacy_source} - Parse legacy config in same context
  6701. @item @command{loadbios} - Load BIOS dump.
  6702. @item @command{lsacpi} - Show ACPI information.
  6703. @item @command{lsapm} - Show APM information.
  6704. @item @command{lscoreboot} - List coreboot tables.
  6705. @item @command{lsdev} - List devices.
  6706. @item @command{lsefi} - Display EFI handles.
  6707. @item @command{lsefimmap} - Display EFI memory map.
  6708. @item @command{lsefisystab} - Display EFI system tables.
  6709. @item @command{lsmmap} - List memory map provided by firmware.
  6710. @item @command{lspci} - List PCI devices.
  6711. @item @command{lssal} - Display SAL system table.
  6712. @item @command{lsspd} - Print Memory information.
  6713. @item @command{macppcbless} - Bless DIR of HFS or HFS+ partition for PPC macs.
  6714. @item @command{mactelbless} - Bless FILE of HFS or HFS+ partition for intel macs.
  6715. @item @command{net_set_vlan} - Set an interface's vlan id.
  6716. @item @command{outb} - Write 8-bit VALUE to PORT.
  6717. @item @command{outl} - Write 32-bit VALUE to PORT.
  6718. @item @command{outw} - Write 16-bit VALUE to PORT.
  6719. @item @command{pcidump} - Show raw dump of the PCI configuration space.
  6720. @item @command{pngtest} - Tests loading of PNG bitmap.
  6721. @item @command{read_byte} - Read 8-bit value from ADDR.
  6722. @item @command{read_dword} - Read 32-bit value from ADDR.
  6723. @item @command{read_word} - Read 16-bit value from ADDR.
  6724. @item @command{setpci} - Manipulate PCI devices.
  6725. @item @command{suspend} - Return to IEEE1275 prompt.
  6726. @item @command{syslinux_configfile} - Execute syslinux config in new context
  6727. @item @command{syslinux_source} - Execute syslinux config in same context
  6728. @item @command{test_blockarg} - Print and execute block argument., 0
  6729. @item @command{testload} - Load the same file in multiple ways.
  6730. @item @command{testspeed} - Test file read speed.
  6731. @item @command{tgatest} - Tests loading of TGA bitmap.
  6732. @item @command{time} - Measure time used by COMMAND
  6733. @item @command{tr} - Translate SET1 characters to SET2 in STRING.
  6734. @item @command{usb} - Test USB support.
  6735. @item @command{vbeinfo} - List available video modes. If resolution is given show only modes matching it.
  6736. @item @command{vbetest} - Test video subsystem.
  6737. @item @command{videotest} - Test video subsystem in mode WxH.
  6738. @item @command{write_byte} - Write 8-bit VALUE to ADDR.
  6739. @item @command{write_dword} - Write 32-bit VALUE to ADDR.
  6740. @item @command{write_word} - Write 16-bit VALUE to ADDR.
  6741. @item @command{xen_cat} - List Xen storage.
  6742. @item @command{xen_ls} - List Xen storage.
  6743. @item @command{xnu_devprop_load} - Load `device-properties' dump.
  6744. @item @command{xnu_uuid} - Transform 64-bit UUID to format suitable for XNU. If -l is given keep it lowercase as done by blkid.
  6745. @item @command{zfs-bootfs} - Print ZFS-BOOTFSOBJ or store it into VARIABLE
  6746. @item @command{zfsinfo} - Print ZFS info about DEVICE.
  6747. @item @command{zfskey} - Import ZFS wrapping key stored in FILE.
  6748. @end itemize
  6749. @node Internationalisation
  6750. @chapter Internationalisation
  6751. @section Charset
  6752. GRUB uses UTF-8 internally other than in rendering where some GRUB-specific
  6753. appropriate representation is used. All text files (including config) are
  6754. assumed to be encoded in UTF-8.
  6755. @section Filesystems
  6756. NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
  6757. ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
  6758. as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
  6759. minix2, minix3, ROMFS, ReiserFS, XFS, EROFS, ext2, ext3, ext4, FAT (short names),
  6760. F2FS, RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed
  6761. to be UTF-8. This might be false on systems configured with legacy charset
  6762. but as long as the charset used is superset of ASCII you should be able to
  6763. access ASCII-named files. And it's recommended to configure your system to use
  6764. UTF-8 to access the filesystem, convmv may help with migration. ISO9660 (plain)
  6765. filenames are specified as being ASCII or being described with unspecified
  6766. escape sequences. GRUB assumes that the ISO9660 names are UTF-8 (since
  6767. any ASCII is valid UTF-8). There are some old CD-ROMs which use CP437
  6768. in non-compliant way. You're still able to access files with names containing
  6769. only ASCII characters on such filesystems though. You're also able to access
  6770. any file if the filesystem contains valid Joliet (UTF-16) or RockRidge (UTF-8).
  6771. AFFS, SFS and HFS never use unicode and GRUB assumes them to be in Latin1,
  6772. Latin1 and MacRoman respectively. GRUB handles filesystem case-insensitivity
  6773. however no attempt is performed at case conversion of international characters
  6774. so e.g. a file named lowercase greek alpha is treated as different from
  6775. the one named as uppercase alpha. The filesystems in questions are
  6776. NTFS (except POSIX namespace), HFS+ (configurable at mkfs time, default
  6777. insensitive), SFS (configurable at mkfs time, default insensitive),
  6778. JFS (configurable at mkfs time, default sensitive), HFS, AFFS, FAT, exFAT
  6779. and ZFS (configurable on per-subvolume basis by property ``casesensitivity'',
  6780. default sensitive). On ZFS subvolumes marked as case insensitive files
  6781. containing lowercase international characters are inaccessible.
  6782. Also like all supported filesystems except HFS+ and ZFS (configurable on
  6783. per-subvolume basis by property ``normalization'', default none) GRUB makes
  6784. no attempt at check of canonical equivalence so a file name u-diaresis is
  6785. treated as distinct from u+combining diaresis. This however means that in
  6786. order to access file on HFS+ its name must be specified in normalisation form D.
  6787. On normalized ZFS subvolumes filenames out of normalisation are inaccessible.
  6788. @section Output terminal
  6789. Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII.
  6790. BIOS firmware console and VGA text are limited to ASCII and some pseudographics.
  6791. None of above mentioned is appropriate for displaying international and any
  6792. unsupported character is replaced with question mark except pseudographics
  6793. which we attempt to approximate with ASCII.
  6794. EFI console on the other hand nominally supports UTF-16 but actual language
  6795. coverage depends on firmware and may be very limited.
  6796. The encoding used on serial can be chosen with @command{terminfo} as
  6797. either ASCII, UTF-8 or ``visual UTF-8''. Last one is against the specification
  6798. but results in correct rendering of right-to-left on some readers which don't
  6799. have own bidi implementation.
  6800. On emu GRUB checks if charset is UTF-8 and uses it if so and uses ASCII
  6801. otherwise.
  6802. When using gfxterm or gfxmenu GRUB itself is responsible for rendering the
  6803. text. In this case GRUB is limited by loaded fonts. If fonts contain all
  6804. required characters then bidirectional text, cursive variants and combining
  6805. marks other than enclosing, half (e.g. left half tilde or combining overline)
  6806. and double ones. Ligatures aren't supported though. This should cover European,
  6807. Middle Eastern (if you don't mind lack of lam-alif ligature in Arabic) and
  6808. East Asian scripts. Notable unsupported scripts are Brahmic family and
  6809. derived as well as Mongolian, Tifinagh, Korean Jamo (precomposed characters
  6810. have no problem) and tonal writing (2e5-2e9). GRUB also ignores deprecated
  6811. (as specified in Unicode) characters (e.g. tags). GRUB also doesn't handle so
  6812. called ``annotation characters'' If you can complete either of
  6813. two lists or, better, propose a patch to improve rendering, please contact
  6814. developer team.
  6815. @section Input terminal
  6816. Firmware console on BIOS, IEEE1275 and ARC doesn't allow you to enter non-ASCII
  6817. characters. EFI specification allows for such but author is unaware of any
  6818. actual implementations. Serial input is currently limited for latin1 (unlikely
  6819. to change). Own keyboard implementations (at_keyboard and usb_keyboard)
  6820. supports any key but work on one-char-per-keystroke.
  6821. So no dead keys or advanced input method. Also there is no keymap change hotkey.
  6822. In practice it makes difficult to enter any text using non-Latin alphabet.
  6823. Moreover all current input consumers are limited to ASCII.
  6824. @section Gettext
  6825. GRUB supports being translated. For this you need to have language *.mo files in $prefix/locale, load gettext module and set ``lang'' variable.
  6826. @section Regexp
  6827. Regexps work on unicode characters, however no attempt at checking canonical
  6828. equivalence has been made. Moreover the classes like [:alpha:] match only
  6829. ASCII subset.
  6830. @section Other
  6831. Currently GRUB always uses YEAR-MONTH-DAY HOUR:MINUTE:SECOND [WEEKDAY] 24-hour
  6832. datetime format but weekdays are translated.
  6833. GRUB always uses the decimal number format with [0-9] as digits and . as
  6834. descimal separator and no group separator.
  6835. IEEE1275 aliases are matched case-insensitively except non-ASCII which is
  6836. matched as binary. Similar behaviour is for matching OSBundleRequired.
  6837. Since IEEE1275 aliases and OSBundleRequired don't contain any non-ASCII it
  6838. should never be a problem in practice.
  6839. Case-sensitive identifiers are matched as raw strings, no canonical
  6840. equivalence check is performed. Case-insensitive identifiers are matched
  6841. as RAW but additionally [a-z] is equivalent to [A-Z]. GRUB-defined
  6842. identifiers use only ASCII and so should user-defined ones.
  6843. Identifiers containing non-ASCII may work but aren't supported.
  6844. Only the ASCII space characters (space U+0020, tab U+000b, CR U+000d and
  6845. LF U+000a) are recognised. Other unicode space characters aren't a valid
  6846. field separator.
  6847. @command{test} (@pxref{test}) tests <, >, <=, >=, -pgt and -plt compare the strings in the
  6848. lexicographical order of unicode codepoints, replicating the behaviour of
  6849. test from coreutils.
  6850. environment variables and commands are listed in the same order.
  6851. @node Security
  6852. @chapter Security
  6853. @menu
  6854. * Authentication and authorisation:: Users and access control
  6855. * Using digital signatures:: Booting digitally signed code
  6856. * UEFI secure boot and shim:: Booting digitally signed PE files
  6857. * Secure Boot Advanced Targeting:: Embedded information for generation number based revocation
  6858. * Measured Boot:: Measuring boot components
  6859. * Lockdown:: Lockdown when booting on a secure setup
  6860. * TPM2 key protector:: Managing disk key with TPM2 key protector
  6861. @end menu
  6862. @node Authentication and authorisation
  6863. @section Authentication and authorisation in GRUB
  6864. By default, the boot loader interface is accessible to anyone with physical
  6865. access to the console: anyone can select and edit any menu entry, and anyone
  6866. can get direct access to a GRUB shell prompt. For most systems, this is
  6867. reasonable since anyone with direct physical access has a variety of other
  6868. ways to gain full access, and requiring authentication at the boot loader
  6869. level would only serve to make it difficult to recover broken systems.
  6870. However, in some environments, such as kiosks, it may be appropriate to lock
  6871. down the boot loader to require authentication before performing certain
  6872. operations.
  6873. The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
  6874. (@pxref{password_pbkdf2}) commands can be used to define users, each of
  6875. which has an associated password. @samp{password} sets the password in
  6876. plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
  6877. sets the password hashed using the Password-Based Key Derivation Function
  6878. (RFC 2898), requiring the use of @command{grub-mkpasswd-pbkdf2}
  6879. (@pxref{Invoking grub-mkpasswd-pbkdf2}) to generate password hashes.
  6880. In order to enable authentication support, the @samp{superusers} environment
  6881. variable must be set to a list of usernames, separated by any of spaces,
  6882. commas, semicolons, pipes, or ampersands. Superusers are permitted to use
  6883. the GRUB command line, edit menu entries, and execute any menu entry. If
  6884. @samp{superusers} is set, then use of the command line and editing of menu
  6885. entries are automatically restricted to superusers. Setting @samp{superusers}
  6886. to empty string effectively disables both access to CLI and editing of menu
  6887. entries. Building a grub image with @samp{--disable-cli} option will also
  6888. disable access to CLI and editing of menu entries, as well as disabling rescue
  6889. mode. Note: The environment variable needs to be exported to also affect the
  6890. section defined by the @samp{submenu} command (@pxref{submenu}).
  6891. Other users may be allowed to execute specific menu entries by giving a list of
  6892. usernames (as above) using the @option{--users} option to the
  6893. @samp{menuentry} command (@pxref{menuentry}). If the @option{--unrestricted}
  6894. option is used for a menu entry, then that entry is unrestricted.
  6895. If the @option{--users} option is not used for a menu entry, then that
  6896. only superusers are able to use it.
  6897. Putting this together, a typical @file{grub.cfg} fragment might look like
  6898. this:
  6899. @example
  6900. @group
  6901. set superusers="root"
  6902. password_pbkdf2 root grub.pbkdf2.sha512.10000.biglongstring
  6903. password user1 insecure
  6904. menuentry "May be run by any user" --unrestricted @{
  6905. set root=(hd0,1)
  6906. linux /vmlinuz
  6907. @}
  6908. menuentry "Superusers only" --users "" @{
  6909. set root=(hd0,1)
  6910. linux /vmlinuz single
  6911. @}
  6912. menuentry "May be run by user1 or a superuser" --users user1 @{
  6913. set root=(hd0,2)
  6914. chainloader +1
  6915. @}
  6916. @end group
  6917. @end example
  6918. The @command{grub-mkconfig} program does not yet have built-in support for
  6919. generating configuration files with authentication. You can use
  6920. @file{/etc/grub.d/40_custom} to add simple superuser authentication, by
  6921. adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
  6922. commands.
  6923. @node Using digital signatures
  6924. @section Using digital signatures in GRUB
  6925. GRUB's @file{core.img} can optionally provide enforcement that all files
  6926. subsequently read from disk are covered by a valid digital signature.
  6927. This document does @strong{not} cover how to ensure that your
  6928. platform's firmware (e.g., Coreboot) validates @file{core.img}.
  6929. If environment variable @code{check_signatures}
  6930. (@pxref{check_signatures}) is set to @code{enforce}, then every
  6931. attempt by the GRUB @file{core.img} to load another file @file{foo}
  6932. implicitly invokes @code{verify_detached foo foo.sig}
  6933. (@pxref{verify_detached}). @code{foo.sig} must contain a valid
  6934. digital signature over the contents of @code{foo}, which can be
  6935. verified with a public key currently trusted by GRUB
  6936. (@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}). If
  6937. validation fails, then file @file{foo} cannot be opened. This failure
  6938. may halt or otherwise impact the boot process.
  6939. An initial trusted public key can be embedded within the GRUB @file{core.img}
  6940. using the @code{--pubkey} option to @command{grub-install}
  6941. (@pxref{Invoking grub-install}).
  6942. GRUB uses GPG-style detached signatures (meaning that a file
  6943. @file{foo.sig} will be produced when file @file{foo} is signed), and
  6944. currently supports the DSA and RSA signing algorithms. A signing key
  6945. can be generated as follows:
  6946. @example
  6947. gpg --gen-key
  6948. @end example
  6949. An individual file can be signed as follows:
  6950. @example
  6951. gpg --detach-sign /path/to/file
  6952. @end example
  6953. For successful validation of all of GRUB's subcomponents and the
  6954. loaded OS kernel, they must all be signed. One way to accomplish this
  6955. is the following (after having already produced the desired
  6956. @file{grub.cfg} file, e.g., by running @command{grub-mkconfig}
  6957. (@pxref{Invoking grub-mkconfig}):
  6958. @example
  6959. @group
  6960. # Edit /dev/shm/passphrase.txt to contain your signing key's passphrase
  6961. for i in `find /boot -name "*.cfg" -or -name "*.lst" -or \
  6962. -name "*.mod" -or -name "vmlinuz*" -or -name "initrd*" -or \
  6963. -name "grubenv"`;
  6964. do
  6965. gpg --batch --detach-sign --passphrase-fd 0 $i < \
  6966. /dev/shm/passphrase.txt
  6967. done
  6968. shred /dev/shm/passphrase.txt
  6969. @end group
  6970. @end example
  6971. See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
  6972. @ref{list_trusted}, @ref{distrust}, @ref{load_env}, @ref{save_env}.
  6973. Note that internally signature enforcement is controlled by setting
  6974. the environment variable @code{check_signatures} equal to
  6975. @code{enforce}. Passing one or more @code{--pubkey} options to
  6976. @command{grub-mkimage} implicitly defines @code{check_signatures}
  6977. equal to @code{enforce} in @file{core.img} prior to processing any
  6978. configuration files.
  6979. Note that signature checking does @strong{not} prevent an attacker
  6980. with (serial, physical, ...) console access from dropping manually to
  6981. the GRUB console and executing:
  6982. @example
  6983. set check_signatures=no
  6984. @end example
  6985. To prevent this, password-protection (@pxref{Authentication and
  6986. authorisation}) is essential. Note that even with GRUB password
  6987. protection, GRUB itself cannot prevent someone with physical access to
  6988. the machine from altering that machine's firmware (e.g., Coreboot
  6989. or BIOS) configuration to cause the machine to boot from a different
  6990. (attacker-controlled) device. GRUB is at best only one link in a
  6991. secure boot chain.
  6992. @node UEFI secure boot and shim
  6993. @section UEFI secure boot and shim support
  6994. The GRUB works with UEFI secure boot and the shim. This functionality is
  6995. provided by the shim_lock verifier. It is built into the @file{core.img} and is
  6996. registered if the UEFI secure boot is enabled. The @samp{shim_lock} variable is
  6997. set to @samp{y} when shim_lock verifier is registered. If it is desired to use
  6998. UEFI secure boot without shim, one can disable shim_lock by disabling shim
  6999. verification with MokSbState UEFI variable or by building grub image with
  7000. @samp{--disable-shim-lock} option.
  7001. All GRUB modules not stored in the @file{core.img}, OS kernels, ACPI tables,
  7002. Device Trees, etc. have to be signed, e.g, using PGP. Additionally, the commands
  7003. that can be used to subvert the UEFI secure boot mechanism, such as @command{iorw}
  7004. and @command{memrw} will not be available when the UEFI secure boot is enabled.
  7005. This is done for security reasons and are enforced by the GRUB Lockdown mechanism
  7006. (@pxref{Lockdown}).
  7007. @node Secure Boot Advanced Targeting
  7008. @section Embedded information for generation number based revocation
  7009. The Secure Boot Advanced Targeting (SBAT) is a mechanism to allow the revocation
  7010. of components in the boot path by using generation numbers embedded into the EFI
  7011. binaries. The SBAT metadata is located in an .sbat data section that has set of
  7012. UTF-8 strings as comma-separated values (CSV). See
  7013. @uref{https://github.com/rhboot/shim/blob/main/SBAT.md} for more details.
  7014. To add a data section containing the SBAT information into the binary, the
  7015. @option{--sbat} option of @command{grub-mkimage} command should be used. The content
  7016. of a CSV file, encoded with UTF-8, is copied as is to the .sbat data section into
  7017. the generated EFI binary. The CSV file can be stored anywhere on the file system.
  7018. @example
  7019. grub-mkimage -O x86_64-efi -o grubx64.efi -p '(tftp)/grub' --sbat sbat.csv efinet tftp
  7020. @end example
  7021. @node Measured Boot
  7022. @section Measuring boot components
  7023. If the tpm module is loaded and the platform has a Trusted Platform Module
  7024. installed, GRUB will log each command executed and each file loaded into the
  7025. TPM event log and extend the PCR values in the TPM correspondingly. All events
  7026. will be logged into the PCR described below with a type of EV_IPL and an
  7027. event description as described below.
  7028. @multitable @columnfractions 0.3 0.1 0.6
  7029. @headitem Event type @tab PCR @tab Description
  7030. @item Command
  7031. @tab 8
  7032. @tab All executed commands (including those from configuration files) will be
  7033. logged and measured as entered with a prefix of ``grub_cmd: ``
  7034. @item Kernel command line
  7035. @tab 8
  7036. @tab Any command line passed to a kernel will be logged and measured as entered
  7037. with a prefix of ``kernel_cmdline: ''
  7038. @item Module command line
  7039. @tab 8
  7040. @tab Any command line passed to a kernel module will be logged and measured as
  7041. entered with a prefix of ``module_cmdline: ``
  7042. @item Files
  7043. @tab 9
  7044. @tab Any file read by GRUB will be logged and measured with a descriptive text
  7045. corresponding to the filename.
  7046. @end multitable
  7047. GRUB will not measure its own @file{core.img} - it is expected that firmware
  7048. will carry this out. GRUB will also not perform any measurements until the
  7049. tpm module is loaded. As such it is recommended that the tpm module be built
  7050. into @file{core.img} in order to avoid a potential gap in measurement between
  7051. @file{core.img} being loaded and the tpm module being loaded.
  7052. Measured boot is currently only supported on EFI and IBM IEEE1275 PowerPC
  7053. platforms.
  7054. @node Lockdown
  7055. @section Lockdown when booting on a secure setup
  7056. The GRUB can be locked down when booted on a secure boot environment, for example
  7057. if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
  7058. be restricted and some operations/commands cannot be executed.
  7059. The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down.
  7060. Otherwise it does not exit.
  7061. @node TPM2 key protector
  7062. @section TPM2 key protector in GRUB
  7063. TPM2 key protector extends measured boot to unlock the encrypted partition
  7064. without user intervention. It uses the TPM Storage Root Key (SRK) to seal
  7065. the disk key with a given set of PCR values. If the system state matches,
  7066. i.e. PCR values match the sealed PCR set, TPM2 key protector unseals the
  7067. disk key for @command{cryptomount} (@pxref{cryptomount}) to unlock the
  7068. encrypted partition. In case the unsealed key fails to unlock the
  7069. partition, @command{cryptomount} falls back to the passphrase prompt.
  7070. Please note that TPM2 key protector uses the SRK in the owner hierarchy
  7071. @emph{without} authorization. If the owner hierarchy is password-protected,
  7072. TPM2 key protector may fail to unseal the key due to the absence of the
  7073. password. For the systems that already enable the password protection for the
  7074. owner hierarchy, the following command removes the password protection with
  7075. the existing password.
  7076. @example
  7077. # @kbd{tpm2_changeauth -c owner -p password}
  7078. @end example
  7079. There are two supported modes to store the sealed key, SRK and NV index.
  7080. The details will be addressed in later sections.
  7081. TPM2 key protector is currently only supported on EFI and EMU platforms.
  7082. @subsection TPM PCR usage
  7083. Since TPM2 key protector relies on PCRs to check the system state, it is
  7084. important to decide which PCRs to seal the key with. The following table
  7085. lists uses of PCRs and the measured objects on EFI platforms.
  7086. @multitable @columnfractions 0.1 0.2 0.7
  7087. @headitem PCR @tab Used by @tab Measured Objects
  7088. @item 0
  7089. @tab Firmware
  7090. @tab Core system firmware executable code
  7091. @item 1
  7092. @tab Firmware
  7093. @tab Core system firmware data/host platform configuration; typically
  7094. contains serial and model numbers
  7095. @item 2
  7096. @tab Firmware
  7097. @tab Extended or pluggable executable code; includes option ROMs on
  7098. pluggable hardware
  7099. @item 3
  7100. @tab Firmware
  7101. @tab Extended or pluggable firmware data; includes information about
  7102. pluggable hardware
  7103. @item 4
  7104. @tab Firmware
  7105. @tab Boot loader and additional drivers; binaries and extensions loaded
  7106. by the boot loader
  7107. @item 5
  7108. @tab Firmware
  7109. @tab GPT/Partition table
  7110. @item 7
  7111. @tab Firmware
  7112. @tab SecureBoot state
  7113. @item 8
  7114. @tab GRUB
  7115. @tab Commands and kernel command line
  7116. @item 9
  7117. @tab GRUB
  7118. @tab All files read (including kernel image)
  7119. @item 9
  7120. @tab Linux Kernel
  7121. @tab All passed initrds (when the new LOAD_FILE2 initrd protocol is used)
  7122. @item 10
  7123. @tab Linux Kernel
  7124. @tab Protection of the IMA measurement log
  7125. @item 14
  7126. @tab shim
  7127. @tab “MOK” certificates and hashes
  7128. @end multitable
  7129. PCR 0, 2, 4, and 7 can be used to check the integrity of the firmware code
  7130. and bootloaders. PCR 8 and 9 are useful to check the file and data processed
  7131. by GRUB. PCRs 10, 11, 12, 13, and 15 are controlled by the operating system,
  7132. so those PCRs are usually still in the initial state when GRUB is running.
  7133. In general, it is nice to include PCR 0, 2, 4, and 7 to ensure the integrity
  7134. of the firmware and bootloaders. For PCR 8 and 9, a sophisticated tool is
  7135. required to examine the GRUB configuration files and the files to be loaded
  7136. to calculate the correct PCR values.
  7137. Please note that PCRs are sensitive to any change, so an update of a component
  7138. could invalidate the sealed key, due to the so-called PCR brittleness. For the
  7139. bootloader update, PCR 4 may be affected. This can be mitigated by extracting
  7140. the events from the TPM event log and predict the value with the updated
  7141. bootloader binary. On the other hand, it is difficult to predict PCR 0~7 after
  7142. a firmware update since the content of the code and the order of drivers may
  7143. not follow the TPM event log from the previous firmware version, so it is
  7144. necessary to reboot the system to update the measurement results of PCR 0~7
  7145. and seal or sign the sealed key again.
  7146. Reference: @url{https://uapi-group.org/specifications/specs/linux_tpm_pcr_registry/, Linux TPM PCR Registry}
  7147. @subsection Setting up the extra disk key
  7148. Instead of using the existing password, it is recommended to seal a new
  7149. random disk key and use the existing password for recovery.
  7150. Here are the sample commands to create a 128 random bytes key file and
  7151. enroll the key into the target partition (sda2).
  7152. @example
  7153. # @kbd{dd if=/dev/urandom of=luks.key bs=1 count=128}
  7154. # @kbd{cryptsetup luksAddKey /dev/sda2 luks.key --pbkdf=pbkdf2 --hash=sha512}
  7155. @end example
  7156. @subsection SRK mode
  7157. To unlock the partition with SRK mode, assume that the sealed key is in
  7158. @file{(hd0,gpt1)/efi/grub/sealed.tpm}, the following GRUB commands
  7159. unseal the disk key with SRK mode and supply it to @command{cryptomount}.
  7160. @example
  7161. grub> @kbd{tpm2_key_protector_init -T (hd0,gpt1)/efi/grub/sealed.tpm}
  7162. grub> @kbd{cryptomount -u <UUID> -P tpm2}
  7163. @end example
  7164. There are two programs to create the sealed key for SRK mode: @command{grub-protect}
  7165. and @command{pcr-oracle} (@url{https://github.com/okirch/pcr-oracle}).
  7166. The following sample command uses @command{grub-protect} to seal the random
  7167. key, @file{luks.key}, with PCR 0, 2, 4 and 7 in TPM 2.0 Key File format.
  7168. @example
  7169. @group
  7170. # @kbd{grub-protect --action=add \
  7171. --protector=tpm2 \
  7172. --tpm2-pcrs=0,2,4,7 \
  7173. --tpm2key \
  7174. --tpm2-keyfile=luks.key \
  7175. --tpm2-outfile=/boot/efi/efi/grub/sealed.tpm}
  7176. @end group
  7177. @end example
  7178. @command{grub-protect} only seals the key with the current PCR values.
  7179. Therefore, when a boot component, such as shim or GRUB, is updated, it is
  7180. necessary to reboot the system to update the measurement results and seal
  7181. the key again. That means the random disk key has to be stored in cleartext
  7182. for the next key sealing. Besides this, the measurement result of some PCRs
  7183. may differ between boot time and OS runtime. For example, PCR 9 measures the
  7184. files loaded by GRUB including the Linux kernel and initrd. To unlock the disk
  7185. containing the kernel and initrd, the key has to be sealed with PCR 9 value
  7186. before loading the kernel and initrd. However, PCR 9 changes after GRUB
  7187. loading the kernel and initrd, so PCR 9 at OS runtime cannot be used directly
  7188. for key sealing.
  7189. To solve these problems, @command{pcr-oracle} takes a different approach. It
  7190. reads the TPM eventlog and predicts the PCR values. Besides,
  7191. @command{pcr-oracle} also supports ``authorized policy'' which allows the
  7192. PCR policy to be updated with a valid signature, so that the user only seals
  7193. the random disk key once. If at some later time the PCR values change due to
  7194. an update of the system firmware, bootloader, or config file, the user just
  7195. needs to update the signature of the PCR policy.
  7196. To seal the key with the authorized policy, the first thing is to generate
  7197. the RSA policy key, @file{policy-key.pem}, and the authorized policy file,
  7198. @file{authorized.policy}. In this example, PCR 0, 2, 4, 7 and 9 are chosen
  7199. for key sealing.
  7200. @example
  7201. @group
  7202. # @kbd{pcr-oracle --rsa-generate-key \
  7203. --private-key policy-key.pem \
  7204. --auth authorized.policy \
  7205. create-authorized-policy 0,2,4,7,9}
  7206. @end group
  7207. @end example
  7208. Then, we seal the random disk key, @file{luks.key}, with the authorized
  7209. policy file and save the sealed key in @file{sealed.key}.
  7210. @example
  7211. @group
  7212. # @kbd{pcr-oracle --key-format tpm2.0 \
  7213. --auth authorized.policy \
  7214. --input luks.key \
  7215. --output sealed.key \
  7216. seal-secret}
  7217. @end group
  7218. @end example
  7219. Since we now have the sealed key, we can remove the random disk key file
  7220. @file{luks.key}.
  7221. The last step is to sign the predicted PCR policy and save the final key
  7222. file, @file{sealed.tpm}.
  7223. @example
  7224. @group
  7225. # @kbd{pcr-oracle --key-format tpm2.0 \
  7226. --private-key policy-key.pem \
  7227. --from eventlog \
  7228. --stop-event "grub-file=grub.cfg" \
  7229. --after \
  7230. --input sealed.key \
  7231. --output /boot/efi/efi/grub/sealed.tpm \
  7232. sign 0,2,4,7,9}
  7233. @end group
  7234. @end example
  7235. Here we also set a stop event for the prediction. With
  7236. @kbd{--stop-event grub-file=grub.cfg --after}, @command{pcr-oracle} stops
  7237. the calculation of PCR values right after GRUB loads @file{grub.cfg}.
  7238. When/After the shim or GRUB are updated, it only requires to run the last
  7239. @command{pcr-oracle} command to update the predicted PCR policy.
  7240. @subsection NV index mode
  7241. Instead of storing the sealed key in a file, NV index mode uses the TPM
  7242. non-volatile memory to store the sealed key.
  7243. The following sample commands use tpm2-tools (@url{https://github.com/tpm2-software/tpm2-tools})
  7244. commands to seal @file{luks.key} into the specific NV index: @kbd{0x81000000}.
  7245. First, we need to create the object file for the primary key, i.e. storage
  7246. root key (SRK) with the default key settings in GRUB: SHA256 hash algorithm
  7247. and ECC key algorithm.
  7248. @example
  7249. # @kbd{tpm2_createprimary -C o -g sha256 -G ecc -c primary.ctx}
  7250. @end example
  7251. The next commands collect the current values of PCR 0, 2, 4, and 7 and saves
  7252. them in @file{pcr.dat}.
  7253. @example
  7254. # @kbd{tpm2_startauthsession -S session.dat}
  7255. # @kbd{tpm2_policypcr -S session.dat -l sha256:0,2,4,7 -f pcrs.dat -L policy.dat}
  7256. # @kbd{tpm2_flushcontext session.dat}
  7257. @end example
  7258. The last commands seal @file{luks.key} with the primary key and stores the
  7259. result in @kbd{0x81000000}.
  7260. @example
  7261. # @kbd{cat luks.key | tpm2_create -C primary.ctx -u key.pub -r key.priv -L policy.dat -i-}
  7262. # @kbd{tpm2_load -C primary.ctx -u key.pub -r key.priv -n sealing.name -c sealing.ctx}
  7263. # @kbd{tpm2_evictcontrol -C o -c sealing.ctx 0x81000000}
  7264. @end example
  7265. To unseal the key, we have to specify the mode @kbd{nv}, the NV index
  7266. @kbd{0x81000000}, and the PCRs @kbd{0,2,4,7} for the @command{tpm2_key_protector_init}
  7267. command.
  7268. @example
  7269. grub> @kbd{tpm2_key_protector_init --mode=nv --nvindex=0x81000000 --pcrs=0,2,4,7}
  7270. grub> @kbd{cryptomount -u <UUID> --protector tpm2}
  7271. @end example
  7272. @subsection Setting up software TPM for EMU platform
  7273. In order to test TPM2 key protector and TPM2 Software Stack (TSS2), it is
  7274. useful to set up a software TPM (swtpm) instance and run the commands on the
  7275. EMU platform.
  7276. Here are the commands to start a swtpm instance which provides a character
  7277. device interface. To store the TPM states, the directory, @file{swtpm-state},
  7278. is created before the @command{swtpm} command. All the messages are stored
  7279. in @file{swtpm.log} including the name of the character device.
  7280. @example
  7281. # @kbd{mkdir swtpm-state}
  7282. @group
  7283. # @kbd{swtpm chardev --vtpm-proxy --tpmstate dir=swtpm-state \
  7284. --tpm2 --ctrl type=unixio,path="swtpm-state/ctrl" \
  7285. --flags startup-clear --daemon > swtpm.log}
  7286. @end group
  7287. @end example
  7288. Then, we extract the name of the character device from @file{swtpm.log} and
  7289. save it to the variable, @samp{tpm2dev}.
  7290. @example
  7291. # @kbd{tpm2dev=$(grep "New TPM device" swtpm.log | cut -d' ' -f 4)}
  7292. @end example
  7293. Now we can start @kbd{grub-emu} with @kbd{--tpm-device $tpm2dev} to interact
  7294. with the swtpm instance.
  7295. @example
  7296. # @kbd{grub-emu --tpm-device $tpm2dev}
  7297. @end example
  7298. On the host, the tpm2-tools commands can interact with the swtpm instance by
  7299. setting @samp{TPM2TOOLS_TCTI}.
  7300. @example
  7301. # @kbd{export TPM2TOOLS_TCTI="device:$tpm2dev"}
  7302. @end example
  7303. When the test is done, use @kbd{swtpm_ioctl} to send the shutdown
  7304. command through the swtpm control channel.
  7305. @example
  7306. # @kbd{swtpm_ioctl -s --unix swtpm-state/ctrl}
  7307. @end example
  7308. @node Platform limitations
  7309. @chapter Platform limitations
  7310. GRUB2 is designed to be portable and is actually ported across platforms. We
  7311. try to keep all platforms at the level. Unfortunately some platforms are better
  7312. supported than others. This is detailed in current and 2 following sections.
  7313. All platforms have an artificially GRUB imposed disk size restriction of 1 EiB.
  7314. In some cases, larger disk sizes can be used, but access will not be allowed
  7315. beyond 1 EiB.
  7316. LUKS2 devices with size larger than 16 EiB are currently not supported. They
  7317. can not be created as crypto devices by cryptomount, so can not even be
  7318. partially read from. LUKS have no limitations other than those imposed by the
  7319. format.
  7320. ARC platform is unable to change datetime (firmware doesn't seem to provide a
  7321. function for it).
  7322. EMU has similar limitation.
  7323. On EMU platform no serial port is available.
  7324. Console charset refers only to firmware-assisted console. gfxterm is always
  7325. Unicode (see Internationalisation section for its limitations). Serial is
  7326. configurable to UTF-8 or ASCII (see Internationalisation). In case of qemu
  7327. and coreboot ports the referred console is vga_text. Loongson always uses
  7328. gfxterm.
  7329. Most limited one is ASCII. CP437 provides additionally pseudographics.
  7330. GRUB2 doesn't use any language characters from CP437 as often CP437 is replaced
  7331. by national encoding compatible only in pseudographics.
  7332. Unicode is the most versatile charset which supports many languages. However
  7333. the actual console may be much more limited depending on firmware
  7334. On BIOS, network is supported only if the image is loaded through network.
  7335. On sparc64, GRUB is unable to determine which server it was booted from.
  7336. Direct ATA/AHCI support allows to circumvent various firmware limitations but
  7337. isn't needed for normal operation except on baremetal ports.
  7338. AT keyboard support allows keyboard layout remapping and support for keys not
  7339. available through firmware. It isn't needed for normal operation except
  7340. baremetal ports.
  7341. Speaker allows morse and spkmodem communication.
  7342. USB support provides benefits similar to ATA (for USB disks) or AT (for USB
  7343. keyboards). In addition it allows USBserial.
  7344. Chainloading refers to the ability to load another bootloader through the same protocol
  7345. Hints allow faster disk discovery by already knowing in advance which is the disk in
  7346. question. On some platforms hints are correct unless you move the disk between boots.
  7347. On other platforms it's just an educated guess.
  7348. Note that hint failure results in just reduced performance, not a failure
  7349. BadRAM is the ability to mark some of the RAM as ``bad''. Note: due to protocol
  7350. limitations mips-loongson (with Linux protocol)
  7351. and mips-qemu_mips can use only memory up to first hole.
  7352. Bootlocation is ability of GRUB to automatically detect where it boots from.
  7353. ``disk'' means the detection is limited to detecting the disk with partition
  7354. being discovered on install time. ``partition'' means that disk and partiton
  7355. can be automatically discovered. ``file'' means that boot image file name as
  7356. well as disk and partition can be discovered. For consistency, default install ignores
  7357. partition and relies solely on disk detection. If no bootlocation discovery is available
  7358. or boot and grub-root disks are different, UUID is used instead. On ARC if no device
  7359. to install to is specified, UUID is used instead as well.
  7360. @multitable @columnfractions .20 .20 .20 .20 .20
  7361. @item @tab BIOS @tab Coreboot @tab Multiboot @tab Qemu
  7362. @item video @tab yes @tab yes @tab yes @tab yes
  7363. @item console charset @tab CP437 @tab CP437 @tab CP437 @tab CP437
  7364. @item network @tab yes (*) @tab no @tab no @tab no
  7365. @item ATA/AHCI @tab yes @tab yes @tab yes @tab yes
  7366. @item AT keyboard @tab yes @tab yes @tab yes @tab yes
  7367. @item Speaker @tab yes @tab yes @tab yes @tab yes
  7368. @item USB @tab yes @tab yes @tab yes @tab yes
  7369. @item chainloader @tab local @tab yes @tab yes @tab no
  7370. @item cpuid @tab partial @tab partial @tab partial @tab partial
  7371. @item rdmsr @tab partial @tab partial @tab partial @tab partial
  7372. @item wrmsr @tab partial @tab partial @tab partial @tab partial
  7373. @item hints @tab guess @tab guess @tab guess @tab guess
  7374. @item PCI @tab yes @tab yes @tab yes @tab yes
  7375. @item badram @tab yes @tab yes @tab yes @tab yes
  7376. @item compression @tab always @tab pointless @tab no @tab no
  7377. @item exit @tab yes @tab no @tab no @tab no
  7378. @item bootlocation @tab disk @tab no @tab no @tab no
  7379. @end multitable
  7380. @multitable @columnfractions .20 .20 .20 .20 .20
  7381. @item @tab ia32 EFI @tab amd64 EFI @tab ia32 IEEE1275 @tab Itanium
  7382. @item video @tab yes @tab yes @tab no @tab no
  7383. @item console charset @tab Unicode @tab Unicode @tab ASCII @tab Unicode
  7384. @item network @tab yes @tab yes @tab yes @tab yes
  7385. @item ATA/AHCI @tab yes @tab yes @tab yes @tab no
  7386. @item AT keyboard @tab yes @tab yes @tab yes @tab no
  7387. @item Speaker @tab yes @tab yes @tab yes @tab no
  7388. @item USB @tab yes @tab yes @tab yes @tab no
  7389. @item chainloader @tab local @tab local @tab no @tab local
  7390. @item cpuid @tab partial @tab partial @tab partial @tab no
  7391. @item rdmsr @tab partial @tab partial @tab partial @tab no
  7392. @item wrmsr @tab partial @tab partial @tab partial @tab no
  7393. @item hints @tab guess @tab guess @tab good @tab guess
  7394. @item PCI @tab yes @tab yes @tab yes @tab no
  7395. @item badram @tab yes @tab yes @tab no @tab yes
  7396. @item compression @tab no @tab no @tab no @tab no
  7397. @item exit @tab yes @tab yes @tab yes @tab yes
  7398. @item bootlocation @tab file @tab file @tab file, ignored @tab file
  7399. @end multitable
  7400. @multitable @columnfractions .20 .20 .20 .20 .20
  7401. @item @tab Loongson @tab sparc64 @tab Powerpc @tab ARC
  7402. @item video @tab yes @tab no @tab yes @tab no
  7403. @item console charset @tab N/A @tab ASCII @tab ASCII @tab ASCII
  7404. @item network @tab no @tab yes (*) @tab yes @tab no
  7405. @item ATA/AHCI @tab yes @tab no @tab no @tab no
  7406. @item AT keyboard @tab yes @tab no @tab no @tab no
  7407. @item Speaker @tab no @tab no @tab no @tab no
  7408. @item USB @tab yes @tab no @tab no @tab no
  7409. @item chainloader @tab yes @tab no @tab no @tab no
  7410. @item cpuid @tab no @tab no @tab no @tab no
  7411. @item rdmsr @tab no @tab no @tab no @tab no
  7412. @item wrmsr @tab no @tab no @tab no @tab no
  7413. @item hints @tab good @tab good @tab good @tab no
  7414. @item PCI @tab yes @tab no @tab no @tab no
  7415. @item badram @tab yes (*) @tab no @tab no @tab no
  7416. @item compression @tab configurable @tab no @tab no @tab configurable
  7417. @item exit @tab no @tab yes @tab yes @tab yes
  7418. @item bootlocation @tab no @tab partition @tab file @tab file (*)
  7419. @end multitable
  7420. @multitable @columnfractions .20 .20 .20 .20 .20
  7421. @item @tab MIPS qemu @tab emu @tab xen
  7422. @item video @tab no @tab yes @tab no
  7423. @item console charset @tab CP437 @tab Unicode (*) @tab ASCII
  7424. @item network @tab no @tab yes @tab no
  7425. @item ATA/AHCI @tab yes @tab no @tab no
  7426. @item AT keyboard @tab yes @tab no @tab no
  7427. @item Speaker @tab no @tab no @tab no
  7428. @item USB @tab N/A @tab yes @tab no
  7429. @item chainloader @tab yes @tab no @tab yes
  7430. @item cpuid @tab no @tab no @tab yes
  7431. @item rdmsr @tab no @tab no @tab yes
  7432. @item wrmsr @tab no @tab no @tab yes
  7433. @item hints @tab guess @tab no @tab no
  7434. @item PCI @tab no @tab no @tab no
  7435. @item badram @tab yes (*) @tab no @tab no
  7436. @item compression @tab configurable @tab no @tab no
  7437. @item exit @tab no @tab yes @tab no
  7438. @item bootlocation @tab no @tab file @tab no
  7439. @end multitable
  7440. @node Platform-specific operations
  7441. @chapter Outline
  7442. Some platforms have features which allows to implement
  7443. some commands useless or not implementable on others.
  7444. Quick summary:
  7445. Information retrieval:
  7446. @itemize
  7447. @item mipsel-loongson: lsspd
  7448. @item mips-arc: lsdev
  7449. @item efi: lsefisystab, lssal, lsefimmap, lsefi
  7450. @item i386-pc: lsapm
  7451. @item i386-coreboot: lscoreboot, coreboot_boottime, cbmemc
  7452. @item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi): lsacpi
  7453. @end itemize
  7454. Workarounds for platform-specific issues:
  7455. @itemize
  7456. @item i386-efi/x86_64-efi: loadbios, fakebios, fix_video
  7457. @item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi):
  7458. acpi (override ACPI tables)
  7459. @item i386-pc: drivemap
  7460. @item i386-pc: sendkey
  7461. @end itemize
  7462. Advanced operations for power users:
  7463. @itemize
  7464. @item x86: iorw (direct access to I/O ports)
  7465. @end itemize
  7466. Miscellaneous:
  7467. @itemize
  7468. @item cmos (x86-*, ieee1275, mips-qemu_mips, mips-loongson): cmostest
  7469. (used on some laptops to check for special power-on key), cmosclean
  7470. @item i386-pc: play
  7471. @end itemize
  7472. @node Supported kernels
  7473. @chapter Supported boot targets
  7474. 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.
  7475. @multitable @columnfractions .50 .22 .22
  7476. @item @tab BIOS @tab Coreboot
  7477. @item BIOS chainloading @tab yes @tab no (1)
  7478. @item NTLDR @tab yes @tab no (1)
  7479. @item Plan9 @tab yes @tab no (1)
  7480. @item Freedos @tab yes @tab no (1)
  7481. @item FreeBSD bootloader @tab yes @tab crashes (1)
  7482. @item 32-bit kFreeBSD @tab yes @tab crashes (5)
  7483. @item 64-bit kFreeBSD @tab yes @tab crashes (5)
  7484. @item 32-bit kNetBSD @tab yes @tab crashes (1)
  7485. @item 64-bit kNetBSD @tab yes @tab crashes
  7486. @item 32-bit kOpenBSD @tab yes @tab yes
  7487. @item 64-bit kOpenBSD @tab yes @tab yes
  7488. @item Multiboot @tab yes @tab yes
  7489. @item Multiboot2 @tab yes @tab yes
  7490. @item 32-bit Linux (legacy protocol) @tab yes @tab no (1)
  7491. @item 64-bit Linux (legacy protocol) @tab yes @tab no (1)
  7492. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  7493. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  7494. @item 32-bit XNU @tab yes @tab ?
  7495. @item 64-bit XNU @tab yes @tab ?
  7496. @item 32-bit EFI chainloader @tab no (2) @tab no (2)
  7497. @item 64-bit EFI chainloader @tab no (2) @tab no (2)
  7498. @item Appleloader @tab no (2) @tab no (2)
  7499. @end multitable
  7500. @multitable @columnfractions .50 .22 .22
  7501. @item @tab Multiboot @tab Qemu
  7502. @item BIOS chainloading @tab no (1) @tab no (1)
  7503. @item NTLDR @tab no (1) @tab no (1)
  7504. @item Plan9 @tab no (1) @tab no (1)
  7505. @item FreeDOS @tab no (1) @tab no (1)
  7506. @item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
  7507. @item 32-bit kFreeBSD @tab crashes (5) @tab crashes (5)
  7508. @item 64-bit kFreeBSD @tab crashes (5) @tab crashes (5)
  7509. @item 32-bit kNetBSD @tab crashes (1) @tab crashes (1)
  7510. @item 64-bit kNetBSD @tab yes @tab yes
  7511. @item 32-bit kOpenBSD @tab yes @tab yes
  7512. @item 64-bit kOpenBSD @tab yes @tab yes
  7513. @item Multiboot @tab yes @tab yes
  7514. @item Multiboot2 @tab yes @tab yes
  7515. @item 32-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7516. @item 64-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7517. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  7518. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  7519. @item 32-bit XNU @tab ? @tab ?
  7520. @item 64-bit XNU @tab ? @tab ?
  7521. @item 32-bit EFI chainloader @tab no (2) @tab no (2)
  7522. @item 64-bit EFI chainloader @tab no (2) @tab no (2)
  7523. @item Appleloader @tab no (2) @tab no (2)
  7524. @end multitable
  7525. @multitable @columnfractions .50 .22 .22
  7526. @item @tab ia32 EFI @tab amd64 EFI
  7527. @item BIOS chainloading @tab no (1) @tab no (1)
  7528. @item NTLDR @tab no (1) @tab no (1)
  7529. @item Plan9 @tab no (1) @tab no (1)
  7530. @item FreeDOS @tab no (1) @tab no (1)
  7531. @item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
  7532. @item 32-bit kFreeBSD @tab headless @tab headless
  7533. @item 64-bit kFreeBSD @tab headless @tab headless
  7534. @item 32-bit kNetBSD @tab crashes (1) @tab crashes (1)
  7535. @item 64-bit kNetBSD @tab yes @tab yes
  7536. @item 32-bit kOpenBSD @tab headless @tab headless
  7537. @item 64-bit kOpenBSD @tab headless @tab headless
  7538. @item Multiboot @tab yes @tab yes
  7539. @item Multiboot2 @tab yes @tab yes
  7540. @item 32-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7541. @item 64-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7542. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  7543. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  7544. @item 32-bit XNU @tab yes @tab yes
  7545. @item 64-bit XNU @tab yes (4) @tab yes
  7546. @item 32-bit EFI chainloader @tab yes @tab no (3)
  7547. @item 64-bit EFI chainloader @tab no (3) @tab yes
  7548. @item Appleloader @tab yes @tab yes
  7549. @end multitable
  7550. @multitable @columnfractions .50 .22 .22
  7551. @item @tab ia32 IEEE1275
  7552. @item BIOS chainloading @tab no (1)
  7553. @item NTLDR @tab no (1)
  7554. @item Plan9 @tab no (1)
  7555. @item FreeDOS @tab no (1)
  7556. @item FreeBSD bootloader @tab crashes (1)
  7557. @item 32-bit kFreeBSD @tab crashes (5)
  7558. @item 64-bit kFreeBSD @tab crashes (5)
  7559. @item 32-bit kNetBSD @tab crashes (1)
  7560. @item 64-bit kNetBSD @tab ?
  7561. @item 32-bit kOpenBSD @tab ?
  7562. @item 64-bit kOpenBSD @tab ?
  7563. @item Multiboot @tab ?
  7564. @item Multiboot2 @tab ?
  7565. @item 32-bit Linux (legacy protocol) @tab no (1)
  7566. @item 64-bit Linux (legacy protocol) @tab no (1)
  7567. @item 32-bit Linux (modern protocol) @tab ?
  7568. @item 64-bit Linux (modern protocol) @tab ?
  7569. @item 32-bit XNU @tab ?
  7570. @item 64-bit XNU @tab ?
  7571. @item 32-bit EFI chainloader @tab no (2)
  7572. @item 64-bit EFI chainloader @tab no (2)
  7573. @item Appleloader @tab no (2)
  7574. @end multitable
  7575. @enumerate
  7576. @item Requires BIOS
  7577. @item EFI only
  7578. @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
  7579. @item Some modules may need to be disabled
  7580. @item Requires ACPI
  7581. @end enumerate
  7582. PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
  7583. and multiboot2.
  7584. @section Boot tests
  7585. 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.
  7586. Following variables must be defined:
  7587. @multitable @columnfractions .30 .65
  7588. @item GRUB_PAYLOADS_DIR @tab directory containing the required kernels
  7589. @item GRUB_CBFSTOOL @tab cbfstool from Coreboot package (for coreboot platform only)
  7590. @item GRUB_COREBOOT_ROM @tab empty Coreboot ROM
  7591. @item GRUB_QEMU_OPTS @tab additional options to be supplied to QEMU
  7592. @end multitable
  7593. Required files are:
  7594. @multitable @columnfractions .40 .55
  7595. @item kfreebsd_env.i386 @tab 32-bit kFreeBSD device hints
  7596. @item kfreebsd.i386 @tab 32-bit FreeBSD kernel image
  7597. @item kfreebsd.x86_64, kfreebsd_env.x86_64 @tab same from 64-bit kFreeBSD
  7598. @item knetbsd.i386 @tab 32-bit NetBSD kernel image
  7599. @item knetbsd.miniroot.i386 @tab 32-bit kNetBSD miniroot.kmod.
  7600. @item knetbsd.x86_64, knetbsd.miniroot.x86_64 @tab same from 64-bit kNetBSD
  7601. @item kopenbsd.i386 @tab 32-bit OpenBSD kernel bsd.rd image
  7602. @item kopenbsd.x86_64 @tab same from 64-bit kOpenBSD
  7603. @item linux.i386 @tab 32-bit Linux
  7604. @item linux.x86_64 @tab 64-bit Linux
  7605. @end multitable
  7606. @node Troubleshooting
  7607. @chapter Error messages produced by GRUB
  7608. @menu
  7609. * GRUB only offers a rescue shell::
  7610. * Firmware stalls instead of booting GRUB::
  7611. @end menu
  7612. @node GRUB only offers a rescue shell
  7613. @section GRUB only offers a rescue shell
  7614. GRUB's normal start-up procedure involves setting the @samp{prefix}
  7615. environment variable to a value set in the core image by
  7616. @command{grub-install}, setting the @samp{root} variable to match, loading
  7617. the @samp{normal} module from the prefix, and running the @samp{normal}
  7618. command (@pxref{normal}). This command is responsible for reading
  7619. @file{/boot/grub/grub.cfg}, running the menu, and doing all the useful
  7620. things GRUB is supposed to do.
  7621. If, instead, you only get a rescue shell, this usually means that GRUB
  7622. failed to load the @samp{normal} module for some reason. It may be possible
  7623. to work around this temporarily: for instance, if the reason for the failure
  7624. is that @samp{prefix} is wrong (perhaps it refers to the wrong device, or
  7625. perhaps the path to @file{/boot/grub} was not correctly made relative to the
  7626. device), then you can correct this and enter normal mode manually:
  7627. @example
  7628. @group
  7629. # Inspect the current prefix (and other preset variables):
  7630. set
  7631. # Find out which devices are available:
  7632. ls
  7633. # Set to the correct value, which might be something like this:
  7634. set prefix=(hd0,1)/grub
  7635. set root=(hd0,1)
  7636. insmod normal
  7637. normal
  7638. @end group
  7639. @end example
  7640. However, any problem that leaves you in the rescue shell probably means that
  7641. GRUB was not correctly installed. It may be more useful to try to reinstall
  7642. it properly using @kbd{grub-install @var{device}} (@pxref{Invoking
  7643. grub-install}). When doing this, there are a few things to remember:
  7644. @itemize @bullet{}
  7645. @item
  7646. Drive ordering in your operating system may not be the same as the boot
  7647. drive ordering used by your firmware. Do not assume that your first hard
  7648. drive (e.g. @samp{/dev/sda}) is the one that your firmware will boot from.
  7649. @file{device.map} (@pxref{Device map}) can be used to override this, but it
  7650. is usually better to use UUIDs or file system labels and avoid depending on
  7651. drive ordering entirely.
  7652. @item
  7653. At least on BIOS systems, if you tell @command{grub-install} to install GRUB
  7654. to a partition but GRUB has already been installed in the master boot
  7655. record, then the GRUB installation in the partition will be ignored.
  7656. @item
  7657. If possible, it is generally best to avoid installing GRUB to a partition
  7658. (unless it is a special partition for the use of GRUB alone, such as the
  7659. BIOS Boot Partition used on GPT). Doing this means that GRUB may stop being
  7660. able to read its core image due to a file system moving blocks around, such
  7661. as while defragmenting, running checks, or even during normal operation.
  7662. Installing to the whole disk device is normally more robust.
  7663. @item
  7664. Check that GRUB actually knows how to read from the device and file system
  7665. containing @file{/boot/grub}. It will not be able to read from encrypted
  7666. devices with unsupported encryption scheme, nor from file systems for which
  7667. support has not yet been added to GRUB.
  7668. @end itemize
  7669. @node Firmware stalls instead of booting GRUB
  7670. @section Firmware stalls instead of booting GRUB
  7671. The EFI implementation of some older MacBook laptops stalls when it gets
  7672. presented a grub-mkrescue ISO image for x86_64-efi target on an USB stick.
  7673. Affected are models of year 2010 or earlier. Workaround is to zeroize the
  7674. bytes 446 to 461 of the EFI partition, where mformat has put a partition table
  7675. entry which claims partition start at block 0. This change will not hamper
  7676. bootability on other machines.
  7677. @node User-space utilities
  7678. @chapter User-space utilities
  7679. @menu
  7680. * Invoking grub-install:: How to use the GRUB installer
  7681. * Invoking grub-mkconfig:: Generate a GRUB configuration file
  7682. * Invoking grub-mkpasswd-pbkdf2::
  7683. Generate GRUB password hashes
  7684. * Invoking grub-mkrelpath:: Make system path relative to its root
  7685. * Invoking grub-mkrescue:: Make a GRUB rescue image
  7686. * Invoking grub-mount:: Mount a file system using GRUB
  7687. * Invoking grub-probe:: Probe device information for GRUB
  7688. * Invoking grub-protect:: Protect a disk key with a key protector
  7689. * Invoking grub-script-check:: Check GRUB script file for syntax errors
  7690. @end menu
  7691. @node Invoking grub-install
  7692. @section Invoking grub-install
  7693. The program @command{grub-install} generates a GRUB core image using
  7694. @command{grub-mkimage} and installs it on your system. You must specify the
  7695. device name on which you want to install GRUB, like this:
  7696. @example
  7697. grub-install @var{install_device}
  7698. @end example
  7699. The device name @var{install_device} is an OS device name or a GRUB
  7700. device name.
  7701. @command{grub-install} accepts the following options:
  7702. @table @option
  7703. @item --help
  7704. Print a summary of the command-line options and exit.
  7705. @item --version
  7706. Print the version number of GRUB and exit.
  7707. @item --boot-directory=@var{dir}
  7708. Install GRUB images under the directory @file{@var{dir}/grub/}
  7709. This option is useful when you want to install GRUB into a
  7710. separate partition or a removable disk.
  7711. If this option is not specified then it defaults to @file{/boot}, so
  7712. @example
  7713. @kbd{grub-install /dev/sda}
  7714. @end example
  7715. is equivalent to
  7716. @example
  7717. @kbd{grub-install --boot-directory=/boot/ /dev/sda}
  7718. @end example
  7719. Here is an example in which you have a separate @dfn{boot} partition which is
  7720. mounted on
  7721. @file{/mnt/boot}:
  7722. @example
  7723. @kbd{grub-install --boot-directory=/mnt/boot /dev/sdb}
  7724. @end example
  7725. @item --recheck
  7726. Recheck the device map, even if @file{/boot/grub/device.map} already
  7727. exists. You should use this option whenever you add/remove a disk
  7728. into/from your computer.
  7729. @item --no-rs-codes
  7730. By default on x86 BIOS systems, @command{grub-install} will use some
  7731. extra space in the bootloader embedding area for Reed-Solomon
  7732. error-correcting codes. This enables GRUB to still boot successfully
  7733. if some blocks are corrupted. The exact amount of protection offered
  7734. is dependent on available space in the embedding area. R sectors of
  7735. redundancy can tolerate up to R/2 corrupted sectors. This
  7736. redundancy may be cumbersome if attempting to cryptographically
  7737. validate the contents of the bootloader embedding area, or in more
  7738. modern systems with GPT-style partition tables (@pxref{BIOS
  7739. installation}) where GRUB does not reside in any unpartitioned space
  7740. outside of the MBR. Disable the Reed-Solomon codes with this option.
  7741. @end table
  7742. @node Invoking grub-mkconfig
  7743. @section Invoking grub-mkconfig
  7744. The program @command{grub-mkconfig} generates a configuration file for GRUB
  7745. (@pxref{Simple configuration}).
  7746. @example
  7747. grub-mkconfig -o /boot/grub/grub.cfg
  7748. @end example
  7749. @command{grub-mkconfig} accepts the following options:
  7750. @table @option
  7751. @item --help
  7752. Print a summary of the command-line options and exit.
  7753. @item --version
  7754. Print the version number of GRUB and exit.
  7755. @item -o @var{file}
  7756. @itemx --output=@var{file}
  7757. Send the generated configuration file to @var{file}. The default is to send
  7758. it to standard output.
  7759. @end table
  7760. @node Invoking grub-mkpasswd-pbkdf2
  7761. @section Invoking grub-mkpasswd-pbkdf2
  7762. The program @command{grub-mkpasswd-pbkdf2} generates password hashes for
  7763. GRUB (@pxref{Security}).
  7764. @example
  7765. grub-mkpasswd-pbkdf2
  7766. @end example
  7767. @command{grub-mkpasswd-pbkdf2} accepts the following options:
  7768. @table @option
  7769. @item -c @var{number}
  7770. @itemx --iteration-count=@var{number}
  7771. Number of iterations of the underlying pseudo-random function. Defaults to
  7772. 10000.
  7773. @item -l @var{number}
  7774. @itemx --buflen=@var{number}
  7775. Length of the generated hash. Defaults to 64.
  7776. @item -s @var{number}
  7777. @itemx --salt=@var{number}
  7778. Length of the salt. Defaults to 64.
  7779. @end table
  7780. @node Invoking grub-mkrelpath
  7781. @section Invoking grub-mkrelpath
  7782. The program @command{grub-mkrelpath} makes a file system path relative to
  7783. the root of its containing file system. For instance, if @file{/usr} is a
  7784. mount point, then:
  7785. @example
  7786. $ @kbd{grub-mkrelpath /usr/share/grub/unicode.pf2}
  7787. @samp{/share/grub/unicode.pf2}
  7788. @end example
  7789. This is mainly used internally by other GRUB utilities such as
  7790. @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig}), but may
  7791. occasionally also be useful for debugging.
  7792. @command{grub-mkrelpath} accepts the following options:
  7793. @table @option
  7794. @item --help
  7795. Print a summary of the command-line options and exit.
  7796. @item --version
  7797. Print the version number of GRUB and exit.
  7798. @end table
  7799. @node Invoking grub-mkrescue
  7800. @section Invoking grub-mkrescue
  7801. The program @command{grub-mkrescue} generates a bootable GRUB rescue image
  7802. (@pxref{Making a GRUB bootable CD-ROM}).
  7803. @example
  7804. grub-mkrescue -o grub.iso
  7805. @end example
  7806. All arguments not explicitly listed as @command{grub-mkrescue} options are
  7807. passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
  7808. Options passed to @command{xorriso} will normally be interpreted as
  7809. @command{mkisofs} options; if the option @samp{--} is used, then anything
  7810. after that will be interpreted as native @command{xorriso} options.
  7811. Non-option arguments specify additional source directories. This is
  7812. commonly used to add extra files to the image:
  7813. @example
  7814. mkdir -p disk/boot/grub
  7815. @r{(add extra files to @file{disk/boot/grub})}
  7816. grub-mkrescue -o grub.iso disk
  7817. @end example
  7818. @command{grub-mkrescue} accepts the following options:
  7819. @table @option
  7820. @item --help
  7821. Print a summary of the command-line options and exit.
  7822. @item --version
  7823. Print the version number of GRUB and exit.
  7824. @item -o @var{file}
  7825. @itemx --output=@var{file}
  7826. Save output in @var{file}. This "option" is required.
  7827. @item --modules=@var{modules}
  7828. Pre-load the named GRUB modules in the image. Multiple entries in
  7829. @var{modules} should be separated by whitespace (so you will probably need
  7830. to quote this for your shell).
  7831. @item --rom-directory=@var{dir}
  7832. If generating images for the QEMU or Coreboot platforms, copy the resulting
  7833. @file{qemu.img} or @file{coreboot.elf} files respectively to the @var{dir}
  7834. directory as well as including them in the image.
  7835. @item --xorriso=@var{file}
  7836. Use @var{file} as the @command{xorriso} program, rather than the built-in
  7837. default.
  7838. @item --grub-mkimage=@var{file}
  7839. Use @var{file} as the @command{grub-mkimage} program, rather than the
  7840. built-in default.
  7841. @end table
  7842. @node Invoking grub-mount
  7843. @section Invoking grub-mount
  7844. The program @command{grub-mount} performs a read-only mount of any file
  7845. system or file system image that GRUB understands, using GRUB's file system
  7846. drivers via FUSE. (It is only available if FUSE development files were
  7847. present when GRUB was built.) This has a number of uses:
  7848. @itemize @bullet
  7849. @item
  7850. It provides a convenient way to check how GRUB will view a file system at
  7851. boot time. You can use normal command-line tools to compare that view with
  7852. that of your operating system, making it easy to find bugs.
  7853. @item
  7854. It offers true read-only mounts. Linux does not have these for journalling
  7855. file systems, because it will always attempt to replay the journal at mount
  7856. time; while you can temporarily mark the block device read-only to avoid
  7857. this, that causes the mount to fail. Since GRUB intentionally contains no
  7858. code for writing to file systems, it can easily provide a guaranteed
  7859. read-only mount mechanism.
  7860. @item
  7861. It allows you to examine any file system that GRUB understands without
  7862. needing to load additional modules into your running kernel, which may be
  7863. useful in constrained environments such as installers.
  7864. @item
  7865. Since it can examine file system images (contained in regular files) just as
  7866. easily as file systems on block devices, you can use it to inspect any file
  7867. system image that GRUB understands with only enough privileges to use FUSE,
  7868. even if nobody has yet written a FUSE module specifically for that file
  7869. system type.
  7870. @end itemize
  7871. Using @command{grub-mount} is normally as simple as:
  7872. @example
  7873. grub-mount /dev/sda1 /mnt
  7874. @end example
  7875. @command{grub-mount} must be given one or more images and a mount point as
  7876. non-option arguments (if it is given more than one image, it will treat them
  7877. as a RAID set), and also accepts the following options:
  7878. @table @option
  7879. @item --help
  7880. Print a summary of the command-line options and exit.
  7881. @item --version
  7882. Print the version number of GRUB and exit.
  7883. @item -C
  7884. @itemx --crypto
  7885. Mount encrypted devices, prompting for a passphrase if necessary.
  7886. @item -d @var{string}
  7887. @itemx --debug=@var{string}
  7888. Show debugging output for conditions matching @var{string}.
  7889. @item -K prompt|@var{file}
  7890. @itemx --zfs-key=prompt|@var{file}
  7891. Load a ZFS encryption key. If you use @samp{prompt} as the argument,
  7892. @command{grub-mount} will read a passphrase from the terminal; otherwise, it
  7893. will read key material from the specified file.
  7894. @item -r @var{device}
  7895. @itemx --root=@var{device}
  7896. Set the GRUB root device to @var{device}. You do not normally need to set
  7897. this; @command{grub-mount} will automatically set the root device to the
  7898. root of the supplied file system.
  7899. If @var{device} is just a number, then it will be treated as a partition
  7900. number within the supplied image. This means that, if you have an image of
  7901. an entire disk in @file{disk.img}, then you can use this command to mount
  7902. its second partition:
  7903. @example
  7904. grub-mount -r 2 disk.img mount-point
  7905. @end example
  7906. @item -v
  7907. @itemx --verbose
  7908. Print verbose messages.
  7909. @end table
  7910. @node Invoking grub-probe
  7911. @section Invoking grub-probe
  7912. The program @command{grub-probe} probes device information for a given path
  7913. or device.
  7914. @example
  7915. grub-probe --target=fs /boot/grub
  7916. grub-probe --target=drive --device /dev/sda1
  7917. @end example
  7918. @command{grub-probe} must be given a path or device as a non-option
  7919. argument, and also accepts the following options:
  7920. @table @option
  7921. @item --help
  7922. Print a summary of the command-line options and exit.
  7923. @item --version
  7924. Print the version number of GRUB and exit.
  7925. @item -d
  7926. @itemx --device
  7927. If this option is given, then the non-option argument is a system device
  7928. name (such as @samp{/dev/sda1}), and @command{grub-probe} will print
  7929. information about that device. If it is not given, then the non-option
  7930. argument is a filesystem path (such as @samp{/boot/grub}), and
  7931. @command{grub-probe} will print information about the device containing that
  7932. part of the filesystem.
  7933. @item -m @var{file}
  7934. @itemx --device-map=@var{file}
  7935. Use @var{file} as the device map (@pxref{Device map}) rather than the
  7936. default, usually @samp{/boot/grub/device.map}.
  7937. @item -t @var{target}
  7938. @itemx --target=@var{target}
  7939. Print information about the given path or device as defined by @var{target}.
  7940. The available targets and their meanings are:
  7941. @table @samp
  7942. @item fs
  7943. GRUB filesystem module.
  7944. @item fs_uuid
  7945. Filesystem Universally Unique Identifier (UUID).
  7946. @item fs_label
  7947. Filesystem label.
  7948. @item drive
  7949. GRUB device name.
  7950. @item device
  7951. System device name.
  7952. @item partmap
  7953. GRUB partition map module.
  7954. @item abstraction
  7955. GRUB abstraction module (e.g. @samp{lvm}).
  7956. @item cryptodisk_uuid
  7957. Crypto device UUID.
  7958. @item msdos_parttype
  7959. MBR partition type code (two hexadecimal digits).
  7960. @item hints_string
  7961. A string of platform search hints suitable for passing to the
  7962. @command{search} command (@pxref{search}).
  7963. @item bios_hints
  7964. Search hints for the PC BIOS platform.
  7965. @item ieee1275_hints
  7966. Search hints for the IEEE1275 platform.
  7967. @item baremetal_hints
  7968. Search hints for platforms where disks are addressed directly rather than
  7969. via firmware.
  7970. @item efi_hints
  7971. Search hints for the EFI platform.
  7972. @item arc_hints
  7973. Search hints for the ARC platform.
  7974. @item compatibility_hint
  7975. A guess at a reasonable GRUB drive name for this device, which may be
  7976. used as a fallback if the @command{search} command fails.
  7977. @item disk
  7978. System device name for the whole disk.
  7979. @end table
  7980. @item -v
  7981. @itemx --verbose
  7982. Print verbose messages.
  7983. @end table
  7984. @node Invoking grub-protect
  7985. @section Invoking grub-protect
  7986. The program @command{grub-protect} protects a disk encryption key with
  7987. a specified key protector.
  7988. @table @option
  7989. @item --help
  7990. Print a summary of the command-line options and exit.
  7991. @item --version
  7992. Print the version number of GRUB and exit.
  7993. @item -a add|remove
  7994. @itemx --action=add|remove
  7995. Add or remove a key protector to or from a key.
  7996. @item -p @var{protector}
  7997. @itemx --protector=@var{protector}
  7998. Set the key protector. Currently, @samp{tpm2} is the only supported key
  7999. protector.
  8000. @item --tpm2-asymmetric=@var{type}
  8001. Choose the the type of SRK. The valid options are @samp{RSA} (@samp{RSA2048})
  8002. and @samp{ECC} (@samp{ECC_NIST_P256}).(default: @samp{ECC})
  8003. @item --tpm2-bank=@var{alg}
  8004. Choose bank of PCRs used to authorize key release: @samp{SHA1}, @samp{SHA256},
  8005. @samp{SHA384}, or @samp{SHA512}. (default: @samp{SHA256})
  8006. @item --tpm2-device=@var{device}
  8007. Set the path to the TPM2 device. (default: @samp{/dev/tpm0})
  8008. @item --tpm2-evict
  8009. Evict a previously persisted SRK from the TPM, if any.
  8010. @item --tpm2-keyfile=@var{file}
  8011. Set the path to a file that contains the cleartext key to protect.
  8012. @item --tpm2-outfile=@var{file}
  8013. Set the path to the file that will contain the key after sealing
  8014. (must be accessible to GRUB during boot).
  8015. @item --tpm2-pcrs=@var{pcrs}
  8016. Set a comma-separated list of PCRs used to authorize key release e.g., @samp{7,11}.
  8017. Please be aware that PCR 0~7 are used by the firmware and the measurement result
  8018. may change after a firmware update (for baremetal systems) or a package
  8019. (OVMF/SLOF) update in the VM host. This may lead to the failure of key
  8020. unsealing. (default: @samp{7})
  8021. @item --tpm2-srk=@var{handle}
  8022. Set the SRK handle, e.g. @samp{0x81000000}, if the SRK is to be made persistent.
  8023. @item --tpm2key
  8024. Use TPM 2.0 Key File format.
  8025. @end table
  8026. Before sealing the key, please check the TPM PCR usage
  8027. (@pxref{TPM2 key protector, TPM PCR usage}) to choose a proper set of PCRs.
  8028. Assume that there is a key file, @file{luks.key}, to be sealed with PCR 0, 2,
  8029. 4, and 7, and here is the @command{grub-protect} command to create the sealed
  8030. key file:
  8031. @example
  8032. @group
  8033. # @kbd{grub-protect --action=add \
  8034. --protector=tpm2 \
  8035. --tpm2-pcrs=0,2,4,7 \
  8036. --tpm2key \
  8037. --tpm2-keyfile=luks.key \
  8038. --tpm2-outfile=/boot/efi/efi/grub/sealed.tpm}
  8039. @end group
  8040. @end example
  8041. Then, GRUB can unlock the target partition with the following commands:
  8042. @example
  8043. grub> @kbd{tpm2_key_protector_init -T (hd0,gpt1)/efi/grub/sealed.tpm}
  8044. grub> @kbd{cryptomount -u <UUID> -P tpm2}
  8045. @end example
  8046. In most of cases, the user only needs to create the key with the `add' action.
  8047. If auto-unlocking is unwanted, just remove the file and the
  8048. @command{tpm2_key_protector_init} command and invoke the @command{cryptomount}
  8049. command without @kbd{-P tpm2}.
  8050. The only use case for the `remove' action is when the SRK is made persistent.
  8051. There are two supported SRKs in @command{grub-protect}: @samp{RSA} and @samp{ECC}.
  8052. Due to slower key generation, some users of the @samp{RSA} SRK may prefer
  8053. making it persistent so that the TPM can skip the SRK generation when GRUB tries
  8054. to unseal the key.
  8055. The available persistent handles can be checked with @command{tpm2_getcap}.
  8056. @example
  8057. @group
  8058. # @kbd{tpm2_getcap properties-variable}
  8059. ...
  8060. TPM2_PT_HR_PERSISTENT: 0x0
  8061. TPM2_PT_HR_PERSISTENT_AVAIL: 0x41
  8062. ...
  8063. @end group
  8064. @end example
  8065. In this system, there is no persistent handle. A TPM handle is an unsigned
  8066. 32-bit integer, and the persistent handles starts with @samp{0x81}. Here
  8067. we choose the well-known persistent handle: @samp{0x81000000}.
  8068. @example
  8069. @group
  8070. # @kbd{grub-protect --action=add \
  8071. --protector=tpm2 \
  8072. --tpm2-pcrs=0,2,4,7 \
  8073. --tpm2-asymmetric=RSA \
  8074. --tpm2-srk=0x81000000 \
  8075. --tpm2key \
  8076. --tpm2-keyfile=luks.key \
  8077. --tpm2-outfile=/boot/efi/efi/grub/sealed.tpm}
  8078. @end group
  8079. @end example
  8080. The additional @kbd{--tpm2-asymmetric=RSA} and @kbd{--tpm2-srk=0x81000000}
  8081. options are used to make the key sealed with the RSA SRK and store the SRK
  8082. in @samp{0x81000000}.
  8083. For the @command{tpm2_key_protector_init} command, the additional @kbd{-s 0x81000000}
  8084. informs the TPM2 key protector to fetch the SRK from @samp{0x81000000}.
  8085. @example
  8086. grub> @kbd{tpm2_key_protector_init -s 0x81000000 -T (hd0,gpt1)/efi/grub/sealed.tpm}
  8087. grub> @kbd{cryptomount -u <UUID> -P tpm2}
  8088. @end example
  8089. After making the SRK handle persistent, we can check the status of the
  8090. persistent handles with @command{tpm2_getcap}.
  8091. @example
  8092. @group
  8093. # @kbd{tpm2_getcap properties-variable}
  8094. ...
  8095. TPM2_PT_HR_PERSISTENT: 0x1
  8096. TPM2_PT_HR_PERSISTENT_AVAIL: 0x40
  8097. ...
  8098. # @kbd{tpm2_getcap handles-persistent}
  8099. - 0x81000000
  8100. @end group
  8101. @end example
  8102. The sealed key can be removed once the user does not want to use the TPM2 key
  8103. protector anymore. Here is the command to remove the persistent SRK handle
  8104. (@samp{0x81000000}) with @kbd{--tpm2-srk} and @kbd{--tpm2-evict}.
  8105. @example
  8106. @group
  8107. # @kbd{grub-protect --action=remove \
  8108. --protector=tpm2 \
  8109. --tpm2-srk 0x81000000 \
  8110. --tpm2-evict}
  8111. @end group
  8112. @end example
  8113. @node Invoking grub-script-check
  8114. @section Invoking grub-script-check
  8115. The program @command{grub-script-check} takes a GRUB script file
  8116. (@pxref{Shell-like scripting}) and checks it for syntax errors, similar to
  8117. commands such as @command{sh -n}. It may take a @var{path} as a non-option
  8118. argument; if none is supplied, it will read from standard input.
  8119. @example
  8120. grub-script-check /boot/grub/grub.cfg
  8121. @end example
  8122. @command{grub-script-check} accepts the following options:
  8123. @table @option
  8124. @item --help
  8125. Print a summary of the command-line options and exit.
  8126. @item --version
  8127. Print the version number of GRUB and exit.
  8128. @item -v
  8129. @itemx --verbose
  8130. Print each line of input after reading it.
  8131. @end table
  8132. @node Obtaining and Building GRUB
  8133. @appendix How to obtain and build GRUB
  8134. @quotation
  8135. @strong{Caution:} GRUB requires binutils-2.9.1.0.23 or later because the
  8136. GNU assembler has been changed so that it can produce real 16bits
  8137. machine code between 2.9.1 and 2.9.1.0.x. See
  8138. @uref{http://sources.redhat.com/binutils/}, to obtain information on
  8139. how to get the latest version.
  8140. @end quotation
  8141. GRUB is available from the GNU alpha archive site
  8142. @uref{ftp://ftp.gnu.org/gnu/grub} or any of its mirrors. The file
  8143. will be named grub-version.tar.gz. The current version is
  8144. @value{VERSION}, so the file you should grab is:
  8145. @uref{ftp://ftp.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz}
  8146. To unbundle GRUB use the instruction:
  8147. @example
  8148. @kbd{zcat grub-@value{VERSION}.tar.gz | tar xvf -}
  8149. @end example
  8150. which will create a directory called @file{grub-@value{VERSION}} with
  8151. all the sources. You can look at the file @file{INSTALL} for detailed
  8152. instructions on how to build and install GRUB, but you should be able to
  8153. just do:
  8154. @example
  8155. @group
  8156. @kbd{cd grub-@value{VERSION}}
  8157. @kbd{./configure}
  8158. @kbd{make install}
  8159. @end group
  8160. @end example
  8161. Also, the latest version is available using Git. See
  8162. @uref{http://www.gnu.org/software/grub/grub-download.html} for more
  8163. information.
  8164. @node Reporting bugs
  8165. @appendix Reporting bugs
  8166. These are the guideline for how to report bugs. Take a look at this
  8167. list below before you submit bugs:
  8168. @enumerate
  8169. @item
  8170. Before getting unsettled, read this manual through and through. Also,
  8171. see the @uref{http://www.gnu.org/software/grub/grub-faq.html, GNU GRUB FAQ}.
  8172. @item
  8173. Always mention the information on your GRUB. The version number and the
  8174. configuration are quite important. If you build it yourself, write the
  8175. options specified to the configure script and your operating system,
  8176. including the versions of gcc and binutils.
  8177. @item
  8178. If you have trouble with the installation, inform us of how you
  8179. installed GRUB. Don't omit error messages, if any. Just @samp{GRUB hangs
  8180. up when it boots} is not enough.
  8181. The information on your hardware is also essential. These are especially
  8182. important: the geometries and the partition tables of your hard disk
  8183. drives and your BIOS.
  8184. @item
  8185. If GRUB cannot boot your operating system, write down
  8186. @emph{everything} you see on the screen. Don't paraphrase them, like
  8187. @samp{The foo OS crashes with GRUB, even though it can boot with the
  8188. bar boot loader just fine}. Mention the commands you executed, the
  8189. messages printed by them, and information on your operating system
  8190. including the version number.
  8191. @item
  8192. Explain what you wanted to do. It is very useful to know your purpose
  8193. and your wish, and how GRUB didn't satisfy you.
  8194. @item
  8195. If you can investigate the problem yourself, please do. That will give
  8196. you and us much more information on the problem. Attaching a patch is
  8197. even better.
  8198. When you attach a patch, make the patch in unified diff format, and
  8199. write ChangeLog entries. But, even when you make a patch, don't forget
  8200. to explain the problem, so that we can understand what your patch is
  8201. for.
  8202. @item
  8203. Write down anything that you think might be related. Please understand
  8204. that we often need to reproduce the same problem you encountered in our
  8205. environment. So your information should be sufficient for us to do the
  8206. same thing---Don't forget that we cannot see your computer directly. If
  8207. you are not sure whether to state a fact or leave it out, state it!
  8208. Reporting too many things is much better than omitting something
  8209. important.
  8210. @end enumerate
  8211. If you follow the guideline above, submit a report to the
  8212. @uref{http://savannah.gnu.org/bugs/?group=grub, Bug Tracking System}.
  8213. Alternatively, you can submit a report via electronic mail to
  8214. @email{bug-grub@@gnu.org}, but we strongly recommend that you use the
  8215. Bug Tracking System, because e-mail can be passed over easily.
  8216. Once we get your report, we will try to fix the bugs.
  8217. @node Future
  8218. @appendix Where GRUB will go
  8219. GRUB 2 is now quite stable and used in many production systems. We are
  8220. currently working towards a 2.0 release.
  8221. If you are interested in the development of GRUB 2, take a look at
  8222. @uref{http://www.gnu.org/software/grub/grub.html, the homepage}.
  8223. @node Copying This Manual
  8224. @appendix Copying This Manual
  8225. @menu
  8226. * GNU Free Documentation License:: License for copying this manual.
  8227. @end menu
  8228. @include fdl.texi
  8229. @node Index
  8230. @unnumbered Index
  8231. @c Currently, we use only the Concept Index.
  8232. @printindex cp
  8233. @bye
  8234. Some notes:
  8235. This is an attempt to make a manual for GRUB 2. The contents are
  8236. copied from the GRUB manual in GRUB Legacy, so they are not always
  8237. appropriate yet for GRUB 2.