grub.texi 379 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409
  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. Note: Only a subset of filesystems are supported in lockdown mode (such
  303. as when secure boot is enabled, @pxref{Lockdown} for more information).
  304. @item Support automatic decompression
  305. Can decompress files which were compressed by @command{gzip} or
  306. @command{xz}@footnote{Only CRC32 data integrity check is supported (xz default
  307. is CRC64 so one should use --check=crc32 option). LZMA BCJ filters are
  308. supported.}. This function is both automatic and transparent to the user
  309. (i.e. all functions operate upon the uncompressed contents of the specified
  310. files). This greatly reduces a file size and loading time, a
  311. particularly great benefit for floppies.@footnote{There are a few
  312. pathological cases where loading a very badly organized ELF kernel might
  313. take longer, but in practice this never happen.}
  314. It is conceivable that some kernel modules should be loaded in a
  315. compressed state, so a different module-loading command can be specified
  316. to avoid uncompressing the modules.
  317. @item Access data on any installed device
  318. Support reading data from any or all floppies or hard disk(s) recognized
  319. by the BIOS, independent of the setting of the root device.
  320. @item Be independent of drive geometry translations
  321. Unlike many other boot loaders, GRUB makes the particular drive
  322. translation irrelevant. A drive installed and running with one
  323. translation may be converted to another translation without any adverse
  324. effects or changes in GRUB's configuration.
  325. @item Detect all installed @sc{ram}
  326. GRUB can generally find all the installed @sc{ram} on a PC-compatible
  327. machine. It uses an advanced BIOS query technique for finding all
  328. memory regions. As described on the Multiboot Specification (@pxref{Top,
  329. Multiboot Specification, Motivation, multiboot, The Multiboot
  330. Specification}), not all kernels make use of this information, but GRUB
  331. provides it for those who do.
  332. @item Support Logical Block Address mode
  333. In traditional disk calls (called @dfn{CHS mode}), there is a geometry
  334. translation problem, that is, the BIOS cannot access over 1024
  335. cylinders, so the accessible space is limited to at least 508 MB and to
  336. at most 8GB. GRUB can't universally solve this problem, as there is no
  337. standard interface used in all machines. However, several newer machines
  338. have the new interface, Logical Block Address (@dfn{LBA}) mode. GRUB
  339. automatically detects if LBA mode is available and uses it if
  340. available. In LBA mode, GRUB can access the entire disk.
  341. @item Support network booting
  342. GRUB is basically a disk-based boot loader but also has network
  343. support. You can load OS images from a network by using the @dfn{TFTP}
  344. protocol.
  345. @item Support remote terminals
  346. To support computers with no console, GRUB provides remote terminal
  347. support, so that you can control GRUB from a remote host. Only serial
  348. terminal support is implemented at the moment.
  349. @end table
  350. @node Role of a boot loader
  351. @section The role of a boot loader
  352. The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
  353. @quotation
  354. Some people like to acknowledge both the operating system and kernel when
  355. they talk about their computers, so they might say they use
  356. ``GNU/Linux'' or ``GNU/Hurd''. Other people seem to think that the
  357. kernel is the most important part of the system, so they like to call
  358. their GNU operating systems ``Linux systems.''
  359. I, personally, believe that this is a grave injustice, because the
  360. @emph{boot loader} is the most important software of all. I used to
  361. refer to the above systems as either ``LILO''@footnote{The LInux LOader,
  362. a boot loader that everybody uses, but nobody likes.} or ``GRUB''
  363. systems.
  364. Unfortunately, nobody ever understood what I was talking about; now I
  365. just use the word ``GNU'' as a pseudonym for GRUB.
  366. So, if you ever hear people talking about their alleged ``GNU'' systems,
  367. remember that they are actually paying homage to the best boot loader
  368. around@dots{} GRUB!
  369. @end quotation
  370. We, the GRUB maintainers, do not (usually) encourage Gordon's level of
  371. fanaticism, but it helps to remember that boot loaders deserve
  372. recognition. We hope that you enjoy using GNU GRUB as much as we did
  373. writing it.
  374. @node Naming convention
  375. @chapter Naming convention
  376. The device syntax used in GRUB is a wee bit different from what you may
  377. have seen before in your operating system(s), and you need to know it so
  378. that you can specify a drive/partition.
  379. Look at the following examples and explanations:
  380. @example
  381. (fd0)
  382. @end example
  383. First of all, GRUB requires that the device name be enclosed with
  384. @samp{(} and @samp{)}. The @samp{fd} part means that it is a floppy
  385. disk. The number @samp{0} is the drive number, which is counted from
  386. @emph{zero}. This expression means that GRUB will use the whole floppy
  387. disk.
  388. @example
  389. (hd0,msdos2)
  390. @end example
  391. Here, @samp{hd} means it is a hard disk drive. The first integer
  392. @samp{0} indicates the drive number, that is, the first hard disk,
  393. the string @samp{msdos} indicates the partition scheme, while
  394. the second integer, @samp{2}, indicates the partition number (or the
  395. @sc{pc} slice number in the BSD terminology). The partition numbers are
  396. counted from @emph{one}, not from zero (as was the case in previous
  397. versions of GRUB). This expression means the second partition of the
  398. first hard disk drive. In this case, GRUB uses one partition of the
  399. disk, instead of the whole disk.
  400. @example
  401. (hd0,msdos5)
  402. @end example
  403. This specifies the first @dfn{extended partition} of the first hard disk
  404. drive. Note that the partition numbers for extended partitions are
  405. counted from @samp{5}, regardless of the actual number of primary
  406. partitions on your hard disk.
  407. @example
  408. (hd1,msdos1,bsd1)
  409. @end example
  410. This means the BSD @samp{a} partition on first @sc{pc} slice number
  411. of the second hard disk.
  412. Of course, to actually access the disks or partitions with GRUB, you
  413. need to use the device specification in a command, like @samp{set
  414. root=(fd0)} or @samp{parttool (hd0,msdos3) hidden-}. To help you find out
  415. which number specifies a partition you want, the GRUB command-line
  416. (@pxref{Command-line interface}) options have argument
  417. completion. This means that, for example, you only need to type
  418. @example
  419. set root=(
  420. @end example
  421. followed by a @key{TAB}, and GRUB will display the list of drives,
  422. partitions, or file names. So it should be quite easy to determine the
  423. name of your target partition, even with minimal knowledge of the
  424. syntax.
  425. Note that GRUB does @emph{not} distinguish IDE from SCSI - it simply
  426. counts the drive numbers from zero, regardless of their type. Normally,
  427. any IDE drive number is less than any SCSI drive number, although that
  428. is not true if you change the boot sequence by swapping IDE and SCSI
  429. drives in your BIOS.
  430. Now the question is, how to specify a file? Again, consider an
  431. example:
  432. @example
  433. (hd0,msdos1)/vmlinuz
  434. @end example
  435. This specifies the file named @samp{vmlinuz}, found on the first
  436. partition of the first hard disk drive. Note that the argument
  437. completion works with file names, too.
  438. That was easy, admit it. Now read the next chapter, to find out how to
  439. actually install GRUB on your drive.
  440. @node OS-specific notes about grub tools
  441. @chapter OS-specific notes about grub tools
  442. On OS which have device nodes similar to Unix-like OS GRUB tools use the
  443. OS name. E.g. for GNU/Linux:
  444. @example
  445. # @kbd{grub-install /dev/sda}
  446. @end example
  447. On AROS we use another syntax. For volumes:
  448. @example
  449. //:<volume name>
  450. @end example
  451. E.g.
  452. @example
  453. //:DH0
  454. @end example
  455. For disks we use syntax:
  456. @example
  457. //:<driver name>/unit/flags
  458. @end example
  459. E.g.
  460. @example
  461. # @kbd{grub-install //:ata.device/0/0}
  462. @end example
  463. On Windows we use UNC path. For volumes it's typically
  464. @example
  465. \\?\Volume@{<GUID>@}
  466. \\?\<drive letter>:
  467. @end example
  468. E.g.
  469. @example
  470. \\?\Volume@{17f34d50-cf64-4b02-800e-51d79c3aa2ff@}
  471. \\?\C:
  472. @end example
  473. For disks it's
  474. @example
  475. \\?\PhysicalDrive<number>
  476. @end example
  477. E.g.
  478. @example
  479. # @kbd{grub-install \\?\PhysicalDrive0}
  480. @end example
  481. Beware that you may need to further escape the backslashes depending on your
  482. shell.
  483. When compiled with cygwin support then cygwin drive names are automatically
  484. when needed. E.g.
  485. @example
  486. # @kbd{grub-install /dev/sda}
  487. @end example
  488. @node Installation
  489. @chapter Installation
  490. In order to install GRUB as your boot loader, you need to first
  491. install the GRUB system and utilities under your UNIX-like operating
  492. system (@pxref{Obtaining and Building GRUB}). You can do this either
  493. from the source tarball, or as a package for your OS.
  494. After you have done that, you need to install the boot loader on a
  495. drive (floppy or hard disk) by using the utility
  496. @command{grub-install} (@pxref{Invoking grub-install}) on a UNIX-like OS.
  497. GRUB comes with boot images, which are normally put in the directory
  498. @file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines
  499. @file{/usr/lib/grub/i386-pc}). Hereafter, the directory where GRUB images are
  500. initially placed (normally @file{/usr/lib/grub/<cpu>-<platform>}) will be
  501. called the @dfn{image directory}, and the directory where the boot
  502. loader needs to find them (usually @file{/boot}) will be called
  503. the @dfn{boot directory}.
  504. @menu
  505. * Installing GRUB using grub-install::
  506. * Making a GRUB bootable CD-ROM::
  507. * Device map::
  508. * BIOS installation::
  509. @end menu
  510. @node Installing GRUB using grub-install
  511. @section Installing GRUB using grub-install
  512. For information on where GRUB should be installed on PC BIOS platforms,
  513. @pxref{BIOS installation}.
  514. In order to install GRUB under a UNIX-like OS (such
  515. as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking
  516. grub-install}) as the superuser (@dfn{root}).
  517. The usage is basically very simple. You only need to specify one
  518. argument to the program, namely, where to install the boot loader. The
  519. argument has to be either a device file (like @samp{/dev/hda}).
  520. For example, under Linux the following will install GRUB into the MBR
  521. of the first IDE disk:
  522. @example
  523. # @kbd{grub-install /dev/sda}
  524. @end example
  525. Likewise, under GNU/Hurd, this has the same effect:
  526. @example
  527. # @kbd{grub-install /dev/hd0}
  528. @end example
  529. But all the above examples assume that GRUB should put images under
  530. the @file{/boot} directory. If you want GRUB to put images under a directory
  531. other than @file{/boot}, you need to specify the option
  532. @option{--boot-directory}. The typical usage is that you create a GRUB
  533. boot floppy with a filesystem. Here is an example:
  534. @example
  535. @group
  536. # @kbd{mke2fs /dev/fd0}
  537. # @kbd{mount -t ext2 /dev/fd0 /mnt}
  538. # @kbd{mkdir /mnt/boot}
  539. # @kbd{grub-install --boot-directory=/mnt/boot /dev/fd0}
  540. # @kbd{umount /mnt}
  541. @end group
  542. @end example
  543. Some BIOSes have a bug of exposing the first partition of a USB drive as a
  544. floppy instead of exposing the USB drive as a hard disk (they call it
  545. ``USB-FDD'' boot). In such cases, you need to install like this:
  546. @example
  547. # @kbd{losetup /dev/loop0 /dev/sdb1}
  548. # @kbd{mount /dev/loop0 /mnt/usb}
  549. # @kbd{grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0}
  550. @end example
  551. This install doesn't conflict with standard install as long as they are in
  552. separate directories.
  553. On EFI systems for fixed disk install you have to mount EFI System Partition.
  554. If you mount it at @file{/boot/efi} then you don't need any special arguments:
  555. @example
  556. # @kbd{grub-install}
  557. @end example
  558. Otherwise you need to specify where your EFI System partition is mounted:
  559. @example
  560. # @kbd{grub-install --efi-directory=/mnt/efi}
  561. @end example
  562. For removable installs you have to use @option{--removable} and specify both
  563. @option{--boot-directory} and @option{--efi-directory}:
  564. @example
  565. # @kbd{grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable}
  566. @end example
  567. @node Making a GRUB bootable CD-ROM
  568. @section Making a GRUB bootable CD-ROM
  569. GRUB supports the @dfn{no emulation mode} in the El Torito
  570. specification@footnote{El Torito is a specification for bootable CD
  571. using BIOS functions.}. This means that you can use the whole CD-ROM
  572. from GRUB and you don't have to make a floppy or hard disk image file,
  573. which can cause compatibility problems.
  574. For booting from a CD-ROM, GRUB uses a special image called
  575. @file{cdboot.img}, which is concatenated with @file{core.img}. The
  576. @file{core.img} used for this should be built with at least the
  577. @samp{iso9660} and @samp{biosdisk} modules. Your bootable CD-ROM will
  578. usually also need to include a configuration file @file{grub.cfg} and some
  579. other GRUB modules.
  580. To make a simple generic GRUB rescue CD, you can use the
  581. @command{grub-mkrescue} program (@pxref{Invoking grub-mkrescue}):
  582. @example
  583. $ @kbd{grub-mkrescue -o grub.iso}
  584. @end example
  585. You will often need to include other files in your image. To do this, first
  586. make a top directory for the bootable image, say, @samp{iso}:
  587. @example
  588. $ @kbd{mkdir iso}
  589. @end example
  590. Make a directory for GRUB:
  591. @example
  592. $ @kbd{mkdir -p iso/boot/grub}
  593. @end example
  594. If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub}
  595. (@pxref{Configuration}), and copy any files and directories for the disc to the
  596. directory @file{iso/}.
  597. Finally, make the image:
  598. @example
  599. $ @kbd{grub-mkrescue -o grub.iso iso}
  600. @end example
  601. This produces a file named @file{grub.iso}, which then can be burned
  602. into a CD (or a DVD), or written to a USB mass storage device.
  603. The root device will be set up appropriately on entering your
  604. @file{grub.cfg} configuration file, so you can refer to file names on the CD
  605. without needing to use an explicit device name. This makes it easier to
  606. produce rescue images that will work on both optical drives and USB mass
  607. storage devices.
  608. @node Device map
  609. @section The map between BIOS drives and OS devices
  610. If the device map file exists, the GRUB utilities (@command{grub-probe},
  611. etc.) read it to map BIOS drives to OS devices. This file consists of lines
  612. like this:
  613. @example
  614. (@var{device}) @var{file}
  615. @end example
  616. @var{device} is a drive specified in the GRUB syntax (@pxref{Device
  617. syntax}), and @var{file} is an OS file, which is normally a device file.
  618. Historically, the device map file was used because GRUB device names had to
  619. be used in the configuration file, and they were derived from BIOS drive
  620. numbers. The map between BIOS drives and OS devices cannot always be
  621. guessed correctly: for example, GRUB will get the order wrong if you
  622. exchange the boot sequence between IDE and SCSI in your BIOS.
  623. Unfortunately, even OS device names are not always stable. Modern versions
  624. of the Linux kernel may probe drives in a different order from boot to boot,
  625. and the prefix (@file{/dev/hd*} versus @file{/dev/sd*}) may change depending
  626. on the driver subsystem in use. As a result, the device map file required
  627. frequent editing on some systems.
  628. GRUB avoids this problem nowadays by using UUIDs or file system labels when
  629. generating @file{grub.cfg}, and we advise that you do the same for any
  630. custom menu entries you write. If the device map file does not exist, then
  631. the GRUB utilities will assume a temporary device map on the fly. This is
  632. often good enough, particularly in the common case of single-disk systems.
  633. However, the device map file is not entirely obsolete yet, and it is
  634. used for overriding when current environment is different from the one on boot.
  635. Most common case is if you use a partition or logical volume as a disk for
  636. virtual machine. You can put any comments in the file if needed,
  637. as the GRUB utilities assume that a line is just a comment if
  638. the first character is @samp{#}.
  639. @node BIOS installation
  640. @section BIOS installation
  641. @heading MBR
  642. The partition table format traditionally used on PC BIOS platforms is called
  643. the Master Boot Record (MBR) format; this is the format that allows up to
  644. four primary partitions and additional logical partitions. With this
  645. partition table format, there are two ways to install GRUB: it can be
  646. embedded in the area between the MBR and the first partition (called by
  647. various names, such as the "boot track", "MBR gap", or "embedding area", and
  648. which is usually at least 1000 KiB), or the core image can be installed in a
  649. file system and a list of the blocks that make it up can be stored in the
  650. first sector of that partition.
  651. Modern tools usually leave MBR gap of at least 1023 KiB. This amount is
  652. sufficient to cover most configurations. Hence this value is recommended
  653. by the GRUB team.
  654. Historically many tools left only 31 KiB of space. This is not enough to
  655. parse reliably difficult structures like Btrfs, ZFS, RAID or LVM, or to
  656. use difficult disk access methods like ahci. Hence GRUB will warn if attempted
  657. to install into small MBR gap except in a small number of configurations
  658. that were grandfathered. The grandfathered config must:
  659. @itemize @bullet
  660. @item
  661. use biosdisk as disk access module for @file{/boot}
  662. @item
  663. not use any additional partition maps to access @file{/boot}
  664. @item
  665. @file{/boot} must be on one of following filesystems:
  666. AFFS, AFS, BFS, cpio, newc, odc, ext2/3/4, FAT, exFAT,
  667. F2FS, HFS, uncompressed HFS+, ISO9660, JFS, Minix, Minix2, Minix3, NILFS2,
  668. NTFS, ReiserFS, ROMFS, SFS, tar, UDF, UFS1, UFS2, XFS
  669. @end itemize
  670. Note: Only a subset of filesystems are supported in lockdown mode (such
  671. as when secure boot is enabled, @pxref{Lockdown} for more information).
  672. MBR gap has few technical problems. There is no way to reserve space in
  673. the embedding area with complete safety, and some proprietary software is
  674. known to use it to make it difficult for users to work around licensing
  675. restrictions. GRUB works around it by detecting sectors by other software and
  676. avoiding them and protecting its own sectors using Reed-Solomon encoding.
  677. GRUB team recommends having MBR gap of at least 1000 KiB.
  678. Should it not be possible, GRUB has support for a fallback solution which is
  679. heavily recommended against. Installing to a filesystem means that GRUB is
  680. vulnerable to its blocks being moved around by filesystem features such as
  681. tail packing, or even by aggressive fsck implementations, so this approach
  682. is quite fragile; and this approach can only be used if the @file{/boot}
  683. filesystem is on the same disk that the BIOS boots from, so that GRUB does
  684. not have to rely on guessing BIOS drive numbers.
  685. The GRUB development team generally recommends embedding GRUB before the
  686. first partition, unless you have special requirements. You must ensure that
  687. the first partition starts at least 1000 KiB (2000 sectors) from the start of
  688. the disk; on modern disks, it is often a performance advantage to align
  689. partitions on larger boundaries anyway, so the first partition might start 1
  690. MiB from the start of the disk.
  691. @heading GPT
  692. Some newer systems use the GUID Partition Table (GPT) format. This was
  693. specified as part of the Extensible Firmware Interface (EFI), but it can
  694. also be used on BIOS platforms if system software supports it; for example,
  695. GRUB and GNU/Linux can be used in this configuration. With this format, it
  696. is possible to reserve a whole partition for GRUB, called the BIOS Boot
  697. Partition. GRUB can then be embedded into that partition without the risk
  698. of being overwritten by other software and without being contained in a
  699. filesystem which might move its blocks around.
  700. When creating a BIOS Boot Partition on a GPT system, you should make sure
  701. that it is at least 31 KiB in size. (GPT-formatted disks are not usually
  702. particularly small, so we recommend that you make it larger than the bare
  703. minimum, such as 1 MiB, to allow plenty of room for growth.) You must also
  704. make sure that it has the proper partition type. Using GNU Parted, you can
  705. set this using a command such as the following:
  706. @example
  707. # @kbd{parted /dev/@var{disk} set @var{partition-number} bios_grub on}
  708. @end example
  709. If you are using gdisk, set the partition type to @samp{0xEF02}. With
  710. partitioning programs that require setting the GUID directly, it should be
  711. @samp{21686148-6449-6e6f-744e656564454649}.
  712. @strong{Caution:} Be very careful which partition you select! When GRUB
  713. finds a BIOS Boot Partition during installation, it will automatically
  714. overwrite part of it. Make sure that the partition does not contain any
  715. other data.
  716. @node Booting
  717. @chapter Booting
  718. GRUB can load Multiboot-compliant kernels in a consistent way,
  719. but for some free operating systems you need to use some OS-specific
  720. magic.
  721. @menu
  722. * General boot methods:: How to boot OSes with GRUB generally
  723. * Loopback booting:: Notes on booting from loopbacks
  724. * LVM cache booting:: Notes on booting from LVM cache logical volume
  725. * OS-specific notes:: Notes on some operating systems
  726. @end menu
  727. @node General boot methods
  728. @section How to boot operating systems
  729. GRUB has three distinct boot methods: loading an operating system
  730. directly, using kexec from userspace, and chainloading another
  731. bootloader. Generally speaking, the first two are more desirable
  732. because you don't need to install or maintain other boot loaders and
  733. GRUB is flexible enough to load an operating system from an arbitrary
  734. disk/partition. However, chainloading is sometimes required, as GRUB
  735. doesn't support all existing operating systems natively.
  736. @menu
  737. * Loading an operating system directly::
  738. * Kexec::
  739. * Chain-loading::
  740. @end menu
  741. @node Loading an operating system directly
  742. @subsection How to boot an OS directly with GRUB
  743. Multiboot (@pxref{Top, Multiboot Specification, Motivation, multiboot,
  744. The Multiboot Specification}) is the native format supported by GRUB.
  745. For the sake of convenience, there is also support for Linux, FreeBSD,
  746. NetBSD and OpenBSD. If you want to boot other operating systems, you
  747. will have to chain-load them (@pxref{Chain-loading}).
  748. FIXME: this section is incomplete.
  749. @enumerate
  750. @item
  751. Run the command @command{boot} (@pxref{boot}).
  752. @end enumerate
  753. However, DOS and Windows have some deficiencies, so you might have to
  754. use more complicated instructions. @xref{DOS/Windows}, for more
  755. information.
  756. @node Kexec
  757. @subsection Kexec with grub2-emu
  758. GRUB can be run in userspace by invoking the grub2-emu tool. It will
  759. read all configuration scripts as if booting directly (see @ref{Loading
  760. an operating system directly}). With the @code{--kexec} flag, and
  761. kexec(8) support from the operating system, the @command{linux} command
  762. will directly boot the target image. For systems that lack working
  763. systemctl(1) support for kexec, passing the @code{--kexec} flag twice
  764. will fallback to invoking kexec(8) directly; note however that this
  765. fallback may be unsafe outside read-only environments, as it does not
  766. invoke shutdown machinery.
  767. @node Chain-loading
  768. @subsection Chain-loading an OS
  769. Operating systems that do not support Multiboot and do not have specific
  770. support in GRUB (specific support is available for Linux, FreeBSD, NetBSD
  771. and OpenBSD) must be chain-loaded, which involves loading another boot
  772. loader and jumping to it in real mode or via the firmware.
  773. The @command{chainloader} command (@pxref{chainloader}) is used to set this
  774. up. It is normally also necessary to load some GRUB modules and set the
  775. appropriate root device. Putting this together, we get something like this,
  776. for a Windows system on the first partition of the first hard disk:
  777. @verbatim
  778. menuentry "Windows" {
  779. insmod chain
  780. insmod ntfs
  781. set root=(hd0,1)
  782. chainloader +1
  783. }
  784. @end verbatim
  785. @c FIXME: document UUIDs.
  786. On systems with multiple hard disks, an additional workaround may be
  787. required. @xref{DOS/Windows}.
  788. Chain-loading is only supported on PC BIOS and EFI platforms.
  789. @node Loopback booting
  790. @section Loopback booting
  791. GRUB is able to read from an image (be it one of CD or HDD) stored on
  792. any of its accessible storages (refer to @pxref{loopback} command).
  793. However the OS itself should be able to find its root. This usually
  794. involves running a userspace program running before the real root
  795. is discovered. This is achieved by GRUB loading a specially made
  796. small image and passing it as ramdisk to the kernel. This is achieved
  797. by commands @command{kfreebsd_module}, @command{knetbsd_module_elf},
  798. @command{kopenbsd_ramdisk}, @command{initrd} (@pxref{initrd}),
  799. @command{initrd16} (@pxref{initrd16}), @command{multiboot_module},
  800. @command{multiboot2_module} or @command{xnu_ramdisk}
  801. depending on the loader. Note that for knetbsd the image must be put
  802. inside miniroot.kmod and the whole miniroot.kmod has to be loaded. In
  803. kopenbsd payload this is disabled by default. Additionally, behaviour of
  804. initial ramdisk depends on command line options. Several distributors provide
  805. the image for this purpose or it's integrated in their standard ramdisk and
  806. activated by special option. Consult your kernel and distribution manual for
  807. more details. Other loaders like @command{appleloader}, @command{chainloader}
  808. (BIOS, EFI, coreboot), @command{freedos}, @command{ntldr}, @command{plan9}
  809. and @command{truecrypt} provide no possibility of loading initial ramdisk and
  810. as far as author is aware the payloads in question don't support either initial
  811. ramdisk or discovering loopback boot in other way and as such not bootable this
  812. way. Please consider alternative boot methods like copying all files
  813. from the image to actual partition. Consult your OS documentation for
  814. more details.
  815. @node LVM cache booting
  816. @section Booting from LVM cache logical volume
  817. The LVM cache logical volume is the logical volume consisting of the original
  818. and the cache pool logical volume. The original is usually on a larger and
  819. slower storage device while the cache pool is on a smaller and faster one. The
  820. performance of the original volume can be improved by storing the frequently
  821. used data on the cache pool to utilize the greater performance of faster
  822. device.
  823. GRUB boots from LVM cache logical volume merely by reading it's original
  824. logical volume so that dirty data in cache pool volume is disregarded. This is
  825. not a problem for "writethrough" cache mode as it ensures that any data written
  826. will be stored both on the cache and the origin LV. For the other cache mode
  827. "writeback", which delays writing from the cache pool back to the origin LV to
  828. boost performance, GRUB may fail to boot in the wake of accidental power outage
  829. due to it's inability to assemble the cache device for reading the required
  830. dirty data left behind. The situation will be improved after adding full
  831. support to the LVM cache logical volume in the future.
  832. @node OS-specific notes
  833. @section Some caveats on OS-specific issues
  834. Here, we describe some caveats on several operating systems.
  835. @menu
  836. * GNU/Hurd::
  837. * GNU/Linux::
  838. * NetBSD::
  839. * DOS/Windows::
  840. @end menu
  841. @node GNU/Hurd
  842. @subsection GNU/Hurd
  843. Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is
  844. nothing special about it. But do not forget that you have to specify a
  845. root partition to the kernel.
  846. @enumerate
  847. @item
  848. Set GRUB's root device to the same drive as GNU/Hurd's. The command
  849. @code{search --set=root --file /boot/gnumach.gz} or similar may help you
  850. (@pxref{search}).
  851. @item
  852. Load the kernel and the modules, like this:
  853. @example
  854. @group
  855. grub> @kbd{multiboot /boot/gnumach.gz root=device:hd0s1}
  856. grub> @kbd{module /hurd/ext2fs.static ext2fs --readonly \
  857. --multiboot-command-line='$@{kernel-command-line@}' \
  858. --host-priv-port='$@{host-port@}' \
  859. --device-master-port='$@{device-port@}' \
  860. --exec-server-task='$@{exec-task@}' -T typed '$@{root@}' \
  861. '$(task-create)' '$(task-resume)'}
  862. grub> @kbd{module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'}
  863. @end group
  864. @end example
  865. @item
  866. Finally, run the command @command{boot} (@pxref{boot}).
  867. @end enumerate
  868. @node GNU/Linux
  869. @subsection GNU/Linux
  870. It is relatively easy to boot GNU/Linux from GRUB, because it somewhat
  871. resembles to boot a Multiboot-compliant OS.
  872. @enumerate
  873. @item
  874. Set GRUB's root device to the same drive as GNU/Linux's. The command
  875. @code{search --set=root --file /vmlinuz} or similar may help you
  876. (@pxref{search}).
  877. @item
  878. Load the kernel using the command @command{linux} (@pxref{linux}):
  879. @example
  880. grub> @kbd{linux /vmlinuz root=/dev/sda1}
  881. @end example
  882. If you need to specify some kernel parameters, just append them to the
  883. command. For example, to set @option{acpi} to @samp{off}, do this:
  884. @example
  885. grub> @kbd{linux /vmlinuz root=/dev/sda1 acpi=off}
  886. @end example
  887. See the documentation in the Linux source tree for complete information on
  888. the available options.
  889. With @command{linux} GRUB uses 32-bit protocol. Some BIOS services like APM
  890. or EDD aren't available with this protocol. In this case you need to use
  891. @command{linux16}
  892. @example
  893. grub> @kbd{linux16 /vmlinuz root=/dev/sda1 acpi=off}
  894. @end example
  895. @item
  896. If you use an initrd, execute the command @command{initrd} (@pxref{initrd})
  897. after @command{linux}:
  898. @example
  899. grub> @kbd{initrd /initrd}
  900. @end example
  901. If you used @command{linux16} you need to use @command{initrd16}:
  902. @example
  903. grub> @kbd{initrd16 /initrd}
  904. @end example
  905. @item
  906. Finally, run the command @command{boot} (@pxref{boot}).
  907. @end enumerate
  908. @node NetBSD
  909. @subsection NetBSD
  910. Booting a NetBSD kernel from GRUB is also relatively easy: first set
  911. GRUB's root device, then load the kernel and the modules, and finally
  912. run @command{boot}.
  913. @enumerate
  914. @item
  915. Set GRUB's root device to the partition holding the NetBSD root file
  916. system. For a disk with a NetBSD disk label, this is usually the first
  917. partition (a:). In that case, and assuming that the partition is on the
  918. first hard disk, set GRUB's root device as follows:
  919. @example
  920. grub> @kbd{insmod part_bsd}
  921. grub> @kbd{set root=(hd0,netbsd1)}
  922. @end example
  923. For a disk with a GUID Partition Table (GPT), and assuming that the
  924. NetBSD root partition is the third GPT partition, do this:
  925. @example
  926. grub> @kbd{insmod part_gpt}
  927. grub> @kbd{set root=(hd0,gpt3)}
  928. @end example
  929. @item
  930. Load the kernel using the command @command{knetbsd}:
  931. @example
  932. grub> @kbd{knetbsd /netbsd}
  933. @end example
  934. Various options may be given to @command{knetbsd}. These options are,
  935. for the most part, the same as in the NetBSD boot loader. For instance,
  936. to boot the system in single-user mode and with verbose messages, do
  937. this:
  938. @example
  939. grub> @kbd{knetbsd /netbsd -s -v}
  940. @end example
  941. @item
  942. If needed, load kernel modules with the command
  943. @command{knetbsd_module_elf}. A typical example is the module for the
  944. root file system:
  945. @example
  946. grub> @kbd{knetbsd_module_elf /stand/amd64/6.0/modules/ffs/ffs.kmod}
  947. @end example
  948. @item
  949. Finally, run the command @command{boot} (@pxref{boot}).
  950. @end enumerate
  951. @node DOS/Windows
  952. @subsection DOS/Windows
  953. GRUB cannot boot DOS or Windows directly, so you must chain-load them
  954. (@pxref{Chain-loading}). However, their boot loaders have some critical
  955. deficiencies, so it may not work to just chain-load them. To overcome
  956. the problems, GRUB provides you with two helper functions.
  957. If you have installed DOS (or Windows) on a non-first hard disk, you
  958. have to use the disk swapping technique, because that OS cannot boot
  959. from any disks but the first one. The workaround used in GRUB is the
  960. command @command{drivemap} (@pxref{drivemap}), like this:
  961. @example
  962. drivemap -s (hd0) (hd1)
  963. @end example
  964. This performs a @dfn{virtual} swap between your first and second hard
  965. drive.
  966. @strong{Caution:} This is effective only if DOS (or Windows) uses BIOS
  967. to access the swapped disks. If that OS uses a special driver for the
  968. disks, this probably won't work.
  969. Another problem arises if you installed more than one set of DOS/Windows
  970. onto one disk, because they could be confused if there are more than one
  971. primary partitions for DOS/Windows. Certainly you should avoid doing
  972. this, but there is a solution if you do want to do so. Use the partition
  973. hiding/unhiding technique.
  974. If GRUB @dfn{hides} a DOS (or Windows) partition (@pxref{parttool}), DOS (or
  975. Windows) will ignore the partition. If GRUB @dfn{unhides} a DOS (or Windows)
  976. partition, DOS (or Windows) will detect the partition. Thus, if you have
  977. installed DOS (or Windows) on the first and the second partition of the
  978. first hard disk, and you want to boot the copy on the first partition, do
  979. the following:
  980. @example
  981. @group
  982. parttool (hd0,1) hidden-
  983. parttool (hd0,2) hidden+
  984. set root=(hd0,1)
  985. chainloader +1
  986. parttool @verb{'${root}'} boot+
  987. boot
  988. @end group
  989. @end example
  990. @node Configuration
  991. @chapter Writing your own configuration file
  992. GRUB is configured using @file{grub.cfg}, usually located under
  993. @file{/boot/grub}. This file is quite flexible, but most users will not
  994. need to write the whole thing by hand.
  995. @menu
  996. * Simple configuration:: Recommended for most users
  997. * Root Identification Heuristics:: Summary on how the root file system is identified.
  998. * Shell-like scripting:: For power users and developers
  999. * Multi-boot manual config:: For non-standard multi-OS scenarios
  1000. * Embedded configuration:: Embedding a configuration file into GRUB
  1001. @end menu
  1002. @node Simple configuration
  1003. @section Simple configuration handling
  1004. The program @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig})
  1005. generates @file{grub.cfg} files suitable for most cases. It is suitable for
  1006. use when upgrading a distribution, and will discover available kernels and
  1007. attempt to generate menu entries for them.
  1008. @command{grub-mkconfig} does have some limitations. While adding extra
  1009. custom menu entries to the end of the list can be done by editing
  1010. @file{/etc/grub.d/40_custom} or creating @file{/boot/grub/custom.cfg},
  1011. changing the order of menu entries or changing their titles may require
  1012. making complex changes to shell scripts stored in @file{/etc/grub.d/}. This
  1013. may be improved in the future. In the meantime, those who feel that it
  1014. would be easier to write @file{grub.cfg} directly are encouraged to do so
  1015. (@pxref{Booting}, and @ref{Shell-like scripting}), and to disable any system
  1016. provided by their distribution to automatically run @command{grub-mkconfig}.
  1017. The file @file{/etc/default/grub} controls the operation of
  1018. @command{grub-mkconfig}. It is sourced by a shell script, and so must be
  1019. valid POSIX shell input; normally, it will just be a sequence of
  1020. @samp{KEY=value} lines, but if the value contains spaces or other special
  1021. characters then it must be quoted. For example:
  1022. @example
  1023. GRUB_TERMINAL_INPUT="console serial"
  1024. @end example
  1025. Valid keys in @file{/etc/default/grub} are as follows:
  1026. @table @samp
  1027. @item GRUB_DEFAULT
  1028. The default menu entry. This may be a number, in which case it identifies
  1029. the Nth entry in the generated menu counted from zero, or the title of a
  1030. menu entry, or the special string @samp{saved}. Using the id may be
  1031. useful if you want to set a menu entry as the default even though there may
  1032. be a variable number of entries before it.
  1033. For example, if you have:
  1034. @verbatim
  1035. menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
  1036. ...
  1037. }
  1038. @end verbatim
  1039. then you can make this the default using:
  1040. @example
  1041. GRUB_DEFAULT=example-gnu-linux
  1042. @end example
  1043. Previously it was documented the way to use entry title. While this still
  1044. works it's not recommended since titles often contain unstable device names
  1045. and may be translated
  1046. If you set this to @samp{saved}, then the default menu entry will be that
  1047. saved by @samp{GRUB_SAVEDEFAULT} or @command{grub-set-default}. This relies on
  1048. the environment block, which may not be available in all situations
  1049. (@pxref{Environment block}).
  1050. The default is @samp{0}.
  1051. @item GRUB_SAVEDEFAULT
  1052. If this option is set to @samp{true}, then, when an entry is selected, save
  1053. it as a new default entry for use by future runs of GRUB. This is only
  1054. useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
  1055. @samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
  1056. @command{grub-set-default}. Unset by default.
  1057. This option relies on the environment block, which may not be available in
  1058. all situations (@pxref{Environment block}).
  1059. @item GRUB_TIMEOUT
  1060. Boot the default entry this many seconds after the menu is displayed, unless
  1061. a key is pressed. The default is @samp{5}. Set to @samp{0} to boot
  1062. immediately without displaying the menu, or to @samp{-1} to wait
  1063. indefinitely.
  1064. If @samp{GRUB_TIMEOUT_STYLE} is set to @samp{countdown} or @samp{hidden},
  1065. the timeout is instead counted before the menu is displayed.
  1066. @item GRUB_TIMEOUT_STYLE
  1067. If this option is unset or set to @samp{menu}, then GRUB will display the
  1068. menu and then wait for the timeout set by @samp{GRUB_TIMEOUT} to expire
  1069. before booting the default entry. Pressing a key interrupts the timeout.
  1070. If this option is set to @samp{countdown} or @samp{hidden}, then, before
  1071. displaying the menu, GRUB will wait for the timeout set by @samp{GRUB_TIMEOUT}
  1072. to expire. If @key{ESC} or @key{F4} are pressed, or @key{SHIFT} is held down
  1073. during that time, it will display the menu and wait for input. If a hotkey
  1074. associated with a menu entry is pressed, it will boot the associated menu entry
  1075. immediately. If the timeout expires before either of these happens, it will
  1076. boot the default entry. In the @samp{countdown} case, it will show a one-line
  1077. indication of the remaining time.
  1078. @item GRUB_DEFAULT_BUTTON
  1079. @itemx GRUB_TIMEOUT_BUTTON
  1080. @itemx GRUB_TIMEOUT_STYLE_BUTTON
  1081. @itemx GRUB_BUTTON_CMOS_ADDRESS
  1082. Variants of the corresponding variables without the @samp{_BUTTON} suffix,
  1083. used to support vendor-specific power buttons. @xref{Vendor power-on keys}.
  1084. @item GRUB_DISTRIBUTOR
  1085. Set by distributors of GRUB to their identifying name. This is used to
  1086. generate more informative menu entry titles.
  1087. @item GRUB_TERMINAL_INPUT
  1088. Select the terminal input device. You may select multiple devices here,
  1089. separated by spaces.
  1090. Valid terminal input names depend on the platform, but may include
  1091. @samp{console} (native platform console), @samp{serial} (serial terminal),
  1092. @samp{serial_<port>} (serial terminal with explicit port selection),
  1093. @samp{at_keyboard} (PC AT keyboard), or @samp{usb_keyboard} (USB keyboard
  1094. using the HID Boot Protocol, for cases where the firmware does not handle
  1095. this).
  1096. The default is to use the platform's native terminal input.
  1097. @item GRUB_TERMINAL_OUTPUT
  1098. Select the terminal output device. You may select multiple devices here,
  1099. separated by spaces.
  1100. Valid terminal output names depend on the platform, but may include
  1101. @samp{console} (native platform console), @samp{serial} (serial terminal),
  1102. @samp{serial_<port>} (serial terminal with explicit port selection),
  1103. @samp{gfxterm} (graphics-mode output), @samp{vga_text} (VGA text output),
  1104. @samp{mda_text} (MDA text output), @samp{morse} (Morse-coding using system
  1105. beeper) or @samp{spkmodem} (simple data protocol using system speaker).
  1106. @samp{spkmodem} is useful when no serial port is available. Connect the output
  1107. of sending system (where GRUB is running) to line-in of receiving system
  1108. (usually developer machine).
  1109. On receiving system compile @samp{spkmodem-recv} from
  1110. @samp{util/spkmodem-recv.c} and run:
  1111. @example
  1112. parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv
  1113. @end example
  1114. The default is to use the platform's native terminal output.
  1115. @item GRUB_TERMINAL
  1116. If this option is set, it overrides both @samp{GRUB_TERMINAL_INPUT} and
  1117. @samp{GRUB_TERMINAL_OUTPUT} to the same value.
  1118. @item GRUB_SERIAL_COMMAND
  1119. A command to configure the serial port when using the serial console.
  1120. @xref{serial}. Defaults to @samp{serial}.
  1121. @item GRUB_CMDLINE_LINUX
  1122. Command-line arguments to add to menu entries for the Linux kernel.
  1123. @item GRUB_CMDLINE_LINUX_DEFAULT
  1124. Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu
  1125. entries will be generated for each Linux kernel: one default entry and one
  1126. entry for recovery mode. This option lists command-line arguments to add
  1127. only to the default menu entry, after those listed in
  1128. @samp{GRUB_CMDLINE_LINUX}.
  1129. @item GRUB_CMDLINE_LINUX_RECOVERY
  1130. Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu
  1131. entries will be generated for each Linux kernel: one default entry and one
  1132. entry for recovery mode. This option lists command-line arguments to add
  1133. only to the recovery menu entry, before those listed in @samp{GRUB_CMDLINE_LINUX}.
  1134. The default is @samp{single}.
  1135. @item GRUB_CMDLINE_NETBSD
  1136. @itemx GRUB_CMDLINE_NETBSD_DEFAULT
  1137. As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
  1138. NetBSD.
  1139. @item GRUB_CMDLINE_GNUMACH
  1140. As @samp{GRUB_CMDLINE_LINUX}, but for GNU Mach.
  1141. @item GRUB_CMDLINE_XEN
  1142. @itemx GRUB_CMDLINE_XEN_DEFAULT
  1143. The values of these options are passed to Xen hypervisor Xen menu entries,
  1144. for all respectively normal entries.
  1145. @item GRUB_CMDLINE_LINUX_XEN_REPLACE
  1146. @item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
  1147. The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
  1148. and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
  1149. @item GRUB_TOP_LEVEL
  1150. @item GRUB_TOP_LEVEL_XEN
  1151. This option should be an absolute path to a kernel image. If provided, the
  1152. image specified will be made the top-level entry if it is found in the scan.
  1153. @item GRUB_TOP_LEVEL_OS_PROBER
  1154. This option should be a line of output from @command{os-prober}. As
  1155. @samp{GRUB_TOP_LEVEL}, if provided, the image specified will be made the
  1156. top-level entry if it is found in the scan.
  1157. @item GRUB_EARLY_INITRD_LINUX_CUSTOM
  1158. @itemx GRUB_EARLY_INITRD_LINUX_STOCK
  1159. List of space-separated early initrd images to be loaded from @samp{/boot}.
  1160. This is for loading things like CPU microcode, firmware, ACPI tables, crypto
  1161. keys, and so on. These early images will be loaded in the order declared,
  1162. and all will be loaded before the actual functional initrd image.
  1163. @samp{GRUB_EARLY_INITRD_LINUX_STOCK} is for your distribution to declare
  1164. images that are provided by the distribution. It should not be modified
  1165. without understanding the consequences. They will be loaded first.
  1166. @samp{GRUB_EARLY_INITRD_LINUX_CUSTOM} is for your custom created images.
  1167. The default stock images are as follows, though they may be overridden by
  1168. your distribution:
  1169. @example
  1170. intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode.cpio
  1171. @end example
  1172. @item GRUB_DISABLE_LINUX_UUID
  1173. Normally, @command{grub-mkconfig} will generate menu entries that use
  1174. universally-unique identifiers (UUIDs) to identify the root filesystem to
  1175. the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
  1176. usually more reliable, but in some cases it may not be appropriate. To
  1177. disable the use of UUIDs, set this option to @samp{true}.
  1178. @item GRUB_DISABLE_LINUX_PARTUUID
  1179. If @command{grub-mkconfig} cannot identify the root filesystem via its
  1180. universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID
  1181. of the partition containing the filesystem to identify the root filesystem to
  1182. the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not
  1183. as reliable as using the filesystem UUID, but is more reliable than using the
  1184. Linux device names. When @samp{GRUB_DISABLE_LINUX_PARTUUID} is set to
  1185. @samp{false}, the Linux kernel version must be 2.6.37 (3.10 for systems using
  1186. the MSDOS partition scheme) or newer. This option defaults to @samp{true}. To
  1187. enable the use of partition UUIDs, set this option to @samp{false}.
  1188. @item GRUB_DISABLE_RECOVERY
  1189. If this option is set to @samp{true}, disable the generation of recovery
  1190. mode menu entries.
  1191. @item GRUB_DISABLE_UUID
  1192. Normally, @command{grub-mkconfig} will generate menu entries that use
  1193. universally-unique identifiers (UUIDs) to identify various filesystems to
  1194. search for files. This is usually more reliable, but in some cases it may
  1195. not be appropriate. To disable this use of UUIDs, set this option to
  1196. @samp{true}. Setting this option to @samp{true}, will also set the options
  1197. @samp{GRUB_DISABLE_LINUX_UUID} and @samp{GRUB_DISABLE_LINUX_PARTUUID} to
  1198. @samp{true}, unless they have been explicitly set to @samp{false}.
  1199. @item GRUB_VIDEO_BACKEND
  1200. If graphical video support is required, either because the @samp{gfxterm}
  1201. graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
  1202. then @command{grub-mkconfig} will normally load all available GRUB video
  1203. drivers and use the one most appropriate for your hardware. If you need to
  1204. override this for some reason, then you can set this option.
  1205. After @command{grub-install} has been run, the available video drivers are
  1206. listed in @file{/boot/grub/video.lst}.
  1207. @item GRUB_GFXMODE
  1208. Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
  1209. you can only use modes which your graphics card supports via VESA BIOS
  1210. Extensions (VBE), so for example native LCD panel resolutions may not be
  1211. available. The default is @samp{auto}, which tries to select a preferred
  1212. resolution. @xref{gfxmode}.
  1213. @item GRUB_BACKGROUND
  1214. Set a background image for use with the @samp{gfxterm} graphical terminal.
  1215. The value of this option must be a file readable by GRUB at boot time, and
  1216. it must end with @file{.png}, @file{.tga}, @file{.jpg}, or @file{.jpeg}.
  1217. The image will be scaled if necessary to fit the screen. Image height and
  1218. width will be restricted by an artificial limit of 16384.
  1219. @item GRUB_THEME
  1220. Set a theme for use with the @samp{gfxterm} graphical terminal.
  1221. @item GRUB_GFXPAYLOAD_LINUX
  1222. Set to @samp{text} to force the Linux kernel to boot in normal text mode,
  1223. @samp{keep} to preserve the graphics mode set using @samp{GRUB_GFXMODE},
  1224. @samp{@var{width}x@var{height}}[@samp{x@var{depth}}] to set a particular
  1225. graphics mode, or a sequence of these separated by commas or semicolons to
  1226. try several modes in sequence. @xref{gfxpayload}.
  1227. Depending on your kernel, your distribution, your graphics card, and the
  1228. phase of the moon, note that using this option may cause GNU/Linux to suffer
  1229. from various display problems, particularly during the early part of the
  1230. boot sequence. If you have problems, set this option to @samp{text} and
  1231. GRUB will tell Linux to boot in normal text mode.
  1232. @item GRUB_DISABLE_OS_PROBER
  1233. The @command{grub-mkconfig} has a feature to use the external
  1234. @command{os-prober} program to discover other operating systems installed on
  1235. the same machine and generate appropriate menu entries for them. It is disabled
  1236. by default since automatic and silent execution of @command{os-prober}, and
  1237. creating boot entries based on that data, is a potential attack vector. Set
  1238. this option to @samp{false} to enable this feature in the
  1239. @command{grub-mkconfig} command.
  1240. @item GRUB_OS_PROBER_SKIP_LIST
  1241. List of space-separated case insensitive UUIDs of filesystems to be ignored
  1242. from os-prober output. For EFI chainloaders it's <UUID>@@<EFI FILE>. For
  1243. backward compatibility with previous behaviour, <UUID>@@/dev/* is also accepted
  1244. for non-EFI chainloaders even if the device does not match, and comma and
  1245. semicolon are also accepted as separator.
  1246. @item GRUB_DISABLE_SUBMENU
  1247. Normally, @command{grub-mkconfig} will generate top level menu entry for
  1248. the kernel with highest version number and put all other found kernels
  1249. or alternative menu entries for recovery mode in submenu. For entries returned
  1250. by @command{os-prober} first entry will be put on top level and all others
  1251. in submenu. If this option is set to @samp{true}, flat menu with all entries
  1252. on top level will be generated instead. Changing this option will require
  1253. changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
  1254. and @samp{default} (@pxref{default}) environment variables as well as saved
  1255. default entry using @command{grub-set-default} and value used with
  1256. @command{grub-reboot}.
  1257. @item GRUB_ENABLE_CRYPTODISK
  1258. If set to @samp{y}, @command{grub-mkconfig} and @command{grub-install} will
  1259. check for encrypted disks and generate additional commands needed to access
  1260. them during boot. Note that in this case unattended boot is not possible
  1261. because GRUB will wait for passphrase to unlock encrypted container.
  1262. @item GRUB_INIT_TUNE
  1263. Play a tune on the speaker when GRUB starts. This is particularly useful
  1264. for users unable to see the screen. The value of this option is passed
  1265. directly to @ref{play}.
  1266. @item GRUB_BADRAM
  1267. If this option is set, GRUB will issue a @ref{badram} command to filter
  1268. out specified regions of RAM.
  1269. @item GRUB_PRELOAD_MODULES
  1270. This option may be set to a list of GRUB module names separated by spaces.
  1271. Each module will be loaded as early as possible, at the start of
  1272. @file{grub.cfg}.
  1273. @end table
  1274. The following options are still accepted for compatibility with existing
  1275. configurations, but have better replacements:
  1276. @table @samp
  1277. @item GRUB_HIDDEN_TIMEOUT
  1278. Wait this many seconds before displaying the menu. If @key{ESC} or @key{F4} are
  1279. pressed, or @key{SHIFT} is held down during that time, display the menu and wait
  1280. for input according to @samp{GRUB_TIMEOUT}. If a hotkey associated with a menu
  1281. entry is pressed, boot the associated menu entry immediately. If the timeout
  1282. expires before either of these happens, display the menu for the number of
  1283. seconds specified in @samp{GRUB_TIMEOUT} before booting the default entry.
  1284. If you set @samp{GRUB_HIDDEN_TIMEOUT}, you should also set
  1285. @samp{GRUB_TIMEOUT=0} so that the menu is not displayed at all unless
  1286. @key{ESC} or @key{F4} are pressed, or @key{SHIFT} is held down.
  1287. This option is unset by default, and is deprecated in favour of the less
  1288. confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
  1289. @samp{GRUB_TIMEOUT_STYLE=hidden}.
  1290. @item GRUB_HIDDEN_TIMEOUT_QUIET
  1291. In conjunction with @samp{GRUB_HIDDEN_TIMEOUT}, set this to @samp{true} to
  1292. suppress the verbose countdown while waiting for a key to be pressed before
  1293. displaying the menu.
  1294. This option is unset by default, and is deprecated in favour of the less
  1295. confusing @samp{GRUB_TIMEOUT_STYLE=countdown}.
  1296. @item GRUB_HIDDEN_TIMEOUT_BUTTON
  1297. Variant of @samp{GRUB_HIDDEN_TIMEOUT}, used to support vendor-specific power
  1298. buttons. @xref{Vendor power-on keys}.
  1299. This option is unset by default, and is deprecated in favour of the less
  1300. confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
  1301. @samp{GRUB_TIMEOUT_STYLE=hidden}.
  1302. @end table
  1303. For more detailed customisation of @command{grub-mkconfig}'s output, you may
  1304. edit the scripts in @file{/etc/grub.d} directly.
  1305. @file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
  1306. menu entries; simply type the menu entries you want to add at the end of
  1307. that file, making sure to leave at least the first two lines intact.
  1308. @node Root Identification Heuristics
  1309. @section Root Identification Heuristics
  1310. If the target operating system uses the Linux kernel, @command{grub-mkconfig}
  1311. attempts to identify the root file system via a heuristic algoirthm. This
  1312. algorithm selects the identification method of the root file system by
  1313. considering three factors. The first is if an initrd for the target operating
  1314. system is also present. The second is @samp{GRUB_DISABLE_LINUX_UUID} and if set
  1315. to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
  1316. system by its UUID. The third is @samp{GRUB_DISABLE_LINUX_PARTUUID} and if set
  1317. to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
  1318. system via the UUID of its enclosing partition. If the variables are assigned
  1319. any other value, that value is considered equivalent to @samp{false}. The
  1320. variables are also considered to be set to @samp{false} if they are not set.
  1321. When booting, the Linux kernel will delegate the task of mounting the root
  1322. filesystem to the initrd. Most initrd images determine the root file system by
  1323. checking the Linux kernel's command-line for the @samp{root} key and use its
  1324. value as the identification method of the root file system. To improve the
  1325. reliability of booting, most initrd images also allow the root file system to be
  1326. identified by its UUID. Because of this behavior, the @command{grub-mkconfig}
  1327. command will set @samp{root} to @samp{root=UUID=...} to provide the initrd with
  1328. the filesystem UUID of the root file system.
  1329. If no initrd is detected or @samp{GRUB_DISABLE_LINUX_UUID} is set to @samp{true}
  1330. then @command{grub-command} will identify the root filesystem by setting the
  1331. kernel command-line variable @samp{root} to @samp{root=PARTUUID=...} unless
  1332. @samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}. If
  1333. @samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true},
  1334. @command{grub-command} will identify by its Linux device name.
  1335. The following table summarizes the behavior of the @command{grub-mkconfig}
  1336. command.
  1337. @multitable {detected} {GRUB_DISABLE_LINUX_PARTUUID} {GRUB_DISABLE_LINUX_UUID} {Linux Root}
  1338. @headitem Initrd detected @tab GRUB_DISABLE_LINUX_PARTUUID Set To @tab GRUB_DISABLE_LINUX_UUID Set To @tab Linux Root ID Method
  1339. @item false @tab false @tab false @tab part UUID
  1340. @item false @tab false @tab true @tab part UUID
  1341. @item false @tab true @tab false @tab dev name
  1342. @item false @tab true @tab true @tab dev name
  1343. @item true @tab false @tab false @tab fs UUID
  1344. @item true @tab false @tab true @tab part UUID
  1345. @item true @tab true @tab false @tab fs UUID
  1346. @item true @tab true @tab true @tab dev name
  1347. @end multitable
  1348. Remember, @samp{GRUB_DISABLE_LINUX_PARTUUID} and @samp{GRUB_DISABLE_LINUX_UUID}
  1349. are also considered to be set to @samp{true} and @samp{false}, respectively,
  1350. when they are unset.
  1351. @node Shell-like scripting
  1352. @section Writing full configuration files directly
  1353. @c Some of this section is derived from the GNU Bash manual page, also
  1354. @c copyrighted by the FSF.
  1355. @file{grub.cfg} is written in GRUB's built-in scripting language, which has
  1356. a syntax quite similar to that of GNU Bash and other Bourne shell
  1357. derivatives.
  1358. @heading Words
  1359. A @dfn{word} is a sequence of characters considered as a single unit by
  1360. GRUB. Words are separated by @dfn{metacharacters}, which are the following
  1361. plus space, tab, and newline:
  1362. @example
  1363. @{ @} | & $ ; < >
  1364. @end example
  1365. Quoting may be used to include metacharacters in words; see below.
  1366. @heading Reserved words
  1367. Reserved words have a special meaning to GRUB. The following words are
  1368. recognised as reserved when unquoted and either the first word of a simple
  1369. command or the third word of a @code{for} command:
  1370. @example
  1371. ! [[ ]] @{ @}
  1372. case do done elif else esac fi for function
  1373. if in menuentry select then time until while
  1374. @end example
  1375. Not all of these reserved words have a useful purpose yet; some are reserved
  1376. for future expansion.
  1377. @heading Quoting
  1378. Quoting is used to remove the special meaning of certain characters or
  1379. words. It can be used to treat metacharacters as part of a word, to prevent
  1380. reserved words from being recognised as such, and to prevent variable
  1381. expansion.
  1382. There are three quoting mechanisms: the escape character, single quotes, and
  1383. double quotes.
  1384. A non-quoted backslash (\) is the @dfn{escape character}. It preserves the
  1385. literal value of the next character that follows, with the exception of
  1386. newline.
  1387. Enclosing characters in single quotes preserves the literal value of each
  1388. character within the quotes. A single quote may not occur between single
  1389. quotes, even when preceded by a backslash.
  1390. Enclosing characters in double quotes preserves the literal value of all
  1391. characters within the quotes, with the exception of @samp{$} and @samp{\}.
  1392. The @samp{$} character retains its special meaning within double quotes.
  1393. The backslash retains its special meaning only when followed by one of the
  1394. following characters: @samp{$}, @samp{"}, @samp{\}, or newline. A
  1395. backslash-newline pair is treated as a line continuation (that is, it is
  1396. removed from the input stream and effectively ignored@footnote{Currently a
  1397. backslash-newline pair within a variable name is not handled properly, so
  1398. use this feature with some care.}). A double quote may be quoted within
  1399. double quotes by preceding it with a backslash.
  1400. @heading Variable expansion
  1401. The @samp{$} character introduces variable expansion. The variable name to
  1402. be expanded may be enclosed in braces, which are optional but serve to
  1403. protect the variable to be expanded from characters immediately following it
  1404. which could be interpreted as part of the name.
  1405. Normal variable names begin with an alphabetic character, followed by zero
  1406. or more alphanumeric characters. These names refer to entries in the GRUB
  1407. environment (@pxref{Environment}).
  1408. Positional variable names consist of one or more digits. They represent
  1409. parameters passed to function calls, with @samp{$1} representing the first
  1410. parameter, and so on.
  1411. The special variable name @samp{?} expands to the exit status of the most
  1412. recently executed command. When positional variable names are active, other
  1413. special variable names @samp{@@}, @samp{*} and @samp{#} are defined and they
  1414. expand to all positional parameters with necessary quoting, positional
  1415. parameters without any quoting, and positional parameter count respectively.
  1416. @heading Comments
  1417. A word beginning with @samp{#} causes that word and all remaining characters
  1418. on that line to be ignored.
  1419. @heading Simple commands
  1420. A @dfn{simple command} is a sequence of words separated by spaces or tabs
  1421. and terminated by a semicolon or a newline. The first word specifies the
  1422. command to be executed. The remaining words are passed as arguments to the
  1423. invoked command.
  1424. The return value of a simple command is its exit status. If the reserved
  1425. word @code{!} precedes the command, then the return value is instead the
  1426. logical negation of the command's exit status.
  1427. @heading Compound commands
  1428. A @dfn{compound command} is one of the following:
  1429. @table @asis
  1430. @item for @var{name} in @var{word} @dots{}; do @var{list}; done
  1431. The list of words following @code{in} is expanded, generating a list of
  1432. items. The variable @var{name} is set to each element of this list in turn,
  1433. and @var{list} is executed each time. The return value is the exit status
  1434. of the last command that executes. If the expansion of the items following
  1435. @code{in} results in an empty list, no commands are executed, and the return
  1436. status is 0.
  1437. @item if @var{list}; then @var{list}; [elif @var{list}; then @var{list};] @dots{} [else @var{list};] fi
  1438. The @code{if} @var{list} is executed, where @var{list} is a series of
  1439. @dfn{simple command}s separated by a ";". If its exit status of the last
  1440. command is zero, the @code{then} @var{list} is executed. Otherwise, each
  1441. @code{elif} @var{list} is executed in turn, and if its last command's exit
  1442. status is zero, the corresponding @code{then} @var{list} is executed and the
  1443. command completes. Otherwise, the @code{else} @var{list} is executed, if
  1444. present. The exit status is the exit status of the last command executed, or
  1445. zero if no condition tested true.
  1446. @item while @var{cond}; do @var{list}; done
  1447. @itemx until @var{cond}; do @var{list}; done
  1448. The @code{while} command continuously executes the @code{do} @var{list} as
  1449. long as the last command in @var{cond} returns an exit status of zero, where
  1450. @var{cond} is a list of @dfn{simple command}s separated by a ";". The
  1451. @code{until} command is identical to the @code{while} command, except that
  1452. the test is negated; the @code{do} @var{list} is executed as long as the
  1453. last command in @var{cond} returns a non-zero exit status. The exit status
  1454. of the @code{while} and @code{until} commands is the exit status of the last
  1455. @code{do} @var{list} command executed, or zero if none was executed.
  1456. @item function @var{name} @{ @var{command}; @dots{} @}
  1457. This defines a function named @var{name}. The @dfn{body} of the function is
  1458. the list of commands within braces, each of which must be terminated with a
  1459. semicolon or a newline. This list of commands will be executed whenever
  1460. @var{name} is specified as the name of a simple command. Function
  1461. definitions do not affect the exit status in @code{$?}. When executed, the
  1462. exit status of a function is the exit status of the last command executed in
  1463. the body.
  1464. @item menuentry @var{title} [@option{--class=class} @dots{}] [@option{--users=users}] [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @{ @var{command}; @dots{} @}
  1465. @xref{menuentry}.
  1466. @end table
  1467. @heading Built-in Commands
  1468. Some built-in commands are also provided by GRUB script to help script
  1469. writers perform actions that are otherwise not possible. For example, these
  1470. include commands to jump out of a loop without fully completing it, etc.
  1471. @table @asis
  1472. @item break [@code{n}]
  1473. Exit from within a @code{for}, @code{while}, or @code{until} loop. If
  1474. @code{n} is specified, break @code{n} levels. @code{n} must be greater than
  1475. or equal to 1. If @code{n} is greater than the number of enclosing loops,
  1476. all enclosing loops are exited. The return value is 0 unless @code{n} is
  1477. not greater than or equal to 1.
  1478. @item continue [@code{n}]
  1479. Resume the next iteration of the enclosing @code{for}, @code{while} or
  1480. @code{until} loop. If @code{n} is specified, resume at the @code{n}th
  1481. enclosing loop. @code{n} must be greater than or equal to 1. If @code{n}
  1482. is greater than the number of enclosing loops, the last enclosing loop (the
  1483. @dfn{top-level} loop) is resumed. The return value is 0 unless @code{n} is
  1484. not greater than or equal to 1.
  1485. @item return [@code{n}]
  1486. Causes a function to exit with the return value specified by @code{n}. If
  1487. @code{n} is omitted, the return status is that of the last command executed
  1488. in the function body. If used outside a function the return status is
  1489. false.
  1490. @item setparams [@code{arg}] @dots{}
  1491. Replace positional parameters starting with @code{$1} with arguments to
  1492. @command{setparams}.
  1493. @item shift [@code{n}]
  1494. The positional parameters from @code{n}+1 @dots{} are renamed to
  1495. @code{$1}@dots{}. Parameters represented by the numbers @code{$#} down to
  1496. @code{$#}-@code{n}+1 are unset. @code{n} must be a non-negative number less
  1497. than or equal to @code{$#}. If @code{n} is 0, no parameters are changed.
  1498. If @code{n} is not given, it is assumed to be 1. If @code{n} is greater
  1499. than @code{$#}, the positional parameters are not changed. The return
  1500. status is greater than zero if @code{n} is greater than @code{$#} or less
  1501. than zero; otherwise 0.
  1502. @end table
  1503. @node Multi-boot manual config
  1504. @section Multi-boot manual config
  1505. Currently autogenerating config files for multi-boot environments depends on
  1506. os-prober and has several shortcomings. Due to that it is disabled by default.
  1507. It is advised to use the power of GRUB syntax and do it yourself. A possible
  1508. configuration is detailed here, feel free to adjust to your needs.
  1509. First create a separate GRUB partition, big enough to hold GRUB. Some of the
  1510. following entries show how to load OS installer images from this same partition,
  1511. for that you obviously need to make the partition large enough to hold those
  1512. images as well.
  1513. Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
  1514. install self-compiled latest GRUB with:
  1515. @code{grub-install --boot-directory=/mnt/boot /dev/sda}
  1516. In all the OSes install GRUB tools but disable installing GRUB in bootsector,
  1517. so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
  1518. use by setting:
  1519. @code{GRUB_DISABLE_OS_PROBER=true}
  1520. in /etc/default/grub
  1521. Then write a grub.cfg (/mnt/boot/grub/grub.cfg):
  1522. @example
  1523. menuentry "OS using grub2" @{
  1524. insmod xfs
  1525. search --set=root --label OS1 --hint hd0,msdos8
  1526. configfile /boot/grub/grub.cfg
  1527. @}
  1528. menuentry "OS using grub2-legacy" @{
  1529. insmod ext2
  1530. search --set=root --label OS2 --hint hd0,msdos6
  1531. legacy_configfile /boot/grub/menu.lst
  1532. @}
  1533. menuentry "Windows XP" @{
  1534. insmod ntfs
  1535. search --set=root --label WINDOWS_XP --hint hd0,msdos1
  1536. ntldr /ntldr
  1537. @}
  1538. menuentry "Windows 7" @{
  1539. insmod ntfs
  1540. search --set=root --label WINDOWS_7 --hint hd0,msdos2
  1541. ntldr /bootmgr
  1542. @}
  1543. menuentry "FreeBSD" @{
  1544. insmod zfs
  1545. search --set=root --label freepool --hint hd0,msdos7
  1546. kfreebsd /freebsd@@/boot/kernel/kernel
  1547. kfreebsd_module_elf /freebsd@@/boot/kernel/opensolaris.ko
  1548. kfreebsd_module_elf /freebsd@@/boot/kernel/zfs.ko
  1549. kfreebsd_module /freebsd@@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
  1550. set kFreeBSD.vfs.root.mountfrom=zfs:freepool/freebsd
  1551. set kFreeBSD.hw.psm.synaptics_support=1
  1552. @}
  1553. menuentry "experimental GRUB" @{
  1554. search --set=root --label GRUB --hint hd0,msdos5
  1555. multiboot /experimental/grub/i386-pc/core.img
  1556. @}
  1557. menuentry "Fedora 16 installer" @{
  1558. search --set=root --label GRUB --hint hd0,msdos5
  1559. linux /fedora/vmlinuz lang=en_US keymap=sg resolution=1280x800
  1560. initrd /fedora/initrd.img
  1561. @}
  1562. menuentry "Fedora rawhide installer" @{
  1563. search --set=root --label GRUB --hint hd0,msdos5
  1564. linux /fedora/vmlinuz repo=ftp://mirror.switch.ch/mirror/fedora/linux/development/rawhide/x86_64 lang=en_US keymap=sg resolution=1280x800
  1565. initrd /fedora/initrd.img
  1566. @}
  1567. menuentry "Debian sid installer" @{
  1568. search --set=root --label GRUB --hint hd0,msdos5
  1569. linux /debian/dists/sid/main/installer-amd64/current/images/hd-media/vmlinuz
  1570. initrd /debian/dists/sid/main/installer-amd64/current/images/hd-media/initrd.gz
  1571. @}
  1572. @end example
  1573. Notes:
  1574. @itemize
  1575. @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.
  1576. @end itemize
  1577. @node Embedded configuration
  1578. @section Embedding a configuration file into GRUB
  1579. GRUB supports embedding a configuration file directly into the core image,
  1580. so that it is loaded before entering normal mode. This is useful, for
  1581. example, when it is not straightforward to find the real configuration file,
  1582. or when you need to debug problems with loading that file.
  1583. @command{grub-install} uses this feature when it is not using BIOS disk
  1584. functions or when installing to a different disk from the one containing
  1585. @file{/boot/grub}, in which case it needs to use the @command{search}
  1586. command (@pxref{search}) to find @file{/boot/grub}.
  1587. To embed a configuration file, use the @option{-c} option to
  1588. @command{grub-mkimage}. The file is copied into the core image, so it may
  1589. reside anywhere on the file system, and may be removed after running
  1590. @command{grub-mkimage}.
  1591. After the embedded configuration file (if any) is executed, GRUB will load
  1592. the @samp{normal} module (@pxref{normal}), which will then read the real
  1593. configuration file from @file{$prefix/grub.cfg}. By this point, the
  1594. @code{root} variable will also have been set to the root device name. For
  1595. example, @code{prefix} might be set to @samp{(hd0,1)/boot/grub}, and
  1596. @code{root} might be set to @samp{hd0,1}. Thus, in most cases, the embedded
  1597. configuration file only needs to set the @code{prefix} and @code{root}
  1598. variables, and then drop through to GRUB's normal processing. A typical
  1599. example of this might look like this:
  1600. @example
  1601. @group
  1602. search.fs_uuid 01234567-89ab-cdef-0123-456789abcdef root
  1603. set prefix=($root)/boot/grub
  1604. @end group
  1605. @end example
  1606. (The @samp{search_fs_uuid} module must be included in the core image for this
  1607. example to work.)
  1608. In more complex cases, it may be useful to read other configuration files
  1609. directly from the embedded configuration file. This allows such things as
  1610. reading files not called @file{grub.cfg}, or reading files from a directory
  1611. other than that where GRUB's loadable modules are installed. To do this,
  1612. include the @samp{configfile} and @samp{normal} modules in the core image,
  1613. and embed a configuration file that uses the @command{configfile} command to
  1614. load another file. The following example of this also requires the
  1615. @command{echo}, @command{search_label}, and @command{test} modules to be
  1616. included in the core image:
  1617. @example
  1618. @group
  1619. search.fs_label grub root
  1620. if [ -e /boot/grub/example/test1.cfg ]; then
  1621. set prefix=($root)/boot/grub
  1622. configfile /boot/grub/example/test1.cfg
  1623. else
  1624. if [ -e /boot/grub/example/test2.cfg ]; then
  1625. set prefix=($root)/boot/grub
  1626. configfile /boot/grub/example/test2.cfg
  1627. else
  1628. echo "Could not find an example configuration file!"
  1629. fi
  1630. fi
  1631. @end group
  1632. @end example
  1633. The embedded configuration file may not contain menu entries directly, but
  1634. may only read them from elsewhere using @command{configfile}.
  1635. @node Theme file format
  1636. @chapter Theme file format
  1637. @section Introduction
  1638. The GRUB graphical menu supports themes that can customize the layout and
  1639. appearance of the GRUB boot menu. The theme is configured through a plain
  1640. text file that specifies the layout of the various GUI components (including
  1641. the boot menu, timeout progress bar, and text messages) as well as the
  1642. appearance using colors, fonts, and images. Example is available in docs/example_theme.txt
  1643. @section Theme Elements
  1644. @subsection Colors
  1645. Colors can be specified in several ways:
  1646. @itemize
  1647. @item HTML-style ``#RRGGBB'' or ``#RGB'' format, where *R*, *G*, and *B* are hexadecimal digits (e.g., ``#8899FF'')
  1648. @item as comma-separated decimal RGB values (e.g., ``128, 128, 255'')
  1649. @item with ``SVG 1.0 color names'' (e.g., ``cornflowerblue'') which must be specified in lowercase.
  1650. @end itemize
  1651. @subsection Fonts
  1652. The fonts GRUB uses ``PFF2 font format'' bitmap fonts. Fonts are specified
  1653. with full font names. Currently there is no
  1654. provision for a preference list of fonts, or deriving one font from another.
  1655. Fonts are loaded with the ``loadfont'' command in GRUB (@ref{loadfont}). To see the list of
  1656. loaded fonts, execute the ``lsfonts'' command (@ref{lsfonts}). If there are too many fonts to
  1657. fit on screen, do ``set pager=1'' before executing ``lsfonts''.
  1658. @subsection Progress Bar
  1659. @float Figure, Pixmap-styled progress bar
  1660. @c @image{Theme_progress_bar,,,,png}
  1661. @end float
  1662. @float Figure, Plain progress bar, drawn with solid color.
  1663. @c @image{Theme_progress_bar_filled,,,,png}
  1664. @end float
  1665. Progress bars are used to display the remaining time before GRUB boots the
  1666. default menu entry. To create a progress bar that will display the remaining
  1667. time before automatic boot, simply create a ``progress_bar'' component with
  1668. the id ``__timeout__''. This indicates to GRUB that the progress bar should
  1669. be updated as time passes, and it should be made invisible if the countdown to
  1670. automatic boot is interrupted by the user.
  1671. Progress bars may optionally have text displayed on them. This text is
  1672. controlled by variable ``text'' which contains a printf template with the
  1673. only argument %d is the number of seconds remaining. Additionally special
  1674. values ``@@TIMEOUT_NOTIFICATION_SHORT@@'', ``@@TIMEOUT_NOTIFICATION_MIDDLE@@'',
  1675. ``@@TIMEOUT_NOTIFICATION_LONG@@'' are replaced with standard and translated
  1676. templates.
  1677. @subsection Circular Progress Indicator
  1678. @c @image{Theme_circular_progress,,,,.png}
  1679. The circular progress indicator functions similarly to the progress bar. When
  1680. given an id of ``__timeout__'', GRUB updates the circular progress indicator's
  1681. value to indicate the time remaining. For the circular progress indicator,
  1682. there are two images used to render it: the *center* image, and the *tick*
  1683. image. The center image is rendered in the center of the component, while the
  1684. tick image is used to render each mark along the circumference of the
  1685. indicator.
  1686. @subsection Labels
  1687. Text labels can be placed on the boot screen. The font, color, and horizontal
  1688. alignment can be specified for labels. If a label is given the id
  1689. ``__timeout__'', then the ``text'' property for that label is also updated
  1690. with a message informing the user of the number of seconds remaining until
  1691. automatic boot. This is useful in case you want the text displayed somewhere
  1692. else instead of directly on the progress bar.
  1693. @subsection Boot Menu
  1694. @c @image{Theme_boot_menu,,,,.png}
  1695. The boot menu where GRUB displays the menu entries from the ``grub.cfg'' file.
  1696. It is a list of items, where each item has a title and an optional icon. The
  1697. icon is selected based on the *classes* specified for the menu entry. If
  1698. there is a PNG file named ``myclass.png'' in the ``grub/themes/icons''
  1699. directory, it will be displayed for items which have the class *myclass*. The
  1700. boot menu can be customized in several ways, such as the font and color used
  1701. for the menu entry title, and by specifying styled boxes for the menu itself
  1702. and for the selected item highlight.
  1703. @subsection Styled Boxes
  1704. One of the most important features for customizing the layout is the use of
  1705. *styled boxes*. A styled box is composed of 9 rectangular (and potentially
  1706. empty) regions, which are used to seamlessly draw the styled box on screen:
  1707. @multitable @columnfractions 0.3 0.3 0.3
  1708. @item Northwest (nw) @tab North (n) @tab Northeast (ne)
  1709. @item West (w) @tab Center (c) @tab East (e)
  1710. @item Southwest (sw) @tab South (s) @tab Southeast (se)
  1711. @end multitable
  1712. To support any size of box on screen, the center slice and the slices for the
  1713. top, bottom, and sides are all scaled to the correct size for the component on
  1714. screen, using the following rules:
  1715. @enumerate
  1716. @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.
  1717. @item The corner slices (northwest, northeast, southeast, and southwest) are not scaled.
  1718. @item The center slice is scaled to fill the remaining space in the middle.
  1719. @end enumerate
  1720. As an example of how an image might be sliced up, consider the styled box
  1721. used for a terminal view.
  1722. @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.
  1723. @c @image{Box_slice_example_terminal,,,,.png}
  1724. @end float
  1725. @subsection Creating Styled Box Images
  1726. The Inkscape_ scalable vector graphics editor is a very useful tool for
  1727. creating styled box images. One process that works well for slicing a drawing
  1728. into the necessary image slices is:
  1729. @enumerate
  1730. @item Create or open the drawing you'd like use.
  1731. @item Create a new layer on the top of the layer stack. Make it visible. Select this layer as the current layer.
  1732. @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.
  1733. @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.
  1734. @item Save the drawing.
  1735. @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.
  1736. @item Click the layer hide icon for the slice layer in the layer palette. The rectangles will remain selected, even though they are hidden.
  1737. @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.
  1738. @end enumerate
  1739. @section Theme File Manual
  1740. The theme file is a plain text file. Lines that begin with ``#`` are ignored
  1741. and considered comments. (Note: This may not be the case if the previous line
  1742. ended where a value was expected.)
  1743. The theme file contains two types of statements:
  1744. @enumerate
  1745. @item Global properties.
  1746. @item Component construction.
  1747. @end enumerate
  1748. @subsection Global Properties
  1749. @subsection Format
  1750. Global properties are specified with the simple format:
  1751. @itemize
  1752. @item name1: value1
  1753. @item name2: "value which may contain spaces"
  1754. @item name3: #88F
  1755. @end itemize
  1756. In this example, name3 is assigned a color value.
  1757. @subsection Global Property List
  1758. @multitable @columnfractions 0.3 0.6
  1759. @item title-text
  1760. @tab Specifies the text to display at the top center of the screen as a title.
  1761. @item title-font
  1762. @tab Defines the font used for the title message at the top of the screen.
  1763. @item title-color
  1764. @tab Defines the color of the title message.
  1765. @item message-font
  1766. @tab Currently unused. Left for backward compatibility.
  1767. @item message-color
  1768. @tab Currently unused. Left for backward compatibility.
  1769. @item message-bg-color
  1770. @tab Currently unused. Left for backward compatibility.
  1771. @item desktop-image
  1772. @tab Specifies the image to use as the background. It will be scaled
  1773. to fit the screen size or proportionally scaled depending on the scale
  1774. method.
  1775. @item desktop-image-scale-method
  1776. @tab Specifies the scaling method for the *desktop-image*. Options are
  1777. ``stretch``, ``crop``, ``padding``, ``fitwidth``, ``fitheight``.
  1778. ``stretch`` for fitting the screen size. Otherwise it is proportional
  1779. scaling of a part of *desktop-image* to the part of the screen.
  1780. ``crop`` part of the *desktop-image* will be proportionally scaled to
  1781. fit the screen sizes. ``padding`` the entire *desktop-image* will be
  1782. contained on the screen. ``fitwidth`` for fitting the *desktop-image*'s
  1783. width with screen width. ``fitheight`` for fitting the *desktop-image*'s
  1784. height with the screen height. Default is ``stretch``.
  1785. @item desktop-image-h-align
  1786. @tab Specifies the horizontal alignment of the *desktop-image* if
  1787. *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
  1788. ``left``, ``center``, ``right``. Default is ``center``.
  1789. @item desktop-image-v-align
  1790. @tab Specifies the vertical alignment of the *desktop-image* if
  1791. *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
  1792. ``top``, ``center``, ``bottom``. Default is ``center``.
  1793. @item desktop-color
  1794. @tab Specifies the color for the background if *desktop-image* is not
  1795. specified.
  1796. @item terminal-box
  1797. @tab Specifies the file name pattern for the styled box slices used for the
  1798. command line terminal window. For example, ``terminal-box: terminal_*.png``
  1799. will use the images ``terminal_c.png`` as the center area, ``terminal_n.png``
  1800. as the north (top) edge, ``terminal_nw.png`` as the northwest (upper left)
  1801. corner, and so on. If the image for any slice is not found, it will simply
  1802. be left empty.
  1803. @item terminal-border
  1804. @tab Specifies the border width of the terminal window.
  1805. @item terminal-left
  1806. @tab Specifies the left coordinate of the terminal window.
  1807. @item terminal-top
  1808. @tab Specifies the top coordinate of the terminal window.
  1809. @item terminal-width
  1810. @tab Specifies the width of the terminal window.
  1811. @item terminal-height
  1812. @tab Specifies the height of the terminal window.
  1813. @end multitable
  1814. @subsection Component Construction
  1815. Greater customizability comes is provided by components. A tree of components
  1816. forms the user interface. *Containers* are components that can contain other
  1817. components, and there is always a single root component which is an instance
  1818. of a *canvas* container.
  1819. Components are created in the theme file by prefixing the type of component
  1820. with a '+' sign:
  1821. @code{ + label @{ text="GRUB" font="aqui 11" color="#8FF" @} }
  1822. properties of a component are specified as "name = value" (whitespace
  1823. surrounding tokens is optional and is ignored) where *value* may be:
  1824. @itemize
  1825. @item a single word (e.g., ``align = center``, ``color = #FF8080``),
  1826. @item a quoted string (e.g., ``text = "Hello, World!"``), or
  1827. @item a tuple (e.g., ``preferred_size = (120, 80)``).
  1828. @end itemize
  1829. @subsection Component List
  1830. The following is a list of the components and the properties they support.
  1831. @itemize
  1832. @item label
  1833. A label displays a line of text.
  1834. Properties:
  1835. @multitable @columnfractions 0.2 0.7
  1836. @item id
  1837. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1838. boot of the default entry.
  1839. @item text
  1840. @tab The text to display. If ``id`` is set to ``__timeout__`` and no
  1841. ``text`` property is set then the amount of seconds will be shown.
  1842. If set to ``@@KEYMAP_SHORT@@``, ``@@KEYMAP_MIDDLE@@`` or
  1843. ``@@KEYMAP_LONG@@`` then predefined hotkey information will be shown.
  1844. @item font
  1845. @tab The font to use for text display.
  1846. @item color
  1847. @tab The color of the text.
  1848. @item align
  1849. @tab The horizontal alignment of the text within the component.
  1850. Options are ``left``, ``center`` and ``right``.
  1851. @item visible
  1852. @tab Set to ``false`` to hide the label.
  1853. @end multitable
  1854. @item image
  1855. A component that displays an image. The image is scaled to fit
  1856. the component.
  1857. Properties:
  1858. @multitable @columnfractions 0.2 0.7
  1859. @item file
  1860. @tab The full path to the image file to load.
  1861. @end multitable
  1862. @item progress_bar
  1863. Displays a horizontally oriented progress bar. It can be rendered using
  1864. simple solid filled rectangles, or using a pair of pixmap styled boxes.
  1865. Properties:
  1866. @multitable @columnfractions 0.2 0.7
  1867. @item id
  1868. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1869. boot of the default entry.
  1870. @item fg_color
  1871. @tab The foreground color for plain solid color rendering.
  1872. @item bg_color
  1873. @tab The background color for plain solid color rendering.
  1874. @item border_color
  1875. @tab The border color for plain solid color rendering.
  1876. @item text_color
  1877. @tab The text color.
  1878. @item bar_style
  1879. @tab The styled box specification for the frame of the progress bar.
  1880. Example: ``progress_frame_*.png``
  1881. If the value is equal to ``highlight_style`` then no styled boxes
  1882. will be shown.
  1883. @item highlight_style
  1884. @tab The styled box specification for the highlighted region of the
  1885. progress bar. This box will be used to paint just the highlighted region
  1886. of the bar, and will be increased in size as the bar nears completion.
  1887. Example: ``progress_hl_*.png``.
  1888. If the value is equal to ``bar_style`` then no styled boxes
  1889. will be shown.
  1890. @item highlight_overlay
  1891. @tab If this option is set to ``true`` then the highlight box
  1892. side slices (every slice except the center slice) will overlay the
  1893. frame box side slices. And the center slice of the highlight box
  1894. can move all the way (from top to bottom), being drawn on the center
  1895. slice of the frame box. That way we can make a progress bar with
  1896. round-shaped edges so there won't be a free space from the highlight to
  1897. the frame in top and bottom scrollbar positions. Default is ``false``.
  1898. @item font
  1899. @tab The font to use for progress bar.
  1900. @item text
  1901. @tab The text to display on the progress bar. If the progress bar's ID
  1902. is set to ``__timeout__`` and the value of this property is set to
  1903. ``@@TIMEOUT_NOTIFICATION_SHORT@@``, ``@@TIMEOUT_NOTIFICATION_MIDDLE@@``
  1904. or ``@@TIMEOUT_NOTIFICATION_LONG@@``, then GRUB will update this
  1905. property with an informative message as the timeout approaches.
  1906. @end multitable
  1907. @item circular_progress
  1908. Displays a circular progress indicator. The appearance of this component
  1909. is determined by two images: the *center* image and the *tick* image. The
  1910. center image is generally larger and will be drawn in the center of the
  1911. component. Around the circumference of a circle within the component, the
  1912. tick image will be drawn a certain number of times, depending on the
  1913. properties of the component.
  1914. Properties:
  1915. @multitable @columnfractions 0.3 0.6
  1916. @item id
  1917. @tab Set to ``__timeout__`` to display the time elapsed to an automatical
  1918. boot of the default entry.
  1919. @item center_bitmap
  1920. @tab The file name of the image to draw in the center of the component.
  1921. @item tick_bitmap
  1922. @tab The file name of the image to draw for the tick marks.
  1923. @item num_ticks
  1924. @tab The number of ticks that make up a full circle.
  1925. @item ticks_disappear
  1926. @tab Boolean value indicating whether tick marks should progressively appear,
  1927. or progressively disappear as *value* approaches *end*. Specify
  1928. ``true`` or ``false``. Default is ``false``.
  1929. @item start_angle
  1930. @tab The position of the first tick mark to appear or disappear.
  1931. Measured in "parrots", 1 "parrot" = 1 / 256 of the full circle.
  1932. Use values ``xxx deg`` or ``xxx \xc2\xb0`` to set the angle in degrees.
  1933. @end multitable
  1934. @item boot_menu
  1935. Displays the GRUB boot menu. It allows selecting items and executing them.
  1936. Properties:
  1937. @multitable @columnfractions 0.4 0.5
  1938. @item item_font
  1939. @tab The font to use for the menu item titles.
  1940. @item selected_item_font
  1941. @tab The font to use for the selected menu item, or ``inherit`` (the default)
  1942. to use ``item_font`` for the selected menu item as well.
  1943. @item item_color
  1944. @tab The color to use for the menu item titles.
  1945. @item selected_item_color
  1946. @tab The color to use for the selected menu item, or ``inherit`` (the default)
  1947. to use ``item_color`` for the selected menu item as well.
  1948. @item icon_width
  1949. @tab The width of menu item icons. Icons are scaled to the specified size.
  1950. @item icon_height
  1951. @tab The height of menu item icons.
  1952. @item item_height
  1953. @tab The height of each menu item in pixels.
  1954. @item item_padding
  1955. @tab The amount of space in pixels to leave on each side of the menu item
  1956. contents.
  1957. @item item_icon_space
  1958. @tab The space between an item's icon and the title text, in pixels.
  1959. @item item_spacing
  1960. @tab The amount of space to leave between menu items, in pixels.
  1961. @item menu_pixmap_style
  1962. @tab The image file pattern for the menu frame styled box.
  1963. Example: ``menu_*.png`` (this will use images such as ``menu_c.png``,
  1964. ``menu_w.png``, `menu_nw.png``, etc.)
  1965. @item item_pixmap_style
  1966. @tab The image file pattern for the item styled box.
  1967. @item selected_item_pixmap_style
  1968. @tab The image file pattern for the selected item highlight styled box.
  1969. @item scrollbar
  1970. @tab Boolean value indicating whether the scroll bar should be drawn if the
  1971. frame and thumb styled boxes are configured.
  1972. @item scrollbar_frame
  1973. @tab The image file pattern for the entire scroll bar.
  1974. Example: ``scrollbar_*.png``
  1975. @item scrollbar_thumb
  1976. @tab The image file pattern for the scroll bar thumb (the part of the scroll
  1977. bar that moves as scrolling occurs).
  1978. Example: ``scrollbar_thumb_*.png``
  1979. @item scrollbar_thumb_overlay
  1980. @tab If this option is set to ``true`` then the scrollbar thumb
  1981. side slices (every slice except the center slice) will overlay the
  1982. scrollbar frame side slices. And the center slice of the scrollbar_thumb
  1983. can move all the way (from top to bottom), being drawn on the center
  1984. slice of the scrollbar frame. That way we can make a scrollbar with
  1985. round-shaped edges so there won't be a free space from the thumb to
  1986. the frame in top and bottom scrollbar positions. Default is ``false``.
  1987. @item scrollbar_slice
  1988. @tab The menu frame styled box's slice in which the scrollbar will be
  1989. drawn. Possible values are ``west``, ``center``, ``east`` (default).
  1990. ``west`` - the scrollbar will be drawn in the west slice (right-aligned).
  1991. ``east`` - the scrollbar will be drawn in the east slice (left-aligned).
  1992. ``center`` - the scrollbar will be drawn in the center slice.
  1993. Note: in case of ``center`` slice:
  1994. a) If the scrollbar should be drawn then boot menu entry's width is
  1995. decreased by the scrollbar's width and the scrollbar is drawn at the
  1996. right side of the center slice.
  1997. b) If the scrollbar won't be drawn then the boot menu entry's width
  1998. is the width of the center slice.
  1999. c) We don't necessary need the menu pixmap box to display the scrollbar.
  2000. @item scrollbar_left_pad
  2001. @tab The left scrollbar padding in pixels.
  2002. Unused if ``scrollbar_slice`` is ``west``.
  2003. @item scrollbar_right_pad
  2004. @tab The right scrollbar padding in pixels.
  2005. Unused if ``scrollbar_slice`` is ``east``.
  2006. @item scrollbar_top_pad
  2007. @tab The top scrollbar padding in pixels.
  2008. @item scrollbar_bottom_pad
  2009. @tab The bottom scrollbar padding in pixels.
  2010. @item visible
  2011. @tab Set to ``false`` to hide the boot menu.
  2012. @end multitable
  2013. @item canvas
  2014. Canvas is a container that allows manual placement of components within it.
  2015. It does not alter the positions of its child components. It assigns all
  2016. child components their preferred sizes.
  2017. @item hbox
  2018. The *hbox* container lays out its children from left to right, giving each
  2019. one its preferred width. The height of each child is set to the maximum of
  2020. the preferred heights of all children.
  2021. @item vbox
  2022. The *vbox* container lays out its children from top to bottom, giving each
  2023. one its preferred height. The width of each child is set to the maximum of
  2024. the preferred widths of all children.
  2025. @end itemize
  2026. @subsection Common properties
  2027. The following properties are supported by all components:
  2028. @table @samp
  2029. @item left
  2030. The distance from the left border of container to left border of the object in either of three formats:
  2031. @multitable @columnfractions 0.2 0.7
  2032. @item x @tab Value in pixels
  2033. @item p% @tab Percentage
  2034. @item p%+x @tab mixture of both
  2035. @end multitable
  2036. @item top
  2037. The distance from the left border of container to left border of the object in same format.
  2038. @item width
  2039. The width of object in same format.
  2040. @item height
  2041. The height of object in same format.
  2042. @item id
  2043. The identifier for the component. This can be any arbitrary string.
  2044. The ID can be used by scripts to refer to various components in the GUI
  2045. component tree. Currently, there is one special ID value that GRUB
  2046. recognizes:
  2047. @multitable @columnfractions 0.2 0.7
  2048. @item ``__timeout__``
  2049. @tab Component with this ID will be updated by GRUB and will indicate
  2050. time elapsed to an automatical boot of the default entry.
  2051. Affected components: ``label``, ``circular_progress``, ``progress_bar``.
  2052. @end multitable
  2053. @end table
  2054. @node Network
  2055. @chapter Booting GRUB from the network
  2056. The following instructions don't work for *-emu, i386-qemu, i386-coreboot,
  2057. i386-multiboot, mips_loongson, mips-arc and mips_qemu_mips
  2058. To generate a netbootable directory, run:
  2059. @example
  2060. @group
  2061. grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/<platform>
  2062. @end group
  2063. @end example
  2064. E.g. for i386-pc:
  2065. @example
  2066. @group
  2067. grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i386-pc
  2068. @end group
  2069. @end example
  2070. Then follow instructions printed out by grub-mknetdir on configuring your DHCP
  2071. server.
  2072. The grub.cfg file is placed in the same directory as the path output by
  2073. grub-mknetdir hereafter referred to as FWPATH. GRUB will search for its
  2074. configuration files in order using the following rules where the appended
  2075. value corresponds to a value on the client machine.
  2076. @example
  2077. @group
  2078. @samp{(FWPATH)}/grub.cfg-@samp{(UUID OF MACHINE)}
  2079. @samp{(FWPATH)}/grub.cfg-01-@samp{(MAC ADDRESS OF NIC)}
  2080. @samp{(FWPATH)}/grub.cfg-@samp{(IPv4 OR IPv6 ADDRESS)}
  2081. @samp{(FWPATH)}/grub.cfg
  2082. @end group
  2083. @end example
  2084. The UUID is the Client Machine Identifier Option Definition as specified in
  2085. RFC 4578. The client will only attempt to look up a UUID config file if it
  2086. was provided by the DHCP server.
  2087. The client will only attempt to look up an IPv6 address config once, however,
  2088. it will try the IPv4 multiple times. The concrete example below shows what
  2089. would happen under the IPv4 case.
  2090. @example
  2091. @group
  2092. UUID: 7726a678-7fc0-4853-a4f6-c85ac36a120a
  2093. MAC: 52:54:00:ec:33:81
  2094. IPV4: 10.0.0.130 (0A000082)
  2095. @end group
  2096. @end example
  2097. @example
  2098. @group
  2099. @samp{(FWPATH)}/grub.cfg-7726a678-7fc0-4853-a4f6-c85ac36a120a
  2100. @samp{(FWPATH)}/grub.cfg-01-52-54-00-ec-33-81
  2101. @samp{(FWPATH)}/grub.cfg-0A000082
  2102. @samp{(FWPATH)}/grub.cfg-0A00008
  2103. @samp{(FWPATH)}/grub.cfg-0A0000
  2104. @samp{(FWPATH)}/grub.cfg-0A000
  2105. @samp{(FWPATH)}/grub.cfg-0A00
  2106. @samp{(FWPATH)}/grub.cfg-0A0
  2107. @samp{(FWPATH)}/grub.cfg-0A
  2108. @samp{(FWPATH)}/grub.cfg-0
  2109. @samp{(FWPATH)}/grub.cfg
  2110. @end group
  2111. @end example
  2112. This feature is enabled by default but it can be disabled by setting the
  2113. @samp{feature_net_search_cfg} to @samp{n}. Since this happens before the
  2114. configuration file is read by GRUB, this option has to be disabled in an
  2115. embedded configuration file (@pxref{Embedded configuration}).
  2116. After GRUB has started, files on the TFTP server will be accessible via the
  2117. @samp{(tftp)} device.
  2118. The server IP address can be controlled by changing the
  2119. @samp{(tftp)} device name to @samp{(tftp,@var{server-ip})}. Note that
  2120. this should be changed both in the prefix and in any references to the
  2121. device name in the configuration file.
  2122. GRUB provides several environment variables which may be used to inspect or
  2123. change the behaviour of the PXE device. In the following description
  2124. @var{<interface>} is placeholder for the name of network interface (platform
  2125. dependent):
  2126. @table @samp
  2127. @item net_@var{<interface>}_ip
  2128. The network interface's IP address. Read-only.
  2129. @item net_@var{<interface>}_mac
  2130. The network interface's MAC address. Read-only.
  2131. @item net_@var{<interface>}_clientid
  2132. The client id provided by DHCP. Read-only.
  2133. @item net_@var{<interface>}_clientuuid
  2134. The client uuid provided by DHCP. Read-only.
  2135. @item net_@var{<interface>}_hostname
  2136. The client host name provided by DHCP. Read-only.
  2137. @item net_@var{<interface>}_domain
  2138. The client domain name provided by DHCP. Read-only.
  2139. @item net_@var{<interface>}_rootpath
  2140. The path to the client's root disk provided by DHCP. Read-only.
  2141. @item net_@var{<interface>}_extensionspath
  2142. The path to additional DHCP vendor extensions provided by DHCP. Read-only.
  2143. @item net_@var{<interface>}_boot_file
  2144. The boot file name provided by DHCP. Read-only.
  2145. @item net_@var{<interface>}_dhcp_server_name
  2146. The name of the DHCP server responsible for these boot parameters.
  2147. Read-only.
  2148. @item net_@var{<interface>}_next_server
  2149. The IP address of the next (usually, TFTP) server provided by DHCP.
  2150. Read-only.
  2151. @item net_default_interface
  2152. Initially set to name of network interface that was used to load grub.
  2153. Read-write, although setting it affects only interpretation of
  2154. @samp{net_default_ip} and @samp{net_default_mac}
  2155. @item net_default_ip
  2156. The IP address of default interface. Read-only. This is alias for the
  2157. @samp{net_$@{net_default_interface@}_ip}.
  2158. @item net_default_mac
  2159. The default interface's MAC address. Read-only. This is alias for the
  2160. @samp{net_$@{net_default_interface@}_mac}.
  2161. @item net_default_server
  2162. The default server used by network drives (@pxref{Device syntax}). Read-write,
  2163. although setting this is only useful before opening a network device.
  2164. @item pxe_default_server
  2165. This performs the same function as @samp{net_default_server}.
  2166. @end table
  2167. @node Serial terminal
  2168. @chapter Using GRUB via a serial line
  2169. This chapter describes how to use the serial terminal support in GRUB.
  2170. If you have many computers or computers with no display/keyboard, it
  2171. could be very useful to control the computers through serial
  2172. communications. To connect one computer with another via a serial line,
  2173. you need to prepare a null-modem (cross) serial cable, and you may need
  2174. to have multiport serial boards, if your computer doesn't have extra
  2175. serial ports. In addition, a terminal emulator is also required, such as
  2176. minicom. Refer to a manual of your operating system, for more
  2177. information.
  2178. As for GRUB, the instruction to set up a serial terminal is quite
  2179. simple. Here is an example:
  2180. @example
  2181. @group
  2182. grub> @kbd{serial --unit=0 --speed=9600}
  2183. grub> @kbd{terminal_input serial; terminal_output serial}
  2184. @end group
  2185. @end example
  2186. The command @command{serial} initializes the serial unit 0 with the
  2187. speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if
  2188. you want to use COM2, you must specify @samp{--unit=1} instead. This
  2189. command accepts many other options, @pxref{serial} for more details.
  2190. Without argument or with @samp{--port=auto}, GRUB will attempt to use
  2191. ACPI when available to auto-detect the default serial port and its
  2192. configuration.
  2193. The commands @command{terminal_input} (@pxref{terminal_input}) and
  2194. @command{terminal_output} (@pxref{terminal_output}) choose which type of
  2195. terminal you want to use. In the case above, the terminal will be a
  2196. serial terminal, but you can also pass @code{console} to the command,
  2197. as @samp{terminal_input serial console}. In this case, a terminal in which
  2198. you press any key will be selected as a GRUB terminal. In the example above,
  2199. note that you need to put both commands on the same command line, as you
  2200. will lose the ability to type commands on the console after the first
  2201. command.
  2202. However, note that GRUB assumes that your terminal emulator is
  2203. compatible with VT100 by default. This is true for most terminal
  2204. emulators nowadays. However if your terminal emulator is not VT100-compatible
  2205. or implements few VT100 escape sequences, you shoud tell GRUB that the
  2206. terminal is dumb using the @command{terminfo} (@pxref{terminfo}) command.
  2207. This will have GRUB provide you with an alternative menu interface, because
  2208. the normal menu requires several fancy features of your terminal.
  2209. @node Vendor power-on keys
  2210. @chapter Using GRUB with vendor power-on keys
  2211. Some laptop vendors provide an additional power-on button which boots
  2212. another OS. GRUB supports such buttons with the @samp{GRUB_TIMEOUT_BUTTON},
  2213. @samp{GRUB_TIMEOUT_STYLE_BUTTON}, @samp{GRUB_DEFAULT_BUTTON}, and
  2214. @samp{GRUB_BUTTON_CMOS_ADDRESS} variables in default/grub (@pxref{Simple
  2215. configuration}). @samp{GRUB_TIMEOUT_BUTTON},
  2216. @samp{GRUB_TIMEOUT_STYLE_BUTTON}, and @samp{GRUB_DEFAULT_BUTTON} are used
  2217. instead of the corresponding variables without the @samp{_BUTTON} suffix
  2218. when powered on using the special button. @samp{GRUB_BUTTON_CMOS_ADDRESS}
  2219. is vendor-specific and partially model-specific. Values known to the GRUB
  2220. team are:
  2221. @table @key
  2222. @item Dell XPS M1330M
  2223. 121:3
  2224. @item Dell XPS M1530
  2225. 85:3
  2226. @item Dell Latitude E4300
  2227. 85:3
  2228. @item Asus EeePC 1005PE
  2229. 84:1 (unconfirmed)
  2230. @item LENOVO ThinkPad T410s (2912W1C)
  2231. 101:3
  2232. @end table
  2233. To take full advantage of this function, install GRUB into the MBR
  2234. (@pxref{Installing GRUB using grub-install}).
  2235. If you have a laptop which has a similar feature and not in the above list
  2236. could you figure your address and contribute?
  2237. To discover the address do the following:
  2238. @itemize
  2239. @item boot normally
  2240. @item
  2241. @example
  2242. sudo modprobe nvram
  2243. sudo cat /dev/nvram | xxd > normal_button.txt
  2244. @end example
  2245. @item boot using vendor button
  2246. @item
  2247. @example
  2248. sudo modprobe nvram
  2249. sudo cat /dev/nvram | xxd > normal_vendor.txt
  2250. @end example
  2251. @end itemize
  2252. Then compare these text files and find where a bit was toggled. E.g. in
  2253. case of Dell XPS it was:
  2254. @example
  2255. byte 0x47: 20 --> 28
  2256. @end example
  2257. It's a bit number 3 as seen from following table:
  2258. @multitable @columnfractions .2 .2
  2259. @item 0 @tab 01
  2260. @item 1 @tab 02
  2261. @item 2 @tab 04
  2262. @item 3 @tab 08
  2263. @item 4 @tab 10
  2264. @item 5 @tab 20
  2265. @item 6 @tab 40
  2266. @item 7 @tab 80
  2267. @end multitable
  2268. 0x47 is decimal 71. Linux nvram implementation cuts first 14 bytes of
  2269. CMOS. So the real byte address in CMOS is 71+14=85
  2270. So complete address is 85:3
  2271. @node Images
  2272. @chapter GRUB image files
  2273. @c FIXME: parts of this section are specific to PC BIOS right now.
  2274. GRUB consists of several images: a variety of bootstrap images for starting
  2275. GRUB in various ways, a kernel image, and a set of modules which are
  2276. combined with the kernel image to form a core image. Here is a short
  2277. overview of them.
  2278. @table @file
  2279. @item boot.img
  2280. On PC BIOS systems, this image is the first part of GRUB to start. It is
  2281. written to a master boot record (MBR) or to the boot sector of a partition.
  2282. Because a PC boot sector is 512 bytes, the size of this image is exactly 512
  2283. bytes.
  2284. The sole function of @file{boot.img} is to read the first sector of the core
  2285. image from a local disk and jump to it. Because of the size restriction,
  2286. @file{boot.img} cannot understand any file system structure, so
  2287. @command{grub-install} hardcodes the location of the first sector of the
  2288. core image into @file{boot.img} when installing GRUB.
  2289. @item diskboot.img
  2290. This image is used as the first sector of the core image when booting from a
  2291. hard disk. It reads the rest of the core image into memory and starts the
  2292. kernel. Since file system handling is not yet available, it encodes the
  2293. location of the core image using a block list format.
  2294. @item cdboot.img
  2295. This image is used as the first sector of the core image when booting from a
  2296. CD-ROM drive. It performs a similar function to @file{diskboot.img}.
  2297. @item pxeboot.img
  2298. This image is used as the start of the core image when booting from the
  2299. network using PXE. @xref{Network}.
  2300. @item lnxboot.img
  2301. This image may be placed at the start of the core image in order to make
  2302. GRUB look enough like a Linux kernel that it can be booted by LILO using an
  2303. @samp{image=} section.
  2304. @item kernel.img
  2305. This image contains GRUB's basic run-time facilities: frameworks for device
  2306. and file handling, environment variables, the rescue mode command-line
  2307. parser, and so on. It is rarely used directly, but is built into all core
  2308. images.
  2309. @item core.img
  2310. This is the core image of GRUB. It is built dynamically from the kernel
  2311. image and an arbitrary list of modules by the @command{grub-mkimage}
  2312. program. Usually, it contains enough modules to access @file{/boot/grub},
  2313. and loads everything else (including menu handling, the ability to load
  2314. target operating systems, and so on) from the file system at run-time. The
  2315. modular design allows the core image to be kept small, since the areas of
  2316. disk where it must be installed are often as small as 32KB.
  2317. @xref{BIOS installation}, for details on where the core image can be
  2318. installed on PC systems.
  2319. @item *.mod
  2320. Everything else in GRUB resides in dynamically loadable modules. These are
  2321. often loaded automatically, or built into the core image if they are
  2322. essential, but may also be loaded manually using the @command{insmod}
  2323. command (@pxref{insmod}).
  2324. @end table
  2325. @heading For GRUB Legacy users
  2326. GRUB 2 has a different design from GRUB Legacy, and so correspondences with
  2327. the images it used cannot be exact. Nevertheless, GRUB Legacy users often
  2328. ask questions in the terms they are familiar with, and so here is a brief
  2329. guide to how GRUB 2's images relate to that.
  2330. @table @file
  2331. @item stage1
  2332. Stage 1 from GRUB Legacy was very similar to @file{boot.img} in GRUB 2, and
  2333. they serve the same function.
  2334. @item *_stage1_5
  2335. In GRUB Legacy, Stage 1.5's function was to include enough filesystem code
  2336. to allow the much larger Stage 2 to be read from an ordinary filesystem. In
  2337. this respect, its function was similar to @file{core.img} in GRUB 2.
  2338. However, @file{core.img} is much more capable than Stage 1.5 was; since it
  2339. offers a rescue shell, it is sometimes possible to recover manually in the
  2340. event that it is unable to load any other modules, for example if partition
  2341. numbers have changed. @file{core.img} is built in a more flexible way,
  2342. allowing GRUB 2 to support reading modules from advanced disk types such as
  2343. LVM and RAID.
  2344. GRUB Legacy could run with only Stage 1 and Stage 2 in some limited
  2345. configurations, while GRUB 2 requires @file{core.img} and cannot work
  2346. without it.
  2347. @item stage2
  2348. GRUB 2 has no single Stage 2 image. Instead, it loads modules from
  2349. @file{/boot/grub} at run-time.
  2350. @item stage2_eltorito
  2351. In GRUB 2, images for booting from CD-ROM drives are now constructed using
  2352. @file{cdboot.img} and @file{core.img}, making sure that the core image
  2353. contains the @samp{iso9660} module. It is usually best to use the
  2354. @command{grub-mkrescue} program for this.
  2355. @item nbgrub
  2356. There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by
  2357. Etherboot and some other network boot loaders.
  2358. @item pxegrub
  2359. In GRUB 2, images for PXE network booting are now constructed using
  2360. @file{pxeboot.img} and @file{core.img}, making sure that the core image
  2361. contains the @samp{pxe} and @samp{pxecmd} modules. @xref{Network}.
  2362. @end table
  2363. @node Core image size limitation
  2364. @chapter Core image size limitation
  2365. Heavily limited platforms:
  2366. @itemize
  2367. @item i386-pc (normal and PXE): the core image size (compressed) is limited by 458240 bytes.
  2368. kernel.img (.text + .data + .bss, uncompressed) is limited by 392704 bytes.
  2369. module size (uncompressed) + kernel.img (.text + .data, uncompressed) is limited by the size of contiguous chunk at 1M address.
  2370. @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.
  2371. @item i386-ieee1275: kernel.img (.text + .data + .bss) + modules is limited by memory available at 0x10000, at most 596K
  2372. @end itemize
  2373. Lightly limited platforms:
  2374. @itemize
  2375. @item *-xen: limited only by adress space and RAM size.
  2376. @item i386-qemu: kernel.img (.text + .data + .bss) is limited by 392704 bytes.
  2377. (core.img would be limited by ROM size but it's unlimited on qemu
  2378. @item All EFI platforms: limited by contiguous RAM size and possibly firmware bugs
  2379. @item Coreboot and multiboot. kernel.img (.text + .data + .bss) is limited by 392704 bytes.
  2380. module size is limited by the size of contiguous chunk at 1M address.
  2381. @item mipsel-loongson (ELF), mips(el)-qemu_mips (ELF): if uncompressed:
  2382. kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
  2383. if compressed:
  2384. kernel.img (.text + .data, uncompressed) + modules (uncompressed)
  2385. + (modules + kernel.img (.text + .data)) (compressed)
  2386. + decompressor is limited by the space from 80200000 forward
  2387. @item mipsel-loongson (Flash), mips(el)-qemu_mips (Flash): kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
  2388. core.img (final) is limited by flash size (512K on yeeloong and fulooong)
  2389. @item mips-arc: if uncompressed:
  2390. kernel.img (.text + .data) is limited by the space from 8bd00000 forward
  2391. modules + dummy decompressor is limited by the space from 8bd00000 backward
  2392. if compressed:
  2393. kernel.img (.text + .data, uncompressed) is limited by the space from 8bd00000 forward
  2394. modules (uncompressed) + (modules + kernel.img (.text + .data)) (compressed, aligned to 1M)
  2395. + 1M (decompressor + scratch space) is limited by the space from 8bd00000 backward
  2396. @item powerpc-ieee1275: kernel.img (.text + .data + .bss) + modules is limited by space available at 0x200000
  2397. @end itemize
  2398. @node Filesystem
  2399. @chapter Filesystem syntax and semantics
  2400. GRUB uses a special syntax for specifying disk drives which can be
  2401. accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
  2402. between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
  2403. device is equivalent to which OS device. Normally, that will be clear if
  2404. you see the files in a device or use the command @command{search}
  2405. (@pxref{search}).
  2406. @menu
  2407. * Device syntax:: How to specify devices
  2408. * File name syntax:: How to specify files
  2409. * Block list syntax:: How to specify block lists
  2410. @end menu
  2411. @node Device syntax
  2412. @section How to specify devices
  2413. The device syntax is like this:
  2414. @example
  2415. @code{(@var{device}[,@var{partmap-name1}@var{part-num1}[,@var{partmap-name2}@var{part-num2}[,...]]])}
  2416. @end example
  2417. @samp{[]} means the parameter is optional. @var{device} depends on the disk
  2418. driver in use. BIOS and EFI disks use either @samp{fd} or @samp{hd} followed
  2419. by a digit, like @samp{fd0}, or @samp{cd}.
  2420. AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
  2421. Memdisk and host are limited to one disk and so it's referred just by driver
  2422. name.
  2423. RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM, virtio (vdsk)
  2424. and arcdisk (arc) use intrinsic name of disk prefixed by driver name.
  2425. Additionally just ``nand'' refers to the disk aliased as ``nand''.
  2426. Conflicts are solved by suffixing a number if necessary.
  2427. Commas need to be escaped.
  2428. Loopback uses whatever name specified to @command{loopback} command.
  2429. Hostdisk uses names specified in device.map as long as it's of the form
  2430. [fhc]d[0-9]* or hostdisk/<OS DEVICE>.
  2431. For crypto and RAID (md) additionally you can use the syntax
  2432. <driver name>uuid/<uuid>. For LVM additionally you can use the syntax
  2433. lvmid/<volume-group-uuid>/<volume-uuid>.
  2434. @example
  2435. (fd0)
  2436. (hd0)
  2437. (cd)
  2438. (ahci0)
  2439. (ata0)
  2440. (crypto0)
  2441. (usb0)
  2442. (cryptouuid/123456789abcdef0123456789abcdef0)
  2443. (mduuid/123456789abcdef0123456789abcdef0)
  2444. (lvm/system-root)
  2445. (lvmid/F1ikgD-2RES-306G-il9M-7iwa-4NKW-EbV1NV/eLGuCQ-L4Ka-XUgR-sjtJ-ffch-bajr-fCNfz5)
  2446. (md/myraid)
  2447. (md/0)
  2448. (ieee1275/disk2)
  2449. (ieee1275//pci@@1f\,0/ide@@d/disk@@2)
  2450. (nand)
  2451. (memdisk)
  2452. (host)
  2453. (myloop)
  2454. (hostdisk//dev/sda)
  2455. @end example
  2456. @var{part-num} represents the partition number of @var{device}, starting
  2457. from one. @var{partname} is optional but is recommended since disk may have
  2458. several top-level partmaps. Specifying third and later component you can access
  2459. to subpartitions.
  2460. The syntax @samp{(hd0)} represents using the entire disk (or the
  2461. MBR when installing GRUB), while the syntax @samp{(hd0,1)}
  2462. represents using the first partition of the disk (or the boot sector
  2463. of the partition when installing GRUB).
  2464. @example
  2465. (hd0,msdos1)
  2466. (hd0,msdos1,msdos5)
  2467. (hd0,msdos1,bsd3)
  2468. (hd0,netbsd1)
  2469. (hd0,gpt1)
  2470. (hd0,1,3)
  2471. @end example
  2472. If you enabled the network support, the special drives
  2473. @code{(@var{protocol}[,@var{server}])} are also available. Supported protocols
  2474. are @samp{http} and @samp{tftp}. If @var{server} is omitted, value of
  2475. environment variable @samp{net_default_server} is used.
  2476. Before using the network drive, you must initialize the network.
  2477. @xref{Network}, for more information.
  2478. When using @samp{http} or @samp{tftp}, ports other than @samp{80} can be
  2479. specified using a colon (@samp{:}) after the address. To avoid parsing
  2480. conflicts, when using IPv6 addresses with custom ports, the addresses
  2481. must be enclosed with square brackets (@samp{[]}), as is standard
  2482. practice.
  2483. @example
  2484. (http,grub.example.com:31337)
  2485. (http,192.0.2.1:339)
  2486. (http,[2001:db8::1]:11235)
  2487. @end example
  2488. If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making
  2489. a GRUB bootable CD-ROM}, for details.
  2490. @node File name syntax
  2491. @section How to specify files
  2492. There are two ways to specify files, by @dfn{absolute file name} and by
  2493. @dfn{block list}.
  2494. An absolute file name resembles a Unix absolute file name, using
  2495. @samp{/} for the directory separator (not @samp{\} as in DOS). One
  2496. example is @samp{(hd0,1)/boot/grub/grub.cfg}. This means the file
  2497. @file{/boot/grub/grub.cfg} in the first partition of the first hard
  2498. disk. If you omit the device name in an absolute file name, GRUB uses
  2499. GRUB's @dfn{root device} implicitly. So if you set the root device to,
  2500. say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}),
  2501. then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
  2502. On ZFS filesystem the first path component must be
  2503. @var{volume}@samp{@@}[@var{snapshot}].
  2504. So @samp{/rootvol@@snap-129/boot/grub/grub.cfg} refers to file
  2505. @samp{/boot/grub/grub.cfg} in snapshot of volume @samp{rootvol} with name
  2506. @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if
  2507. snapshot name is omitted.
  2508. @node Block list syntax
  2509. @section How to specify block lists
  2510. A block list is used for specifying a file that doesn't appear in the
  2511. filesystem, like a chainloader. The syntax is
  2512. @code{[@var{offset}]+[@var{length}][,[@var{offset}]+[@var{length}]]@dots{}}.
  2513. Here is an example:
  2514. @example
  2515. @code{0+100,200+1,300+300,800+}
  2516. @end example
  2517. This represents that GRUB should read blocks 0 through 99, block 200,
  2518. blocks 300 through 599, and blocks 800 until the end of the device.
  2519. If you omit an offset, then GRUB assumes the offset is zero. If the
  2520. length is omitted, then GRUB assumes the block list extends until the
  2521. end of the device.
  2522. Like the file name syntax (@pxref{File name syntax}), if a blocklist
  2523. does not contain a device name, then GRUB uses GRUB's @dfn{root
  2524. device}. So @code{(hd0,2)+1} is the same as @code{+1} when the root
  2525. device is @samp{(hd0,2)}.
  2526. @node Interface
  2527. @chapter GRUB's user interface
  2528. GRUB has both a simple menu interface for choosing preset entries from a
  2529. configuration file, and a highly flexible command-line for performing
  2530. any desired combination of boot commands.
  2531. GRUB looks for its configuration file as soon as it is loaded. If one
  2532. is found, then the full menu interface is activated using whatever
  2533. entries were found in the file. If you choose the @dfn{command-line} menu
  2534. option, or if the configuration file was not found, then GRUB drops to
  2535. the command-line interface.
  2536. @menu
  2537. * Command-line interface:: The flexible command-line interface
  2538. * Menu interface:: The simple menu interface
  2539. * Menu entry editor:: Editing a menu entry
  2540. @end menu
  2541. @node Command-line interface
  2542. @section The flexible command-line interface
  2543. The command-line interface provides a prompt and after it an editable
  2544. text area much like a command-line in Unix or DOS. Each command is
  2545. immediately executed after it is entered@footnote{However, this
  2546. behavior will be changed in the future version, in a user-invisible
  2547. way.}. The commands (@pxref{Commands}) are a subset of those available
  2548. in the configuration file, used with exactly the same syntax.
  2549. Cursor movement and editing of the text on the line can be done via a
  2550. subset of the functions available in the Bash shell:
  2551. @table @key
  2552. @item C-f
  2553. @itemx PC right key
  2554. Move forward one character.
  2555. @item C-b
  2556. @itemx PC left key
  2557. Move back one character.
  2558. @item C-a
  2559. @itemx HOME
  2560. Move to the start of the line.
  2561. @item C-e
  2562. @itemx END
  2563. Move the the end of the line.
  2564. @item C-d
  2565. @itemx DEL
  2566. Delete the character underneath the cursor.
  2567. @item C-h
  2568. @itemx BS
  2569. Delete the character to the left of the cursor.
  2570. @item C-k
  2571. Kill the text from the current cursor position to the end of the line.
  2572. @item C-u
  2573. Kill backward from the cursor to the beginning of the line.
  2574. @item C-y
  2575. Yank the killed text back into the buffer at the cursor.
  2576. @item C-p
  2577. @itemx PC up key
  2578. Move up through the history list.
  2579. @item C-n
  2580. @itemx PC down key
  2581. Move down through the history list.
  2582. @end table
  2583. When typing commands interactively, if the cursor is within or before
  2584. the first word in the command-line, pressing the @key{TAB} key (or
  2585. @key{C-i}) will display a listing of the available commands, and if the
  2586. cursor is after the first word, the @kbd{@key{TAB}} will provide a
  2587. completion listing of disks, partitions, and file names depending on the
  2588. context. Note that to obtain a list of drives, one must open a
  2589. parenthesis, as @command{root (}.
  2590. Note that you cannot use the completion functionality in the TFTP
  2591. filesystem. This is because TFTP doesn't support file name listing for
  2592. the security.
  2593. @node Menu interface
  2594. @section The simple menu interface
  2595. The menu interface is quite easy to use. Its commands are both
  2596. reasonably intuitive and described on screen.
  2597. Basically, the menu interface provides a list of @dfn{boot entries} to
  2598. the user to choose from. Use the arrow keys to select the entry of
  2599. choice, then press @key{RET} to run it. An optional timeout is
  2600. available to boot the default entry (the first one if not set), which is
  2601. aborted by pressing any key.
  2602. Commands are available to enter a bare command-line by pressing @key{c}
  2603. (which operates exactly like the non-config-file version of GRUB, but
  2604. allows one to return to the menu if desired by pressing @key{ESC}) or to
  2605. edit any of the @dfn{boot entries} by pressing @key{e}.
  2606. If you protect the menu interface with a password (@pxref{Security}),
  2607. all you can do is choose an entry by pressing @key{RET}, or press
  2608. @key{p} to enter the password.
  2609. Pressing @key{Ctrl-l} will refresh the menu, which can be useful when
  2610. connecting via serial after the menu has been drawn.
  2611. @node Menu entry editor
  2612. @section Editing a menu entry
  2613. The menu entry editor looks much like the main menu interface, but the
  2614. lines in the menu are individual commands in the selected entry instead
  2615. of entry names.
  2616. If an @key{ESC} is pressed in the editor, it aborts all the changes made
  2617. to the configuration entry and returns to the main menu interface.
  2618. Each line in the menu entry can be edited freely, and you can add new lines
  2619. by pressing @key{RET} at the end of a line. To boot the edited entry, press
  2620. @key{Ctrl-x}.
  2621. Although GRUB unfortunately does not support @dfn{undo}, you can do almost
  2622. the same thing by just returning to the main menu using @key{ESC}.
  2623. @node Environment
  2624. @chapter GRUB environment variables
  2625. GRUB supports environment variables which are rather like those offered by
  2626. all Unix-like systems. Environment variables have a name, which is unique
  2627. and is usually a short identifier, and a value, which is an arbitrary string
  2628. of characters. They may be set (@pxref{set}), unset (@pxref{unset}), or
  2629. looked up (@pxref{Shell-like scripting}) by name.
  2630. A number of environment variables have special meanings to various parts of
  2631. GRUB. Others may be used freely in GRUB configuration files.
  2632. @menu
  2633. * Special environment variables::
  2634. * Environment block::
  2635. @end menu
  2636. @node Special environment variables
  2637. @section Special environment variables
  2638. These variables have special meaning to GRUB.
  2639. @menu
  2640. * biosnum::
  2641. * check_signatures::
  2642. * chosen::
  2643. * cmdpath::
  2644. * color_highlight::
  2645. * color_normal::
  2646. * config_directory::
  2647. * config_file::
  2648. * cryptodisk_passphrase_tries::
  2649. * debug::
  2650. * default::
  2651. * fallback::
  2652. * gfxmode::
  2653. * gfxpayload::
  2654. * gfxterm_font::
  2655. * grub_cpu::
  2656. * grub_platform::
  2657. * icondir::
  2658. * lang::
  2659. * locale_dir::
  2660. * lockdown::
  2661. * menu_color_highlight::
  2662. * menu_color_normal::
  2663. * net_@var{<interface>}_boot_file::
  2664. * net_@var{<interface>}_clientid::
  2665. * net_@var{<interface>}_clientuuid::
  2666. * net_@var{<interface>}_dhcp_server_name::
  2667. * net_@var{<interface>}_domain::
  2668. * net_@var{<interface>}_extensionspath::
  2669. * net_@var{<interface>}_hostname::
  2670. * net_@var{<interface>}_ip::
  2671. * net_@var{<interface>}_mac::
  2672. * net_@var{<interface>}_next_server::
  2673. * net_@var{<interface>}_rootpath::
  2674. * net_default_interface::
  2675. * net_default_ip::
  2676. * net_default_mac::
  2677. * net_default_server::
  2678. * pager::
  2679. * prefix::
  2680. * pxe_default_server::
  2681. * root::
  2682. * shim_lock::
  2683. * superusers::
  2684. * theme::
  2685. * timeout::
  2686. * timeout_style::
  2687. * tpm_fail_fatal::
  2688. @end menu
  2689. @node biosnum
  2690. @subsection biosnum
  2691. When chain-loading another boot loader (@pxref{Chain-loading}), GRUB may
  2692. need to know what BIOS drive number corresponds to the root device
  2693. (@pxref{root}) so that it can set up registers properly. If the
  2694. @var{biosnum} variable is set, it overrides GRUB's own means of guessing
  2695. this.
  2696. For an alternative approach which also changes BIOS drive mappings for the
  2697. chain-loaded system, @pxref{drivemap}.
  2698. @node check_signatures
  2699. @subsection check_signatures
  2700. This variable controls whether GRUB enforces digital signature
  2701. validation on loaded files. @xref{Using digital signatures}.
  2702. @node chosen
  2703. @subsection chosen
  2704. When executing a menu entry, GRUB sets the @var{chosen} variable to the
  2705. title of the entry being executed.
  2706. If the menu entry is in one or more submenus, then @var{chosen} is set to
  2707. the titles of each of the submenus starting from the top level followed by
  2708. the title of the menu entry itself, separated by @samp{>}.
  2709. @node cmdpath
  2710. @subsection cmdpath
  2711. The location from which @file{core.img} was loaded as an absolute
  2712. directory name (@pxref{File name syntax}). This is set by GRUB at
  2713. startup based on information returned by platform firmware. Not every
  2714. platform provides this information and some may return only device
  2715. without path name.
  2716. @node color_highlight
  2717. @subsection color_highlight
  2718. This variable contains the ``highlight'' foreground and background terminal
  2719. colors, separated by a slash (@samp{/}). Setting this variable changes
  2720. those colors. For the available color names, @pxref{color_normal}.
  2721. The default is @samp{black/light-gray}.
  2722. @node color_normal
  2723. @subsection color_normal
  2724. This variable contains the ``normal'' foreground and background terminal
  2725. colors, separated by a slash (@samp{/}). Setting this variable changes
  2726. those colors. Each color must be a name from the following list:
  2727. @itemize @bullet
  2728. @item black
  2729. @item blue
  2730. @item green
  2731. @item cyan
  2732. @item red
  2733. @item magenta
  2734. @item brown
  2735. @item light-gray
  2736. @item dark-gray
  2737. @item light-blue
  2738. @item light-green
  2739. @item light-cyan
  2740. @item light-red
  2741. @item light-magenta
  2742. @item yellow
  2743. @item white
  2744. @end itemize
  2745. The default is @samp{light-gray/black}.
  2746. The color support support varies from terminal to terminal.
  2747. @samp{morse} has no color support at all.
  2748. @samp{mda_text} color support is limited to highlighting by
  2749. black/white reversal.
  2750. @samp{console} on ARC, EMU and IEEE1275, @samp{serial_*} and
  2751. @samp{spkmodem} are governed by terminfo and support
  2752. only 8 colors if in modes @samp{vt100-color} (default for console on emu),
  2753. @samp{arc} (default for console on ARC), @samp{ieee1275} (default
  2754. for console on IEEE1275). When in mode @samp{vt100}
  2755. then the color support is limited to highlighting by black/white
  2756. reversal. When in mode @samp{dumb} there is no color support.
  2757. When console supports no colors this setting is ignored.
  2758. When console supports 8 colors, then the colors from the
  2759. second half of the previous list are mapped to the
  2760. matching colors of first half.
  2761. @samp{console} on EFI and BIOS and @samp{vga_text} support all 16 colors.
  2762. @samp{gfxterm} supports all 16 colors and would be theoretically extendable
  2763. to support whole rgb24 palette but currently there is no compelling reason
  2764. to go beyond the current 16 colors.
  2765. @node config_directory
  2766. @subsection config_directory
  2767. This variable is automatically set by GRUB to the directory part of
  2768. current configuration file name (@pxref{config_file}).
  2769. @node config_file
  2770. @subsection config_file
  2771. This variable is automatically set by GRUB to the name of configuration file that is being
  2772. processed by commands @command{configfile} (@pxref{configfile}) or @command{normal}
  2773. (@pxref{normal}). It is restored to the previous value when command completes.
  2774. @node cryptodisk_passphrase_tries
  2775. @subsection cryptodisk_passphrase_tries
  2776. When prompting the user for a cryptodisk passphrase, allow this many attempts
  2777. before giving up. Defaults to @samp{3} if unset or set to an invalid value.
  2778. (The user can give up early by entering an empty passphrase.)
  2779. @node debug
  2780. @subsection debug
  2781. This variable may be set to enable debugging output from various components
  2782. of GRUB. The value is an ordered list of debug facility names separated by
  2783. whitespace or @samp{,}. If the special facility named @samp{all} is present
  2784. then debugging output of all facility names is enabled at the start of
  2785. processing the value of this variable. A facility's debug output can then be
  2786. disabled by prefixing its name with a @samp{-}. The last occurence facility
  2787. name with or without a leading @samp{-} takes precendent over any previous
  2788. occurence. This allows the easy enabling or disabling of facilities by
  2789. appending a @samp{,} and then the facility name with or without the leading
  2790. @samp{-}, which will preserve the state of the rest of the facilities.
  2791. The facility names are the first argument to grub_dprintf. Consult the
  2792. source for more details.
  2793. @node default
  2794. @subsection default
  2795. If this variable is set, it identifies a menu entry that should be
  2796. selected by default, possibly after a timeout (@pxref{timeout}). The
  2797. entry may be identified by number (starting from 0 at each level of
  2798. the hierarchy), by title, or by id.
  2799. For example, if you have:
  2800. @verbatim
  2801. menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
  2802. ...
  2803. }
  2804. @end verbatim
  2805. then you can make this the default using:
  2806. @example
  2807. default=example-gnu-linux
  2808. @end example
  2809. If the entry is in a submenu, then it must be identified using the
  2810. number, title, or id of each of the submenus starting from the top
  2811. level, followed by the number, title, or id of the menu entry itself,
  2812. with each element separated by @samp{>}. For example, take the
  2813. following menu structure:
  2814. @example
  2815. GNU/Hurd --id gnu-hurd
  2816. Standard Boot --id=gnu-hurd-std
  2817. Rescue shell --id=gnu-hurd-rescue
  2818. Other platforms --id=other
  2819. Minix --id=minix
  2820. Version 3.4.0 --id=minix-3.4.0
  2821. Version 3.3.0 --id=minix-3.3.0
  2822. GRUB Invaders --id=grub-invaders
  2823. @end example
  2824. The more recent release of Minix would then be identified as
  2825. @samp{Other platforms>Minix>Version 3.4.0}, or as @samp{1>0>0}, or as
  2826. @samp{other>minix>minix-3.4.0}.
  2827. This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
  2828. configuration}), @command{grub-set-default}, or @command{grub-reboot}.
  2829. @node fallback
  2830. @subsection fallback
  2831. If this variable is set, it identifies a menu entry that should be selected
  2832. if the default menu entry fails to boot. Entries are identified in the same
  2833. way as for @samp{default} (@pxref{default}).
  2834. @node gfxmode
  2835. @subsection gfxmode
  2836. If this variable is set, it sets the resolution used on the @samp{gfxterm}
  2837. graphical terminal. Note that you can only use modes which your graphics
  2838. card supports via VESA BIOS Extensions (VBE), so for example native LCD
  2839. panel resolutions may not be available. The default is @samp{auto}, which
  2840. selects a platform-specific default that should look reasonable. Supported
  2841. modes can be listed by @samp{videoinfo} command in GRUB.
  2842. The resolution may be specified as a sequence of one or more modes,
  2843. separated by commas (@samp{,}) or semicolons (@samp{;}); each will be tried
  2844. in turn until one is found. Each mode should be either @samp{auto},
  2845. @samp{@var{width}x@var{height}}, or
  2846. @samp{@var{width}x@var{height}x@var{depth}}.
  2847. @node gfxpayload
  2848. @subsection gfxpayload
  2849. If this variable is set, it controls the video mode in which the Linux
  2850. kernel starts up, replacing the @samp{vga=} boot option (@pxref{linux}). It
  2851. may be set to @samp{text} to force the Linux kernel to boot in normal text
  2852. mode, @samp{keep} to preserve the graphics mode set using @samp{gfxmode}, or
  2853. any of the permitted values for @samp{gfxmode} to set a particular graphics
  2854. mode (@pxref{gfxmode}).
  2855. Depending on your kernel, your distribution, your graphics card, and the
  2856. phase of the moon, note that using this option may cause GNU/Linux to suffer
  2857. from various display problems, particularly during the early part of the
  2858. boot sequence. If you have problems, set this variable to @samp{text} and
  2859. GRUB will tell Linux to boot in normal text mode.
  2860. The default is platform-specific. On platforms with a native text mode
  2861. (such as PC BIOS platforms), the default is @samp{text}. Otherwise the
  2862. default may be @samp{auto} or a specific video mode.
  2863. This variable is often set by @samp{GRUB_GFXPAYLOAD_LINUX} (@pxref{Simple
  2864. configuration}).
  2865. @node gfxterm_font
  2866. @subsection gfxterm_font
  2867. If this variable is set, it names a font to use for text on the
  2868. @samp{gfxterm} graphical terminal. Otherwise, @samp{gfxterm} may use any
  2869. available font.
  2870. @node grub_cpu
  2871. @subsection grub_cpu
  2872. In normal mode (@pxref{normal}), GRUB sets the @samp{grub_cpu} variable to
  2873. the CPU type for which GRUB was built (e.g. @samp{i386} or @samp{powerpc}).
  2874. @node grub_platform
  2875. @subsection grub_platform
  2876. In normal mode (@pxref{normal}), GRUB sets the @samp{grub_platform} variable
  2877. to the platform for which GRUB was built (e.g. @samp{pc} or @samp{efi}).
  2878. @node icondir
  2879. @subsection icondir
  2880. If this variable is set, it names a directory in which the GRUB graphical
  2881. menu should look for icons after looking in the theme's @samp{icons}
  2882. directory. @xref{Theme file format}.
  2883. @node lang
  2884. @subsection lang
  2885. If this variable is set, it names the language code that the
  2886. @command{gettext} command (@pxref{gettext}) uses to translate strings. For
  2887. example, French would be named as @samp{fr}, and Simplified Chinese as
  2888. @samp{zh_CN}.
  2889. @command{grub-mkconfig} (@pxref{Simple configuration}) will try to set a
  2890. reasonable default for this variable based on the system locale.
  2891. @node locale_dir
  2892. @subsection locale_dir
  2893. If this variable is set, it names the directory where translation files may
  2894. be found (@pxref{gettext}), usually @file{/boot/grub/locale}. Otherwise,
  2895. internationalization is disabled.
  2896. @command{grub-mkconfig} (@pxref{Simple configuration}) will set a reasonable
  2897. default for this variable if internationalization is needed and any
  2898. translation files are available.
  2899. @node lockdown
  2900. @subsection lockdown
  2901. If this variable is set to @samp{y}, it means that GRUB has entered
  2902. @pxref{Lockdown} mode.
  2903. @node menu_color_highlight
  2904. @subsection menu_color_highlight
  2905. This variable contains the foreground and background colors to be used for
  2906. the highlighted menu entry, separated by a slash (@samp{/}). Setting this
  2907. variable changes those colors. For the available color names,
  2908. @pxref{color_normal}.
  2909. The default is the value of @samp{color_highlight}
  2910. (@pxref{color_highlight}).
  2911. @node menu_color_normal
  2912. @subsection menu_color_normal
  2913. This variable contains the foreground and background colors to be used for
  2914. non-highlighted menu entries, separated by a slash (@samp{/}). Setting this
  2915. variable changes those colors. For the available color names,
  2916. @pxref{color_normal}.
  2917. The default is the value of @samp{color_normal} (@pxref{color_normal}).
  2918. @node net_@var{<interface>}_boot_file
  2919. @subsection net_@var{<interface>}_boot_file
  2920. @xref{Network}.
  2921. @node net_@var{<interface>}_clientid
  2922. @subsection net_@var{<interface>}_clientid
  2923. @xref{Network}.
  2924. @node net_@var{<interface>}_clientuuid
  2925. @subsection net_@var{<interface>}_clientuuid
  2926. @xref{Network}.
  2927. @node net_@var{<interface>}_dhcp_server_name
  2928. @subsection net_@var{<interface>}_dhcp_server_name
  2929. @xref{Network}.
  2930. @node net_@var{<interface>}_domain
  2931. @subsection net_@var{<interface>}_domain
  2932. @xref{Network}.
  2933. @node net_@var{<interface>}_extensionspath
  2934. @subsection net_@var{<interface>}_extensionspath
  2935. @xref{Network}.
  2936. @node net_@var{<interface>}_hostname
  2937. @subsection net_@var{<interface>}_hostname
  2938. @xref{Network}.
  2939. @node net_@var{<interface>}_ip
  2940. @subsection net_@var{<interface>}_ip
  2941. @xref{Network}.
  2942. @node net_@var{<interface>}_mac
  2943. @subsection net_@var{<interface>}_mac
  2944. @xref{Network}.
  2945. @node net_@var{<interface>}_next_server
  2946. @subsection net_@var{<interface>}_next_server
  2947. @xref{Network}.
  2948. @node net_@var{<interface>}_rootpath
  2949. @subsection net_@var{<interface>}_rootpath
  2950. @xref{Network}.
  2951. @node net_default_interface
  2952. @subsection net_default_interface
  2953. @xref{Network}.
  2954. @node net_default_ip
  2955. @subsection net_default_ip
  2956. @xref{Network}.
  2957. @node net_default_mac
  2958. @subsection net_default_mac
  2959. @xref{Network}.
  2960. @node net_default_server
  2961. @subsection net_default_server
  2962. @xref{Network}.
  2963. @node pager
  2964. @subsection pager
  2965. If set to @samp{1}, pause output after each screenful and wait for keyboard
  2966. input. The default is not to pause output.
  2967. @node prefix
  2968. @subsection prefix
  2969. The location of the @samp{/boot/grub} directory as an absolute file name
  2970. (@pxref{File name syntax}). This is normally set by GRUB at startup based
  2971. on information provided by @command{grub-install}. GRUB modules are
  2972. dynamically loaded from this directory, so it must be set correctly in order
  2973. for many parts of GRUB to work.
  2974. @node pxe_default_server
  2975. @subsection pxe_default_server
  2976. @xref{Network}.
  2977. @node root
  2978. @subsection root
  2979. The root device name (@pxref{Device syntax}). Any file names that do not
  2980. specify an explicit device name are read from this device. The default is
  2981. normally set by GRUB at startup based on the value of @samp{prefix}
  2982. (@pxref{prefix}).
  2983. For example, if GRUB was installed to the first partition of the first hard
  2984. disk, then @samp{prefix} might be set to @samp{(hd0,msdos1)/boot/grub} and
  2985. @samp{root} to @samp{hd0,msdos1}.
  2986. @node shim_lock
  2987. @subsection shim_lock
  2988. If this variable is set to @samp{y}, it means that the shim_lock verifier
  2989. is registered (see @pxref{UEFI secure boot and shim}).
  2990. @node superusers
  2991. @subsection superusers
  2992. This variable may be set to a list of superuser names to enable
  2993. authentication support. @xref{Security}.
  2994. @node theme
  2995. @subsection theme
  2996. This variable may be set to a directory containing a GRUB graphical menu
  2997. theme. @xref{Theme file format}.
  2998. This variable is often set by @samp{GRUB_THEME} (@pxref{Simple
  2999. configuration}).
  3000. @node timeout
  3001. @subsection timeout
  3002. If this variable is set, it specifies the time in seconds to wait for
  3003. keyboard input before booting the default menu entry. A timeout of @samp{0}
  3004. means to boot the default entry immediately without displaying the menu; a
  3005. timeout of @samp{-1} (or unset) means to wait indefinitely.
  3006. If @samp{timeout_style} (@pxref{timeout_style}) is set to @samp{countdown}
  3007. or @samp{hidden}, the timeout is instead counted before the menu is
  3008. displayed.
  3009. This variable is often set by @samp{GRUB_TIMEOUT} (@pxref{Simple
  3010. configuration}).
  3011. @node timeout_style
  3012. @subsection timeout_style
  3013. This variable may be set to @samp{menu}, @samp{countdown}, or @samp{hidden}
  3014. to control the way in which the timeout (@pxref{timeout}) interacts with
  3015. displaying the menu. See the documentation of @samp{GRUB_TIMEOUT_STYLE}
  3016. (@pxref{Simple configuration}) for details.
  3017. @node tpm_fail_fatal
  3018. @subsection tpm_fail_fatal
  3019. If this variable is set and true (i.e., not set to ``0'', ``false'',
  3020. ``disable'', or ``no''), TPM measurements that fail will be treated as
  3021. fatal. Otherwise, they will merely be debug-logged and boot will
  3022. continue.
  3023. Call to EFI firmware, like hash_log_extend_event(), can return an unknown
  3024. error, i.e. due to bug present in firmware. When this variable is set and
  3025. true (same values as with TPM measurements) this situation will be considered
  3026. to be fatal and error-logged as ``unknown TPM error''. If not set, booting
  3027. the OS will be enabled.
  3028. @node Environment block
  3029. @section The GRUB environment block
  3030. It is often useful to be able to remember a small amount of information from
  3031. one boot to the next. For example, you might want to set the default menu
  3032. entry based on what was selected the last time. GRUB deliberately does not
  3033. implement support for writing files in order to minimise the possibility of
  3034. the boot loader being responsible for file system corruption, so a GRUB
  3035. configuration file cannot just create a file in the ordinary way. However,
  3036. GRUB provides an ``environment block'' which can be used to save a small
  3037. amount of state.
  3038. The environment block is a preallocated 1024-byte file, which normally lives
  3039. in @file{/boot/grub/grubenv} (although you should not assume this). At boot
  3040. time, the @command{load_env} command (@pxref{load_env}) loads environment
  3041. variables from it, and the @command{save_env} (@pxref{save_env}) command
  3042. saves environment variables to it. From a running system, the
  3043. @command{grub-editenv} utility can be used to edit the environment block.
  3044. For safety reasons, this storage is only available when installed on a plain
  3045. disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and
  3046. using BIOS or EFI functions (no ATA, USB or IEEE1275).
  3047. @command{grub-mkconfig} uses this facility to implement
  3048. @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
  3049. @node Modules
  3050. @chapter Modules
  3051. In this chapter, we list all modules that are available in GRUB.
  3052. Modules can be loaded via the @command{insmod} (@pxref{insmod}) command.
  3053. @menu
  3054. * acpi_module::
  3055. * adler32_module::
  3056. * affs_module::
  3057. * afs_module::
  3058. * afsplitter_module::
  3059. * ahci_module::
  3060. * all_video_module::
  3061. * aout_module::
  3062. * appleldr_module::
  3063. * archelp_module::
  3064. * at_keyboard_module::
  3065. * ata_module::
  3066. * backtrace_module::
  3067. * bfs_module::
  3068. * biosdisk_module::
  3069. * bitmap_module::
  3070. * bitmap_scale_module::
  3071. * bli_module::
  3072. * blocklist_module::
  3073. * boot_module::
  3074. * boottime_module::
  3075. * bsd_module::
  3076. * bswap_test_module::
  3077. * btrfs_module::
  3078. * bufio_module::
  3079. * cacheinfo_module::
  3080. * cat_module::
  3081. * cbfs_module::
  3082. * cbls_module::
  3083. * cbmemc_module::
  3084. * cbtable_module::
  3085. * cbtime_module::
  3086. * chain_module::
  3087. * cmdline_cat_test_module::
  3088. * cmosdump_module::
  3089. * cmostest_module::
  3090. * cmp_module::
  3091. * cmp_test_module::
  3092. * configfile_module::
  3093. * cpio_module::
  3094. * cpio_be_module::
  3095. * cpuid_module::
  3096. * crc64_module::
  3097. * crypto_module::
  3098. * cryptodisk_module::
  3099. * cs5536_module::
  3100. * ctz_test_module::
  3101. * date_module::
  3102. * datehook_module::
  3103. * datetime_module::
  3104. * disk_module::
  3105. * diskfilter_module::
  3106. * div_module::
  3107. * div_test_module::
  3108. * dm_nv_module::
  3109. * drivemap_module::
  3110. * echo_module::
  3111. * efi_gop_module::
  3112. * efi_uga_module::
  3113. * efiemu_module::
  3114. * efifwsetup_module::
  3115. * efinet_module::
  3116. * efitextmode_module::
  3117. * ehci_module::
  3118. * elf_module::
  3119. * emunet_module::
  3120. * emupci_module::
  3121. * erofs_module::
  3122. * escc_module::
  3123. * eval_module::
  3124. * exfat_module::
  3125. * exfctest_module::
  3126. * ext2_module::
  3127. * extcmd_module::
  3128. * f2fs_module::
  3129. * fat_module::
  3130. * fdt_module::
  3131. * file_module::
  3132. * fixvideo_module::
  3133. * font_module::
  3134. * freedos_module::
  3135. * fshelp_module::
  3136. * functional_test_module::
  3137. * gcry_arcfour_module::
  3138. * gcry_blowfish_module::
  3139. * gcry_camellia_module::
  3140. * gcry_cast5_module::
  3141. * gcry_crc_module::
  3142. * gcry_des_module::
  3143. * gcry_dsa_module::
  3144. * gcry_idea_module::
  3145. * gcry_md4_module::
  3146. * gcry_md5_module::
  3147. * gcry_rfc2268_module::
  3148. * gcry_rijndael_module::
  3149. * gcry_rmd160_module::
  3150. * gcry_rsa_module::
  3151. * gcry_seed_module::
  3152. * gcry_serpent_module::
  3153. * gcry_sha1_module::
  3154. * gcry_sha256_module::
  3155. * gcry_sha512_module::
  3156. * gcry_tiger_module::
  3157. * gcry_twofish_module::
  3158. * gcry_whirlpool_module::
  3159. * gdb_module::
  3160. * geli_module::
  3161. * gettext_module::
  3162. * gfxmenu_module::
  3163. * gfxterm_module::
  3164. * gfxterm_background_module::
  3165. * gfxterm_menu_module::
  3166. * gptsync_module::
  3167. * gzio_module::
  3168. * halt_module::
  3169. * hashsum_module::
  3170. * hdparm_module::
  3171. * hello_module::
  3172. * help_module::
  3173. * hexdump_module::
  3174. * hfs_module::
  3175. * hfsplus_module::
  3176. * hfspluscomp_module::
  3177. * http_module::
  3178. * ieee1275_fb_module::
  3179. * iorw_module::
  3180. * iso9660_module::
  3181. * jfs_module::
  3182. * jpeg_module::
  3183. * json_module::
  3184. * keylayouts_module::
  3185. * keystatus_module::
  3186. * ldm_module::
  3187. * legacy_password_test_module::
  3188. * legacycfg_module::
  3189. * linux_module::
  3190. * linux16_module::
  3191. * loadbios_module::
  3192. * loadenv_module::
  3193. * loopback_module::
  3194. * ls_module::
  3195. * lsacpi_module::
  3196. * lsapm_module::
  3197. * lsdev_module::
  3198. * lsefi_module::
  3199. * lsefimmap_module::
  3200. * lsefisystab_module::
  3201. * lsmmap_module::
  3202. * lspci_module::
  3203. * lssal_module::
  3204. * lsspd_module::
  3205. * lsxen_module::
  3206. * luks_module::
  3207. * luks2_module::
  3208. * lvm_module::
  3209. * lzopio_module::
  3210. * macbless_module::
  3211. * macho_module::
  3212. * mda_text_module::
  3213. * mdraid09_module::
  3214. * mdraid09_be_module::
  3215. * mdraid1x_module::
  3216. * memdisk_module::
  3217. * memrw_module::
  3218. * memtools_module::
  3219. * minicmd_module::
  3220. * minix_module::
  3221. * minix2_module::
  3222. * minix2_be_module::
  3223. * minix3_module::
  3224. * minix3_be_module::
  3225. * minix_be_module::
  3226. * mmap_module::
  3227. * morse_module::
  3228. * mpi_module::
  3229. * msdospart_module::
  3230. * mul_test_module::
  3231. * multiboot_module::
  3232. * multiboot2_module::
  3233. * nand_module::
  3234. * nativedisk_module::
  3235. * net_module::
  3236. * newc_module::
  3237. * nilfs2_module::
  3238. * normal_module::
  3239. * ntfs_module::
  3240. * ntfscomp_module::
  3241. * ntldr_module::
  3242. * odc_module::
  3243. * offsetio_module::
  3244. * ofnet_module::
  3245. * ohci_module::
  3246. * part_acorn_module::
  3247. * part_amiga_module::
  3248. * part_apple_module::
  3249. * part_bsd_module::
  3250. * part_dfly_module::
  3251. * part_dvh_module::
  3252. * part_gpt_module::
  3253. * part_msdos_module::
  3254. * part_plan_module::
  3255. * part_sun_module::
  3256. * part_sunpc_module::
  3257. * parttool_module::
  3258. * password_module::
  3259. * password_pbkdf2_module::
  3260. * pata_module::
  3261. * pbkdf2_module::
  3262. * pbkdf2_test_module::
  3263. * pci_module::
  3264. * pcidump_module::
  3265. * pgp_module::
  3266. * plainmount_module::
  3267. * plan9_module::
  3268. * play_module::
  3269. * png_module::
  3270. * priority_queue_module::
  3271. * probe_module::
  3272. * procfs_module::
  3273. * progress_module::
  3274. * pxe_module::
  3275. * pxechain_module::
  3276. * raid5rec_module::
  3277. * raid6rec_module::
  3278. * random_module::
  3279. * rdmsr_module::
  3280. * read_module::
  3281. * reboot_module::
  3282. * regexp_module::
  3283. * reiserfs_module::
  3284. * relocator_module::
  3285. * romfs_module::
  3286. * scsi_module::
  3287. * sdl_module::
  3288. * search_module::
  3289. * search_fs_file_module::
  3290. * search_fs_uuid_module::
  3291. * search_label_module::
  3292. * sendkey_module::
  3293. * serial_module::
  3294. * setjmp_module::
  3295. * setjmp_test_module::
  3296. * setpci_module::
  3297. * sfs_module::
  3298. * shift_test_module::
  3299. * signature_test_module::
  3300. * sleep_module::
  3301. * sleep_test_module::
  3302. * smbios_module::
  3303. * spkmodem_module::
  3304. * squash4_module::
  3305. * strtoull_test_module::
  3306. * suspend_module::
  3307. * syslinuxcfg_module::
  3308. * tar_module::
  3309. * terminal_module::
  3310. * terminfo_module::
  3311. * test_module::
  3312. * test_blockarg_module::
  3313. * testload_module::
  3314. * testspeed_module::
  3315. * tftp_module::
  3316. * tga_module::
  3317. * time_module::
  3318. * tpm_module::
  3319. * tr_module::
  3320. * trig_module::
  3321. * true_module::
  3322. * truecrypt_module::
  3323. * ubootnet_module::
  3324. * udf_module::
  3325. * ufs1_module::
  3326. * ufs1_be_module::
  3327. * ufs2_module::
  3328. * uhci_module::
  3329. * usb_module::
  3330. * usb_keyboard_module::
  3331. * usbms_module::
  3332. * usbserial_common_module::
  3333. * usbserial_ftdi_module::
  3334. * usbserial_pl2303_module::
  3335. * usbserial_usbdebug_module::
  3336. * usbtest_module::
  3337. * vbe_module::
  3338. * verifiers_module::
  3339. * vga_module::
  3340. * vga_text_module::
  3341. * video_module::
  3342. * video_bochs_module::
  3343. * video_cirrus_module::
  3344. * video_colors_module::
  3345. * video_fb_module::
  3346. * videoinfo_module::
  3347. * videotest_module::
  3348. * videotest_checksum_module::
  3349. * wrmsr_module::
  3350. * xen_boot_module::
  3351. * xfs_module::
  3352. * xnu_module::
  3353. * xnu_uuid_module::
  3354. * xnu_uuid_test_module::
  3355. * xzio_module::
  3356. * zfs_module::
  3357. * zfscrypt_module::
  3358. * zfsinfo_module::
  3359. * zstd_module::
  3360. @end menu
  3361. @node acpi_module
  3362. @section acpi
  3363. This module provides the command @command{acpi} for loading / replacing Advanced
  3364. Configuration and Power Interface (ACPI) tables. Please @pxref{acpi} for more
  3365. information.
  3366. @node adler32_module
  3367. @section adler32
  3368. This module provides the library implementation for the adler32 checksum.
  3369. This is used as part of LZO decompression / compression.
  3370. @node affs_module
  3371. @section affs
  3372. This module provides support for the Amiga Fast FileSystem (AFFS).
  3373. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  3374. information.
  3375. @node afs_module
  3376. @section afs
  3377. This module provides support for the AtheOS File System (AFS).
  3378. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  3379. information.
  3380. @node afsplitter_module
  3381. @section afsplitter
  3382. This module provides library support for the Anti forensic information splitter
  3383. (AFS) operation @code{AF_merge}. This is used by LUKS and LUKS2.
  3384. @node ahci_module
  3385. @section ahci
  3386. This module provides support for the Advanced Host Controller Interface protocol
  3387. to access disks supporting this standard. AHCI is often an option for Serial
  3388. ATA (SATA) controllers (meant to replace the older IDE protocol).
  3389. @node all_video_module
  3390. @section all_video
  3391. This is a "dummy module" with no actual function except to load all other video
  3392. modules as dependencies (a convenient way to load all video modules).
  3393. @node aout_module
  3394. @section aout
  3395. This module provides support for loading files packaged in the "a.out" format.
  3396. The "a.out" format is considered to be an older format than some alternatives
  3397. such as "ELF", for example support for the "a.out" format was removed from the
  3398. Linux kernel in 5.18.
  3399. @node appleldr_module
  3400. @section appleldr
  3401. This module provides support for loading files on a BIOS / EFI based Apple Mac
  3402. computer (Intel based Macs).
  3403. @node archelp_module
  3404. @section archelp
  3405. This module provides Archive Helper functions for archive based file systems
  3406. such as TAR and CPIO archives.
  3407. @node at_keyboard_module
  3408. @section at_keyboard
  3409. This module provides support for the AT keyboard input for the GRUB terminal.
  3410. @node ata_module
  3411. @section ata
  3412. This modules provides support for direct ATA and ATAPI access to compatible
  3413. disks.
  3414. @node backtrace_module
  3415. @section backtrace
  3416. This module provides the command @command{backtrace} for printing a backtrace
  3417. to the terminal for the current call stack.
  3418. @node bfs_module
  3419. @section bfs
  3420. This module provides support for the BeOS "Be File System" (BFS).
  3421. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  3422. information.
  3423. @node biosdisk_module
  3424. @section biosdisk
  3425. This module provides support for booting from a bootable removable disk such
  3426. as a CD-ROM, BD-ROM, etc.
  3427. @node bitmap_module
  3428. @section bitmap
  3429. This module provides support for reading and interacting with bitmap image
  3430. files.
  3431. @node bitmap_scale_module
  3432. @section bitmap_scale
  3433. This module provides support for scaling bitmap image files.
  3434. @node bli_module
  3435. @section bli
  3436. This module provides basic support for the Boot Loader Interface. The Boot
  3437. Loader Interface specifies a set of EFI variables that are used to communicate
  3438. boot-time information between the bootloader and the operating system.
  3439. The following variables are placed under the vendor UUID
  3440. @code{4a67b082-0a4c-41cf-b6c7-440b29bb8c4f} when the module is loaded:
  3441. The GPT partition UUID of the EFI System Partition used during boot is
  3442. published via the @code{LoaderDevicePartUUID} variable. The Boot Loader
  3443. Interface specification requires GPT formatted drives. The bli module
  3444. ignores drives/partitions in any other format. If GRUB is loaded from
  3445. a non-GPT partition, e.g. from an MSDOS formatted drive or network,
  3446. this variable will not be set.
  3447. A string identifying GRUB as the active bootloader including the version
  3448. number is stored in @code{LoaderInfo}.
  3449. This module is only available on UEFI platforms.
  3450. @node blocklist_module
  3451. @section blocklist
  3452. This module provides support for the command @command{blocklist} to list
  3453. blocks for a given file. Please @pxref{blocklist} for more information.
  3454. @node boot_module
  3455. @section boot
  3456. This module provides support for the command @command{boot} to boot an
  3457. operating system. Please @pxref{boot} for more information.
  3458. @node boottime_module
  3459. @section boottime
  3460. This module provides support for the command @command{boottime} to display
  3461. time taken to perform various GRUB operations. This module is only available
  3462. when GRUB is built with the conditional compile option @code{BOOT_TIME_STATS}.
  3463. @node bsd_module
  3464. @section bsd
  3465. This module provides support for loading BSD operating system images via
  3466. commands such as: @command{kfreebsd_loadenv}, @command{kfreebsd_module_elf},
  3467. @command{kfreebsd_module}, @command{kfreebsd}, @command{knetbsd_module_elf},
  3468. @command{knetbsd_module}, @command{knetbsd}, @command{kopenbsd}, and
  3469. @command{kopenbsd_ramdisk}. Please @pxref{Loader commands} for more info.
  3470. @node bswap_test_module
  3471. @section bswap_test
  3472. This module is intended for performing a functional test of the byte swapping
  3473. functionality of GRUB.
  3474. @node btrfs_module
  3475. @section btrfs
  3476. This module provides support for the B-Tree File System (BTRFS).
  3477. @node bufio_module
  3478. @section bufio
  3479. This module is a library module for support buffered I/O of files to support
  3480. file reads performed in other modules.
  3481. @node cacheinfo_module
  3482. @section cacheinfo
  3483. This module provides support for the command @command{cacheinfo} which provides
  3484. statistics on disk cache accesses. This module is only built if
  3485. @code{DISK_CACHE_STATS} is enabled.
  3486. @node cat_module
  3487. @section cat
  3488. This module provides support for the command @command{cat} which outputs the
  3489. content of a file to the terminal. Please @pxref{cat} for more info.
  3490. @node cbfs_module
  3491. @section cbfs
  3492. This module provides support for the Coreboot File System (CBFS) which is an
  3493. archive based file system.
  3494. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  3495. information.
  3496. @node cbls_module
  3497. @section cbls
  3498. This module provides support for the command @command{lscoreboot} to list the
  3499. Coreboot tables.
  3500. @node cbmemc_module
  3501. @section cbmemc
  3502. This module provides support for the command @command{cbmemc} to show the
  3503. content of the Coreboot Memory console.
  3504. @node cbtable_module
  3505. @section cbtable
  3506. This module provides support for accessing the Coreboot tables.
  3507. @node cbtime_module
  3508. @section cbtime
  3509. This module provides support for the command @command{coreboot_boottime} to show
  3510. the Coreboot boot time statistics.
  3511. @node chain_module
  3512. @section chain
  3513. This module provides support for the command @command{chainloader} to boot
  3514. another bootloader. Please @pxref{chainloader} for more information.
  3515. @node cmdline_cat_test_module
  3516. @section cmdline_cat_test
  3517. This module is intended for performing a functional test of the @command{cat}
  3518. command of GRUB.
  3519. @node cmosdump_module
  3520. @section cmosdump
  3521. This module provides support for the command @command{cmosdump} to show a raw
  3522. dump of the CMOS contents. Please @pxref{cmosdump} for more information.
  3523. @node cmostest_module
  3524. @section cmostest
  3525. This module provides support for the commands @command{cmostest},
  3526. @command{cmosclean}, and @command{cmosset} to interact with a CMOS.
  3527. @xref{cmostest} / @pxref{cmosclean} for more information.
  3528. @node cmp_module
  3529. @section cmp
  3530. This module provides support for the command @command{cmp} to compare the
  3531. content of two files. @xref{cmp} for more information.
  3532. @node cmp_test_module
  3533. @section cmp_test
  3534. This module is intended for performing a functional test of relational
  3535. operations in GRUB. Note that this module is *not* associated with the
  3536. @command{cmp} command and does not test the @command{cmp} command.
  3537. @node configfile_module
  3538. @section configfile
  3539. This module provides support for the commands: @command{configfile},
  3540. @command{source}, @command{extract_entries_source},
  3541. @command{extract_entries_configfile}, @command{.} (dot command).
  3542. @xref{configfile} / @pxref{source}.
  3543. @node cpio_module
  3544. @section cpio
  3545. This module provides support for the CPIO archive file format. This module is
  3546. for the "bin" version of CPIO (default of GNU CPIO) supporting around 2GB.
  3547. @node cpio_be_module
  3548. @section cpio_be
  3549. This module provides support for the CPIO archive file format in big-endian
  3550. format. This module is for the "bin" version of CPIO (default of GNU CPIO)
  3551. supporting around 2GB.
  3552. @node cpuid_module
  3553. @section cpuid
  3554. This module provides support for the command @command{cpuid} to test for
  3555. various CPU features. @xref{cpuid} for more information.
  3556. @node crc64_module
  3557. @section crc64
  3558. This module provides support for the CRC64 operation.
  3559. @node crypto_module
  3560. @section crypto
  3561. This module provides library support for various base cryptography operations
  3562. in GRUB.
  3563. @node cryptodisk_module
  3564. @section cryptodisk
  3565. This module provides support for the command @command{cryptomount} to interact
  3566. with encrypted file systems. @xref{cryptomount} for more information.
  3567. @node cs5536_module
  3568. @section cs5536
  3569. This module provides support for the AMD Geode CS5536 companion device.
  3570. @node ctz_test_module
  3571. @section ctz_test
  3572. This module is intended for performing a functional test of the ctz functions
  3573. in GRUB used to Count Trailing Zeros.
  3574. @node date_module
  3575. @section date
  3576. This module provides support for the command @command{date} to get the date/time
  3577. or set the date/time. @xref{date} for more information.
  3578. @node datehook_module
  3579. @section datehook
  3580. This module provides support for populating / providing the environment
  3581. variables @code{YEAR}, @code{MONTH}, @code{DAY}, @code{HOUR}, @code{MINUTE},
  3582. @code{SECOND}, @code{WEEKDAY}.
  3583. @node datetime_module
  3584. @section datetime
  3585. This module provides library support for getting and setting the date / time
  3586. from / to a hardware clock device.
  3587. @node disk_module
  3588. @section disk
  3589. This module provides library support for writing to a storage disk.
  3590. @node diskfilter_module
  3591. @section diskfilter
  3592. This module provides library support for reading a disk RAID array.
  3593. @node div_module
  3594. @section div
  3595. This module provides library support for some operations such as divmod.
  3596. @node div_test_module
  3597. @section div_test
  3598. This module is intended for performing a functional test of the divmod function
  3599. in GRUB.
  3600. @node dm_nv_module
  3601. @section dm_nv
  3602. This module provides support for handling some Nvidia "fakeraid" disk devices.
  3603. @node drivemap_module
  3604. @section drivemap
  3605. This module provides support for the @command{drivemap} to manage BIOS drive
  3606. mappings. @xref{drivemap} for more information.
  3607. @node echo_module
  3608. @section echo
  3609. This module provides support for the @command{echo} to display a line of text.
  3610. @xref{echo} for more information.
  3611. @node efi_gop_module
  3612. @section efi_gop
  3613. This module provides support for the UEFI video output protocol "Graphics
  3614. Output Protocol" (GOP).
  3615. @node efi_uga_module
  3616. @section efi_uga
  3617. This module provides support for the EFI video protocol "Universal Graphic
  3618. Adapter" (UGA).
  3619. @node efiemu_module
  3620. @section efiemu
  3621. This module provides support for the commands @command{efiemu_loadcore},
  3622. @command{efiemu_prepare}, and @command{efiemu_unload}. This provides an EFI
  3623. emulation.
  3624. @node efifwsetup_module
  3625. @section efifwsetup
  3626. This modules provides support for the command @command{fwsetup} to reboot into
  3627. the firmware setup menu. @xref{fwsetup} for more information.
  3628. @node efinet_module
  3629. @section efinet
  3630. This module provides support for UEFI Network Booting for loading images and
  3631. data from the network.
  3632. @node efitextmode_module
  3633. @section efitextmode
  3634. This module provides support for command @command{efitextmode} to get and set
  3635. output mode resolution. @xref{efitextmode} for more information.
  3636. @node ehci_module
  3637. @section ehci
  3638. This module provides support for the USB Enhanced Host Controller Interface
  3639. (EHCI) specification (USB 2.0).
  3640. @node elf_module
  3641. @section elf
  3642. This module provides support for loading Executable and Linkable Format (ELF)
  3643. files.
  3644. @node emunet_module
  3645. @section emunet
  3646. This module provides support for networking in GRUB on the emu platform.
  3647. @node emupci_module
  3648. @section emupci
  3649. This module provides support for accessing the PCI bus in GRUB on the emu
  3650. platform.
  3651. @node erofs_module
  3652. @section erofs
  3653. This module provides support for the Enhanced Read Only File System (EROFS).
  3654. @node escc_module
  3655. @section escc
  3656. This module provides support for the "mac-io" terminal device on PowerPC.
  3657. @node eval_module
  3658. @section eval
  3659. This module provides support for command @command{eval} to evaluate the provided
  3660. input as a sequence of GRUB commands. @xref{eval} for more information.
  3661. @node exfat_module
  3662. @section exfat
  3663. This module provides support for the Extensible File Allocation Table (exFAT)
  3664. file system in GRUB.
  3665. @node exfctest_module
  3666. @section exfctest
  3667. This module is intended to provide an Example Functional Test of GRUB functions
  3668. to use as a template for developing other GRUB functional tests.
  3669. @node ext2_module
  3670. @section ext2
  3671. This module provides support for the Extended File System versions 2, 3, and 4
  3672. (ext2, ext3, and ext4) file systems in GRUB.
  3673. @node extcmd_module
  3674. @section extcmd
  3675. This module is a support module to provide wrapper functions for registering
  3676. other module commands depending on the state of the lockdown variable.
  3677. @node f2fs_module
  3678. @section f2fs
  3679. This module provides support for the Flash-Friendly File System (F2FS) in GRUB.
  3680. @node fat_module
  3681. @section fat
  3682. This module provides support for the File Allocation Table 12-bit, 16-bit, and
  3683. 32-bit (FAT12, FAT16, and FAT32) file systems in GRUB.
  3684. @node fdt_module
  3685. @section fdt
  3686. This module provides support for the commands @command{fdtdump} and
  3687. @command{devicetree} to dump the contents of a device tree blob (.dtb) to the
  3688. console and to load a device tree blob (.dtb) from a filesystem, for
  3689. later use by a Linux kernel, respectively. @xref{devicetree} and
  3690. @pxref{fdtdump} for more information.
  3691. @node file_module
  3692. @section file
  3693. This module provides support for the command @command{file} to test if the
  3694. provided filename is of the specified type. @xref{file} for more information.
  3695. @node fixvideo_module
  3696. @section fixvideo
  3697. This module provides support for the command @command{fix_video} to fix video
  3698. problems in specific PCIe video devices by "patching" specific device register
  3699. settings. Currently supports Intel 945GM (PCI ID @code{0x27a28086}) and Intel
  3700. 965GM (PCI ID @code{0x2a028086}).
  3701. @node font_module
  3702. @section font
  3703. This module provides support for the commands @command{loadfont} and
  3704. @command{lsfonts} to load a given font or list the loaded fonts. @xref{loadfont}
  3705. and @pxref{lsfonts} for more information.
  3706. @node freedos_module
  3707. @section freedos
  3708. This module provides support for command @command{freedos} for loading a FreeDOS
  3709. kernel.
  3710. @node fshelp_module
  3711. @section fshelp
  3712. This module provides support functions (helper functions) for file systems.
  3713. @node functional_test_module
  3714. @section functional_test
  3715. This module provides support for running the GRUB functional tests using
  3716. commands @command{functional_test} and @command{all_functional_test}.
  3717. @node gcry_arcfour_module
  3718. @section gcry_arcfour
  3719. This module provides support for the arcfour stream cipher also known as RC4.
  3720. If security is a concern, RC4 / arcfour cipher is consider broken (multiple
  3721. known vulnerabilities make this insecure).
  3722. This GRUB module is based on libgcrypt.
  3723. @node gcry_blowfish_module
  3724. @section gcry_blowfish
  3725. This module provides support for the Blowfish cipher.
  3726. This GRUB module is based on libgcrypt.
  3727. @node gcry_camellia_module
  3728. @section gcry_camellia
  3729. This module provides support for the Camellia cipher.
  3730. This GRUB module is based on libgcrypt.
  3731. @node gcry_cast5_module
  3732. @section gcry_cast5
  3733. This module provides support for the CAST5 (RFC2144, also known as CAST-128)
  3734. cipher. This GRUB module is based on libgcrypt.
  3735. @node gcry_crc_module
  3736. @section gcry_crc
  3737. This module provides support for the CRC32, CRC32 RFC1510, and CRC24 RFC2440
  3738. cyclic redundancy checks.
  3739. This GRUB module is based on libgcrypt.
  3740. @node gcry_des_module
  3741. @section gcry_des
  3742. This module provides support for the Data Encryption Standard (DES) and
  3743. Triple-DES ciphers.
  3744. If security is a concern, DES has known vulnerabilities and is not recommended,
  3745. and Triple-DES is no longer recommended by NIST.
  3746. This GRUB module is based on libgcrypt.
  3747. @node gcry_dsa_module
  3748. @section gcry_dsa
  3749. This module provides support for the Digital Signature Algorithm (DSA) cipher.
  3750. This GRUB module is based on libgcrypt.
  3751. @node gcry_idea_module
  3752. @section gcry_idea
  3753. This module provides support for the International Data Encryption Algorithm
  3754. (IDEA) cipher.
  3755. This GRUB module is based on libgcrypt.
  3756. @node gcry_md4_module
  3757. @section gcry_md4
  3758. This module provides support for the Message Digest 4 (MD4) message digest.
  3759. If security is a concern, MD4 has known vulnerabilities and is not recommended.
  3760. This GRUB module is based on libgcrypt.
  3761. @node gcry_md5_module
  3762. @section gcry_md5
  3763. This module provides support for the Message Digest 5 (MD5) message digest.
  3764. If security is a concern, MD5 has known vulnerabilities and is not recommended.
  3765. This GRUB module is based on libgcrypt.
  3766. @node gcry_rfc2268_module
  3767. @section gcry_rfc2268
  3768. This module provides support for the RFC2268 (RC2 / Ron's Cipher 2) cipher.
  3769. If security is a concern, RC2 has known vulnerabilities and is not recommended.
  3770. This GRUB module is based on libgcrypt.
  3771. @node gcry_rijndael_module
  3772. @section gcry_rijndael
  3773. This module provides support for the Advanced Encryption Standard (AES-128,
  3774. AES-192, and AES-256) ciphers.
  3775. This GRUB module is based on libgcrypt.
  3776. @node gcry_rmd160_module
  3777. @section gcry_rmd160
  3778. This module provides support for the RIPEMD-160 message digest.
  3779. This GRUB module is based on libgcrypt.
  3780. @node gcry_rsa_module
  3781. @section gcry_rsa
  3782. This module provides support for the Rivest–Shamir–Adleman (RSA) cipher.
  3783. This GRUB module is based on libgcrypt.
  3784. @node gcry_seed_module
  3785. @section gcry_seed
  3786. This module provides support for the SEED cipher.
  3787. This GRUB module is based on libgcrypt.
  3788. @node gcry_serpent_module
  3789. @section gcry_serpent
  3790. This module provides support for the Serpent (128, 192, and 256) ciphers.
  3791. This GRUB module is based on libgcrypt.
  3792. @node gcry_sha1_module
  3793. @section gcry_sha1
  3794. This module provides support for the Secure Hash Algorithm 1 (SHA-1) message
  3795. digest.
  3796. If security is a concern, SHA-1 has known vulnerabilities and is not
  3797. recommended.
  3798. This GRUB module is based on libgcrypt.
  3799. @node gcry_sha256_module
  3800. @section gcry_sha256
  3801. This module provides support for the Secure Hash Algorithm 2 (224 and 256 bit)
  3802. (SHA-224 / SHA-256) message digests.
  3803. This GRUB module is based on libgcrypt.
  3804. @node gcry_sha512_module
  3805. @section gcry_sha512
  3806. This module provides support for the Secure Hash Algorithm 2 (384 and 512 bit)
  3807. (SHA-384 / SHA-512) message digests.
  3808. This GRUB module is based on libgcrypt.
  3809. @node gcry_tiger_module
  3810. @section gcry_tiger
  3811. This module provides support for the Tiger, Tiger 1, and Tiger 2 message
  3812. digests.
  3813. This GRUB module is based on libgcrypt.
  3814. @node gcry_twofish_module
  3815. @section gcry_twofish
  3816. This module provides support for the Twofish (128 and 256) ciphers.
  3817. This GRUB module is based on libgcrypt.
  3818. @node gcry_whirlpool_module
  3819. @section gcry_whirlpool
  3820. This module provides support for the Whirlpool message digest.
  3821. This GRUB module is based on libgcrypt.
  3822. @node gdb_module
  3823. @section gdb
  3824. This module provides support for remotely debugging GRUB using the GNU
  3825. Debugger (GDB) over serial. This is typically done when troubleshooting GRUB
  3826. during development and not required for normal GRUB operation. This module adds
  3827. support for commands required by the GDB remote debug function including
  3828. @command{gdbstub} to start GDB stub on given serial port,
  3829. @command{gdbstub_break} to break into GDB, @command{gdbstub_stop} to stop the
  3830. GDB stub.
  3831. @node geli_module
  3832. @section geli
  3833. This module provides support for the GEOM ELI (GELI) disk encryption /
  3834. decryption protocol used by FreeBSD. This module supports the following ciphers
  3835. using the associated "gcry" modules: DES, Triple-DES, Blowfish, CAST5, AES, and
  3836. Camellia 128.
  3837. @node gettext_module
  3838. @section gettext
  3839. This module provides support for the @command{gettext} command to support
  3840. translating information displayed / output by GRUB. @xref{gettext} for more
  3841. information.
  3842. @node gfxmenu_module
  3843. @section gfxmenu
  3844. This module provides support for displaying a graphical menu / user interface
  3845. from GRUB. This includes features such as graphical font support, theme support,
  3846. image support, and icon support.
  3847. @node gfxterm_module
  3848. @section gfxterm
  3849. This module provides support for displaying a terminal and menu interface from
  3850. GRUB using graphics mode.
  3851. @node gfxterm_background_module
  3852. @section gfxterm_background
  3853. This module provides support for setting the gfxterm background color and
  3854. background image using commands @command{background_color} and
  3855. @command{background_image}. @xref{background_color} and @pxref{background_image}
  3856. for more information.
  3857. @node gfxterm_menu_module
  3858. @section gfxterm_menu
  3859. This module is intended for performing a functional test of the gfxmenu function
  3860. in GRUB.
  3861. @node gptsync_module
  3862. @section gptsync
  3863. This module provides support for the @command{gptsync} command.. @xref{gptsync}
  3864. for more information.
  3865. @node gzio_module
  3866. @section gzio
  3867. This module provides support for decompression (inflate) of files compressed
  3868. with the GZ compression algorithm. This supports only the "DEFLATE" method for
  3869. GZIP. Unsupported flags (will result in failure to inflate) include:
  3870. @code{GRUB_GZ_CONTINUATION}, @code{GRUB_GZ_ENCRYPTED},
  3871. @code{GRUB_GZ_RESERVED}, and @code{GRUB_GZ_EXTRA_FIELD}.
  3872. @node halt_module
  3873. @section halt
  3874. This module provides support for the @command{halt} command to shutdown / halt
  3875. the system. @xref{halt} for more information.
  3876. @node hashsum_module
  3877. @section hashsum
  3878. This module provide support for the commands @command{hashsum},
  3879. @command{md5sum}, @command{sha1sum}, @command{sha256sum}, @command{sha512sum},
  3880. and @command{crc} to calculate or check hashes of files using various methods.
  3881. @xref{hashsum}, @pxref{md5sum} @pxref{sha1sum}, @pxref{sha256sum},
  3882. @pxref{sha512sum}, and @pxref{crc}.
  3883. @node hdparm_module
  3884. @section hdparm
  3885. This module provides support for the @command{hdparm} command to get or set
  3886. various ATA disk parameters. This includes controlling Advanced Power Management
  3887. (APM), displaying power mode, freezing ATA security settings until reset,
  3888. displaying SMART status, controlling automatic acoustic management, setting
  3889. standby timeout, setting the drive to standby mode, setting the drive to sleep
  3890. mode, displaying the drive identification and settings, and enable/disable
  3891. SMART.
  3892. @node hello_module
  3893. @section hello
  3894. This provides support for the @command{hello} command to simply output
  3895. "Hello World". This is intended for testing GRUB module loading / functionality.
  3896. @node help_module
  3897. @section help
  3898. This module provides support for the @command{help} command to output help
  3899. text. @xref{help} for more information.
  3900. @node hexdump_module
  3901. @section hexdump
  3902. This module provides support for the @command{hexdump} command to dump the
  3903. contents of a file in hexadecimal. @xref{hexdump} for more information.
  3904. @node hfs_module
  3905. @section hfs
  3906. This module provides support for the Hierarchical File System (HFS) file system
  3907. in GRUB.
  3908. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  3909. information.
  3910. @node hfsplus_module
  3911. @section hfsplus
  3912. This module provides support for the Hierarchical File System Plus (HFS+) file
  3913. system in GRUB.
  3914. @node hfspluscomp_module
  3915. @section hfspluscomp
  3916. This module provides support for the Hierarchical File System Plus Compressed
  3917. (HFS+ Compressed) file system in GRUB.
  3918. @node http_module
  3919. @section http
  3920. This module provides support for getting data over the HTTP network protocol in
  3921. GRUB (using the HTTP GET method). This may be used, for example, to obtain
  3922. an operating system over HTTP (network boot).
  3923. @node ieee1275_fb_module
  3924. @section ieee1275_fb
  3925. This module provides support for the IEEE1275 video driver output for PowerPC
  3926. with a IEEE-1275 platform.
  3927. @node iorw_module
  3928. @section iorw
  3929. This module provides support for commands @command{inb}, @command{inw},
  3930. @command{inl}, @command{outb}, @command{outw}, and @command{outl} to read /
  3931. write data to physical I/O ports. The "in" commands accept one
  3932. parameter to specify the source port. The "out" commands require either two
  3933. or three parameters, with the order: port, value, <optional mask>.
  3934. @node iso9660_module
  3935. @section iso9660
  3936. This module provides support for the ISO9660 file system (often associated with
  3937. optical disks such as CD-ROMs and DVD-ROMs, with extensions:
  3938. System Use Sharing Protocol (SUSP), Rock Ridge (UNIX style permissions and
  3939. longer names)
  3940. @node jfs_module
  3941. @section jfs
  3942. This module provides support for the Journaled File System (JFS) file system.
  3943. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  3944. information.
  3945. @node jpeg_module
  3946. @section jpeg
  3947. This module provides support for reading JPEG image files in GRUB, such as
  3948. to support displaying a JPEG image as a background image of the gfxmenu.
  3949. @node json_module
  3950. @section json
  3951. This module provides library support for parsing / processing JavaScript Object
  3952. Notation (JSON) formatted data. This is used, for example, to support LUKS2
  3953. disk encryption / decryption as metadata is encoded in JSON.
  3954. @node keylayouts_module
  3955. @section keylayouts
  3956. This module provides support for the @command{keymap} command. This command
  3957. accepts one parameter to specify either the @var{layout_name} or the
  3958. @var{filename}.
  3959. When specifying the @var{layout_name}, this command will attempt to open the
  3960. GRUB keymap file based on the following logic:
  3961. Get the "prefix" from environment variable @var{prefix}
  3962. Open keymap file @var{prefix}/layouts/@var{layout_name}.gkb
  3963. When specifying the @var{filename}, the full path to the ".gkb" file should be
  3964. provided. The ".gkb" file can be generated by grub-kbdcomp.
  3965. @node keystatus_module
  3966. @section keystatus
  3967. This module provides support for the @command{keystatus} command to check key
  3968. modifier status. @xref{keystatus} for more information.
  3969. @node ldm_module
  3970. @section ldm
  3971. This module provides support for the Logical Disk Manager (LDM) disk format.
  3972. LDM is used to add support for logical volumes most often with Microsoft
  3973. Windows systems. A logical volume can be defined to span more than one physical
  3974. disk.
  3975. @node legacy_password_test_module
  3976. @section legacy_password_test
  3977. This module is intended for performing a functional test of the legacy password
  3978. function in GRUB.
  3979. @node legacycfg_module
  3980. @section legacycfg
  3981. This module provides support for commands @command{legacy_source},
  3982. @command{legacy_configfile}, @command{extract_legacy_entries_source},
  3983. @command{extract_legacy_entries_configfile}, @command{legacy_kernel},
  3984. @command{legacy_initrd}, @command{legacy_initrd_nounzip},
  3985. @command{legacy_password}, and @command{legacy_check_password}. For new uses /
  3986. configurations of GRUB other commands / modules offer the modern equivalents.
  3987. @node linux_module
  3988. @section linux
  3989. This module provides support for the commands @command{linux} and
  3990. @command{initrd} to load Linux and an Initial RAM Disk respectively.
  3991. @xref{linux} and @pxref{initrd} for more information.
  3992. @node linux16_module
  3993. @section linux16
  3994. This module provides support for the commands @command{linux16} and
  3995. @command{initrd16} to load Linux in 16-bit mode and an Initial RAM Disk
  3996. in 16-bit mode respectively.
  3997. @xref{linux16} and @pxref{initrd16} for more information.
  3998. @node loadbios_module
  3999. @section loadbios
  4000. This module provides support for the commands @command{fakebios} and
  4001. @command{loadbios}. These commands may only be useful on platforms with
  4002. issues requiring work-arounds. Command @command{fakebios} is used to create
  4003. BIOS-like structures for backward compatibility with existing OS. Command
  4004. @command{loadbios} is used to load a BIOS dump.
  4005. @node loadenv_module
  4006. @section loadenv
  4007. This module provides support for commands @command{load_env},
  4008. @command{list_env}, and @command{save_env}. These commands can be used to
  4009. load environment variables from a file, list environment variables in a file,
  4010. and save environment variables to a file. @xref{load_env}, @pxref{list_env}, and
  4011. @pxref{save_env}.
  4012. @node loopback_module
  4013. @section loopback
  4014. This module provides support for the @command{loopback} command.
  4015. @xref{loopback} for more information.
  4016. @node ls_module
  4017. @section ls
  4018. This module provides support for the @command{ls} command.
  4019. @xref{ls} for more information.
  4020. @node lsacpi_module
  4021. @section lsacpi
  4022. This module provides support for the @command{lsacpi} command. This command
  4023. can be used to display Advanced Configuration and Power Interface (ACPI) tables.
  4024. @node lsapm_module
  4025. @section lsapm
  4026. This module provides support for the @command{lsapm} command. This command
  4027. can be used to display Advanced power management (APM) information.
  4028. @node lsdev_module
  4029. @section lsdev
  4030. This module provides support for the @command{lsdev} command. This command
  4031. can be used on MIPS Advanced RISC Computing (ARC) platforms to display devices.
  4032. @node lsefi_module
  4033. @section lsefi
  4034. This module provides support for the @command{lsefi} command. This command
  4035. can be used on EFI platforms to display EFI handles.
  4036. @node lsefimmap_module
  4037. @section lsefimmap
  4038. This module provides support for the @command{lsefimmap} command. This command
  4039. can be used on EFI platforms to display the EFI memory map.
  4040. @node lsefisystab_module
  4041. @section lsefisystab
  4042. This module provides support for the @command{lsefisystab} command. This
  4043. command can be used on EFI platforms to display the EFI system tables.
  4044. @node lsmmap_module
  4045. @section lsmmap
  4046. This module provides support for the @command{lsmmap} command. This
  4047. command can be used to display the memory map provided by firmware.
  4048. @node lspci_module
  4049. @section lspci
  4050. This module provides support for the @command{lspci} command. This
  4051. command can be used to display the PCI / PCIe devices.
  4052. @node lssal_module
  4053. @section lssal
  4054. This module provides support for the @command{lsefisystab} command. This
  4055. command can be used on Itanium (IA-64) EFI platforms to display the EFI
  4056. System Abstraction Layer system table.
  4057. @node lsspd_module
  4058. @section lsspd
  4059. This module provides support for the @command{lsspd} command. This
  4060. command can be used on MIPS Loongson platforms to display the DDR RAM Serial
  4061. Presence Detect (SPD) EEPROM data.
  4062. @node lsxen_module
  4063. @section lsxen
  4064. This module provides support for the commands @command{xen_ls} and
  4065. @command{xen_cat} on Xen platforms to list Xen storage.
  4066. @node luks_module
  4067. @section luks
  4068. This module provides support for the Linux Unified Key Setup (LUKS) (version 1)
  4069. disk encryption / decryption protocol.
  4070. @node luks2_module
  4071. @section luks2
  4072. This module provides support for the Linux Unified Key Setup 2 (LUKS2)
  4073. disk encryption / decryption protocol.
  4074. @node lvm_module
  4075. @section lvm
  4076. This module provides support for reading Logical Volume Management "logical"
  4077. disks. For example, a single "logical" disk may be mapped to span more than one
  4078. physical disk. This would be used when booting from a LVM formatted disk as may
  4079. be setup in Linux.
  4080. @node lzopio_module
  4081. @section lzopio
  4082. This module provides support for decompressing LZO / LZOP compressed files /
  4083. archives.
  4084. @node macbless_module
  4085. @section macbless
  4086. This module provides support for commands @command{mactelbless} and
  4087. @command{macppcbless} for "blessing" a bootloader on Intel / PPC based MACs
  4088. using the HFS or HFS+ file system. On HFS / HFS+ - "blessing" makes a file
  4089. run as the bootloader.
  4090. @node macho_module
  4091. @section macho
  4092. This module provides support for Mach Object (Mach-O) object / executable files
  4093. in GRUB often used in MacOS.
  4094. @node mda_text_module
  4095. @section mda_text
  4096. This module provides support for the Monochrome Display Adapter (MDA) terminal
  4097. output device. MDA is a predecessor to VGA.
  4098. @node mdraid09_module
  4099. @section mdraid09
  4100. This module provides support for handling Linux compatible "version 0.9"
  4101. software-based RAID disks in little-endian format. The "version 0.9" format
  4102. was largely replaced around the year 2009 with the "version 1.x" format
  4103. (@pxref{mdraid1x_module} for more information).
  4104. @node mdraid09_be_module
  4105. @section mdraid09_be
  4106. This module provides support for handling Linux compatible "version 0.9"
  4107. software-based RAID disks in bid-endian format. The "version 0.9" format
  4108. was largely replaced around the year 2009 with the "version 1.x" format
  4109. (@pxref{mdraid1x_module} for more information).
  4110. @node mdraid1x_module
  4111. @section mdraid1x
  4112. This module provides support for handling Linux compatible "version 1.x"
  4113. software-based RAID disks. This includes the current version used by Linux
  4114. at the time of writing.
  4115. @node memdisk_module
  4116. @section memdisk
  4117. This module provides support for a memdisk device. A memdisk is a memory mapped
  4118. emulated disk.
  4119. @node memrw_module
  4120. @section memrw
  4121. This module provides support for commands @command{read_byte},
  4122. @command{read_word}, @command{read_dword}, @command{write_byte},
  4123. @command{write_word}, and @command{write_dword} to read /
  4124. write data to physical memory (addresses). The "read" commands accept one
  4125. parameter to specify the source address. The "write" commands require either two
  4126. or three parameters, with the order: address, value, <optional mask>.
  4127. Note: The commands provided by this module are not allowed when lockdown is
  4128. enforced (@pxref{Lockdown}).
  4129. @node memtools_module
  4130. @section memtools
  4131. This module provides support for GRUB development / debugging commands
  4132. @command{lsmem}, @command{lsfreemem}, and @command{stress_big_allocs}.
  4133. @node minicmd_module
  4134. @section minicmd
  4135. This module provides support for a subset of commands for GRUB rescue mode
  4136. including: @command{cat}, @command{help}, @command{dump}, @command{rmmod},
  4137. @command{lsmod}, and @command{exit}. The version of the commands in this module
  4138. are similar to their full-fledged counterparts implemented in other GRUB
  4139. modules.
  4140. Note: The @command{dump} command is not allowed when lockdown is enforced
  4141. (@pxref{Lockdown}).
  4142. @node minix_module
  4143. @section minix
  4144. This module provides support for the Minix filesystem, version 1.
  4145. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4146. information.
  4147. @node minix2_module
  4148. @section minix2
  4149. This module provides support for the Minix filesystem, version 2.
  4150. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4151. information.
  4152. @node minix2_be_module
  4153. @section minix2_be
  4154. This module provides support for the Minix filesystem, version 2 big-endian.
  4155. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4156. information.
  4157. @node minix3_module
  4158. @section minix3
  4159. This module provides support for the Minix filesystem, version 3.
  4160. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4161. information.
  4162. @node minix3_be_module
  4163. @section minix3_be
  4164. This module provides support for the Minix filesystem, version 3 big-endian.
  4165. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4166. information.
  4167. @node minix_be_module
  4168. @section minix_be
  4169. This module provides support for the Minix filesystem, version 1 big-endian.
  4170. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4171. information.
  4172. @node mmap_module
  4173. @section mmap
  4174. This module provides support for mapping or unmapping devices or files into
  4175. memory as well as commands @command{badram} and @command{cutmem}.
  4176. @xref{badram} and @ref{cutmem}.
  4177. @node morse_module
  4178. @section morse
  4179. This module provides support for outputting terminal output via Morse code
  4180. to an audio speaker output.
  4181. @node mpi_module
  4182. @section mpi
  4183. This module provides support for multi-precision-integers (MPIs) in GRUB. MPIs
  4184. are used by the crypto functions as many depend on mathematics of large numbers.
  4185. This GRUB module is based on libgcrypt.
  4186. @node msdospart_module
  4187. @section msdospart
  4188. This module provides support for modifying MSDOS formatted disk partitions
  4189. through the separate @command{parttool} command.
  4190. @node mul_test_module
  4191. @section mul_test
  4192. This module is intended for performing a functional test of the multiplication
  4193. operations in GRUB.
  4194. @node multiboot_module
  4195. @section multiboot
  4196. This module provides support for commands @command{multiboot} and
  4197. @command{module} to load a multiboot kernel and load a multiboot module,
  4198. respectively. @xref{multiboot} and @ref{module} for more information. This
  4199. is for loading data formatted per the GNU Multiboot specification.
  4200. @node multiboot2_module
  4201. @section multiboot2
  4202. This module provides support for commands @command{multiboot2} and
  4203. @command{module2} to load a multiboot kernel and load a multiboot module,
  4204. respectively. This is for loading data formatted per the GNU Multiboot
  4205. specification.
  4206. @node nand_module
  4207. @section nand
  4208. This module provides support for accessing an IEEE-1275 compliant NAND disk
  4209. from GRUB.
  4210. @node nativedisk_module
  4211. @section nativedisk
  4212. This module provides support for the @command{nativedisk} command.
  4213. @xref{nativedisk} for more information.
  4214. @node net_module
  4215. @section net
  4216. This module provides support for networking protocols including ARP, BOOTP,
  4217. DNS, Ethernet, ICMPv6, ICMP, IP, TCP, and UDP. Support is included for both
  4218. IPv4 and IPv6.
  4219. This includes the following commands:
  4220. @itemize @bullet
  4221. @item
  4222. @command{net_bootp} - @pxref{net_bootp}
  4223. @item
  4224. @command{net_dhcp} - @pxref{net_dhcp}
  4225. @item
  4226. @command{net_get_dhcp_option} - @pxref{net_get_dhcp_option}
  4227. @item
  4228. @command{net_nslookup} - @pxref{net_nslookup}
  4229. @item
  4230. @command{net_add_dns} - @pxref{net_add_dns}
  4231. @item
  4232. @command{net_del_dns} - @pxref{net_del_dns}
  4233. @item
  4234. @command{net_ls_dns} - @pxref{net_ls_dns}
  4235. @item
  4236. @command{net_add_addr} - @pxref{net_add_addr}
  4237. @item
  4238. @command{net_ipv6_autoconf} - @pxref{net_ipv6_autoconf}
  4239. @item
  4240. @command{net_del_addr} - @pxref{net_del_addr}
  4241. @item
  4242. @command{net_add_route} - @pxref{net_add_route}
  4243. @item
  4244. @command{net_del_route} - @pxref{net_del_route}
  4245. @item
  4246. @command{net_set_vlan} - @pxref{net_set_vlan}
  4247. @item
  4248. @command{net_ls_routes} - @pxref{net_ls_routes}
  4249. @item
  4250. @command{net_ls_cards} - @pxref{net_ls_cards}
  4251. @item
  4252. @command{net_ls_addr} - @pxref{net_ls_addr}
  4253. @end itemize
  4254. @node newc_module
  4255. @section newc
  4256. This module provides support for accessing a CPIO archive as a file system
  4257. from GRUB. This module is for the following newer variants of the CPIO archive
  4258. supported by GNU CPIO (but GNU CPIO defaults to the "bin" format which is
  4259. handled by the module @ref{cpio_module}).
  4260. These are the variants supported by this module:
  4261. @itemize @bullet
  4262. @item
  4263. "newc" - SVR4 portable format without CRC. GNU file utility will identify these
  4264. as something like "ASCII cpio archive (SVR4 with no CRC)"
  4265. @item
  4266. ‘crc’ - SVR4 portable format with CRC. GNU file utility will identify these as
  4267. something like "ASCII cpio archive (SVR4 with CRC)"
  4268. @end itemize
  4269. @node nilfs2_module
  4270. @section nilfs2
  4271. This module provides support for the New Implementation of Log filesystem
  4272. (nilfs2).
  4273. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4274. information.
  4275. @node normal_module
  4276. @section normal
  4277. This module provides support for the normal mode in GRUB. @xref{normal} for
  4278. more information.
  4279. @node ntfs_module
  4280. @section ntfs
  4281. This module provides support for the New Technology File System (NTFS) in GRUB.
  4282. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4283. information.
  4284. @node ntfscomp_module
  4285. @section ntfscomp
  4286. This module provides support for compression with the New Technology File
  4287. System (NTFS) in GRUB.
  4288. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4289. information.
  4290. @node ntldr_module
  4291. @section ntldr
  4292. This module provides support for the @command{ntldr} command. This is may be
  4293. used to boot a Windows boot loader such as NTLDR or BootMGR.
  4294. @node odc_module
  4295. @section odc
  4296. This module provides support for accessing a CPIO archive as a file system
  4297. from GRUB. This module is for "odc" variant of the CPIO archive
  4298. supported by GNU CPIO (but GNU CPIO defaults to the "bin" format which is
  4299. handled by the module @ref{cpio_module}).
  4300. GNU file utility will identify these as something like "ASCII cpio archive
  4301. (pre-SVR4 or odc)"
  4302. @node offsetio_module
  4303. @section offsetio
  4304. This module provides support for reading from a file / archive at specified
  4305. offsets in GRUB.
  4306. @node ofnet_module
  4307. @section ofnet
  4308. This module provides support for the Open Firmware (IEEE-1275) network device
  4309. support in GRUB.
  4310. @node ohci_module
  4311. @section ohci
  4312. This module provides support for the Open Host Controller Interface (OHCI) for
  4313. USB 1 / USB 1.1 support in GRUB.
  4314. @node part_acorn_module
  4315. @section part_acorn
  4316. This module provides support for reading from disks partitioned with the
  4317. Acorn Disc Filing System (ADFS) used on RiscOS.
  4318. @node part_amiga_module
  4319. @section part_amiga
  4320. This module provides support for reading from disks partitioned with the
  4321. Amiga partition table.
  4322. @node part_apple_module
  4323. @section part_apple
  4324. This module provides support for reading from disks partitioned with the
  4325. Macintosh partition table.
  4326. @node part_bsd_module
  4327. @section part_bsd
  4328. This module provides support for reading from disks partitioned with BSD
  4329. style partition tables.
  4330. @node part_dfly_module
  4331. @section part_dfly
  4332. This module provides support for reading from disks partitioned with the
  4333. DragonFly BSD partition table.
  4334. @node part_dvh_module
  4335. @section part_dvh
  4336. This module provides support for reading from disks partitioned with the
  4337. SGI Disk Volume Header partition table.
  4338. @node part_gpt_module
  4339. @section part_gpt
  4340. This module provides support for reading from disks partitioned with the
  4341. GUID Partition Tables (GPT) partition table.
  4342. @node part_msdos_module
  4343. @section part_msdos
  4344. This module provides support for reading from disks partitioned with the
  4345. MSDOS (Master Boot Record / MBR) style partition tables.
  4346. @node part_plan_module
  4347. @section part_plan
  4348. This module provides support for reading from disk partitioned with the
  4349. Plan9 style partition table.
  4350. @node part_sun_module
  4351. @section part_sun
  4352. This module provides support for reading from disk partitioned with the
  4353. Sun style partition table.
  4354. @node part_sunpc_module
  4355. @section part_sunpc
  4356. This module provides support for reading from disk partitioned with the
  4357. Sun PC style partition table.
  4358. @node parttool_module
  4359. @section parttool
  4360. This module provides support for the @command{parttool} command. @xref{parttool}
  4361. for more information.
  4362. @node password_module
  4363. @section password
  4364. This module provides support for the @command{password} command. Please note
  4365. that this uses the password in plain text, if security is a concern consider
  4366. using @ref{password_pbkdf2_module} instead. @xref{password} for more
  4367. information.
  4368. @node password_pbkdf2_module
  4369. @section password_pbkdf2
  4370. This module provides support for the @command{password_pbkdf2} command.
  4371. @xref{password_pbkdf2} for more information.
  4372. @node pata_module
  4373. @section pata
  4374. This module provides support for Parallel ATA (PATA) disk device interfaces.
  4375. @node pbkdf2_module
  4376. @section pbkdf2
  4377. This module provides support for the Password-Based Key Derivation Function 2
  4378. (PBKDF2) / PKCS#5 PBKDF2 as per RFC 2898.
  4379. @node pbkdf2_test_module
  4380. @section pbkdf2_test
  4381. This module is intended for performing a functional test of the PBKDF2
  4382. operation in GRUB.
  4383. @node pci_module
  4384. @section pci
  4385. This module provides support for generic Peripheral Component Interconnect (PCI)
  4386. bus in GRUB.
  4387. @node pcidump_module
  4388. @section pcidump
  4389. This module provides support for the @command{pcidump} command in GRUB to dump
  4390. the PCI configuration registers in hexadecimal of a specified PCI device
  4391. (vendor / device ID) or by position on the bus.
  4392. @node pgp_module
  4393. @section pgp
  4394. This module provides support for the commands: @command{verify_detached},
  4395. @command{trust}, @command{list_trusted}, @command{distrust} associated with
  4396. digital signature checking via the "Open Pretty Good Privacy" (PGP) protocol /
  4397. RFC 4880 using a provided public key. This module also uses / sets
  4398. environment variable @code{check_signatures}. @xref{verify_detached},
  4399. @ref{trust}, @ref{list_trusted}, @ref{distrust}, and @ref{check_signatures}.
  4400. @node plainmount_module
  4401. @section plainmount
  4402. This module provides support for accessing / mounting partitions encrypted
  4403. by "cryptsetup" operating in "plain mode". @xref{plainmount} for more
  4404. information.
  4405. @node plan9_module
  4406. @section plan9
  4407. This module provides support for the @command{plan9} command to load a Plan9
  4408. kernel.
  4409. @node play_module
  4410. @section play
  4411. This module provides support for the @command{play} command to play a tune
  4412. through the PC speaker. @xref{play} for more information.
  4413. @node png_module
  4414. @section png
  4415. This module provides support for reading Portable Network Graphics (PNG) image
  4416. files in GRUB.
  4417. @node priority_queue_module
  4418. @section priority_queue
  4419. This module provides support for a priority queue function within GRUB such as
  4420. to support networking functions.
  4421. @node probe_module
  4422. @section probe
  4423. This module provides support for the @command{probe} command to retrieve device
  4424. information. @xref{probe} for more information.
  4425. @node procfs_module
  4426. @section procfs
  4427. This module provides support for a Proc File System to provide a file system
  4428. like interface to some GRUB internal data.
  4429. @node progress_module
  4430. @section progress
  4431. This module provides support for showing file loading progress to the terminal.
  4432. @node pxe_module
  4433. @section pxe
  4434. This module provides support for Preboot Execution Environment (PXE) network
  4435. boot services as a file system driver for other GRUB modules.
  4436. @node pxechain_module
  4437. @section pxechain
  4438. This module provides support for the @command{pxechainloader} command to load
  4439. another bootloader by PXE.
  4440. @node raid5rec_module
  4441. @section raid5rec
  4442. This module provides support for recovering from faulty RAID4/5 disk arrays
  4443. @node raid6rec_module
  4444. @section raid6rec
  4445. This module provides support for recovering from faulty RAID6 disk arrays.
  4446. @node random_module
  4447. @section random
  4448. This module provides support for library functions to get random data via
  4449. the hardware ACPI Power Management Timer and the TSC time source (Timestamp
  4450. Counter).
  4451. @node rdmsr_module
  4452. @section rdmsr
  4453. This module provides support for the @command{rdmsr} command to read CPU
  4454. Model Specific Registers. @xref{rdmsr} for more information.
  4455. @node read_module
  4456. @section read
  4457. This module provides support for the @command{read} command for getting user
  4458. input. @xref{read} for more information.
  4459. @node reboot_module
  4460. @section reboot
  4461. This module provides support for the @command{reboot} command to reboot the
  4462. computer. @xref{reboot} for more information.
  4463. @node regexp_module
  4464. @section regexp
  4465. This module provides support for the @command{regexp} command to check if a
  4466. regular expression matches a string. This module also provides support for the
  4467. GRUB script wildcard translator. @xref{regexp} for more information.
  4468. @node reiserfs_module
  4469. @section reiserfs
  4470. This module provides support for the ReiserFS File System in GRUB.
  4471. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4472. information.
  4473. @node relocator_module
  4474. @section relocator
  4475. This module provides support for relocating the image / executable being loaded
  4476. to the expected memory location(s) and jumping to (invoking) the executable.
  4477. @node romfs_module
  4478. @section romfs
  4479. This module provides support for the Read-Only Memory File System (ROMFS).
  4480. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4481. information.
  4482. @node scsi_module
  4483. @section scsi
  4484. This module provides support for the Small Computer System Interface (SCSI)
  4485. protocol used for some types of disk communication include some modern ones
  4486. such as USB Mass Storage Devices supporting "USB Attached SCSI" (UAS).
  4487. @node sdl_module
  4488. @section sdl
  4489. This module provides support for Simple DirectMedia Layer (SDL) video / image
  4490. output from the grub-emu tool used to preview the GRUB menu from a running
  4491. Operating System such as Linux (useful to test GRUB menu configuration changes
  4492. without rebooting). When available in the compilation target environment, SDL2
  4493. will be used instead of SDL1.
  4494. @node search_module
  4495. @section search
  4496. This module provides support for the @command{search} command to search devices
  4497. by file, filesystem label, or filesystem UUID. @xref{search} for more
  4498. information.
  4499. @node search_fs_file_module
  4500. @section search_fs_file
  4501. This module provides support for the @command{search.file} command which
  4502. is an alias for the corresponding @command{search} command. @xref{search} for
  4503. more information.
  4504. @node search_fs_uuid_module
  4505. @section search_fs_uuid
  4506. This module provides support for the @command{search.fs_uuid} command which
  4507. is an alias for the corresponding @command{search} command. @xref{search} for
  4508. more information.
  4509. @node search_label_module
  4510. @section search_label
  4511. This module provides support for the @command{search.fs_label} command which
  4512. is an alias for the corresponding @command{search} command. @xref{search} for
  4513. more information.
  4514. @node sendkey_module
  4515. @section sendkey
  4516. This module provides support for the @command{sendkey} command to send
  4517. emulated keystrokes. @xref{sendkey} for more information.
  4518. @node serial_module
  4519. @section serial
  4520. This module provides support for the @command{serial} command and associated
  4521. driver support for communication over a serial interface from GRUB.
  4522. @xref{serial} for more information.
  4523. @node setjmp_module
  4524. @section setjmp
  4525. This module provides support for the @code{setjmp} and @code{longjmp} functions
  4526. used within GRUB.
  4527. @node setjmp_test_module
  4528. @section setjmp_test
  4529. This module is intended for performing a functional test of the @code{setjmp}
  4530. and @code{longjmp} functions in GRUB.
  4531. @node setpci_module
  4532. @section setpci
  4533. This module provides support for the @command{setpci} command to get / set
  4534. values from / to specified PCI / PCIe devices.
  4535. @node sfs_module
  4536. @section sfs
  4537. This module provides support for the Amiga Smart File System (SFS) in GRUB.
  4538. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4539. information.
  4540. @node shift_test_module
  4541. @section shift_test
  4542. This module is intended for performing a functional test of the bit-wise shift
  4543. operations in GRUB.
  4544. @node signature_test_module
  4545. @section signature_test
  4546. This module is intended for performing a functional test of the digital
  4547. signature verification functions in GRUB.
  4548. @node sleep_module
  4549. @section sleep
  4550. This module provides support for the @command{sleep} command to wait a specified
  4551. number of seconds in GRUB. @xref{sleep} for more information.
  4552. @node sleep_test_module
  4553. @section sleep_test
  4554. This module is intended for performing a functional test of the sleep function
  4555. in GRUB.
  4556. @node smbios_module
  4557. @section smbios
  4558. This module provides support for the @command{smbios} command to retrieve SMBIOS
  4559. information in GRUB. @xref{smbios} for more information.
  4560. @node spkmodem_module
  4561. @section spkmodem
  4562. This module provides support for outputting GRUB console information over an
  4563. audio output. This output can be fed into another computer's sound input
  4564. and decoded using the @code{spkmodem_recv} utility. Note that this will slow
  4565. down GRUB's performance.
  4566. @node squash4_module
  4567. @section squash4
  4568. This module provides support for the SquashFS compressed read-only file system
  4569. in GRUB.
  4570. @node strtoull_test_module
  4571. @section strtoull_test
  4572. This module is intended for performing a functional test of the strtoull
  4573. function in GRUB.
  4574. @node suspend_module
  4575. @section suspend
  4576. This module provides support for the @command{suspend} command in GRUB to
  4577. return to IEEE1275 prompt on "Open Firmware" systems.
  4578. @node syslinuxcfg_module
  4579. @section syslinuxcfg
  4580. This module provides support for commands @command{syslinux_source},
  4581. @command{syslinux_configfile}, @command{extract_syslinux_entries_source},
  4582. and @command{extract_syslinux_entries_configfile} in GRUB. These commands
  4583. can be used to parse and display GRUB menu entries based on a Syslinux based
  4584. configuration (used for SYSLINUX, ISOLINUX, and PXELINUX). It can also
  4585. be used to execute the Syslinux loader from GRUB.
  4586. @node tar_module
  4587. @section tar
  4588. This module provides support for the GNU Tar and POSIX Tar file archives as a
  4589. file system in GRUB.
  4590. @node terminal_module
  4591. @section terminal
  4592. This module provides support for the commands @command{terminal_input} and
  4593. @command{terminal_output} in GRUB. @xref{terminal_input} and
  4594. @ref{terminal_output} for more information.
  4595. @node terminfo_module
  4596. @section terminfo
  4597. This module provides support for the @command{terminfo} command in GRUB to
  4598. set various terminal modes / options. @xref{terminfo} for more information.
  4599. @node test_module
  4600. @section test
  4601. This module provides support for the commands @command{test} and @command{[}.
  4602. These commands can be used to evaluate (test) an expression. @xref{test} for
  4603. more information.
  4604. @node test_blockarg_module
  4605. @section test_blockarg
  4606. This module is intended for performing a functional test of the "block" command
  4607. argument function in GRUB internal functions via a test command
  4608. @command{test_blockarg}.
  4609. @node testload_module
  4610. @section testload
  4611. This module is intended for performing a functional test of some file reading /
  4612. seeking functions in GRUB internals via a test command @command{testload}.
  4613. @node testspeed_module
  4614. @section testspeed
  4615. This module provides support for the @command{testspeed} command to test and
  4616. print file read speed of a specified file.
  4617. @node tftp_module
  4618. @section tftp
  4619. This module provides support for the Trivial File Transfer Protocol (TFTP) for
  4620. receiving files via the network to GRUB. TFTP may be used along with PXE for
  4621. network booting for example.
  4622. @node tga_module
  4623. @section tga
  4624. This module provides support for reading Truevision Graphics Adapter (TGA)
  4625. image files in GRUB.
  4626. @node time_module
  4627. @section time
  4628. This module provides support for the @command{time} command to measure the
  4629. time taken by a given command and output it to the terminal.
  4630. @node tpm_module
  4631. @section tpm
  4632. This module provides support for interacting with a Trusted Platform Module
  4633. (TPM) with GRUB to perform Measured Boot. @xref{Measured Boot} for more
  4634. information.
  4635. @node tr_module
  4636. @section tr
  4637. This module provides support for the @command{tr} command in GRUB. This can be
  4638. used to translate characters in a string according to the provided arguments.
  4639. For example this can be used to convert upper-case to lower-case and visa-versa.
  4640. @node trig_module
  4641. @section trig
  4642. This module provides support for internal trig functions @code{grub_cos} and
  4643. @code{grub_sin} using lookup based computation. Currently these trig functions
  4644. are used by the gfxmenu circular progress bar.
  4645. @node true_module
  4646. @section true
  4647. This module provides support for the commands @command{true} and
  4648. @command{false}. @xref{true} and @ref{false} for more information.
  4649. @node truecrypt_module
  4650. @section truecrypt
  4651. This module provides support for the @command{truecrypt} command. This can be
  4652. used to load a Truecrypt ISO image.
  4653. @node ubootnet_module
  4654. @section ubootnet
  4655. This module provides support for configuring network interfaces in GRUB using
  4656. information provided by a U-Boot bootloader.
  4657. @node udf_module
  4658. @section udf
  4659. This module provides support for the Universal Disk Format (UDF) used on some
  4660. newer optical disks.
  4661. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4662. information.
  4663. @node ufs1_module
  4664. @section ufs1
  4665. This module provides support for the Unix File System version 1 in GRUB.
  4666. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4667. information.
  4668. @node ufs1_be_module
  4669. @section ufs1_be
  4670. This module provides support for the Unix File System version 1 (big-endian) in
  4671. GRUB.
  4672. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4673. information.
  4674. @node ufs2_module
  4675. @section ufs2
  4676. This module provides support for the Unix File System version 2 in GRUB.
  4677. Note: This module is not allowed in lockdown mode, @pxref{Lockdown} for more
  4678. information.
  4679. @node uhci_module
  4680. @section uhci
  4681. This module provides support for the Universal Host Controller Interface (UHCI)
  4682. for USB 1.x.
  4683. @node usb_module
  4684. @section usb
  4685. This module provides support for USB interfaces, USB hubs, and USB transfers
  4686. in GRUB.
  4687. @node usb_keyboard_module
  4688. @section usb_keyboard
  4689. This module provides support for a USB keyboard in GRUB.
  4690. @node usbms_module
  4691. @section usbms
  4692. This module provides support for USB Mass Storage devices in GRUB.
  4693. @node usbserial_common_module
  4694. @section usbserial_common
  4695. This module provides support for common operations needed to support USB Serial
  4696. port adapters in GRUB (to support a model / type specific USB to serial
  4697. adapter defined in another module).
  4698. @node usbserial_ftdi_module
  4699. @section usbserial_ftdi
  4700. This module provides support for USB to serial adapters with vendor ID 0x0403
  4701. and product ID 0x6001 (often associated with FTDI devices).
  4702. @node usbserial_pl2303_module
  4703. @section usbserial_pl2303
  4704. This module provides support for USB to serial adapters with vendor ID 0x067b
  4705. and product ID 0x2303 (PL2303 USB to Serial adapter).
  4706. @node usbserial_usbdebug_module
  4707. @section usbserial_usbdebug
  4708. This module provides support for debugging GRUB via a "USB 2.0 Debug Cable".
  4709. The USB 2.0 specification includes a "USB2 Debug Device Functional
  4710. Specification" that this driver is intended to support for GRUB. This may
  4711. integrate with GDB server function in GRUB (@pxref{gdb_module}).
  4712. @node usbtest_module
  4713. @section usbtest
  4714. This module provides support for the @command{usb} command in GRUB to test USB
  4715. functionality by iterating through all connected USB devices and printing
  4716. information for each to the terminal.
  4717. @node vbe_module
  4718. @section vbe
  4719. This module provides support for the VESA BIOS Extension (VBE) Video Driver in
  4720. GRUB.
  4721. @node verifiers_module
  4722. @section verifiers
  4723. This module is a built-in kernel module to provide a framework for GRUB file
  4724. verifiers and string verifiers.
  4725. @node vga_module
  4726. @section vga
  4727. This module provides support for the Video Graphics Array (VGA) Video Driver in
  4728. GRUB.
  4729. @node vga_text_module
  4730. @section vga_text
  4731. This module provides support for the Video Graphics Array (VGA) terminal
  4732. output device.
  4733. @node video_module
  4734. @section video
  4735. This module provides support for video output support functions within GRUB.
  4736. @node video_bochs_module
  4737. @section video_bochs
  4738. This module provides support for the Bochs PCI Video Driver (also known as
  4739. Bochs Graphics Adapter / BGA) in GRUB.
  4740. @node video_cirrus_module
  4741. @section video_cirrus
  4742. This module provides support for the Cirrus CLGD 5446 PCI Video Driver (Cirrus
  4743. Video) in GRUB.
  4744. @node video_colors_module
  4745. @section video_colors
  4746. This module provides support for interpreting named colors and parsing RBG
  4747. hexadecimal values.
  4748. @node video_fb_module
  4749. @section video_fb
  4750. This module provides support for video frame buffer (FB) support in GRUB.
  4751. @node videoinfo_module
  4752. @section videoinfo
  4753. This module provides support for the @command{videoinfo} command and (depending
  4754. on architecture) the @command{vbeinfo} command. @xref{videoinfo} for more
  4755. information.
  4756. @node videotest_module
  4757. @section videotest
  4758. This module provides support for the @command{videotest} command and (depending
  4759. on architecture) the @command{vbetest} to test the video subsystem in the
  4760. specified width and height.
  4761. @node videotest_checksum_module
  4762. @section videotest_checksum
  4763. This module is intended for performing a functional test of the video
  4764. functions in GRUB by displaying a test image and capturing a checksum.
  4765. @node wrmsr_module
  4766. @section wrmsr
  4767. This module provides support for the @command{wrmsr} command to write to CPU
  4768. model-specific registers. @xref{wrmsr} for more information.
  4769. @node xen_boot_module
  4770. @section xen_boot
  4771. This module provides support for the commands @command{xen_hypervisor} and
  4772. @command{xen_module} to load a XEN hypervisor and module respectively.
  4773. @node xfs_module
  4774. @section xfs
  4775. This module provides support for the XFS file system in GRUB.
  4776. @node xnu_module
  4777. @section xnu
  4778. This module provides support for the commands: @command{xnu_devprop_load},
  4779. @command{xnu_kernel}, @command{xnu_kernel64}, @command{xnu_mkext},
  4780. @command{xnu_kext}, @command{xnu_kextdir}, @command{xnu_ramdisk},
  4781. @command{xnu_splash}, and @command{xnu_resume} (only for emulated machine).
  4782. These commands support loading and interacting with a XNU (MacOS / Apple) based
  4783. system / kernel.
  4784. @node xnu_uuid_module
  4785. @section xnu_uuid
  4786. This module provides support for the @command{xnu_uuid} command to transform
  4787. a 64-bit UUID to a format suitable for XNU.
  4788. @node xnu_uuid_test_module
  4789. @section xnu_uuid_test
  4790. This module is intended for performing a functional test of the XNU UUID
  4791. conversion function.
  4792. @node xzio_module
  4793. @section xzio
  4794. This module provides support for decompression of XZ compressed data.
  4795. @node zfs_module
  4796. @section zfs
  4797. This module provides support for the ZFS file system in GRUB.
  4798. @node zfscrypt_module
  4799. @section zfscrypt
  4800. This module provides support for the @command{zfskey} to import a decryption
  4801. key as well as decryption support for encrypted ZFS file systems.
  4802. @node zfsinfo_module
  4803. @section zfsinfo
  4804. This module provides support for the commands @command{zfsinfo} to output ZFS
  4805. info about a device and @command{zfs-bootfs} to output ZFS-BOOTFSOBJ or store
  4806. it into a variable.
  4807. @node zstd_module
  4808. @section zstd
  4809. This module provides support for the Zstandard (zstd) decompression algorithm
  4810. in GRUB.
  4811. @node Commands
  4812. @chapter Available commands
  4813. In this chapter, we list all commands that are available in GRUB.
  4814. Commands belong to different groups. A few can only be used in
  4815. the global section of the configuration file (or ``menu''); most
  4816. of them can be entered on the command-line and can be used either
  4817. anywhere in the menu or specifically in the menu entries.
  4818. In rescue mode, only the @command{insmod} (@pxref{insmod}), @command{ls}
  4819. (@pxref{ls}), @command{set} (@pxref{set}), and @command{unset}
  4820. (@pxref{unset}) commands are normally available. If you end up in rescue
  4821. mode and do not know what to do, then @pxref{GRUB only offers a rescue
  4822. shell}.
  4823. @menu
  4824. * Menu-specific commands::
  4825. * Loader commands::
  4826. * General commands::
  4827. * Command-line commands::
  4828. * Networking commands::
  4829. * Undocumented commands::
  4830. @end menu
  4831. @node Menu-specific commands
  4832. @section Commands for the menu only
  4833. The semantics used in parsing the configuration file are the following:
  4834. @itemize @bullet
  4835. @item
  4836. The files @emph{must} be in plain-text format.
  4837. @item
  4838. @samp{#} at the beginning of a line in a configuration file means it is
  4839. only a comment.
  4840. @item
  4841. Options are separated by spaces.
  4842. @item
  4843. All numbers can be either decimal or hexadecimal. A hexadecimal number
  4844. must be preceded by @samp{0x}, and is case-insensitive.
  4845. @end itemize
  4846. These commands can only be used in the menu:
  4847. @menu
  4848. * menuentry:: Start a menu entry
  4849. * submenu:: Group menu entries
  4850. @end menu
  4851. @node menuentry
  4852. @subsection menuentry
  4853. @deffn Command menuentry @var{title} @
  4854. [@option{--class=class} @dots{}] [@option{--users=users}] @
  4855. [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
  4856. [@var{arg} @dots{}] @{ @var{command}; @dots{} @}
  4857. This defines a GRUB menu entry named @var{title}. When this entry is
  4858. selected from the menu, GRUB will set the @var{chosen} environment variable
  4859. to value of @option{--id} if @option{--id} is given, execute the list of
  4860. commands given within braces, and if the last command in the list returned
  4861. successfully and a kernel was loaded it will execute the @command{boot} command.
  4862. The @option{--class} option may be used any number of times to group menu
  4863. entries into classes. Menu themes may display different classes using
  4864. different styles.
  4865. The @option{--users} option grants specific users access to specific menu
  4866. entries. @xref{Security}.
  4867. The @option{--unrestricted} option grants all users access to specific menu
  4868. entries. @xref{Security}.
  4869. The @option{--hotkey} option associates a hotkey with a menu entry.
  4870. @var{key} may be a single letter, or one of the aliases @samp{backspace},
  4871. @samp{tab}, or @samp{delete}.
  4872. The @option{--id} may be used to associate unique identifier with a menu entry.
  4873. @var{id} is string of ASCII aphanumeric characters, underscore and hyphen
  4874. and should not start with a digit.
  4875. All other arguments including @var{title} are passed as positional parameters
  4876. when list of commands is executed with @var{title} always assigned to @code{$1}.
  4877. @end deffn
  4878. @node submenu
  4879. @subsection submenu
  4880. @deffn Command submenu @var{title} @
  4881. [@option{--class=class} @dots{}] [@option{--users=users}] @
  4882. [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
  4883. @{ @var{menu entries} @dots{} @}
  4884. This defines a submenu. An entry called @var{title} will be added to the
  4885. menu; when that entry is selected, a new menu will be displayed showing all
  4886. the entries within this submenu.
  4887. All options are the same as in the @command{menuentry} command
  4888. (@pxref{menuentry}).
  4889. @end deffn
  4890. @node Loader commands
  4891. @section Various loader commands
  4892. These commands are used to load necessary components to boot desired OS.
  4893. Many of the loader commands are not sufficiently documented. The following is
  4894. a list of commands that could use more documentation:
  4895. @itemize @bullet
  4896. @item @command{appleloader} - Boot BIOS-based system.
  4897. @item @command{freedos} - Load FreeDOS kernel.sys.
  4898. @item @command{kfreebsd_loadenv} - Load FreeBSD env.
  4899. @item @command{kfreebsd_module_elf} - Load FreeBSD kernel module (ELF).
  4900. @item @command{kfreebsd_module} - Load FreeBSD kernel module.
  4901. @item @command{kfreebsd} - Load kernel of FreeBSD.
  4902. @item @command{knetbsd_module_elf} - Load NetBSD kernel module (ELF).
  4903. @item @command{knetbsd_module} - Load NetBSD kernel module.
  4904. @item @command{knetbsd} - Load kernel of NetBSD.
  4905. @item @command{kopenbsd} - Load kernel of OpenBSD.
  4906. @item @command{kopenbsd_ramdisk} - Load kOpenBSD ramdisk.
  4907. @item @command{legacy_initrd_nounzip} - Simulate grub-legacy `modulenounzip' command
  4908. @item @command{legacy_initrd} - Simulate grub-legacy `initrd' command
  4909. @item @command{legacy_kernel} - Simulate grub-legacy `kernel' command
  4910. @item @command{module2} - Load a multiboot 2 module.
  4911. @item @command{module} - Load a multiboot module.
  4912. @item @command{multiboot2} - Load a multiboot 2 kernel.
  4913. @item @command{multiboot} - Load a multiboot kernel.
  4914. @item @command{ntldr} - Load NTLDR or BootMGR.
  4915. @item @command{plan9} - Load Plan9 kernel.
  4916. @item @command{pxechainloader} - Load a PXE image.
  4917. @item @command{truecrypt} - Load Truecrypt ISO.
  4918. @item @command{xnu_kernel64} - Load 64-bit XNU image.
  4919. @item @command{xnu_kernel} - Load XNU image.
  4920. @item @command{xnu_kextdir} - Load XNU extension directory.
  4921. @item @command{xnu_kext} - Load XNU extension.
  4922. @item @command{xnu_mkext} - Load XNU extension package.
  4923. @item @command{xnu_ramdisk} - Load XNU ramdisk. It will be available in OS as md0.
  4924. @item @command{xnu_resume} - Load an image of hibernated XNU.
  4925. @item @command{xnu_splash} - Load a splash image for XNU.
  4926. @end itemize
  4927. @menu
  4928. * chainloader:: Chain-load another boot loader
  4929. * initrd:: Load a Linux initrd
  4930. * initrd16:: Load a Linux initrd (16-bit mode)
  4931. * linux:: Load a Linux kernel
  4932. * linux16:: Load a Linux kernel (16-bit mode)
  4933. @comment * xen_*:: Xen boot commands for AArch64
  4934. * xen_hypervisor:: Load xen hypervisor binary (only on AArch64)
  4935. * xen_module:: Load xen modules for xen hypervisor (only on AArch64)
  4936. @end menu
  4937. @node chainloader
  4938. @subsection chainloader
  4939. @deffn Command chainloader [@option{--force}] file [args...]
  4940. Load @var{file} as a chain-loader. Like any other file loaded by the
  4941. filesystem code, it can use the blocklist notation (@pxref{Block list
  4942. syntax}) to grab the first sector of the current partition with @samp{+1}.
  4943. On EFI platforms, any arguments after @var{file} will be sent to the loaded
  4944. image.
  4945. If you specify the option @option{--force}, then load @var{file} forcibly,
  4946. whether it has a correct signature or not. This is required when you want to
  4947. load a defective boot loader, such as SCO UnixWare 7.1.
  4948. @end deffn
  4949. @node initrd
  4950. @subsection initrd
  4951. @deffn Command initrd file [file @dots{}]
  4952. Load, in order, all initrds for a Linux kernel image, and set the
  4953. appropriate parameters in the Linux setup area in memory. This may only
  4954. be used after the @command{linux} command (@pxref{linux}) has been run.
  4955. See @ref{GNU/Linux} for more info on booting GNU/Linux. For more
  4956. information on initrds see the GNU/Linux kernel
  4957. @uref{https://docs.kernel.org/filesystems/ramfs-rootfs-initramfs.html,
  4958. documentation}.
  4959. A new-style initrd (for kernels newer than 2.6) containing one file
  4960. with leading path components can also be generated at run time. This
  4961. can be done by prefixing an argument with @code{newc:} followed by the
  4962. path of the file in the new initrd, a @code{:}, and then the GRUB file
  4963. path to the file data to be be included.
  4964. For example:
  4965. @example
  4966. initrd newc:/etc/ssh/config:(hd0,2)/home/user/.ssh/config \
  4967. newc:/etc/ssh/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key \
  4968. /boot/initrd.gz \
  4969. newc:/init:/home/user/init.fixed
  4970. @end example
  4971. This command will generate two new-style initrds on the fly. The first
  4972. contains the path @samp{/etc/ssh/config} with the contents of
  4973. @samp{(hd0,2)/home/user/.ssh/config} and the path
  4974. @samp{/etc/ssh/ssh_host_rsa_key} with the contents of
  4975. @samp{/etc/ssh/ssh_host_rsa_key} on the @var{root} device. Parent directory
  4976. paths will automatically be generated as needed. This first generated initrd
  4977. will then have @samp{/boot/initrd.gz} concatenated after it. Next, another
  4978. new-style archive will be generated with the contents of @samp{/home/user/init.fixed}
  4979. in the path @samp{/init} and appended to the previous concatenation. Finally,
  4980. the result will be sent to the kernel when booted.
  4981. Keep in mind that paths that come later will take precedence. So in the
  4982. example above, the generated path @samp{/init} will overwrite any @samp{/init}
  4983. in @samp{/boot/initrd.gz}. This can be useful when changing the main initrd
  4984. is undesirable or difficult.
  4985. @end deffn
  4986. @node initrd16
  4987. @subsection initrd16
  4988. @deffn Command initrd16 file [file @dots{}]
  4989. Load, in order, all initrds for a Linux kernel image to be booted in
  4990. 16-bit mode, and set the appropriate parameters in the Linux setup area in
  4991. memory. This may only be used after the @command{linux16} command
  4992. (@pxref{linux16}) has been run. See also @ref{GNU/Linux} and the @command{initrd}
  4993. command (@pxref{initrd}) for more details on arguments.
  4994. This command is only available on the pc platform for x86 systems.
  4995. @end deffn
  4996. @node linux
  4997. @subsection linux
  4998. @deffn Command linux file @dots{}
  4999. Load a Linux kernel image from @var{file}. The rest of the line is passed
  5000. verbatim as the @dfn{kernel command-line}. Any initrd must be reloaded
  5001. after using this command (@pxref{initrd}).
  5002. On x86 systems, the kernel will be booted using the 32-bit boot protocol.
  5003. Note that this means that the @samp{vga=} boot option will not work; if you
  5004. want to set a special video mode, you will need to use GRUB commands such as
  5005. @samp{set gfxpayload=1024x768} or @samp{set gfxpayload=keep} (to keep the
  5006. same mode as used in GRUB) instead. GRUB can automatically detect some uses
  5007. of @samp{vga=} and translate them to appropriate settings of
  5008. @samp{gfxpayload}. The @command{linux16} command (@pxref{linux16}) avoids
  5009. this restriction.
  5010. @end deffn
  5011. @node linux16
  5012. @subsection linux16
  5013. @deffn Command linux16 file @dots{}
  5014. Load a Linux kernel image from @var{file} in 16-bit mode. The rest of the
  5015. line is passed verbatim as the @dfn{kernel command-line}. Any initrd must
  5016. be reloaded after using this command (@pxref{initrd16}).
  5017. The kernel will be booted using the traditional 16-bit boot protocol. As
  5018. well as bypassing problems with @samp{vga=} described in @ref{linux}, this
  5019. permits booting some other programs that implement the Linux boot protocol
  5020. for the sake of convenience.
  5021. This command is only available on x86 systems.
  5022. @end deffn
  5023. @node xen_hypervisor
  5024. @subsection xen_hypervisor
  5025. @deffn Command xen_hypervisor file [arguments] @dots{}
  5026. Load a Xen hypervisor binary from @var{file}. The rest of the line is passed
  5027. verbatim as the @dfn{kernel command-line}. Any other binaries must be
  5028. reloaded after using this command.
  5029. This command is only available on AArch64 systems.
  5030. @end deffn
  5031. @node xen_module
  5032. @subsection xen_module
  5033. @deffn Command xen_module [--nounzip] file [arguments]
  5034. Load a module for xen hypervisor at the booting process of xen.
  5035. The rest of the line is passed verbatim as the module command line.
  5036. Modules should be loaded in the following order:
  5037. - dom0 kernel image
  5038. - dom0 ramdisk if present
  5039. - XSM policy if present
  5040. This command is only available on AArch64 systems.
  5041. @end deffn
  5042. @node General commands
  5043. @section General commands
  5044. Commands usable anywhere in the menu and in the command-line.
  5045. @menu
  5046. * serial:: Set up a serial device
  5047. * terminal_input:: Manage input terminals
  5048. * terminal_output:: Manage output terminals
  5049. * terminfo:: Define terminal type
  5050. @end menu
  5051. @node serial
  5052. @subsection serial
  5053. @deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}]
  5054. Initialize a serial device. @var{unit} is a number in the range 0-3
  5055. specifying which serial port to use; default is 0, which corresponds to
  5056. the port often called COM1.
  5057. @var{port} is the I/O port where the UART is to be found or, if prefixed
  5058. with @samp{mmio,}, the MMIO address of the UART. If specified it takes
  5059. precedence over @var{unit}.
  5060. Additionally, an MMIO address can be suffixed with:
  5061. @itemize @bullet
  5062. @item
  5063. @samp{.b} for bytes access (default)
  5064. @item
  5065. @samp{.w} for 16-bit word access
  5066. @item
  5067. @samp{.l} for 32-bit long word access or
  5068. @item
  5069. @samp{.q} for 64-bit long long word access
  5070. @end itemize
  5071. Also, @var{port} can be of the form @samp{pci,XX:XX.X} to indicate a serial
  5072. device exposed on the PCI bus.
  5073. @var{speed} is the transmission speed; default is 9600. @var{word} and
  5074. @var{stop} are the number of data bits and stop bits. Data bits must
  5075. be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
  5076. bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd},
  5077. @samp{even} and defaults to @samp{no}.
  5078. If passed no @var{unit} nor @var{port}, or if @var{port} is set to
  5079. @samp{auto} then GRUB will attempt to use ACPI to automatically detect
  5080. the system default serial port and its configuration. If this information
  5081. is not available, it will default to @var{unit} 0.
  5082. The serial port is not used as a communication channel unless the
  5083. @command{terminal_input} or @command{terminal_output} command is used
  5084. (@pxref{terminal_input}, @pxref{terminal_output}).
  5085. Note, valid @var{port} values, excluding IO port addresses, can be found
  5086. by listing terminals with @command{terminal_output}, selecting all names
  5087. prefixed by @samp{serial_} and removing that prefix.
  5088. Examples:
  5089. @example
  5090. serial --port=0x3f8 --speed=9600
  5091. serial --port=mmio,fefb0000.l --speed=115200
  5092. serial --port=pci,00:16.3 --speed=115200
  5093. @end example
  5094. See also @ref{Serial terminal}.
  5095. @end deffn
  5096. @node terminal_input
  5097. @subsection terminal_input
  5098. @deffn Command terminal_input [@option{--append}|@option{--remove}] @
  5099. [terminal1] [terminal2] @dots{}
  5100. List or select an input terminal.
  5101. With no arguments, list the active and available input terminals.
  5102. With @option{--append}, add the named terminals to the list of active input
  5103. terminals; any of these may be used to provide input to GRUB.
  5104. With @option{--remove}, remove the named terminals from the active list.
  5105. With no options but a list of terminal names, make only the listed terminal
  5106. names active.
  5107. @end deffn
  5108. @node terminal_output
  5109. @subsection terminal_output
  5110. @deffn Command terminal_output [@option{--append}|@option{--remove}] @
  5111. [terminal1] [terminal2] @dots{}
  5112. List or select an output terminal.
  5113. With no arguments, list the active and available output terminals.
  5114. With @option{--append}, add the named terminals to the list of active output
  5115. terminals; all of these will receive output from GRUB.
  5116. With @option{--remove}, remove the named terminals from the active list.
  5117. With no options but a list of terminal names, make only the listed terminal
  5118. names active.
  5119. @end deffn
  5120. @node terminfo
  5121. @subsection terminfo
  5122. @deffn Command terminfo [@option{-a}|@option{-u}|@option{-v}] [@option{-g WxH}] [term] [type]
  5123. Define the capabilities of your terminal by giving the name of an entry in
  5124. the terminfo database, which should correspond roughly to a @samp{TERM}
  5125. environment variable in Unix.
  5126. The currently available terminal types are @samp{vt100}, @samp{vt100-color},
  5127. @samp{ieee1275}, and @samp{dumb}. If you need other terminal types, please
  5128. contact us to discuss the best way to include support for these in GRUB.
  5129. The @option{-a} (@option{--ascii}), @option{-u} (@option{--utf8}), and
  5130. @option{-v} (@option{--visual-utf8}) options control how non-ASCII text is
  5131. displayed. @option{-a} specifies an ASCII-only terminal; @option{-u}
  5132. specifies logically-ordered UTF-8; and @option{-v} specifies
  5133. "visually-ordered UTF-8" (in other words, arranged such that a terminal
  5134. emulator without bidirectional text support will display right-to-left text
  5135. in the proper order; this is not really proper UTF-8, but a workaround).
  5136. The @option{-g} (@option{--geometry}) can be used to specify terminal geometry.
  5137. If no option or terminal type is specified, the current terminal type is
  5138. printed.
  5139. @end deffn
  5140. @node Command-line commands
  5141. @section Command-line commands
  5142. These commands are usable in the command-line and in menu entries. If
  5143. you forget a command, you can run the command @command{help}
  5144. (@pxref{help}).
  5145. @menu
  5146. * [:: Check file types and compare values
  5147. * acpi:: Load ACPI tables
  5148. * authenticate:: Check whether user is in user list
  5149. * background_color:: Set background color for active terminal
  5150. * background_image:: Load background image for active terminal
  5151. * badram:: Filter out bad regions of RAM
  5152. * blocklist:: Print a block list
  5153. * boot:: Start up your operating system
  5154. * cat:: Show the contents of a file
  5155. * clear:: Clear the screen
  5156. * cmosclean:: Clear bit in CMOS
  5157. * cmosdump:: Dump CMOS contents
  5158. * cmostest:: Test bit in CMOS
  5159. * cmp:: Compare two files
  5160. * configfile:: Load a configuration file
  5161. * cpuid:: Check for CPU features
  5162. * crc:: Compute or check CRC32 checksums
  5163. * cryptomount:: Mount a crypto device
  5164. * cutmem:: Remove memory regions
  5165. * date:: Display or set current date and time
  5166. * devicetree:: Load a device tree blob
  5167. * distrust:: Remove a pubkey from trusted keys
  5168. * drivemap:: Map a drive to another
  5169. * echo:: Display a line of text
  5170. * efitextmode:: Set/Get text output mode resolution
  5171. * eval:: Evaluate agruments as GRUB commands
  5172. * export:: Export an environment variable
  5173. * false:: Do nothing, unsuccessfully
  5174. * fdtdump:: Retrieve device tree information
  5175. * file:: Test the provided file against a type
  5176. * fwsetup:: Reboot into the firmware setup menu
  5177. * gdbinfo:: Provide info for debugging with GDB
  5178. * gettext:: Translate a string
  5179. * gptsync:: Fill an MBR based on GPT entries
  5180. * halt:: Shut down your computer
  5181. * hashsum:: Compute or check hash checksum
  5182. * help:: Show help messages
  5183. * hexdump:: Show raw contents of a file or memory
  5184. * insmod:: Insert a module
  5185. * keystatus:: Check key modifier status
  5186. * list_env:: List variables in environment block
  5187. * list_trusted:: List trusted public keys
  5188. * load_env:: Load variables from environment block
  5189. * loadfont:: Load font files
  5190. * loopback:: Make a device from a filesystem image
  5191. * ls:: List devices or files
  5192. * lsfonts:: List loaded fonts
  5193. * lsmod:: Show loaded modules
  5194. * md5sum:: Compute or check MD5 hash
  5195. * module:: Load module for multiboot kernel
  5196. * multiboot:: Load multiboot compliant kernel
  5197. * nativedisk:: Switch to native disk drivers
  5198. * normal:: Enter normal mode
  5199. * normal_exit:: Exit from normal mode
  5200. * parttool:: Modify partition table entries
  5201. * password:: Set a clear-text password
  5202. * password_pbkdf2:: Set a hashed password
  5203. * plainmount:: Open device encrypted in plain mode
  5204. * play:: Play a tune
  5205. * probe:: Retrieve device info
  5206. * rdmsr:: Read values from model-specific registers
  5207. * read:: Read user input
  5208. * reboot:: Reboot your computer
  5209. * regexp:: Test if regular expression matches string
  5210. * rmmod:: Remove a module
  5211. * save_env:: Save variables to environment block
  5212. * search:: Search devices by file, label, or UUID
  5213. * sendkey:: Emulate keystrokes
  5214. * set:: Set an environment variable
  5215. * sha1sum:: Compute or check SHA1 hash
  5216. * sha256sum:: Compute or check SHA256 hash
  5217. * sha512sum:: Compute or check SHA512 hash
  5218. * sleep:: Wait for a specified number of seconds
  5219. * smbios:: Retrieve SMBIOS information
  5220. * source:: Read a configuration file in same context
  5221. * test:: Check file types and compare values
  5222. * tpm2_key_protector_init:: Initialize the TPM2 key protector
  5223. * tpm2_key_protector_clear:: Clear the TPM2 key protector
  5224. * true:: Do nothing, successfully
  5225. * trust:: Add public key to list of trusted keys
  5226. * unset:: Unset an environment variable
  5227. @comment * vbeinfo:: List available video modes
  5228. * verify_detached:: Verify detached digital signature
  5229. * videoinfo:: List available video modes
  5230. * wrmsr:: Write values to model-specific registers
  5231. @end menu
  5232. @node [
  5233. @subsection [
  5234. @deffn Command @code{[} expression @code{]}
  5235. Alias for @code{test @var{expression}} (@pxref{test}).
  5236. @end deffn
  5237. @node acpi
  5238. @subsection acpi
  5239. @deffn Command acpi [@option{-1}|@option{-2}] @
  5240. [@option{--exclude=table1,@dots{}}|@option{--load-only=table1,@dots{}}] @
  5241. [@option{--oemid=id}] [@option{--oemtable=table}] @
  5242. [@option{--oemtablerev=rev}] [@option{--oemtablecreator=creator}] @
  5243. [@option{--oemtablecreatorrev=rev}] [@option{--no-ebda}] @
  5244. filename @dots{}
  5245. Modern BIOS systems normally implement the Advanced Configuration and Power
  5246. Interface (ACPI), and define various tables that describe the interface
  5247. between an ACPI-compliant operating system and the firmware. In some cases,
  5248. the tables provided by default only work well with certain operating
  5249. systems, and it may be necessary to replace some of them.
  5250. Normally, this command will replace the Root System Description Pointer
  5251. (RSDP) in the Extended BIOS Data Area to point to the new tables. If the
  5252. @option{--no-ebda} option is used, the new tables will be known only to
  5253. GRUB, but may be used by GRUB's EFI emulation.
  5254. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5255. Otherwise an attacker can instruct the GRUB to load an SSDT table to
  5256. overwrite the kernel lockdown configuration and later load and execute
  5257. unsigned code.
  5258. @end deffn
  5259. @node authenticate
  5260. @subsection authenticate
  5261. @deffn Command authenticate [userlist]
  5262. Check whether user is in @var{userlist} or listed in the value of variable
  5263. @samp{superusers}. See @pxref{superusers} for valid user list format.
  5264. If @samp{superusers} is empty, this command returns true. @xref{Security}.
  5265. @end deffn
  5266. @node background_color
  5267. @subsection background_color
  5268. @deffn Command background_color color
  5269. Set background color for active terminal. For valid color specifications see
  5270. @pxref{Theme file format, ,Colors}. Background color can be changed only when
  5271. using @samp{gfxterm} for terminal output.
  5272. This command sets color of empty areas without text. Text background color
  5273. is controlled by environment variables @var{color_normal}, @var{color_highlight},
  5274. @var{menu_color_normal}, @var{menu_color_highlight}. @xref{Special environment variables}.
  5275. @end deffn
  5276. @node background_image
  5277. @subsection background_image
  5278. @deffn Command background_image [[@option{--mode} @samp{stretch}|@samp{normal}] file]
  5279. Load background image for active terminal from @var{file}. Image is stretched
  5280. to fill up entire screen unless option @option{--mode} @samp{normal} is given.
  5281. Without arguments remove currently loaded background image. Background image
  5282. can be changed only when using @samp{gfxterm} for terminal output.
  5283. @end deffn
  5284. @node badram
  5285. @subsection badram
  5286. @deffn Command badram addr,mask[,addr,mask...]
  5287. Filter out bad RAM.
  5288. This command notifies the memory manager that specified regions of
  5289. RAM ought to be filtered out (usually, because they're damaged). This
  5290. remains in effect after a payload kernel has been loaded by GRUB, as
  5291. long as the loaded kernel obtains its memory map from GRUB. Kernels that
  5292. support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
  5293. kernels in general.
  5294. Syntax is the same as provided by the @uref{http://www.memtest.org/,
  5295. Memtest86+ utility}: a list of address/mask pairs. Given a page-aligned
  5296. address and a base address / mask pair, if all the bits of the page-aligned
  5297. address that are enabled by the mask match with the base address, it means
  5298. this page is to be filtered. This syntax makes it easy to represent patterns
  5299. that are often result of memory damage, due to physical distribution of memory
  5300. cells.
  5301. The command is similar to @command{cutmem} command.
  5302. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5303. This prevents removing EFI memory regions to potentially subvert the
  5304. security mechanisms provided by the UEFI secure boot.
  5305. @end deffn
  5306. @node blocklist
  5307. @subsection blocklist
  5308. @deffn Command blocklist file
  5309. Print a block list (@pxref{Block list syntax}) for @var{file}.
  5310. @end deffn
  5311. @node boot
  5312. @subsection boot
  5313. @deffn Command boot
  5314. Boot the OS or chain-loader which has been loaded. Only necessary if
  5315. running the fully interactive command-line (it is implicit at the end of
  5316. a menu entry).
  5317. @end deffn
  5318. @node cat
  5319. @subsection cat
  5320. @deffn Command cat [@option{--dos}] file
  5321. Display the contents of the file @var{file}. This command may be useful
  5322. to remind you of your OS's root partition:
  5323. @example
  5324. grub> @kbd{cat /etc/fstab}
  5325. @end example
  5326. If the @option{--dos} option is used, then carriage return / new line pairs
  5327. will be displayed as a simple new line. Otherwise, the carriage return will
  5328. be displayed as a control character (@samp{<d>}) to make it easier to see
  5329. when boot problems are caused by a file formatted using DOS-style line
  5330. endings.
  5331. Note: @command{cat} can be used to view the contents of devices using the
  5332. block list syntax (@pxref{Block list syntax}). However, it is not advised
  5333. to view binary data because it will try to decode UTF-8 strings, which can
  5334. lead to some bytes missing or added in the output. Instead, use the
  5335. @command{hexdump} command (@pxref{hexdump}).
  5336. @end deffn
  5337. @node clear
  5338. @subsection clear
  5339. @deffn Command clear
  5340. Clear the screen.
  5341. @end deffn
  5342. @node cmosclean
  5343. @subsection cmosclean
  5344. @deffn Command cmosclean byte:bit
  5345. Clear value of bit in CMOS at location @var{byte}:@var{bit}. This command
  5346. is available only on platforms that support CMOS.
  5347. @end deffn
  5348. @node cmosdump
  5349. @subsection cmosdump
  5350. @deffn Dump CMOS contents
  5351. Dump full CMOS contents as hexadecimal values. This command is available only
  5352. on platforms that support CMOS.
  5353. @end deffn
  5354. @node cmostest
  5355. @subsection cmostest
  5356. @deffn Command cmostest byte:bit
  5357. Test value of bit in CMOS at location @var{byte}:@var{bit}. Exit status
  5358. is zero if bit is set, non zero otherwise. This command is available only
  5359. on platforms that support CMOS.
  5360. @end deffn
  5361. @node cmp
  5362. @subsection cmp
  5363. @deffn Command cmp [@option{-v}] file1 file2
  5364. Compare the file @var{file1} with the file @var{file2}. If they are completely
  5365. identical, @code{$?} will be set to 0. Otherwise, if the files are not identical,
  5366. @code{$?} will be set to a nonzero value.
  5367. By default nothing will be output. If the @option{-v} is used, verbose mode is
  5368. enabled. In this mode when when the files differ in size, print the sizes like
  5369. this:
  5370. @example
  5371. Differ in size: 0x1234 [foo], 0x4321 [bar]
  5372. @end example
  5373. If the sizes are equal but the bytes at an offset differ, then print the
  5374. bytes like this:
  5375. @example
  5376. Differ at the offset 777: 0xbe [foo], 0xef [bar]
  5377. @end example
  5378. @end deffn
  5379. @node configfile
  5380. @subsection configfile
  5381. @deffn Command configfile file
  5382. Load @var{file} as a configuration file. If @var{file} defines any menu
  5383. entries, then show a menu containing them immediately. Any environment
  5384. variable changes made by the commands in @var{file} will not be preserved
  5385. after @command{configfile} returns.
  5386. @end deffn
  5387. @node cpuid
  5388. @subsection cpuid
  5389. @deffn Command cpuid [-l] [-p]
  5390. Check for CPU features. This command is only available on x86 systems.
  5391. With the @option{-l} option, return true if the CPU supports long mode
  5392. (64-bit).
  5393. With the @option{-p} option, return true if the CPU supports Physical
  5394. Address Extension (PAE).
  5395. If invoked without options, this command currently behaves as if it had been
  5396. invoked with @option{-l}. This may change in the future.
  5397. @end deffn
  5398. @node crc
  5399. @subsection crc
  5400. @deffn Command crc arg @dots{}
  5401. Alias for @code{hashsum --hash crc32 arg @dots{}}. See command @command{hashsum}
  5402. (@pxref{hashsum}) for full description.
  5403. @end deffn
  5404. @node cryptomount
  5405. @subsection cryptomount
  5406. @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}
  5407. Setup access to encrypted device. A passphrase will be requested interactively,
  5408. if neither the @option{-p} nor @option{-k} options are given. The option
  5409. @option{-p} can be used to supply a passphrase (useful for scripts).
  5410. Alternatively the @option{-k} option can be used to supply a keyfile with
  5411. options @option{-O} and @option{-S} optionally supplying the offset and size,
  5412. respectively, of the key data in the given key file. Besides the keyfile,
  5413. the key can be stored in a key protector, and option @option{-P} configures
  5414. specific key protector, e.g. tpm2, to retrieve the key from.
  5415. The @option{-H} options can be used to supply cryptomount backends with an
  5416. alternative header file (aka detached header). Not all backends have headers
  5417. nor support alternative header files (currently only LUKS1 and LUKS2 support them).
  5418. Argument @var{device} configures specific grub device
  5419. (@pxref{Naming convention}); option @option{-u} @var{uuid} configures device
  5420. with specified @var{uuid}; option @option{-a} configures all detected encrypted
  5421. devices; option @option{-b} configures all geli containers that have boot flag set.
  5422. Devices are not allowed to be given as key files nor as detached header files.
  5423. However, this limitation can be worked around by using blocklist syntax. So
  5424. for instance, @code{(hd1,gpt2)} can not be used, but @code{(hd1,gpt2)0+} will
  5425. achieve the desired result.
  5426. GRUB supports devices encrypted using LUKS, LUKS2 and geli. Note that necessary
  5427. modules (@var{luks}, @var{luks2} and @var{geli}) have to be loaded manually
  5428. before this command can be used. For LUKS2 only the PBKDF2 key derivation
  5429. function is supported, as Argon2 is not yet supported.
  5430. Successfully decrypted disks are named as (cryptoX) and have increasing numeration
  5431. suffix for each new decrypted disk. If the encrypted disk hosts some higher level
  5432. of abstraction (like LVM2 or MDRAID) it will be created under a separate device
  5433. namespace in addition to the cryptodisk namespace.
  5434. Support for plain encryption mode (plain dm-crypt) is provided via separate
  5435. @command{@pxref{plainmount}} command.
  5436. @end deffn
  5437. @node cutmem
  5438. @subsection cutmem
  5439. @deffn Command cutmem from[K|M|G] to[K|M|G]
  5440. Remove any memory regions in specified range.
  5441. This command notifies the memory manager that specified regions of RAM ought to
  5442. be filtered out. This remains in effect after a payload kernel has been loaded
  5443. by GRUB, as long as the loaded kernel obtains its memory map from GRUB. Kernels
  5444. that support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
  5445. kernels in general.
  5446. The command is similar to @command{badram} command.
  5447. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5448. This prevents removing EFI memory regions to potentially subvert the
  5449. security mechanisms provided by the UEFI secure boot.
  5450. @end deffn
  5451. @node date
  5452. @subsection date
  5453. @deffn Command date [[year-]month-day] [hour:minute[:second]]
  5454. With no arguments, print the current date and time.
  5455. Otherwise, take the current date and time, change any elements specified as
  5456. arguments, and set the result as the new date and time. For example, `date
  5457. 01-01' will set the current month and day to January 1, but leave the year,
  5458. hour, minute, and second unchanged.
  5459. @end deffn
  5460. @node devicetree
  5461. @subsection devicetree
  5462. @deffn Command devicetree file
  5463. Load a device tree blob (.dtb) from a filesystem, for later use by a Linux
  5464. kernel. Does not perform merging with any device tree supplied by firmware,
  5465. but rather replaces it completely.
  5466. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  5467. This is done to prevent subverting various security mechanisms.
  5468. @end deffn
  5469. @node distrust
  5470. @subsection distrust
  5471. @deffn Command distrust pubkey_id
  5472. Remove public key @var{pubkey_id} from GRUB's keyring of trusted keys.
  5473. @var{pubkey_id} is the last four bytes (eight hexadecimal digits) of
  5474. the GPG v4 key id, which is also the output of @command{list_trusted}
  5475. (@pxref{list_trusted}). Outside of GRUB, the key id can be obtained
  5476. using @code{gpg --fingerprint}).
  5477. These keys are used to validate signatures when environment variable
  5478. @code{check_signatures} is set to @code{enforce}
  5479. (@pxref{check_signatures}), and by some invocations of
  5480. @command{verify_detached} (@pxref{verify_detached}). @xref{Using
  5481. digital signatures}, for more information.
  5482. @end deffn
  5483. @node drivemap
  5484. @subsection drivemap
  5485. @deffn Command drivemap @option{-l}|@option{-r}|[@option{-s}] @
  5486. from_drive to_drive
  5487. Without options, map the drive @var{from_drive} to the drive @var{to_drive}.
  5488. This is necessary when you chain-load some operating systems, such as DOS,
  5489. if such an OS resides at a non-first drive. For convenience, any partition
  5490. suffix on the drive is ignored, so you can safely use @verb{'${root}'} as a
  5491. drive specification.
  5492. With the @option{-s} option, perform the reverse mapping as well, swapping
  5493. the two drives.
  5494. With the @option{-l} option, list the current mappings.
  5495. With the @option{-r} option, reset all mappings to the default values.
  5496. For example:
  5497. @example
  5498. drivemap -s (hd0) (hd1)
  5499. @end example
  5500. NOTE: Only available on i386-pc.
  5501. @end deffn
  5502. @node echo
  5503. @subsection echo
  5504. @deffn Command echo [@option{-n}] [@option{-e}] string @dots{}
  5505. Display the requested text and, unless the @option{-n} option is used, a
  5506. trailing new line. If there is more than one string, they are separated by
  5507. spaces in the output. As usual in GRUB commands, variables may be
  5508. substituted using @samp{$@{var@}}.
  5509. The @option{-e} option enables interpretation of backslash escapes. The
  5510. following sequences are recognised:
  5511. @table @code
  5512. @item \\
  5513. backslash
  5514. @item \a
  5515. alert (BEL)
  5516. @item \c
  5517. suppress trailing new line
  5518. @item \f
  5519. form feed
  5520. @item \n
  5521. new line
  5522. @item \r
  5523. carriage return
  5524. @item \t
  5525. horizontal tab
  5526. @item \v
  5527. vertical tab
  5528. @end table
  5529. When interpreting backslash escapes, backslash followed by any other
  5530. character will print that character.
  5531. @end deffn
  5532. @node efitextmode
  5533. @subsection efitextmode
  5534. @deffn Command efitextmode [min | max | <mode_num> | <cols> <rows>]
  5535. When used with no arguments displays all available text output modes. The
  5536. set mode determines the columns and rows of the text display when in
  5537. text mode. An asterisk, @samp{*}, will be at the end of the line of the
  5538. currently set mode.
  5539. If given a single parameter, it must be @samp{min}, @samp{max}, or a mode
  5540. number given by the listing when run with no arguments. These arguments set
  5541. the mode to the minimum, maximum, and particular mode respectively.
  5542. Otherwise, the command must be given two numerical arguments specifying the
  5543. columns and rows of the desired mode. Specifying a columns and rows
  5544. combination that corresponds to no supported mode, will return error, but
  5545. otherwise have no effect.
  5546. By default GRUB will start in whatever mode the EFI firmware defaults to.
  5547. There are firmwares known to set up the default mode such that output
  5548. behaves strangely, for example the cursor in the GRUB shell never reaches
  5549. the bottom of the screen or, when typing characters at the prompt,
  5550. characters from previous command output are overwritten. Setting the mode
  5551. may fix this.
  5552. The EFI specification says that mode 0 must be available and have
  5553. columns and rows of 80 and 25 respectively. Mode 1 may be defined and if
  5554. so must have columns and rows of 80 and 50 respectively. Any other modes
  5555. may have columns and rows arbitrarily defined by the firmware. This means
  5556. that a mode with columns and rows of 100 and 31 on one firmware may be
  5557. a different mode number on a different firmware or not exist at all.
  5558. Likewise, mode number 2 on one firmware may have a different number of
  5559. columns and rows than mode 2 on a different firmware. So one should not
  5560. rely on a particular mode number or a mode of a certain number of columns
  5561. and rows existing on all firmwares, except for mode 0.
  5562. Note: This command is only available on EFI platforms and is similar to
  5563. EFI shell "mode" command.
  5564. @end deffn
  5565. @node eval
  5566. @subsection eval
  5567. @deffn Command eval string ...
  5568. Concatenate arguments together using single space as separator and evaluate
  5569. result as sequence of GRUB commands.
  5570. @end deffn
  5571. @node export
  5572. @subsection export
  5573. @deffn Command export envvar
  5574. Export the environment variable @var{envvar}. Exported variables are visible
  5575. to subsidiary configuration files loaded using @command{configfile}.
  5576. @end deffn
  5577. @node false
  5578. @subsection false
  5579. @deffn Command false
  5580. Do nothing, unsuccessfully. This is mainly useful in control constructs
  5581. such as @code{if} and @code{while} (@pxref{Shell-like scripting}).
  5582. @end deffn
  5583. @node fdtdump
  5584. @subsection fdtdump
  5585. @deffn Command fdtdump @
  5586. [@option{--prop} @var{prop}] @
  5587. [@option{--set} @var{variable}]
  5588. Retrieve device tree information.
  5589. The @command{fdtdump} command returns the value of a property in the device
  5590. tree provided by the firmware. The @option{--prop} option determines which
  5591. property to select.
  5592. The default action is to print the value of the requested field to the console,
  5593. but a variable name can be specified with @option{--set} to store the value
  5594. instead of printing it.
  5595. For example, this will store and then display the model string.
  5596. @example
  5597. fdtdump --prop model --set machine_model
  5598. echo $machine_model
  5599. @end example
  5600. @end deffn
  5601. @node file
  5602. @subsection file
  5603. @deffn Command file is_file_type filename
  5604. The @command{file} command tests whether the provided @var{filename} is the
  5605. type provided by @var{is_file_type}. When the @command{file} is of type
  5606. @var{is_file_type} this command will return 0, otherwise it will return
  5607. non-zero (no output is provided to the terminal).
  5608. @var{is_file_type} may be one of the following options:
  5609. @itemize @bullet
  5610. @item
  5611. @option{--is-i386-xen-pae-domu} Check if @var{filename} can be booted as i386
  5612. PAE Xen unprivileged guest kernel
  5613. @item
  5614. @option{--is-x86_64-xen-domu} Check if @var{filename} can be booted as x86_64
  5615. Xen unprivileged guest kernel
  5616. @item
  5617. @option{--is-x86-xen-dom0} Check if @var{filename} can be used as Xen x86
  5618. privileged guest kernel
  5619. @item
  5620. @option{--is-x86-multiboot} Check if @var{filename} can be used as x86
  5621. multiboot kernel
  5622. @item
  5623. @option{--is-x86-multiboot2} Check if @var{filename} can be used as x86
  5624. multiboot2 kernel
  5625. @item
  5626. @option{--is-arm-linux} Check if @var{filename} is ARM Linux
  5627. @item
  5628. @option{--is-arm64-linux} Check if @var{filename} is ARM64 Linux
  5629. @item
  5630. @option{--is-ia64-linux} Check if @var{filename} is IA64 Linux
  5631. @item
  5632. @option{--is-mips-linux} Check if @var{filename} is MIPS Linux
  5633. @item
  5634. @option{--is-mipsel-linux} Check if @var{filename} is MIPSEL Linux
  5635. @item
  5636. @option{--is-sparc64-linux} Check if @var{filename} is SPARC64 Linux
  5637. @item
  5638. @option{--is-powerpc-linux} Check if @var{filename} is POWERPC Linux
  5639. @item
  5640. @option{--is-x86-linux} Check if @var{filename} is x86 Linux
  5641. @item
  5642. @option{--is-x86-linux32} Check if @var{filename} is x86 Linux supporting
  5643. 32-bit protocol
  5644. @item
  5645. @option{--is-x86-kfreebsd} Check if @var{filename} is x86 kFreeBSD
  5646. @item
  5647. @option{--is-i386-kfreebsd} Check if @var{filename} is i386 kFreeBSD
  5648. @item
  5649. @option{--is-x86_64-kfreebsd} Check if @var{filename} is x86_64 kFreeBSD
  5650. @item
  5651. @option{--is-x86-knetbsd} Check if @var{filename} is x86 kNetBSD
  5652. @item
  5653. @option{--is-i386-knetbsd} Check if @var{filename} is i386 kNetBSD
  5654. @item
  5655. @option{--is-x86_64-knetbsd} Check if @var{filename} is x86_64 kNetBSD
  5656. @item
  5657. @option{--is-i386-efi} Check if @var{filename} is i386 EFI file
  5658. @item
  5659. @option{--is-x86_64-efi} Check if @var{filename} is x86_64 EFI file
  5660. @item
  5661. @option{--is-ia64-efi} Check if @var{filename} is IA64 EFI file
  5662. @item
  5663. @option{--is-arm64-efi} Check if @var{filename} is ARM64 EFI file
  5664. @item
  5665. @option{--is-arm-efi} Check if @var{filename} is ARM EFI file
  5666. @item
  5667. @option{--is-riscv32-efi} Check if @var{filename} is RISC-V 32bit EFI file
  5668. @item
  5669. @option{--is-riscv64-efi} Check if @var{filename} is RISC-V 64bit EFI file
  5670. @item
  5671. @option{--is-hibernated-hiberfil} Check if @var{filename} is hiberfil.sys in
  5672. hibernated state
  5673. @item
  5674. @option{--is-x86_64-xnu} Check if @var{filename} is x86_64 XNU (Mac OS X kernel)
  5675. @item
  5676. @option{--is-i386-xnu} Check if @var{filename} is i386 XNU (Mac OS X kernel)
  5677. @item
  5678. @option{--is-xnu-hibr} Check if @var{filename} is XNU (Mac OS X kernel)
  5679. hibernated image
  5680. @item
  5681. @option{--is-x86-bios-bootsector} Check if @var{filename} is BIOS bootsector
  5682. @end itemize
  5683. @end deffn
  5684. @node fwsetup
  5685. @subsection fwsetup
  5686. @deffn Command fwsetup [@option{--is-supported}]
  5687. Reboot into the firmware setup menu. If @option{--is-supported} option is
  5688. specified, instead check whether the firmware supports a setup menu and
  5689. exit successfully if so.
  5690. @end deffn
  5691. @node gdbinfo
  5692. @subsection gdbinfo
  5693. @deffn Command gdbinfo
  5694. Output text to be used as a GDB command for a GDB session using the gdb_grub
  5695. script and attached to a running GRUB instance. The GDB command that is
  5696. output will tell GDB how to load debugging symbols to their proper runtime
  5697. address. Currently this is only available for EFI platforms. See the Debugging
  5698. in the developer documentation for more information.
  5699. @end deffn
  5700. @node gettext
  5701. @subsection gettext
  5702. @deffn Command gettext string
  5703. Translate @var{string} into the current language.
  5704. The current language code is stored in the @samp{lang} variable in GRUB's
  5705. environment (@pxref{lang}). Translation files in MO format are read from
  5706. @samp{locale_dir} (@pxref{locale_dir}), usually @file{/boot/grub/locale}.
  5707. @end deffn
  5708. @node gptsync
  5709. @subsection gptsync
  5710. @deffn Command gptsync device [partition[+/-[type]]] @dots{}
  5711. Disks using the GUID Partition Table (GPT) also have a legacy Master Boot
  5712. Record (MBR) partition table for compatibility with the BIOS and with older
  5713. operating systems. The legacy MBR can only represent a limited subset of
  5714. GPT partition entries.
  5715. This command populates the legacy MBR with the specified @var{partition}
  5716. entries on @var{device}. Up to three partitions may be used.
  5717. @var{type} is an MBR partition type code; prefix with @samp{0x} if you want
  5718. to enter this in hexadecimal. The separator between @var{partition} and
  5719. @var{type} may be @samp{+} to make the partition active, or @samp{-} to make
  5720. it inactive; only one partition may be active. If both the separator and
  5721. type are omitted, then the partition will be inactive.
  5722. @end deffn
  5723. @node halt
  5724. @subsection halt
  5725. @deffn Command halt [@option{--no-apm}]
  5726. The command halts the computer. On the i386-pc target, the @option{--no-apm}
  5727. option, or short @option{-n}, is specified, no APM BIOS call is performed.
  5728. Otherwise, the computer is shut down using APM on that target.
  5729. @end deffn
  5730. @node hashsum
  5731. @subsection hashsum
  5732. @deffn Command hashsum @option{--hash} hash @option{--keep-going} @option{--uncompress} @option{--check} file [@option{--prefix} dir]|file @dots{}
  5733. Compute or verify file hashes. Hash type is selected with option @option{--hash}.
  5734. Supported hashes are: @samp{adler32}, @samp{crc64}, @samp{crc32},
  5735. @samp{crc32rfc1510}, @samp{crc24rfc2440}, @samp{md4}, @samp{md5},
  5736. @samp{ripemd160}, @samp{sha1}, @samp{sha224}, @samp{sha256}, @samp{sha512},
  5737. @samp{sha384}, @samp{tiger192}, @samp{tiger}, @samp{tiger2}, @samp{whirlpool}.
  5738. Option @option{--uncompress} uncompresses files before computing hash.
  5739. When list of files is given, hash of each file is computed and printed,
  5740. followed by file name, each file on a new line.
  5741. When option @option{--check} is given, it points to a file that contains
  5742. list of @var{hash name} pairs in the same format as used by UNIX
  5743. @command{md5sum} command. Option @option{--prefix}
  5744. may be used to give directory where files are located. Hash verification
  5745. stops after the first mismatch was found unless option @option{--keep-going}
  5746. was given. The exit code @code{$?} is set to 0 if hash verification
  5747. is successful. If it fails, @code{$?} is set to a nonzero value.
  5748. @end deffn
  5749. @node help
  5750. @subsection help
  5751. @deffn Command help [pattern @dots{}]
  5752. Display helpful information about builtin commands. If you do not
  5753. specify @var{pattern}, this command shows short descriptions of all
  5754. available commands.
  5755. If you specify any @var{patterns}, it displays longer information
  5756. about each of the commands whose names begin with those @var{patterns}.
  5757. @end deffn
  5758. @node hexdump
  5759. @subsection hexdump
  5760. @deffn Command hexdump [--skip offset] [--length len] FILE_OR_DEVICE
  5761. Show raw contents of a file or memory. When option @option{--skip} is given,
  5762. @samp{offset} number of bytes are skipped from the start of the device or
  5763. file given. And @option{--length} allows specifying a maximum number of bytes
  5764. to be shown.
  5765. If given the special device named @samp{(mem)}, then the @samp{offset} given to
  5766. @option{--skip} is treated as the address of a memory location to dump from.
  5767. Note: The dumping of RAM memory (by the (mem) argument) is not allowed when
  5768. when lockdown is enforced (@pxref{Lockdown}). The dumping of disk or file
  5769. data is allowed when lockdown is enforced.
  5770. @end deffn
  5771. @node insmod
  5772. @subsection insmod
  5773. @deffn Command insmod module
  5774. Insert the dynamic GRUB module called @var{module}.
  5775. @end deffn
  5776. @node keystatus
  5777. @subsection keystatus
  5778. @deffn Command keystatus [@option{--shift}] [@option{--ctrl}] [@option{--alt}]
  5779. Return true if the Shift, Control, or Alt modifier keys are held down, as
  5780. requested by options. This is useful in scripting, to allow some user
  5781. control over behaviour without having to wait for a keypress.
  5782. Checking key modifier status is only supported on some platforms. If invoked
  5783. without any options, the @command{keystatus} command returns true if and
  5784. only if checking key modifier status is supported.
  5785. @end deffn
  5786. @node list_env
  5787. @subsection list_env
  5788. @deffn Command list_env [@option{--file} file]
  5789. List all variables in the environment block file. @xref{Environment block}.
  5790. The @option{--file} option overrides the default location of the
  5791. environment block.
  5792. @end deffn
  5793. @node list_trusted
  5794. @subsection list_trusted
  5795. @deffn Command list_trusted
  5796. List all public keys trusted by GRUB for validating signatures.
  5797. The output is in GPG's v4 key fingerprint format (i.e., the output of
  5798. @code{gpg --fingerprint}). The least significant four bytes (last
  5799. eight hexadecimal digits) can be used as an argument to
  5800. @command{distrust} (@pxref{distrust}).
  5801. @xref{Using digital signatures}, for more information about uses for
  5802. these keys.
  5803. @end deffn
  5804. @node load_env
  5805. @subsection load_env
  5806. @deffn Command load_env [@option{--file} file] [@option{--skip-sig}] [whitelisted_variable_name] @dots{}
  5807. Load all variables from the environment block file into the environment.
  5808. @xref{Environment block}.
  5809. The @option{--file} option overrides the default location of the environment
  5810. block.
  5811. The @option{--skip-sig} option skips signature checking even when the
  5812. value of environment variable @code{check_signatures} is set to
  5813. @code{enforce} (@pxref{check_signatures}).
  5814. If one or more variable names are provided as arguments, they are
  5815. interpreted as a whitelist of variables to load from the environment
  5816. block file. Variables set in the file but not present in the
  5817. whitelist are ignored.
  5818. The @option{--skip-sig} option should be used with care, and should
  5819. always be used in concert with a whitelist of acceptable variables
  5820. whose values should be set. Failure to employ a carefully constructed
  5821. whitelist could result in reading a malicious value into critical
  5822. environment variables from the file, such as setting
  5823. @code{check_signatures=no}, modifying @code{prefix} to boot from an
  5824. unexpected location or not at all, etc.
  5825. When used with care, @option{--skip-sig} and the whitelist enable an
  5826. administrator to configure a system to boot only signed
  5827. configurations, but to allow the user to select from among multiple
  5828. configurations, and to enable ``one-shot'' boot attempts and
  5829. ``savedefault'' behavior. @xref{Using digital signatures}, for more
  5830. information.
  5831. @end deffn
  5832. @node loadfont
  5833. @subsection loadfont
  5834. @deffn Command loadfont file @dots{}
  5835. Load specified font files. Unless absolute pathname is given, @var{file}
  5836. is assumed to be in directory @samp{$prefix/fonts} with
  5837. suffix @samp{.pf2} appended. @xref{Theme file format,,Fonts}.
  5838. @end deffn
  5839. @node loopback
  5840. @subsection loopback
  5841. @deffn Command loopback [@option{-d}] [@option{-D}] device file
  5842. Make the device named @var{device} correspond to the contents of the
  5843. filesystem image in @var{file}. For example:
  5844. @example
  5845. loopback loop0 /path/to/image
  5846. ls (loop0)/
  5847. @end example
  5848. Specifying the @option{-D} option allows the loopback file to be tranparently
  5849. decompressed if there is an appropriate decompressor loaded.
  5850. With the @option{-d} option, delete a device previously created using this
  5851. command.
  5852. @end deffn
  5853. @node ls
  5854. @subsection ls
  5855. @deffn Command ls [arg @dots{}]
  5856. List devices or files.
  5857. With no arguments, print all devices known to GRUB.
  5858. If the argument is a device name enclosed in parentheses (@pxref{Device
  5859. syntax}), then print the name of the filesystem of that device.
  5860. If the argument is a directory given as an absolute file name (@pxref{File
  5861. name syntax}), then list the contents of that directory.
  5862. @end deffn
  5863. @node lsfonts
  5864. @subsection lsfonts
  5865. @deffn Command lsfonts
  5866. List loaded fonts.
  5867. @end deffn
  5868. @node lsmod
  5869. @subsection lsmod
  5870. @deffn Command lsmod
  5871. Show list of loaded modules.
  5872. @end deffn
  5873. @node md5sum
  5874. @subsection md5sum
  5875. @deffn Command md5sum arg @dots{}
  5876. Alias for @code{hashsum --hash md5 arg @dots{}}. See command @command{hashsum}
  5877. (@pxref{hashsum}) for full description.
  5878. @end deffn
  5879. @node module
  5880. @subsection module
  5881. @deffn Command module [--nounzip] file [arguments]
  5882. Load a module for multiboot kernel image. The rest of the
  5883. line is passed verbatim as the module command line.
  5884. @end deffn
  5885. @node multiboot
  5886. @subsection multiboot
  5887. @deffn Command multiboot [--quirk-bad-kludge] [--quirk-modules-after-kernel] file @dots{}
  5888. Load a multiboot kernel image from @var{file}. The rest of the
  5889. line is passed verbatim as the @dfn{kernel command-line}. Any module must
  5890. be reloaded after using this command (@pxref{module}).
  5891. Some kernels have known problems. You need to specify --quirk-* for those.
  5892. --quirk-bad-kludge is a problem seen in several products that they include
  5893. loading kludge information with invalid data in ELF file. GRUB prior to 0.97
  5894. and some custom builds preferred ELF information while 0.97 and GRUB 2
  5895. use kludge. Use this option to ignore kludge.
  5896. Known affected systems: old Solaris, SkyOS.
  5897. --quirk-modules-after-kernel is needed for kernels which load at relatively
  5898. high address e.g. 16MiB mark and can't cope with modules stuffed between
  5899. 1MiB mark and beginning of the kernel.
  5900. Known afftected systems: VMWare.
  5901. @end deffn
  5902. @node nativedisk
  5903. @subsection nativedisk
  5904. @deffn Command nativedisk
  5905. Switch from firmware disk drivers to native ones.
  5906. Really useful only on platforms where both
  5907. firmware and native disk drives are available.
  5908. Currently i386-pc, i386-efi, i386-ieee1275 and
  5909. x86_64-efi.
  5910. @end deffn
  5911. @node normal
  5912. @subsection normal
  5913. @deffn Command normal [file]
  5914. Enter normal mode and display the GRUB menu.
  5915. In normal mode, commands, filesystem modules, and cryptography modules are
  5916. automatically loaded, and the full GRUB script parser is available. Other
  5917. modules may be explicitly loaded using @command{insmod} (@pxref{insmod}).
  5918. If a @var{file} is given, then commands will be read from that file.
  5919. Otherwise, they will be read from @file{$prefix/grub.cfg} if it exists.
  5920. @command{normal} may be called from within normal mode, creating a nested
  5921. environment. It is more usual to use @command{configfile}
  5922. (@pxref{configfile}) for this.
  5923. @end deffn
  5924. @node normal_exit
  5925. @subsection normal_exit
  5926. @deffn Command normal_exit
  5927. Exit normal mode (@pxref{normal}). If this instance of normal mode was not
  5928. nested within another one, then return to rescue mode.
  5929. @end deffn
  5930. @node parttool
  5931. @subsection parttool
  5932. @deffn Command parttool partition commands
  5933. Make various modifications to partition table entries.
  5934. Each @var{command} is either a boolean option, in which case it must be
  5935. followed with @samp{+} or @samp{-} (with no intervening space) to enable or
  5936. disable that option, or else it takes a value in the form
  5937. @samp{@var{command}=@var{value}}.
  5938. Currently, @command{parttool} is only useful on DOS partition tables (also
  5939. known as Master Boot Record, or MBR). On these partition tables, the
  5940. following commands are available:
  5941. @table @asis
  5942. @item @samp{boot} (boolean)
  5943. When enabled, this makes the selected partition be the active (bootable)
  5944. partition on its disk, clearing the active flag on all other partitions.
  5945. This command is limited to @emph{primary} partitions.
  5946. @item @samp{type} (value)
  5947. Change the type of an existing partition. The value must be a number in the
  5948. range 0-0xFF (prefix with @samp{0x} to enter it in hexadecimal).
  5949. @item @samp{hidden} (boolean)
  5950. When enabled, this hides the selected partition by setting the @dfn{hidden}
  5951. bit in its partition type code; when disabled, unhides the selected
  5952. partition by clearing this bit. This is useful only when booting DOS or
  5953. Windows and multiple primary FAT partitions exist in one disk. See also
  5954. @ref{DOS/Windows}.
  5955. @end table
  5956. @end deffn
  5957. @node password
  5958. @subsection password
  5959. @deffn Command password user clear-password
  5960. Define a user named @var{user} with password @var{clear-password}.
  5961. @xref{Security}.
  5962. @end deffn
  5963. @node password_pbkdf2
  5964. @subsection password_pbkdf2
  5965. @deffn Command password_pbkdf2 user hashed-password
  5966. Define a user named @var{user} with password hash @var{hashed-password}.
  5967. Use @command{grub-mkpasswd-pbkdf2} (@pxref{Invoking grub-mkpasswd-pbkdf2})
  5968. to generate password hashes. @xref{Security}.
  5969. @end deffn
  5970. @node plainmount
  5971. @subsection plainmount
  5972. @deffn Command plainmount device @option{-c} cipher @option{-s} key size [@option{-h} hash]
  5973. [@option{-S} sector size] [@option{-p} password] [@option{-u} uuid]
  5974. [[@option{-d} keyfile] [@option{-O} keyfile offset]]
  5975. Setup access to the encrypted device in plain mode. Offset of the encrypted
  5976. data at the device is specified in terms of 512 byte sectors using the blocklist
  5977. syntax and loopback device. The following example shows how to specify 1MiB
  5978. offset:
  5979. @example
  5980. loopback node (hd0,gpt1)2048+
  5981. plainmount node @var{...}
  5982. @end example
  5983. The @command{plainmount} command can be used to open LUKS encrypted volume
  5984. if its master key and parameters (key size, cipher, offset, etc) are known.
  5985. There are two ways to specify a password: a keyfile and a secret passphrase.
  5986. The keyfile path parameter has higher priority than the secret passphrase
  5987. parameter and is specified with the option @option{-d}. Password data obtained
  5988. from keyfiles is not hashed and is used directly as a cipher key. An optional
  5989. offset of password data in the keyfile can be specified with the option
  5990. @option{-O} or directly with the option @option{-d} and GRUB blocklist syntax,
  5991. if the keyfile data can be accessed from a device and is 512 byte aligned.
  5992. The following example shows both methods to specify password data in the
  5993. keyfile at offset 1MiB:
  5994. @example
  5995. plainmount -d (hd0,gpt1)2048+ @var{...}
  5996. plainmount -d (hd0,gpt1)+ -O 1048576 @var{...}
  5997. @end example
  5998. If no keyfile is specified then the password is set to the string specified
  5999. by option @option{-p} or is requested interactively from the console. In both
  6000. cases the provided password is hashed with the algorithm specified by the
  6001. option @option{-h}. This option is mandatory if no keyfile is specified, but
  6002. it can be set to @samp{plain} which means that no hashing is done and such
  6003. password is used directly as a key.
  6004. Cipher @option{-c} and keysize @option{-s} options specify the cipher algorithm
  6005. and the key size respectively and are mandatory options. Cipher must be specified
  6006. with the mode separated by a dash (for example, @samp{aes-xts-plain64}). Key size
  6007. option @option{-s} is the key size of the cipher in bits, not to be confused with
  6008. the offset of the key data in a keyfile specified with the @option{-O} option. It
  6009. must not exceed 1024 bits, so a 32 byte key would be specified as 256 bits
  6010. The optional parameter @option{-S} specifies encrypted device sector size. It
  6011. must be at least 512 bytes long (default value) and a power of 2. @footnote{Current
  6012. implementation of cryptsetup supports only 512/1024/2048/4096 byte sectors}.
  6013. Disk sector size is configured when creating the encrypted volume. Attempting
  6014. to decrypt volumes with a different sector size than it was created with will
  6015. not result in an error, but will decrypt to random bytes and thus prevent
  6016. accessing the volume (in some cases the filesystem driver can detect the presence
  6017. of a filesystem, but nevertheless will refuse to mount it).
  6018. By default new plainmount devices will be given a UUID starting with
  6019. '109fea84-a6b7-34a8-4bd1-1c506305a401' where the last digits are incremented
  6020. by one for each plainmounted device beyond the first up to 2^10 devices.
  6021. All encryption arguments (cipher, hash, key size, disk offset and disk sector
  6022. size) must match the parameters used to create the volume. If any of them does
  6023. not match the actual arguments used during the initial encryption, plainmount
  6024. will create virtual device with the garbage data and GRUB will report unknown
  6025. filesystem for such device.
  6026. @end deffn
  6027. @node play
  6028. @subsection play
  6029. @deffn Command play file | tempo [pitch1 duration1] [pitch2 duration2] @dots{}
  6030. Plays a tune
  6031. If the argument is a file name (@pxref{File name syntax}), play the tune
  6032. recorded in it. The file format is first the tempo as an unsigned 32bit
  6033. little-endian number, then pairs of unsigned 16bit little-endian numbers for
  6034. pitch and duration pairs.
  6035. If the arguments are a series of numbers, play the inline tune.
  6036. The tempo is the base for all note durations. 60 gives a 1-second base, 120
  6037. gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
  6038. a rest.
  6039. @end deffn
  6040. @node probe
  6041. @subsection probe
  6042. @deffn Command probe [@option{--set} var] @option{--driver}|@option{--partmap}|@option{--fs}|@option{--fs-uuid}|@option{--label}|@option{--part-uuid} device
  6043. Retrieve device information. If option @option{--set} is given, assign result
  6044. to variable @var{var}, otherwise print information on the screen.
  6045. The option @option{--part-uuid} is currently only implemented for MSDOS and GPT formatted disks.
  6046. @end deffn
  6047. @node rdmsr
  6048. @subsection rdmsr
  6049. @deffn Command: rdmsr 0xADDR [-v VARNAME]
  6050. Read a model-specific register at address 0xADDR. If the parameter
  6051. @option{-v} is used and an environment variable @var{VARNAME} is
  6052. given, set that environment variable to the value that was read.
  6053. Please note that on SMP systems, reading from a MSR that has a
  6054. scope per hardware thread, implies that the value that is returned
  6055. only applies to the particular cpu/core/thread that runs the command.
  6056. Also, if you specify a reserved or unimplemented MSR address, it will
  6057. cause a general protection exception (which is not currently being handled)
  6058. and the system will reboot.
  6059. @end deffn
  6060. @node read
  6061. @subsection read
  6062. @deffn Command read [-s] [var]
  6063. Read a line of input from the user. If an environment variable @var{var} is
  6064. given, set that environment variable to the line of input that was read,
  6065. with no terminating newline. If the parameter @option{-s} is used, enable
  6066. silent mode where input is not printed to the terminal.
  6067. @end deffn
  6068. @node reboot
  6069. @subsection reboot
  6070. @deffn Command reboot
  6071. Reboot the computer.
  6072. @end deffn
  6073. @node regexp
  6074. @subsection regexp
  6075. @deffn Command regexp [@option{--set} [number:]var] regexp string
  6076. Test if regular expression @var{regexp} matches @var{string}. Supported
  6077. regular expressions are POSIX.2 Extended Regular Expressions. If option
  6078. @option{--set} is given, store @var{number}th matched subexpression in
  6079. variable @var{var}. Subexpressions are numbered in order of their opening
  6080. parentheses starting from @samp{1}. @var{number} defaults to @samp{1}.
  6081. @end deffn
  6082. @node rmmod
  6083. @subsection rmmod
  6084. @deffn Command rmmod module
  6085. Remove a loaded @var{module}.
  6086. @end deffn
  6087. @node save_env
  6088. @subsection save_env
  6089. @deffn Command save_env [@option{--file} file] var @dots{}
  6090. Save the named variables from the environment to the environment block file.
  6091. @xref{Environment block}.
  6092. The @option{--file} option overrides the default location of the environment
  6093. block.
  6094. This command will operate successfully even when environment variable
  6095. @code{check_signatures} is set to @code{enforce}
  6096. (@pxref{check_signatures}), since it writes to disk and does not alter
  6097. the behavior of GRUB based on any contents of disk that have been
  6098. read. It is possible to modify a digitally signed environment block
  6099. file from within GRUB using this command, such that its signature will
  6100. no longer be valid on subsequent boots. Care should be taken in such
  6101. advanced configurations to avoid rendering the system
  6102. unbootable. @xref{Using digital signatures}, for more information.
  6103. @end deffn
  6104. @node search
  6105. @subsection search
  6106. @deffn Command search @
  6107. [@option{--file}|@option{--label}|@option{--fs-uuid}] @
  6108. [@option{--set} [var]] [@option{--no-floppy}|@option{--efidisk-only}] name
  6109. Search devices by file (@option{-f}, @option{--file}), filesystem label
  6110. (@option{-l}, @option{--label}), or filesystem UUID (@option{-u},
  6111. @option{--fs-uuid}).
  6112. If the (@option{-s}, @option{--set}) option is used, the first device found is
  6113. set as the value of environment variable @var{var}. The default variable is
  6114. @samp{root}.
  6115. The (@option{-n}, @option{--no-floppy}) option prevents searching floppy
  6116. devices, which can be slow.
  6117. The (@option{--efidisk-only}) option prevents searching any other devices then
  6118. EFI disks. This is typically used when chainloading to local EFI partition.
  6119. The @samp{search.file}, @samp{search.fs_label}, and @samp{search.fs_uuid}
  6120. commands are aliases for @samp{search --file}, @samp{search --label}, and
  6121. @samp{search --fs-uuid} respectively.
  6122. Also hints as to which device may be the most likely to contain the item
  6123. searched for may be given via the (@option{-h}, @option{--hint}) option with
  6124. a device name as an argument. If the argument ends with a comma, then partitions
  6125. on the device are also searched. Furthermore, platform specific hints may be
  6126. given via the options @option{--hint-ieee1275}, @option{--hint-bios},
  6127. @option{--hint-baremetal}, @option{--hint-efi}, and @option{--hint-arc}. When
  6128. specified, these options take an argument and operate like @option{--hint}, but
  6129. only on the specified platform.
  6130. @end deffn
  6131. @node sendkey
  6132. @subsection sendkey
  6133. @deffn Command sendkey @
  6134. [@option{--num}|@option{--caps}|@option{--scroll}|@option{--insert}|@
  6135. @option{--pause}|@option{--left-shift}|@option{--right-shift}|@
  6136. @option{--sysrq}|@option{--numkey}|@option{--capskey}|@option{--scrollkey}|@
  6137. @option{--insertkey}|@option{--left-alt}|@option{--right-alt}|@
  6138. @option{--left-ctrl}|@option{--right-ctrl} @
  6139. @samp{on}|@samp{off}]@dots{} @
  6140. [@option{no-led}] @
  6141. keystroke
  6142. Insert keystrokes into the keyboard buffer when booting. Sometimes an
  6143. operating system or chainloaded boot loader requires particular keys to be
  6144. pressed: for example, one might need to press a particular key to enter
  6145. "safe mode", or when chainloading another boot loader one might send
  6146. keystrokes to it to navigate its menu.
  6147. Note: This command is currently only available on the i386-pc target.
  6148. You may provide up to 16 keystrokes (the length of the BIOS keyboard
  6149. buffer). Keystroke names may be upper-case or lower-case letters, digits,
  6150. or taken from the following table:
  6151. @c Please keep this table in the same order as in
  6152. @c commands/i386/pc/sendkey.c, for ease of maintenance.
  6153. @c Exception: The function and numeric keys are sorted, for aesthetics.
  6154. @multitable @columnfractions .4 .5
  6155. @headitem Name @tab Key
  6156. @item escape @tab Escape
  6157. @item exclam @tab !
  6158. @item at @tab @@
  6159. @item numbersign @tab #
  6160. @item dollar @tab $
  6161. @item percent @tab %
  6162. @item caret @tab ^
  6163. @item ampersand @tab &
  6164. @item asterisk @tab *
  6165. @item parenleft @tab (
  6166. @item parenright @tab )
  6167. @item minus @tab -
  6168. @item underscore @tab _
  6169. @item equal @tab =
  6170. @item plus @tab +
  6171. @item backspace @tab Backspace
  6172. @item tab @tab Tab
  6173. @item bracketleft @tab [
  6174. @item braceleft @tab @{
  6175. @item bracketright @tab ]
  6176. @item braceright @tab @}
  6177. @item enter @tab Enter
  6178. @item control @tab press and release Control
  6179. @item semicolon @tab ;
  6180. @item colon @tab :
  6181. @item quote @tab '
  6182. @item doublequote @tab "
  6183. @item backquote @tab `
  6184. @item tilde @tab ~
  6185. @item shift @tab press and release left Shift
  6186. @item backslash @tab \
  6187. @item bar @tab |
  6188. @item comma @tab ,
  6189. @item less @tab <
  6190. @item period @tab .
  6191. @item greater @tab >
  6192. @item slash @tab /
  6193. @item question @tab ?
  6194. @item rshift @tab press and release right Shift
  6195. @item alt @tab press and release Alt
  6196. @item space @tab space bar
  6197. @item capslock @tab Caps Lock
  6198. @item F1 @tab F1
  6199. @item F2 @tab F2
  6200. @item F3 @tab F3
  6201. @item F4 @tab F4
  6202. @item F5 @tab F5
  6203. @item F6 @tab F6
  6204. @item F7 @tab F7
  6205. @item F8 @tab F8
  6206. @item F9 @tab F9
  6207. @item F10 @tab F10
  6208. @item F11 @tab F11
  6209. @item F12 @tab F12
  6210. @item num1 @tab 1 (numeric keypad)
  6211. @item num2 @tab 2 (numeric keypad)
  6212. @item num3 @tab 3 (numeric keypad)
  6213. @item num4 @tab 4 (numeric keypad)
  6214. @item num5 @tab 5 (numeric keypad)
  6215. @item num6 @tab 6 (numeric keypad)
  6216. @item num7 @tab 7 (numeric keypad)
  6217. @item num8 @tab 8 (numeric keypad)
  6218. @item num9 @tab 9 (numeric keypad)
  6219. @item num0 @tab 0 (numeric keypad)
  6220. @item numperiod @tab . (numeric keypad)
  6221. @item numend @tab End (numeric keypad)
  6222. @item numdown @tab Down (numeric keypad)
  6223. @item numpgdown @tab Page Down (numeric keypad)
  6224. @item numleft @tab Left (numeric keypad)
  6225. @item numcenter @tab 5 with Num Lock inactive (numeric keypad)
  6226. @item numright @tab Right (numeric keypad)
  6227. @item numhome @tab Home (numeric keypad)
  6228. @item numup @tab Up (numeric keypad)
  6229. @item numpgup @tab Page Up (numeric keypad)
  6230. @item numinsert @tab Insert (numeric keypad)
  6231. @item numdelete @tab Delete (numeric keypad)
  6232. @item numasterisk @tab * (numeric keypad)
  6233. @item numminus @tab - (numeric keypad)
  6234. @item numplus @tab + (numeric keypad)
  6235. @item numslash @tab / (numeric keypad)
  6236. @item numenter @tab Enter (numeric keypad)
  6237. @item delete @tab Delete
  6238. @item insert @tab Insert
  6239. @item home @tab Home
  6240. @item end @tab End
  6241. @item pgdown @tab Page Down
  6242. @item pgup @tab Page Up
  6243. @item down @tab Down
  6244. @item up @tab Up
  6245. @item left @tab Left
  6246. @item right @tab Right
  6247. @end multitable
  6248. As well as keystrokes, the @command{sendkey} command takes various options
  6249. that affect the BIOS keyboard status flags. These options take an @samp{on}
  6250. or @samp{off} parameter, specifying that the corresponding status flag be
  6251. set or unset; omitting the option for a given status flag will leave that
  6252. flag at its initial state at boot. The @option{--num}, @option{--caps},
  6253. @option{--scroll}, and @option{--insert} options emulate setting the
  6254. corresponding mode, while the @option{--numkey}, @option{--capskey},
  6255. @option{--scrollkey}, and @option{--insertkey} options emulate pressing and
  6256. holding the corresponding key. The other status flag options are
  6257. self-explanatory.
  6258. If the @option{--no-led} option is given, the status flag options will have
  6259. no effect on keyboard LEDs.
  6260. If the @command{sendkey} command is given multiple times, then only the last
  6261. invocation has any effect.
  6262. Since @command{sendkey} manipulates the BIOS keyboard buffer, it may cause
  6263. hangs, reboots, or other misbehaviour on some systems. If the operating
  6264. system or boot loader that runs after GRUB uses its own keyboard driver
  6265. rather than the BIOS keyboard functions, then @command{sendkey} will have no
  6266. effect.
  6267. This command is only available on PC BIOS systems.
  6268. @end deffn
  6269. @node set
  6270. @subsection set
  6271. @deffn Command set [envvar=value]
  6272. Set the environment variable @var{envvar} to @var{value}. If invoked with no
  6273. arguments, print all environment variables with their values. For the list of
  6274. environment variables currently used by GRUB itself see the relevant section
  6275. @pxref{Environment}.
  6276. @end deffn
  6277. @node sha1sum
  6278. @subsection sha1sum
  6279. @deffn Command sha1sum arg @dots{}
  6280. Alias for @code{hashsum --hash sha1 arg @dots{}}. See command @command{hashsum}
  6281. (@pxref{hashsum}) for full description.
  6282. @end deffn
  6283. @node sha256sum
  6284. @subsection sha256sum
  6285. @deffn Command sha256sum arg @dots{}
  6286. Alias for @code{hashsum --hash sha256 arg @dots{}}. See command @command{hashsum}
  6287. (@pxref{hashsum}) for full description.
  6288. @end deffn
  6289. @node sha512sum
  6290. @subsection sha512sum
  6291. @deffn Command sha512sum arg @dots{}
  6292. Alias for @code{hashsum --hash sha512 arg @dots{}}. See command @command{hashsum}
  6293. (@pxref{hashsum}) for full description.
  6294. @end deffn
  6295. @node sleep
  6296. @subsection sleep
  6297. @deffn Command sleep [@option{--verbose}] [@option{--interruptible}] count
  6298. Sleep for @var{count} seconds. If option @option{--interruptible} is given,
  6299. allow pressing @key{ESC}, @key{F4} or holding down @key{SHIFT} to interrupt
  6300. sleep. With @option{--verbose} show countdown of remaining seconds. Exit code
  6301. is set to 0 if timeout expired and to 1 if timeout was interrupted using any
  6302. of the mentioned keys.
  6303. @end deffn
  6304. @node smbios
  6305. @subsection smbios
  6306. @deffn Command smbios @
  6307. [@option{--type} @var{type}] @
  6308. [@option{--handle} @var{handle}] @
  6309. [@option{--match} @var{match}] @
  6310. (@option{--get-byte} | @option{--get-word} | @option{--get-dword} | @
  6311. @option{--get-qword} | @option{--get-string} | @option{--get-uuid}) @
  6312. @var{offset} @
  6313. [@option{--set} @var{variable}]
  6314. Retrieve SMBIOS information.
  6315. The @command{smbios} command returns the value of a field in an SMBIOS
  6316. structure. The following options determine which structure to select.
  6317. @itemize @bullet
  6318. @item
  6319. Specifying @option{--type} will select structures with a matching
  6320. @var{type}. The type can be any integer from 0 to 255.
  6321. @item
  6322. Specifying @option{--handle} will select structures with a matching
  6323. @var{handle}. The handle can be any integer from 0 to 65535.
  6324. @item
  6325. Specifying @option{--match} will select structure number @var{match} in the
  6326. filtered list of structures; e.g. @code{smbios --type 4 --match 2} will select
  6327. the second Process Information (Type 4) structure. The list is always ordered
  6328. the same as the hardware's SMBIOS table. The match number must be a positive
  6329. integer. If unspecified, the first matching structure will be selected.
  6330. @end itemize
  6331. The remaining options determine which field in the selected SMBIOS structure to
  6332. return. Only one of these options may be specified at a time.
  6333. @itemize @bullet
  6334. @item
  6335. When given @option{--get-byte}, return the value of the byte
  6336. at @var{offset} bytes into the selected SMBIOS structure.
  6337. It will be formatted as an unsigned decimal integer.
  6338. @item
  6339. When given @option{--get-word}, return the value of the word (two bytes)
  6340. at @var{offset} bytes into the selected SMBIOS structure.
  6341. It will be formatted as an unsigned decimal integer.
  6342. @item
  6343. When given @option{--get-dword}, return the value of the dword (four bytes)
  6344. at @var{offset} bytes into the selected SMBIOS structure.
  6345. It will be formatted as an unsigned decimal integer.
  6346. @item
  6347. When given @option{--get-qword}, return the value of the qword (eight bytes)
  6348. at @var{offset} bytes into the selected SMBIOS structure.
  6349. It will be formatted as an unsigned decimal integer.
  6350. @item
  6351. When given @option{--get-string}, return the string with its index found
  6352. at @var{offset} bytes into the selected SMBIOS structure.
  6353. @item
  6354. When given @option{--get-uuid}, return the value of the UUID (sixteen bytes)
  6355. at @var{offset} bytes into the selected SMBIOS structure.
  6356. It will be formatted as lower-case hyphenated hexadecimal digits, with the
  6357. first three fields as little-endian, and the rest printed byte-by-byte.
  6358. @end itemize
  6359. The default action is to print the value of the requested field to the console,
  6360. but a variable name can be specified with @option{--set} to store the value
  6361. instead of printing it.
  6362. For example, this will store and then display the system manufacturer's name.
  6363. @example
  6364. smbios --type 1 --get-string 4 --set system_manufacturer
  6365. echo $system_manufacturer
  6366. @end example
  6367. @end deffn
  6368. @node source
  6369. @subsection source
  6370. @deffn Command source file
  6371. Read @var{file} as a configuration file, as if its contents had been
  6372. incorporated directly into the sourcing file. Unlike @command{configfile}
  6373. (@pxref{configfile}), this executes the contents of @var{file} without
  6374. changing context: any environment variable changes made by the commands in
  6375. @var{file} will be preserved after @command{source} returns, and the menu
  6376. will not be shown immediately.
  6377. @end deffn
  6378. @node test
  6379. @subsection test
  6380. @deffn Command test expression
  6381. Evaluate @var{expression} and return zero exit status if result is true,
  6382. non zero status otherwise.
  6383. @var{expression} is one of:
  6384. @table @asis
  6385. @item @var{string1} @code{==} @var{string2}
  6386. the strings are equal
  6387. @item @var{string1} @code{!=} @var{string2}
  6388. the strings are not equal
  6389. @item @var{string1} @code{<} @var{string2}
  6390. @var{string1} is lexicographically less than @var{string2}
  6391. @item @var{string1} @code{<=} @var{string2}
  6392. @var{string1} is lexicographically less or equal than @var{string2}
  6393. @item @var{string1} @code{>} @var{string2}
  6394. @var{string1} is lexicographically greater than @var{string2}
  6395. @item @var{string1} @code{>=} @var{string2}
  6396. @var{string1} is lexicographically greater or equal than @var{string2}
  6397. @item @var{integer1} @code{-eq} @var{integer2}
  6398. @var{integer1} is equal to @var{integer2}
  6399. @item @var{integer1} @code{-ge} @var{integer2}
  6400. @var{integer1} is greater than or equal to @var{integer2}
  6401. @item @var{integer1} @code{-gt} @var{integer2}
  6402. @var{integer1} is greater than @var{integer2}
  6403. @item @var{integer1} @code{-le} @var{integer2}
  6404. @var{integer1} is less than or equal to @var{integer2}
  6405. @item @var{integer1} @code{-lt} @var{integer2}
  6406. @var{integer1} is less than @var{integer2}
  6407. @item @var{integer1} @code{-ne} @var{integer2}
  6408. @var{integer1} is not equal to @var{integer2}
  6409. @item @var{prefix}@var{integer1} @code{-pgt} @var{prefix}@var{integer2}
  6410. @var{integer1} is greater than @var{integer2} after stripping off common non-numeric @var{prefix}.
  6411. @item @var{prefix}@var{integer1} @code{-plt} @var{prefix}@var{integer2}
  6412. @var{integer1} is less than @var{integer2} after stripping off common non-numeric @var{prefix}.
  6413. @item @var{file1} @code{-nt} @var{file2}
  6414. @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.
  6415. @item @var{file1} @code{-ot} @var{file2}
  6416. @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.
  6417. @item @code{-d} @var{file}
  6418. @var{file} exists and is a directory
  6419. @item @code{-e} @var{file}
  6420. @var{file} exists
  6421. @item @code{-f} @var{file}
  6422. @var{file} exists and is not a directory
  6423. @item @code{-s} @var{file}
  6424. @var{file} exists and has a size greater than zero
  6425. @item @code{-n} @var{string}
  6426. the length of @var{string} is nonzero
  6427. @item @var{string}
  6428. @var{string} is equivalent to @code{-n @var{string}}
  6429. @item @code{-z} @var{string}
  6430. the length of @var{string} is zero
  6431. @item @code{(} @var{expression} @code{)}
  6432. @var{expression} is true
  6433. @item @code{!} @var{expression}
  6434. @var{expression} is false
  6435. @item @var{expression1} @code{-a} @var{expression2}
  6436. both @var{expression1} and @var{expression2} are true
  6437. @item @var{expression1} @var{expression2}
  6438. both @var{expression1} and @var{expression2} are true. This syntax is not POSIX-compliant and is not recommended.
  6439. @item @var{expression1} @code{-o} @var{expression2}
  6440. either @var{expression1} or @var{expression2} is true
  6441. @end table
  6442. @end deffn
  6443. @node tpm2_key_protector_init
  6444. @subsection tpm2_key_protector_init
  6445. @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]
  6446. Initialize the TPM2 key protector to unseal the key for the @command{cryptomount}
  6447. (@pxref{cryptomount}) command. There are two supported modes,
  6448. SRK(@kbd{srk}) and NV index(@kbd{nv}), to be specified by the option
  6449. @option{-m}. The default mode is SRK. The main difference between SRK mode
  6450. and NV index mode is the storage of the sealed key. For SRK mode, the sealed
  6451. key is stored in a file while NV index mode stores the sealed key in the
  6452. non-volatile memory inside TPM with a given NV index.
  6453. The @option{-p} and @option{-b} options are used to supply the PCR list and
  6454. bank that the key is sealed with. The PCR list is a comma-separated list, e.g.,
  6455. '0,2,4,7,9', to represent the involved PCRs, and the default is '7'. The PCR
  6456. bank is chosen by selecting a hash algorithm. The current supported PCR banks
  6457. are SHA1, SHA256, SHA384, and SHA512, and the default is SHA256.
  6458. Some options are only available for the specific mode. The SRK-specific
  6459. options are @option{-T}, @option{-k}, @option{-a}, and @option{-s}. On the
  6460. other hand, the NV index-specific option is @option{-n}.
  6461. The key file for SRK mode can be supplied with either @option{-T} or
  6462. @option{-k}. The @option{-T} option is for the path to the key file in
  6463. TPM 2.0 Key File format. Since the parameters for the TPM commands are written
  6464. in the file, there is no need to set the PCR list(@option{-p}) and
  6465. bank(@option{-b}) when using the @option{-T} option. The @option{-k} option
  6466. is for the key file in the raw format, and the @option{-p} and @option{-b}
  6467. options are necessary for the non-default PCR list or bank. In general,
  6468. TPM 2.0 Key File format is preferred due to the simplified GRUB command
  6469. options and the authorized policy support
  6470. Besides the key file, there are two options, @option{-a} and @option{-s}, to
  6471. tweak the TPM Storage Root Key (SRK). The SRK can be either created at
  6472. runtime or stored in the non-volatile memory. When creating SRK at runtime,
  6473. GRUB provides the SRK template to the TPM to create the key. There are two SRK
  6474. templates for the @option{-a} option, ECC and RSA, and the default is ECC.
  6475. If the SRK is stored in a specific handle, e.g. @code{0x81000001}, the
  6476. @option{-s} option can be used to set the handle to notify GRUB to load
  6477. the SRK from the given handle.
  6478. The only NV index-specific option is the @option{-n} option which is used to
  6479. set the NV index containing the sealed key. Then GRUB can load the sealed
  6480. key and unseal it with the given PCR list and bank.
  6481. @end deffn
  6482. @node tpm2_key_protector_clear
  6483. @subsection tpm2_key_protector_clear
  6484. @deffn Command tpm2_key_protector_clear
  6485. Clear the TPM2 key protector if previously initialized.
  6486. @end deffn
  6487. @node true
  6488. @subsection true
  6489. @deffn Command true
  6490. Do nothing, successfully. This is mainly useful in control constructs such
  6491. as @code{if} and @code{while} (@pxref{Shell-like scripting}).
  6492. @end deffn
  6493. @node trust
  6494. @subsection trust
  6495. @deffn Command trust [@option{--skip-sig}] pubkey_file
  6496. Read public key from @var{pubkey_file} and add it to GRUB's internal
  6497. list of trusted public keys. These keys are used to validate digital
  6498. signatures when environment variable @code{check_signatures} is set to
  6499. @code{enforce}. Note that if @code{check_signatures} is set to
  6500. @code{enforce} when @command{trust} executes, then @var{pubkey_file}
  6501. must itself be properly signed. The @option{--skip-sig} option can be
  6502. used to disable signature-checking when reading @var{pubkey_file}
  6503. itself. It is expected that @option{--skip-sig} is useful for testing
  6504. and manual booting. @xref{Using digital signatures}, for more
  6505. information.
  6506. @end deffn
  6507. @node unset
  6508. @subsection unset
  6509. @deffn Command unset envvar
  6510. Unset the environment variable @var{envvar}.
  6511. @end deffn
  6512. @ignore
  6513. @node vbeinfo
  6514. @subsection vbeinfo
  6515. @deffn Command vbeinfo [[WxH]xD]
  6516. Alias for command @command{videoinfo} (@pxref{videoinfo}). It is available
  6517. only on PC BIOS platforms.
  6518. @end deffn
  6519. @end ignore
  6520. @node verify_detached
  6521. @subsection verify_detached
  6522. @deffn Command verify_detached [@option{--skip-sig}] file signature_file [pubkey_file]
  6523. Verifies a GPG-style detached signature, where the signed file is
  6524. @var{file}, and the signature itself is in file @var{signature_file}.
  6525. Optionally, a specific public key to use can be specified using
  6526. @var{pubkey_file}. When environment variable @code{check_signatures}
  6527. is set to @code{enforce}, then @var{pubkey_file} must itself be
  6528. properly signed by an already-trusted key. An unsigned
  6529. @var{pubkey_file} can be loaded by specifying @option{--skip-sig}.
  6530. If @var{pubkey_file} is omitted, then public keys from GRUB's trusted keys
  6531. (@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}) are
  6532. tried.
  6533. Exit code @code{$?} is set to 0 if the signature validates
  6534. successfully. If validation fails, it is set to a non-zero value.
  6535. @xref{Using digital signatures}, for more information.
  6536. @end deffn
  6537. @node videoinfo
  6538. @subsection videoinfo
  6539. @deffn Command videoinfo [[WxH]xD]
  6540. List available video modes. If resolution is given, show only matching modes.
  6541. @end deffn
  6542. @node wrmsr
  6543. @subsection wrmsr
  6544. @deffn Command: wrmsr 0xADDR 0xVALUE
  6545. Write a 0xVALUE to a model-specific register at address 0xADDR.
  6546. Please note that on SMP systems, writing to a MSR that has a scope
  6547. per hardware thread, implies that the value that is written
  6548. only applies to the particular cpu/core/thread that runs the command.
  6549. Also, if you specify a reserved or unimplemented MSR address, it will
  6550. cause a general protection exception (which is not currently being handled)
  6551. and the system will reboot.
  6552. Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
  6553. This is done to prevent subverting various security mechanisms.
  6554. @end deffn
  6555. @node Networking commands
  6556. @section Networking commands
  6557. @menu
  6558. * net_add_addr:: Add a network address
  6559. * net_add_dns:: Add a DNS server
  6560. * net_add_route:: Add routing entry
  6561. * net_bootp:: Perform a bootp/DHCP autoconfiguration
  6562. * net_del_addr:: Remove IP address from interface
  6563. * net_del_dns:: Remove a DNS server
  6564. * net_del_route:: Remove a route entry
  6565. * net_dhcp:: Perform a DHCP autoconfiguration
  6566. * net_get_dhcp_option:: Retrieve DHCP options
  6567. * net_ipv6_autoconf:: Perform IPv6 autoconfiguration
  6568. * net_ls_addr:: List interfaces
  6569. * net_ls_cards:: List network cards
  6570. * net_ls_dns:: List DNS servers
  6571. * net_ls_routes:: List routing entries
  6572. * net_nslookup:: Perform a DNS lookup
  6573. * net_set_vlan:: Set vlan id on an interface
  6574. @end menu
  6575. @node net_add_addr
  6576. @subsection net_add_addr
  6577. @deffn Command net_add_addr @var{interface} @var{card} @var{address}
  6578. Configure additional network @var{interface} with @var{address} on a
  6579. network @var{card}. @var{address} can be either IP in dotted decimal notation,
  6580. or symbolic name which is resolved using DNS lookup. If successful, this command
  6581. also adds local link routing entry to the default subnet of @var{address}
  6582. with name @var{interface}@samp{:local} via @var{interface}.
  6583. @end deffn
  6584. @node net_add_dns
  6585. @subsection net_add_dns
  6586. @deffn Command net_add_dns @var{server}
  6587. Resolve @var{server} IP address and add to the list of DNS servers used during
  6588. name lookup.
  6589. @end deffn
  6590. @node net_add_route
  6591. @subsection net_add_route
  6592. @deffn Command net_add_route @var{shortname} @var{ip}[/@var{prefix}] [@var{interface} | @samp{gw} @var{gateway}]
  6593. Add route to network with address @var{ip} as modified by @var{prefix} via
  6594. either local @var{interface} or @var{gateway}. @var{prefix} is optional and
  6595. defaults to 32 for IPv4 address and 128 for IPv6 address. Route is identified
  6596. by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
  6597. @end deffn
  6598. @node net_bootp
  6599. @subsection net_bootp
  6600. @deffn Command net_bootp [@var{card}]
  6601. Alias for net_dhcp, for compatibility with older Grub versions. Will perform
  6602. the same DHCP handshake with potential fallback to BOOTP as the net_dhcp
  6603. command (@pxref{net_dhcp}).
  6604. @end deffn
  6605. @node net_del_addr
  6606. @subsection net_del_addr
  6607. @deffn Command net_del_addr @var{interface}
  6608. Remove configured @var{interface} with associated address.
  6609. @end deffn
  6610. @node net_del_dns
  6611. @subsection net_del_dns
  6612. @deffn Command net_del_dns @var{address}
  6613. Remove @var{address} from list of servers used during name lookup.
  6614. @end deffn
  6615. @node net_del_route
  6616. @subsection net_del_route
  6617. @deffn Command net_del_route @var{shortname}
  6618. Remove route entry identified by @var{shortname}.
  6619. @end deffn
  6620. @node net_dhcp
  6621. @subsection net_dhcp
  6622. @deffn Command net_dhcp [@var{card}]
  6623. Perform configuration of @var{card} using DHCP protocol. If no card name
  6624. is specified, try to configure all existing cards.
  6625. Falls back to the BOOTP protocol, if needed. If configuration was
  6626. successful, interface with name @var{card}@samp{:dhcp} and configured
  6627. address is added to @var{card}.
  6628. @comment If server provided gateway information in
  6629. @comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}.
  6630. Additionally the following DHCP options are recognized and processed:
  6631. @table @samp
  6632. @item 1 (Subnet Mask)
  6633. Used to calculate network local routing entry for interface @var{card}@samp{:dhcp}.
  6634. @item 3 (Router)
  6635. Adds default route entry with the name @var{card}@samp{:dhcp:default} via gateway
  6636. from DHCP option. Note that only option with single route is accepted.
  6637. @item 6 (Domain Name Server)
  6638. Adds all servers from option value to the list of servers used during name resolution.
  6639. @item 12 (Host Name)
  6640. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_hostname}
  6641. (@pxref{net_@var{<interface>}_hostname}) to the value of option.
  6642. @item 15 (Domain Name)
  6643. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_domain}
  6644. (@pxref{net_@var{<interface>}_domain}) to the value of option.
  6645. @item 17 (Root Path)
  6646. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_rootpath}
  6647. (@pxref{net_@var{<interface>}_rootpath}) to the value of option.
  6648. @item 18 (Extensions Path)
  6649. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_extensionspath}
  6650. (@pxref{net_@var{<interface>}_extensionspath}) to the value of option.
  6651. @item 66 (TFTP Server Name)
  6652. Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_server_name}
  6653. (@pxref{net_@var{<interface>}_dhcp_server_name}) to the value of option.
  6654. @item 67 (Filename)
  6655. Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
  6656. (@pxref{net_@var{<interface>}_boot_file}) to the value of option.
  6657. @end table
  6658. @end deffn
  6659. @node net_get_dhcp_option
  6660. @subsection net_get_dhcp_option
  6661. @deffn Command net_get_dhcp_option @var{var} @var{interface} @var{number} @var{type}
  6662. Request DHCP option @var{number} of @var{type} via @var{interface}. @var{type}
  6663. can be one of @samp{string}, @samp{number} or @samp{hex}. If option is found,
  6664. assign its value to variable @var{var}. Values of types @samp{number} and @samp{hex}
  6665. are converted to string representation.
  6666. @end deffn
  6667. @node net_ipv6_autoconf
  6668. @subsection net_ipv6_autoconf
  6669. @deffn Command net_ipv6_autoconf [@var{card}]
  6670. Perform IPv6 autoconfiguration by adding to the @var{card} interface with name
  6671. @var{card}@samp{:link} and link local MAC-based address. If no card is specified,
  6672. perform autoconfiguration for all existing cards.
  6673. @end deffn
  6674. @node net_ls_addr
  6675. @subsection net_ls_addr
  6676. @deffn Command net_ls_addr
  6677. List all configured interfaces with their MAC and IP addresses.
  6678. @end deffn
  6679. @node net_ls_cards
  6680. @subsection net_ls_cards
  6681. @deffn Command net_ls_cards
  6682. List all detected network cards with their MAC address.
  6683. @end deffn
  6684. @node net_ls_dns
  6685. @subsection net_ls_dns
  6686. @deffn Command net_ls_dns
  6687. List addresses of DNS servers used during name lookup.
  6688. @end deffn
  6689. @node net_ls_routes
  6690. @subsection net_ls_routes
  6691. @deffn Command net_ls_routes
  6692. List routing entries.
  6693. @end deffn
  6694. @node net_nslookup
  6695. @subsection net_nslookup
  6696. @deffn Command net_nslookup @var{name} [@var{server}]
  6697. Resolve address of @var{name} using DNS server @var{server}. If no server
  6698. is given, use default list of servers.
  6699. @end deffn
  6700. @node net_set_vlan
  6701. @subsection net_set_vlan
  6702. @deffn Command net_set_vlan @var{interface} @var{vlanid}
  6703. Set the 802.1Q VLAN identifier on @var{interface} to @var{vlanid}. For example,
  6704. to set the VLAN identifier on interface @samp{efinet1} to @samp{100}:
  6705. @example
  6706. net_set_vlan efinet1 100
  6707. @end example
  6708. The VLAN identifier can be removed by setting it to @samp{0}:
  6709. @example
  6710. net_set_vlan efinet1 0
  6711. @end example
  6712. @end deffn
  6713. @node Undocumented commands
  6714. @section Commands currently undocumented
  6715. Unfortunately, not all GRUB commands are documented at this time due to
  6716. developer resource constraints. One way to contribute back to the GRUB
  6717. project would be to help document these commands, and submit patches or
  6718. ideas to the mailing list. The following is a (most likely incomplete)
  6719. list of undocumented or poorly documented commands and not all of them
  6720. are allowed for all platforms. Running the command help from within the
  6721. GRUB shell may provide more information on parameters and usage.
  6722. @itemize @bullet
  6723. @item @command{all_functional_test} - Run all functional tests.
  6724. @item @command{backtrace} - Print backtrace.
  6725. @item @command{boottime} - Show boot time statistics.
  6726. @item @command{cacheinfo} - Get disk cache info.
  6727. @item @command{cbmemc} - Show CBMEM console content.
  6728. @item @command{cmosset} - Set bit at BYTE:BIT in CMOS.
  6729. @item @command{coreboot_boottime} - Show coreboot boot time statistics.
  6730. @item @command{dump} - Show memory contents.
  6731. @item @command{efiemu_loadcore} - Load and initialize EFI emulator.
  6732. @item @command{efiemu_prepare} - Finalize loading of EFI emulator.
  6733. @item @command{efiemu_unload} - Unload EFI emulator.
  6734. @item @command{exit} - Exit from GRUB.
  6735. @item @command{extract_entries_configfile} - Load another config file but take only menu entries.
  6736. @item @command{extract_entries_source} - Load another config file without changing context but take only menu entries.
  6737. @item @command{extract_legacy_entries_configfile} - Parse legacy config in new context taking only menu entries
  6738. @item @command{extract_legacy_entries_source} - Parse legacy config in same context taking only menu entries
  6739. @item @command{extract_syslinux_entries_configfile} - Execute syslinux config in new context taking only menu entries
  6740. @item @command{extract_syslinux_entries_source} - Execute syslinux config in same context taking only menu entries
  6741. @item @command{fakebios} - Create BIOS-like structures for backward compatibility with existing OS.
  6742. @item @command{fix_video} - Fix video problem.
  6743. @item @command{fpswa} - Display FPSWA version.
  6744. @item @command{functional_test} - Run all loaded functional tests.
  6745. @item @command{gdbstub_break} - Break into GDB
  6746. @item @command{gdbstub} - Start GDB stub on given port
  6747. @item @command{gdbstub_stop} - Stop GDB stub
  6748. @item @command{hdparm} - Get/set ATA disk parameters.
  6749. @item @command{hexdump_random} - Hexdump random data.
  6750. @item @command{inb} - Read 8-bit value from PORT.
  6751. @item @command{inl} - Read 32-bit value from PORT.
  6752. @item @command{inw} - Read 16-bit value from PORT.
  6753. @item @command{jpegtest} - Tests loading of JPEG bitmap.
  6754. @item @command{keymap} - Load a keyboard layout.
  6755. @item @command{legacy_check_password} - Simulate grub-legacy `password' command in menu entry mode
  6756. @item @command{legacy_configfile} - Parse legacy config in new context
  6757. @item @command{legacy_password} - Simulate grub-legacy `password' command
  6758. @item @command{legacy_source} - Parse legacy config in same context
  6759. @item @command{loadbios} - Load BIOS dump.
  6760. @item @command{lsacpi} - Show ACPI information.
  6761. @item @command{lsapm} - Show APM information.
  6762. @item @command{lscoreboot} - List coreboot tables.
  6763. @item @command{lsdev} - List devices.
  6764. @item @command{lsefi} - Display EFI handles.
  6765. @item @command{lsefimmap} - Display EFI memory map.
  6766. @item @command{lsefisystab} - Display EFI system tables.
  6767. @item @command{lsmmap} - List memory map provided by firmware.
  6768. @item @command{lspci} - List PCI devices.
  6769. @item @command{lssal} - Display SAL system table.
  6770. @item @command{lsspd} - Print Memory information.
  6771. @item @command{macppcbless} - Bless DIR of HFS or HFS+ partition for PPC macs.
  6772. @item @command{mactelbless} - Bless FILE of HFS or HFS+ partition for intel macs.
  6773. @item @command{net_set_vlan} - Set an interface's vlan id.
  6774. @item @command{outb} - Write 8-bit VALUE to PORT.
  6775. @item @command{outl} - Write 32-bit VALUE to PORT.
  6776. @item @command{outw} - Write 16-bit VALUE to PORT.
  6777. @item @command{pcidump} - Show raw dump of the PCI configuration space.
  6778. @item @command{pngtest} - Tests loading of PNG bitmap.
  6779. @item @command{read_byte} - Read 8-bit value from ADDR.
  6780. @item @command{read_dword} - Read 32-bit value from ADDR.
  6781. @item @command{read_word} - Read 16-bit value from ADDR.
  6782. @item @command{setpci} - Manipulate PCI devices.
  6783. @item @command{suspend} - Return to IEEE1275 prompt.
  6784. @item @command{syslinux_configfile} - Execute syslinux config in new context
  6785. @item @command{syslinux_source} - Execute syslinux config in same context
  6786. @item @command{test_blockarg} - Print and execute block argument., 0
  6787. @item @command{testload} - Load the same file in multiple ways.
  6788. @item @command{testspeed} - Test file read speed.
  6789. @item @command{tgatest} - Tests loading of TGA bitmap.
  6790. @item @command{time} - Measure time used by COMMAND
  6791. @item @command{tr} - Translate SET1 characters to SET2 in STRING.
  6792. @item @command{usb} - Test USB support.
  6793. @item @command{vbeinfo} - List available video modes. If resolution is given show only modes matching it.
  6794. @item @command{vbetest} - Test video subsystem.
  6795. @item @command{videotest} - Test video subsystem in mode WxH.
  6796. @item @command{write_byte} - Write 8-bit VALUE to ADDR.
  6797. @item @command{write_dword} - Write 32-bit VALUE to ADDR.
  6798. @item @command{write_word} - Write 16-bit VALUE to ADDR.
  6799. @item @command{xen_cat} - List Xen storage.
  6800. @item @command{xen_ls} - List Xen storage.
  6801. @item @command{xnu_devprop_load} - Load `device-properties' dump.
  6802. @item @command{xnu_uuid} - Transform 64-bit UUID to format suitable for XNU. If -l is given keep it lowercase as done by blkid.
  6803. @item @command{zfs-bootfs} - Print ZFS-BOOTFSOBJ or store it into VARIABLE
  6804. @item @command{zfsinfo} - Print ZFS info about DEVICE.
  6805. @item @command{zfskey} - Import ZFS wrapping key stored in FILE.
  6806. @end itemize
  6807. @node Internationalisation
  6808. @chapter Internationalisation
  6809. @section Charset
  6810. GRUB uses UTF-8 internally other than in rendering where some GRUB-specific
  6811. appropriate representation is used. All text files (including config) are
  6812. assumed to be encoded in UTF-8.
  6813. @section Filesystems
  6814. NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
  6815. ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
  6816. as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
  6817. minix2, minix3, ROMFS, ReiserFS, XFS, EROFS, ext2, ext3, ext4, FAT (short names),
  6818. F2FS, RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed
  6819. to be UTF-8. This might be false on systems configured with legacy charset
  6820. but as long as the charset used is superset of ASCII you should be able to
  6821. access ASCII-named files. And it's recommended to configure your system to use
  6822. UTF-8 to access the filesystem, convmv may help with migration. ISO9660 (plain)
  6823. filenames are specified as being ASCII or being described with unspecified
  6824. escape sequences. GRUB assumes that the ISO9660 names are UTF-8 (since
  6825. any ASCII is valid UTF-8). There are some old CD-ROMs which use CP437
  6826. in non-compliant way. You're still able to access files with names containing
  6827. only ASCII characters on such filesystems though. You're also able to access
  6828. any file if the filesystem contains valid Joliet (UTF-16) or RockRidge (UTF-8).
  6829. AFFS, SFS and HFS never use unicode and GRUB assumes them to be in Latin1,
  6830. Latin1 and MacRoman respectively. GRUB handles filesystem case-insensitivity
  6831. however no attempt is performed at case conversion of international characters
  6832. so e.g. a file named lowercase greek alpha is treated as different from
  6833. the one named as uppercase alpha. The filesystems in questions are
  6834. NTFS (except POSIX namespace), HFS+ (configurable at mkfs time, default
  6835. insensitive), SFS (configurable at mkfs time, default insensitive),
  6836. JFS (configurable at mkfs time, default sensitive), HFS, AFFS, FAT, exFAT
  6837. and ZFS (configurable on per-subvolume basis by property ``casesensitivity'',
  6838. default sensitive). On ZFS subvolumes marked as case insensitive files
  6839. containing lowercase international characters are inaccessible.
  6840. Also like all supported filesystems except HFS+ and ZFS (configurable on
  6841. per-subvolume basis by property ``normalization'', default none) GRUB makes
  6842. no attempt at check of canonical equivalence so a file name u-diaresis is
  6843. treated as distinct from u+combining diaresis. This however means that in
  6844. order to access file on HFS+ its name must be specified in normalisation form D.
  6845. On normalized ZFS subvolumes filenames out of normalisation are inaccessible.
  6846. @section Output terminal
  6847. Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII.
  6848. BIOS firmware console and VGA text are limited to ASCII and some pseudographics.
  6849. None of above mentioned is appropriate for displaying international and any
  6850. unsupported character is replaced with question mark except pseudographics
  6851. which we attempt to approximate with ASCII.
  6852. EFI console on the other hand nominally supports UTF-16 but actual language
  6853. coverage depends on firmware and may be very limited.
  6854. The encoding used on serial can be chosen with @command{terminfo} as
  6855. either ASCII, UTF-8 or ``visual UTF-8''. Last one is against the specification
  6856. but results in correct rendering of right-to-left on some readers which don't
  6857. have own bidi implementation.
  6858. On emu GRUB checks if charset is UTF-8 and uses it if so and uses ASCII
  6859. otherwise.
  6860. When using gfxterm or gfxmenu GRUB itself is responsible for rendering the
  6861. text. In this case GRUB is limited by loaded fonts. If fonts contain all
  6862. required characters then bidirectional text, cursive variants and combining
  6863. marks other than enclosing, half (e.g. left half tilde or combining overline)
  6864. and double ones. Ligatures aren't supported though. This should cover European,
  6865. Middle Eastern (if you don't mind lack of lam-alif ligature in Arabic) and
  6866. East Asian scripts. Notable unsupported scripts are Brahmic family and
  6867. derived as well as Mongolian, Tifinagh, Korean Jamo (precomposed characters
  6868. have no problem) and tonal writing (2e5-2e9). GRUB also ignores deprecated
  6869. (as specified in Unicode) characters (e.g. tags). GRUB also doesn't handle so
  6870. called ``annotation characters'' If you can complete either of
  6871. two lists or, better, propose a patch to improve rendering, please contact
  6872. developer team.
  6873. @section Input terminal
  6874. Firmware console on BIOS, IEEE1275 and ARC doesn't allow you to enter non-ASCII
  6875. characters. EFI specification allows for such but author is unaware of any
  6876. actual implementations. Serial input is currently limited for latin1 (unlikely
  6877. to change). Own keyboard implementations (at_keyboard and usb_keyboard)
  6878. supports any key but work on one-char-per-keystroke.
  6879. So no dead keys or advanced input method. Also there is no keymap change hotkey.
  6880. In practice it makes difficult to enter any text using non-Latin alphabet.
  6881. Moreover all current input consumers are limited to ASCII.
  6882. @section Gettext
  6883. GRUB supports being translated. For this you need to have language *.mo files in $prefix/locale, load gettext module and set ``lang'' variable.
  6884. @section Regexp
  6885. Regexps work on unicode characters, however no attempt at checking canonical
  6886. equivalence has been made. Moreover the classes like [:alpha:] match only
  6887. ASCII subset.
  6888. @section Other
  6889. Currently GRUB always uses YEAR-MONTH-DAY HOUR:MINUTE:SECOND [WEEKDAY] 24-hour
  6890. datetime format but weekdays are translated.
  6891. GRUB always uses the decimal number format with [0-9] as digits and . as
  6892. descimal separator and no group separator.
  6893. IEEE1275 aliases are matched case-insensitively except non-ASCII which is
  6894. matched as binary. Similar behaviour is for matching OSBundleRequired.
  6895. Since IEEE1275 aliases and OSBundleRequired don't contain any non-ASCII it
  6896. should never be a problem in practice.
  6897. Case-sensitive identifiers are matched as raw strings, no canonical
  6898. equivalence check is performed. Case-insensitive identifiers are matched
  6899. as RAW but additionally [a-z] is equivalent to [A-Z]. GRUB-defined
  6900. identifiers use only ASCII and so should user-defined ones.
  6901. Identifiers containing non-ASCII may work but aren't supported.
  6902. Only the ASCII space characters (space U+0020, tab U+000b, CR U+000d and
  6903. LF U+000a) are recognised. Other unicode space characters aren't a valid
  6904. field separator.
  6905. @command{test} (@pxref{test}) tests <, >, <=, >=, -pgt and -plt compare the strings in the
  6906. lexicographical order of unicode codepoints, replicating the behaviour of
  6907. test from coreutils.
  6908. environment variables and commands are listed in the same order.
  6909. @node Security
  6910. @chapter Security
  6911. @menu
  6912. * Authentication and authorisation:: Users and access control
  6913. * Using digital signatures:: Booting digitally signed code
  6914. * UEFI secure boot and shim:: Booting digitally signed PE files
  6915. * Secure Boot Advanced Targeting:: Embedded information for generation number based revocation
  6916. * Measured Boot:: Measuring boot components
  6917. * Lockdown:: Lockdown when booting on a secure setup
  6918. * TPM2 key protector:: Managing disk key with TPM2 key protector
  6919. @end menu
  6920. @node Authentication and authorisation
  6921. @section Authentication and authorisation in GRUB
  6922. By default, the boot loader interface is accessible to anyone with physical
  6923. access to the console: anyone can select and edit any menu entry, and anyone
  6924. can get direct access to a GRUB shell prompt. For most systems, this is
  6925. reasonable since anyone with direct physical access has a variety of other
  6926. ways to gain full access, and requiring authentication at the boot loader
  6927. level would only serve to make it difficult to recover broken systems.
  6928. However, in some environments, such as kiosks, it may be appropriate to lock
  6929. down the boot loader to require authentication before performing certain
  6930. operations.
  6931. The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
  6932. (@pxref{password_pbkdf2}) commands can be used to define users, each of
  6933. which has an associated password. @samp{password} sets the password in
  6934. plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
  6935. sets the password hashed using the Password-Based Key Derivation Function
  6936. (RFC 2898), requiring the use of @command{grub-mkpasswd-pbkdf2}
  6937. (@pxref{Invoking grub-mkpasswd-pbkdf2}) to generate password hashes.
  6938. In order to enable authentication support, the @samp{superusers} environment
  6939. variable must be set to a list of usernames, separated by any of spaces,
  6940. commas, semicolons, pipes, or ampersands. Superusers are permitted to use
  6941. the GRUB command line, edit menu entries, and execute any menu entry. If
  6942. @samp{superusers} is set, then use of the command line and editing of menu
  6943. entries are automatically restricted to superusers. Setting @samp{superusers}
  6944. to empty string effectively disables both access to CLI and editing of menu
  6945. entries. Building a grub image with @samp{--disable-cli} option will also
  6946. disable access to CLI and editing of menu entries, as well as disabling rescue
  6947. mode. Note: The environment variable needs to be exported to also affect the
  6948. section defined by the @samp{submenu} command (@pxref{submenu}).
  6949. Other users may be allowed to execute specific menu entries by giving a list of
  6950. usernames (as above) using the @option{--users} option to the
  6951. @samp{menuentry} command (@pxref{menuentry}). If the @option{--unrestricted}
  6952. option is used for a menu entry, then that entry is unrestricted.
  6953. If the @option{--users} option is not used for a menu entry, then that
  6954. only superusers are able to use it.
  6955. Putting this together, a typical @file{grub.cfg} fragment might look like
  6956. this:
  6957. @example
  6958. @group
  6959. set superusers="root"
  6960. password_pbkdf2 root grub.pbkdf2.sha512.10000.biglongstring
  6961. password user1 insecure
  6962. menuentry "May be run by any user" --unrestricted @{
  6963. set root=(hd0,1)
  6964. linux /vmlinuz
  6965. @}
  6966. menuentry "Superusers only" --users "" @{
  6967. set root=(hd0,1)
  6968. linux /vmlinuz single
  6969. @}
  6970. menuentry "May be run by user1 or a superuser" --users user1 @{
  6971. set root=(hd0,2)
  6972. chainloader +1
  6973. @}
  6974. @end group
  6975. @end example
  6976. The @command{grub-mkconfig} program does not yet have built-in support for
  6977. generating configuration files with authentication. You can use
  6978. @file{/etc/grub.d/40_custom} to add simple superuser authentication, by
  6979. adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
  6980. commands.
  6981. @node Using digital signatures
  6982. @section Using digital signatures in GRUB
  6983. GRUB's @file{core.img} can optionally provide enforcement that all files
  6984. subsequently read from disk are covered by a valid digital signature.
  6985. This document does @strong{not} cover how to ensure that your
  6986. platform's firmware (e.g., Coreboot) validates @file{core.img}.
  6987. If environment variable @code{check_signatures}
  6988. (@pxref{check_signatures}) is set to @code{enforce}, then every
  6989. attempt by the GRUB @file{core.img} to load another file @file{foo}
  6990. implicitly invokes @code{verify_detached foo foo.sig}
  6991. (@pxref{verify_detached}). @code{foo.sig} must contain a valid
  6992. digital signature over the contents of @code{foo}, which can be
  6993. verified with a public key currently trusted by GRUB
  6994. (@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}). If
  6995. validation fails, then file @file{foo} cannot be opened. This failure
  6996. may halt or otherwise impact the boot process.
  6997. An initial trusted public key can be embedded within the GRUB @file{core.img}
  6998. using the @code{--pubkey} option to @command{grub-install}
  6999. (@pxref{Invoking grub-install}).
  7000. GRUB uses GPG-style detached signatures (meaning that a file
  7001. @file{foo.sig} will be produced when file @file{foo} is signed), and
  7002. currently supports the DSA and RSA signing algorithms. A signing key
  7003. can be generated as follows:
  7004. @example
  7005. gpg --gen-key
  7006. @end example
  7007. An individual file can be signed as follows:
  7008. @example
  7009. gpg --detach-sign /path/to/file
  7010. @end example
  7011. For successful validation of all of GRUB's subcomponents and the
  7012. loaded OS kernel, they must all be signed. One way to accomplish this
  7013. is the following (after having already produced the desired
  7014. @file{grub.cfg} file, e.g., by running @command{grub-mkconfig}
  7015. (@pxref{Invoking grub-mkconfig}):
  7016. @example
  7017. @group
  7018. # Edit /dev/shm/passphrase.txt to contain your signing key's passphrase
  7019. for i in `find /boot -name "*.cfg" -or -name "*.lst" -or \
  7020. -name "*.mod" -or -name "vmlinuz*" -or -name "initrd*" -or \
  7021. -name "grubenv"`;
  7022. do
  7023. gpg --batch --detach-sign --passphrase-fd 0 $i < \
  7024. /dev/shm/passphrase.txt
  7025. done
  7026. shred /dev/shm/passphrase.txt
  7027. @end group
  7028. @end example
  7029. See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
  7030. @ref{list_trusted}, @ref{distrust}, @ref{load_env}, @ref{save_env}.
  7031. Note that internally signature enforcement is controlled by setting
  7032. the environment variable @code{check_signatures} equal to
  7033. @code{enforce}. Passing one or more @code{--pubkey} options to
  7034. @command{grub-mkimage} implicitly defines @code{check_signatures}
  7035. equal to @code{enforce} in @file{core.img} prior to processing any
  7036. configuration files.
  7037. Note that signature checking does @strong{not} prevent an attacker
  7038. with (serial, physical, ...) console access from dropping manually to
  7039. the GRUB console and executing:
  7040. @example
  7041. set check_signatures=no
  7042. @end example
  7043. To prevent this, password-protection (@pxref{Authentication and
  7044. authorisation}) is essential. Note that even with GRUB password
  7045. protection, GRUB itself cannot prevent someone with physical access to
  7046. the machine from altering that machine's firmware (e.g., Coreboot
  7047. or BIOS) configuration to cause the machine to boot from a different
  7048. (attacker-controlled) device. GRUB is at best only one link in a
  7049. secure boot chain.
  7050. @node UEFI secure boot and shim
  7051. @section UEFI secure boot and shim support
  7052. The GRUB works with UEFI secure boot and the shim. This functionality is
  7053. provided by the shim_lock verifier. It is built into the @file{core.img} and is
  7054. registered if the UEFI secure boot is enabled. The @samp{shim_lock} variable is
  7055. set to @samp{y} when shim_lock verifier is registered. If it is desired to use
  7056. UEFI secure boot without shim, one can disable shim_lock by disabling shim
  7057. verification with MokSbState UEFI variable or by building grub image with
  7058. @samp{--disable-shim-lock} option.
  7059. All GRUB modules not stored in the @file{core.img}, OS kernels, ACPI tables,
  7060. Device Trees, etc. have to be signed, e.g, using PGP. Additionally, the commands
  7061. that can be used to subvert the UEFI secure boot mechanism, such as @command{iorw}
  7062. and @command{memrw} will not be available when the UEFI secure boot is enabled.
  7063. This is done for security reasons and are enforced by the GRUB Lockdown mechanism
  7064. (@pxref{Lockdown}).
  7065. @node Secure Boot Advanced Targeting
  7066. @section Embedded information for generation number based revocation
  7067. The Secure Boot Advanced Targeting (SBAT) is a mechanism to allow the revocation
  7068. of components in the boot path by using generation numbers embedded into the EFI
  7069. binaries. The SBAT metadata is located in an .sbat data section that has set of
  7070. UTF-8 strings as comma-separated values (CSV). See
  7071. @uref{https://github.com/rhboot/shim/blob/main/SBAT.md} for more details.
  7072. To add a data section containing the SBAT information into the binary, the
  7073. @option{--sbat} option of @command{grub-mkimage} command should be used. The content
  7074. of a CSV file, encoded with UTF-8, is copied as is to the .sbat data section into
  7075. the generated EFI binary. The CSV file can be stored anywhere on the file system.
  7076. @example
  7077. grub-mkimage -O x86_64-efi -o grubx64.efi -p '(tftp)/grub' --sbat sbat.csv efinet tftp
  7078. @end example
  7079. @node Measured Boot
  7080. @section Measuring boot components
  7081. If the tpm module is loaded and the platform has a Trusted Platform Module
  7082. installed, GRUB will log each command executed and each file loaded into the
  7083. TPM event log and extend the PCR values in the TPM correspondingly. All events
  7084. will be logged into the PCR described below with a type of EV_IPL and an
  7085. event description as described below.
  7086. @multitable @columnfractions 0.3 0.1 0.6
  7087. @headitem Event type @tab PCR @tab Description
  7088. @item Command
  7089. @tab 8
  7090. @tab All executed commands (including those from configuration files) will be
  7091. logged and measured as entered with a prefix of ``grub_cmd: ``
  7092. @item Kernel command line
  7093. @tab 8
  7094. @tab Any command line passed to a kernel will be logged and measured as entered
  7095. with a prefix of ``kernel_cmdline: ''
  7096. @item Module command line
  7097. @tab 8
  7098. @tab Any command line passed to a kernel module will be logged and measured as
  7099. entered with a prefix of ``module_cmdline: ``
  7100. @item Files
  7101. @tab 9
  7102. @tab Any file read by GRUB will be logged and measured with a descriptive text
  7103. corresponding to the filename.
  7104. @end multitable
  7105. GRUB will not measure its own @file{core.img} - it is expected that firmware
  7106. will carry this out. GRUB will also not perform any measurements until the
  7107. tpm module is loaded. As such it is recommended that the tpm module be built
  7108. into @file{core.img} in order to avoid a potential gap in measurement between
  7109. @file{core.img} being loaded and the tpm module being loaded.
  7110. Measured boot is currently only supported on EFI and IBM IEEE1275 PowerPC
  7111. platforms.
  7112. @node Lockdown
  7113. @section Lockdown when booting on a secure setup
  7114. The GRUB can be locked down when booted on a secure boot environment, for example
  7115. if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
  7116. be restricted and some operations/commands cannot be executed. This also includes
  7117. limiting which filesystems are supported to those thought to be more robust and
  7118. widely used within GRUB.
  7119. The filesystems currently allowed in lockdown mode include:
  7120. @itemize @bullet
  7121. @item BtrFS
  7122. @item cpio
  7123. @item exFAT
  7124. @item Enhanced Read-Only File System (EROFS)
  7125. @item Linux ext2/ext3/ext4
  7126. @item F2FS
  7127. @item DOS FAT12/FAT16/FAT32
  7128. @item HFS+
  7129. @item ISO9660
  7130. @item Squash4
  7131. @item tar
  7132. @item XFS
  7133. @item ZFS
  7134. @end itemize
  7135. The filesystems currently not allowed in lockdown mode include:
  7136. @itemize @bullet
  7137. @item Amiga Fast FileSystem (AFFS)
  7138. @item AtheOS File System (AFS)
  7139. @item Bee File System (BFS)
  7140. @item Coreboot File System (CBFS)
  7141. @item Hierarchical File System (HFS)
  7142. @item Journaled File System (JFS)
  7143. @item Minix filesystem
  7144. @item New Implementation of Log filesystem (nilfs2)
  7145. @item Windows New Technology File System (NTFS)
  7146. @item ReiserFS
  7147. @item Read-Only Memory File System (ROMFS)
  7148. @item Amiga Smart File System (SFS)
  7149. @item Universal Disk Format (UDF)
  7150. @item Unix File System (UFS)
  7151. @end itemize
  7152. The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down.
  7153. Otherwise it does not exist.
  7154. @node TPM2 key protector
  7155. @section TPM2 key protector in GRUB
  7156. TPM2 key protector extends measured boot to unlock the encrypted partition
  7157. without user intervention. It uses the TPM Storage Root Key (SRK) to seal
  7158. the disk key with a given set of PCR values. If the system state matches,
  7159. i.e. PCR values match the sealed PCR set, TPM2 key protector unseals the
  7160. disk key for @command{cryptomount} (@pxref{cryptomount}) to unlock the
  7161. encrypted partition. In case the unsealed key fails to unlock the
  7162. partition, @command{cryptomount} falls back to the passphrase prompt.
  7163. Please note that TPM2 key protector uses the SRK in the owner hierarchy
  7164. @emph{without} authorization. If the owner hierarchy is password-protected,
  7165. TPM2 key protector may fail to unseal the key due to the absence of the
  7166. password. For the systems that already enable the password protection for the
  7167. owner hierarchy, the following command removes the password protection with
  7168. the existing password.
  7169. @example
  7170. # @kbd{tpm2_changeauth -c owner -p password}
  7171. @end example
  7172. There are two supported modes to store the sealed key, SRK and NV index.
  7173. The details will be addressed in later sections.
  7174. TPM2 key protector is currently only supported on EFI and EMU platforms.
  7175. @subsection TPM PCR usage
  7176. Since TPM2 key protector relies on PCRs to check the system state, it is
  7177. important to decide which PCRs to seal the key with. The following table
  7178. lists uses of PCRs and the measured objects on EFI platforms.
  7179. @multitable @columnfractions 0.1 0.2 0.7
  7180. @headitem PCR @tab Used by @tab Measured Objects
  7181. @item 0
  7182. @tab Firmware
  7183. @tab Core system firmware executable code
  7184. @item 1
  7185. @tab Firmware
  7186. @tab Core system firmware data/host platform configuration; typically
  7187. contains serial and model numbers
  7188. @item 2
  7189. @tab Firmware
  7190. @tab Extended or pluggable executable code; includes option ROMs on
  7191. pluggable hardware
  7192. @item 3
  7193. @tab Firmware
  7194. @tab Extended or pluggable firmware data; includes information about
  7195. pluggable hardware
  7196. @item 4
  7197. @tab Firmware
  7198. @tab Boot loader and additional drivers; binaries and extensions loaded
  7199. by the boot loader
  7200. @item 5
  7201. @tab Firmware
  7202. @tab GPT/Partition table
  7203. @item 7
  7204. @tab Firmware
  7205. @tab SecureBoot state
  7206. @item 8
  7207. @tab GRUB
  7208. @tab Commands and kernel command line
  7209. @item 9
  7210. @tab GRUB
  7211. @tab All files read (including kernel image)
  7212. @item 9
  7213. @tab Linux Kernel
  7214. @tab All passed initrds (when the new LOAD_FILE2 initrd protocol is used)
  7215. @item 10
  7216. @tab Linux Kernel
  7217. @tab Protection of the IMA measurement log
  7218. @item 14
  7219. @tab shim
  7220. @tab “MOK” certificates and hashes
  7221. @end multitable
  7222. PCR 0, 2, 4, and 7 can be used to check the integrity of the firmware code
  7223. and bootloaders. PCR 8 and 9 are useful to check the file and data processed
  7224. by GRUB. PCRs 10, 11, 12, 13, and 15 are controlled by the operating system,
  7225. so those PCRs are usually still in the initial state when GRUB is running.
  7226. In general, it is nice to include PCR 0, 2, 4, and 7 to ensure the integrity
  7227. of the firmware and bootloaders. For PCR 8 and 9, a sophisticated tool is
  7228. required to examine the GRUB configuration files and the files to be loaded
  7229. to calculate the correct PCR values.
  7230. Please note that PCRs are sensitive to any change, so an update of a component
  7231. could invalidate the sealed key, due to the so-called PCR brittleness. For the
  7232. bootloader update, PCR 4 may be affected. This can be mitigated by extracting
  7233. the events from the TPM event log and predict the value with the updated
  7234. bootloader binary. On the other hand, it is difficult to predict PCR 0~7 after
  7235. a firmware update since the content of the code and the order of drivers may
  7236. not follow the TPM event log from the previous firmware version, so it is
  7237. necessary to reboot the system to update the measurement results of PCR 0~7
  7238. and seal or sign the sealed key again.
  7239. Reference: @url{https://uapi-group.org/specifications/specs/linux_tpm_pcr_registry/, Linux TPM PCR Registry}
  7240. @subsection Setting up the extra disk key
  7241. Instead of using the existing password, it is recommended to seal a new
  7242. random disk key and use the existing password for recovery.
  7243. Here are the sample commands to create a 128 random bytes key file and
  7244. enroll the key into the target partition (sda2).
  7245. @example
  7246. # @kbd{dd if=/dev/urandom of=luks.key bs=1 count=128}
  7247. # @kbd{cryptsetup luksAddKey /dev/sda2 luks.key --pbkdf=pbkdf2 --hash=sha512}
  7248. @end example
  7249. @subsection SRK mode
  7250. To unlock the partition with SRK mode, assume that the sealed key is in
  7251. @file{(hd0,gpt1)/efi/grub/sealed.tpm}, the following GRUB commands
  7252. unseal the disk key with SRK mode and supply it to @command{cryptomount}.
  7253. @example
  7254. grub> @kbd{tpm2_key_protector_init -T (hd0,gpt1)/efi/grub/sealed.tpm}
  7255. grub> @kbd{cryptomount -u <UUID> -P tpm2}
  7256. @end example
  7257. There are two programs to create the sealed key for SRK mode: @command{grub-protect}
  7258. and @command{pcr-oracle} (@url{https://github.com/okirch/pcr-oracle}).
  7259. The following sample command uses @command{grub-protect} to seal the random
  7260. key, @file{luks.key}, with PCR 0, 2, 4 and 7 in TPM 2.0 Key File format.
  7261. @example
  7262. @group
  7263. # @kbd{grub-protect --action=add \
  7264. --protector=tpm2 \
  7265. --tpm2-pcrs=0,2,4,7 \
  7266. --tpm2key \
  7267. --tpm2-keyfile=luks.key \
  7268. --tpm2-outfile=/boot/efi/efi/grub/sealed.tpm}
  7269. @end group
  7270. @end example
  7271. @command{grub-protect} only seals the key with the current PCR values.
  7272. Therefore, when a boot component, such as shim or GRUB, is updated, it is
  7273. necessary to reboot the system to update the measurement results and seal
  7274. the key again. That means the random disk key has to be stored in cleartext
  7275. for the next key sealing. Besides this, the measurement result of some PCRs
  7276. may differ between boot time and OS runtime. For example, PCR 9 measures the
  7277. files loaded by GRUB including the Linux kernel and initrd. To unlock the disk
  7278. containing the kernel and initrd, the key has to be sealed with PCR 9 value
  7279. before loading the kernel and initrd. However, PCR 9 changes after GRUB
  7280. loading the kernel and initrd, so PCR 9 at OS runtime cannot be used directly
  7281. for key sealing.
  7282. To solve these problems, @command{pcr-oracle} takes a different approach. It
  7283. reads the TPM eventlog and predicts the PCR values. Besides,
  7284. @command{pcr-oracle} also supports ``authorized policy'' which allows the
  7285. PCR policy to be updated with a valid signature, so that the user only seals
  7286. the random disk key once. If at some later time the PCR values change due to
  7287. an update of the system firmware, bootloader, or config file, the user just
  7288. needs to update the signature of the PCR policy.
  7289. To seal the key with the authorized policy, the first thing is to generate
  7290. the RSA policy key, @file{policy-key.pem}, and the authorized policy file,
  7291. @file{authorized.policy}. In this example, PCR 0, 2, 4, 7 and 9 are chosen
  7292. for key sealing.
  7293. @example
  7294. @group
  7295. # @kbd{pcr-oracle --rsa-generate-key \
  7296. --private-key policy-key.pem \
  7297. --auth authorized.policy \
  7298. create-authorized-policy 0,2,4,7,9}
  7299. @end group
  7300. @end example
  7301. Then, we seal the random disk key, @file{luks.key}, with the authorized
  7302. policy file and save the sealed key in @file{sealed.key}.
  7303. @example
  7304. @group
  7305. # @kbd{pcr-oracle --key-format tpm2.0 \
  7306. --auth authorized.policy \
  7307. --input luks.key \
  7308. --output sealed.key \
  7309. seal-secret}
  7310. @end group
  7311. @end example
  7312. Since we now have the sealed key, we can remove the random disk key file
  7313. @file{luks.key}.
  7314. The last step is to sign the predicted PCR policy and save the final key
  7315. file, @file{sealed.tpm}.
  7316. @example
  7317. @group
  7318. # @kbd{pcr-oracle --key-format tpm2.0 \
  7319. --private-key policy-key.pem \
  7320. --from eventlog \
  7321. --stop-event "grub-file=grub.cfg" \
  7322. --after \
  7323. --input sealed.key \
  7324. --output /boot/efi/efi/grub/sealed.tpm \
  7325. sign 0,2,4,7,9}
  7326. @end group
  7327. @end example
  7328. Here we also set a stop event for the prediction. With
  7329. @kbd{--stop-event grub-file=grub.cfg --after}, @command{pcr-oracle} stops
  7330. the calculation of PCR values right after GRUB loads @file{grub.cfg}.
  7331. When/After the shim or GRUB are updated, it only requires to run the last
  7332. @command{pcr-oracle} command to update the predicted PCR policy.
  7333. @subsection NV index mode
  7334. Instead of storing the sealed key in a file, NV index mode uses the TPM
  7335. non-volatile memory to store the sealed key.
  7336. The following sample commands use tpm2-tools (@url{https://github.com/tpm2-software/tpm2-tools})
  7337. commands to seal @file{luks.key} into the specific NV index: @kbd{0x81000000}.
  7338. First, we need to create the object file for the primary key, i.e. storage
  7339. root key (SRK) with the default key settings in GRUB: SHA256 hash algorithm
  7340. and ECC key algorithm.
  7341. @example
  7342. # @kbd{tpm2_createprimary -C o -g sha256 -G ecc -c primary.ctx}
  7343. @end example
  7344. The next commands collect the current values of PCR 0, 2, 4, and 7 and saves
  7345. them in @file{pcr.dat}.
  7346. @example
  7347. # @kbd{tpm2_startauthsession -S session.dat}
  7348. # @kbd{tpm2_policypcr -S session.dat -l sha256:0,2,4,7 -f pcrs.dat -L policy.dat}
  7349. # @kbd{tpm2_flushcontext session.dat}
  7350. @end example
  7351. The last commands seal @file{luks.key} with the primary key and stores the
  7352. result in @kbd{0x81000000}.
  7353. @example
  7354. # @kbd{cat luks.key | tpm2_create -C primary.ctx -u key.pub -r key.priv -L policy.dat -i-}
  7355. # @kbd{tpm2_load -C primary.ctx -u key.pub -r key.priv -n sealing.name -c sealing.ctx}
  7356. # @kbd{tpm2_evictcontrol -C o -c sealing.ctx 0x81000000}
  7357. @end example
  7358. To unseal the key, we have to specify the mode @kbd{nv}, the NV index
  7359. @kbd{0x81000000}, and the PCRs @kbd{0,2,4,7} for the @command{tpm2_key_protector_init}
  7360. command.
  7361. @example
  7362. grub> @kbd{tpm2_key_protector_init --mode=nv --nvindex=0x81000000 --pcrs=0,2,4,7}
  7363. grub> @kbd{cryptomount -u <UUID> --protector tpm2}
  7364. @end example
  7365. @subsection Setting up software TPM for EMU platform
  7366. In order to test TPM2 key protector and TPM2 Software Stack (TSS2), it is
  7367. useful to set up a software TPM (swtpm) instance and run the commands on the
  7368. EMU platform.
  7369. Here are the commands to start a swtpm instance which provides a character
  7370. device interface. To store the TPM states, the directory, @file{swtpm-state},
  7371. is created before the @command{swtpm} command. All the messages are stored
  7372. in @file{swtpm.log} including the name of the character device.
  7373. @example
  7374. # @kbd{mkdir swtpm-state}
  7375. @group
  7376. # @kbd{swtpm chardev --vtpm-proxy --tpmstate dir=swtpm-state \
  7377. --tpm2 --ctrl type=unixio,path="swtpm-state/ctrl" \
  7378. --flags startup-clear --daemon > swtpm.log}
  7379. @end group
  7380. @end example
  7381. Then, we extract the name of the character device from @file{swtpm.log} and
  7382. save it to the variable, @samp{tpm2dev}.
  7383. @example
  7384. # @kbd{tpm2dev=$(grep "New TPM device" swtpm.log | cut -d' ' -f 4)}
  7385. @end example
  7386. Now we can start @kbd{grub-emu} with @kbd{--tpm-device $tpm2dev} to interact
  7387. with the swtpm instance.
  7388. @example
  7389. # @kbd{grub-emu --tpm-device $tpm2dev}
  7390. @end example
  7391. On the host, the tpm2-tools commands can interact with the swtpm instance by
  7392. setting @samp{TPM2TOOLS_TCTI}.
  7393. @example
  7394. # @kbd{export TPM2TOOLS_TCTI="device:$tpm2dev"}
  7395. @end example
  7396. When the test is done, use @kbd{swtpm_ioctl} to send the shutdown
  7397. command through the swtpm control channel.
  7398. @example
  7399. # @kbd{swtpm_ioctl -s --unix swtpm-state/ctrl}
  7400. @end example
  7401. @subsection Command line and menuentry editor protection
  7402. The TPM key protector provides full disk encryption support on servers or
  7403. virtual machine images, meanwhile keeping the boot process unattended. This
  7404. prevents service disruptions by eliminating the need for manual password input
  7405. during startup, improving system uptime and continuity. It is achieved by TPM,
  7406. which verifies the integrity of boot components by checking cryptographic
  7407. hashes against securely stored values, to confirm the disks are unlocked in a
  7408. trusted state.
  7409. However, for users to access the system interactively, some form of
  7410. authentication is still required, as the disks are not unlocked by an
  7411. authorized user. This raised concerns about using an unprotected
  7412. @samp{command-line interface} (@pxref{Command-line interface}), as anyone could
  7413. execute commands to access decrypted data. To address this issue, the LUKS
  7414. password is used to ensure that only authorized users are granted access to the
  7415. interface. Additionally, the @samp{menu entry editor} (@pxref{Menu entry
  7416. editor}) is also safeguarded by the LUKS password, as modifying a boot entry is
  7417. effectively the same as altering the @file{grub.cfg} file read from encrypted
  7418. files.
  7419. It is worth mentioning that the built-in password support, as described in
  7420. @samp{Authentication and Authorization in GRUB} (@pxref{Authentication and
  7421. authorisation}), can also be used to protect the command-line interface from
  7422. unauthorized access. However, it is not recommended to rely on this approach as
  7423. it is an optional step. Setting it up requires additional manual intervention,
  7424. which increases the risk of password leakage during the process. Moreover, the
  7425. superuser list must be well maintained, and the password used cannot be
  7426. synchronized with LUKS key rotation.
  7427. @node Platform limitations
  7428. @chapter Platform limitations
  7429. GRUB2 is designed to be portable and is actually ported across platforms. We
  7430. try to keep all platforms at the level. Unfortunately some platforms are better
  7431. supported than others. This is detailed in current and 2 following sections.
  7432. All platforms have an artificially GRUB imposed disk size restriction of 1 EiB.
  7433. In some cases, larger disk sizes can be used, but access will not be allowed
  7434. beyond 1 EiB.
  7435. LUKS2 devices with size larger than 16 EiB are currently not supported. They
  7436. can not be created as crypto devices by cryptomount, so can not even be
  7437. partially read from. LUKS have no limitations other than those imposed by the
  7438. format.
  7439. ARC platform is unable to change datetime (firmware doesn't seem to provide a
  7440. function for it).
  7441. EMU has similar limitation.
  7442. On EMU platform no serial port is available.
  7443. Console charset refers only to firmware-assisted console. gfxterm is always
  7444. Unicode (see Internationalisation section for its limitations). Serial is
  7445. configurable to UTF-8 or ASCII (see Internationalisation). In case of qemu
  7446. and coreboot ports the referred console is vga_text. Loongson always uses
  7447. gfxterm.
  7448. Most limited one is ASCII. CP437 provides additionally pseudographics.
  7449. GRUB2 doesn't use any language characters from CP437 as often CP437 is replaced
  7450. by national encoding compatible only in pseudographics.
  7451. Unicode is the most versatile charset which supports many languages. However
  7452. the actual console may be much more limited depending on firmware
  7453. On BIOS, network is supported only if the image is loaded through network.
  7454. On sparc64, GRUB is unable to determine which server it was booted from.
  7455. Direct ATA/AHCI support allows to circumvent various firmware limitations but
  7456. isn't needed for normal operation except on baremetal ports.
  7457. AT keyboard support allows keyboard layout remapping and support for keys not
  7458. available through firmware. It isn't needed for normal operation except
  7459. baremetal ports.
  7460. Speaker allows morse and spkmodem communication.
  7461. USB support provides benefits similar to ATA (for USB disks) or AT (for USB
  7462. keyboards). In addition it allows USBserial.
  7463. Chainloading refers to the ability to load another bootloader through the same protocol
  7464. Hints allow faster disk discovery by already knowing in advance which is the disk in
  7465. question. On some platforms hints are correct unless you move the disk between boots.
  7466. On other platforms it's just an educated guess.
  7467. Note that hint failure results in just reduced performance, not a failure
  7468. BadRAM is the ability to mark some of the RAM as ``bad''. Note: due to protocol
  7469. limitations mips-loongson (with Linux protocol)
  7470. and mips-qemu_mips can use only memory up to first hole.
  7471. Bootlocation is ability of GRUB to automatically detect where it boots from.
  7472. ``disk'' means the detection is limited to detecting the disk with partition
  7473. being discovered on install time. ``partition'' means that disk and partiton
  7474. can be automatically discovered. ``file'' means that boot image file name as
  7475. well as disk and partition can be discovered. For consistency, default install ignores
  7476. partition and relies solely on disk detection. If no bootlocation discovery is available
  7477. or boot and grub-root disks are different, UUID is used instead. On ARC if no device
  7478. to install to is specified, UUID is used instead as well.
  7479. @multitable @columnfractions .20 .20 .20 .20 .20
  7480. @item @tab BIOS @tab Coreboot @tab Multiboot @tab Qemu
  7481. @item video @tab yes @tab yes @tab yes @tab yes
  7482. @item console charset @tab CP437 @tab CP437 @tab CP437 @tab CP437
  7483. @item network @tab yes (*) @tab no @tab no @tab no
  7484. @item ATA/AHCI @tab yes @tab yes @tab yes @tab yes
  7485. @item AT keyboard @tab yes @tab yes @tab yes @tab yes
  7486. @item Speaker @tab yes @tab yes @tab yes @tab yes
  7487. @item USB @tab yes @tab yes @tab yes @tab yes
  7488. @item chainloader @tab local @tab yes @tab yes @tab no
  7489. @item cpuid @tab partial @tab partial @tab partial @tab partial
  7490. @item rdmsr @tab partial @tab partial @tab partial @tab partial
  7491. @item wrmsr @tab partial @tab partial @tab partial @tab partial
  7492. @item hints @tab guess @tab guess @tab guess @tab guess
  7493. @item PCI @tab yes @tab yes @tab yes @tab yes
  7494. @item badram @tab yes @tab yes @tab yes @tab yes
  7495. @item compression @tab always @tab pointless @tab no @tab no
  7496. @item exit @tab yes @tab no @tab no @tab no
  7497. @item bootlocation @tab disk @tab no @tab no @tab no
  7498. @end multitable
  7499. @multitable @columnfractions .20 .20 .20 .20 .20
  7500. @item @tab ia32 EFI @tab amd64 EFI @tab ia32 IEEE1275 @tab Itanium
  7501. @item video @tab yes @tab yes @tab no @tab no
  7502. @item console charset @tab Unicode @tab Unicode @tab ASCII @tab Unicode
  7503. @item network @tab yes @tab yes @tab yes @tab yes
  7504. @item ATA/AHCI @tab yes @tab yes @tab yes @tab no
  7505. @item AT keyboard @tab yes @tab yes @tab yes @tab no
  7506. @item Speaker @tab yes @tab yes @tab yes @tab no
  7507. @item USB @tab yes @tab yes @tab yes @tab no
  7508. @item chainloader @tab local @tab local @tab no @tab local
  7509. @item cpuid @tab partial @tab partial @tab partial @tab no
  7510. @item rdmsr @tab partial @tab partial @tab partial @tab no
  7511. @item wrmsr @tab partial @tab partial @tab partial @tab no
  7512. @item hints @tab guess @tab guess @tab good @tab guess
  7513. @item PCI @tab yes @tab yes @tab yes @tab no
  7514. @item badram @tab yes @tab yes @tab no @tab yes
  7515. @item compression @tab no @tab no @tab no @tab no
  7516. @item exit @tab yes @tab yes @tab yes @tab yes
  7517. @item bootlocation @tab file @tab file @tab file, ignored @tab file
  7518. @end multitable
  7519. @multitable @columnfractions .20 .20 .20 .20 .20
  7520. @item @tab Loongson @tab sparc64 @tab Powerpc @tab ARC
  7521. @item video @tab yes @tab no @tab yes @tab no
  7522. @item console charset @tab N/A @tab ASCII @tab ASCII @tab ASCII
  7523. @item network @tab no @tab yes (*) @tab yes @tab no
  7524. @item ATA/AHCI @tab yes @tab no @tab no @tab no
  7525. @item AT keyboard @tab yes @tab no @tab no @tab no
  7526. @item Speaker @tab no @tab no @tab no @tab no
  7527. @item USB @tab yes @tab no @tab no @tab no
  7528. @item chainloader @tab yes @tab no @tab no @tab no
  7529. @item cpuid @tab no @tab no @tab no @tab no
  7530. @item rdmsr @tab no @tab no @tab no @tab no
  7531. @item wrmsr @tab no @tab no @tab no @tab no
  7532. @item hints @tab good @tab good @tab good @tab no
  7533. @item PCI @tab yes @tab no @tab no @tab no
  7534. @item badram @tab yes (*) @tab no @tab no @tab no
  7535. @item compression @tab configurable @tab no @tab no @tab configurable
  7536. @item exit @tab no @tab yes @tab yes @tab yes
  7537. @item bootlocation @tab no @tab partition @tab file @tab file (*)
  7538. @end multitable
  7539. @multitable @columnfractions .20 .20 .20 .20 .20
  7540. @item @tab MIPS qemu @tab emu @tab xen
  7541. @item video @tab no @tab yes @tab no
  7542. @item console charset @tab CP437 @tab Unicode (*) @tab ASCII
  7543. @item network @tab no @tab yes @tab no
  7544. @item ATA/AHCI @tab yes @tab no @tab no
  7545. @item AT keyboard @tab yes @tab no @tab no
  7546. @item Speaker @tab no @tab no @tab no
  7547. @item USB @tab N/A @tab yes @tab no
  7548. @item chainloader @tab yes @tab no @tab yes
  7549. @item cpuid @tab no @tab no @tab yes
  7550. @item rdmsr @tab no @tab no @tab yes
  7551. @item wrmsr @tab no @tab no @tab yes
  7552. @item hints @tab guess @tab no @tab no
  7553. @item PCI @tab no @tab no @tab no
  7554. @item badram @tab yes (*) @tab no @tab no
  7555. @item compression @tab configurable @tab no @tab no
  7556. @item exit @tab no @tab yes @tab no
  7557. @item bootlocation @tab no @tab file @tab no
  7558. @end multitable
  7559. @node Platform-specific operations
  7560. @chapter Outline
  7561. Some platforms have features which allows to implement
  7562. some commands useless or not implementable on others.
  7563. Quick summary:
  7564. Information retrieval:
  7565. @itemize
  7566. @item mipsel-loongson: lsspd
  7567. @item mips-arc: lsdev
  7568. @item efi: lsefisystab, lssal, lsefimmap, lsefi
  7569. @item i386-pc: lsapm
  7570. @item i386-coreboot: lscoreboot, coreboot_boottime, cbmemc
  7571. @item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi): lsacpi
  7572. @end itemize
  7573. Workarounds for platform-specific issues:
  7574. @itemize
  7575. @item i386-efi/x86_64-efi: loadbios, fakebios, fix_video
  7576. @item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi):
  7577. acpi (override ACPI tables)
  7578. @item i386-pc: drivemap
  7579. @item i386-pc: sendkey
  7580. @end itemize
  7581. Advanced operations for power users:
  7582. @itemize
  7583. @item x86: iorw (direct access to I/O ports)
  7584. @end itemize
  7585. Miscellaneous:
  7586. @itemize
  7587. @item cmos (x86-*, ieee1275, mips-qemu_mips, mips-loongson): cmostest
  7588. (used on some laptops to check for special power-on key), cmosclean
  7589. @item i386-pc: play
  7590. @end itemize
  7591. @node Supported kernels
  7592. @chapter Supported boot targets
  7593. 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.
  7594. @multitable @columnfractions .50 .22 .22
  7595. @item @tab BIOS @tab Coreboot
  7596. @item BIOS chainloading @tab yes @tab no (1)
  7597. @item NTLDR @tab yes @tab no (1)
  7598. @item Plan9 @tab yes @tab no (1)
  7599. @item Freedos @tab yes @tab no (1)
  7600. @item FreeBSD bootloader @tab yes @tab crashes (1)
  7601. @item 32-bit kFreeBSD @tab yes @tab crashes (5)
  7602. @item 64-bit kFreeBSD @tab yes @tab crashes (5)
  7603. @item 32-bit kNetBSD @tab yes @tab crashes (1)
  7604. @item 64-bit kNetBSD @tab yes @tab crashes
  7605. @item 32-bit kOpenBSD @tab yes @tab yes
  7606. @item 64-bit kOpenBSD @tab yes @tab yes
  7607. @item Multiboot @tab yes @tab yes
  7608. @item Multiboot2 @tab yes @tab yes
  7609. @item 32-bit Linux (legacy protocol) @tab yes @tab no (1)
  7610. @item 64-bit Linux (legacy protocol) @tab yes @tab no (1)
  7611. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  7612. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  7613. @item 32-bit XNU @tab yes @tab ?
  7614. @item 64-bit XNU @tab yes @tab ?
  7615. @item 32-bit EFI chainloader @tab no (2) @tab no (2)
  7616. @item 64-bit EFI chainloader @tab no (2) @tab no (2)
  7617. @item Appleloader @tab no (2) @tab no (2)
  7618. @end multitable
  7619. @multitable @columnfractions .50 .22 .22
  7620. @item @tab Multiboot @tab Qemu
  7621. @item BIOS chainloading @tab no (1) @tab no (1)
  7622. @item NTLDR @tab no (1) @tab no (1)
  7623. @item Plan9 @tab no (1) @tab no (1)
  7624. @item FreeDOS @tab no (1) @tab no (1)
  7625. @item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
  7626. @item 32-bit kFreeBSD @tab crashes (5) @tab crashes (5)
  7627. @item 64-bit kFreeBSD @tab crashes (5) @tab crashes (5)
  7628. @item 32-bit kNetBSD @tab crashes (1) @tab crashes (1)
  7629. @item 64-bit kNetBSD @tab yes @tab yes
  7630. @item 32-bit kOpenBSD @tab yes @tab yes
  7631. @item 64-bit kOpenBSD @tab yes @tab yes
  7632. @item Multiboot @tab yes @tab yes
  7633. @item Multiboot2 @tab yes @tab yes
  7634. @item 32-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7635. @item 64-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7636. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  7637. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  7638. @item 32-bit XNU @tab ? @tab ?
  7639. @item 64-bit XNU @tab ? @tab ?
  7640. @item 32-bit EFI chainloader @tab no (2) @tab no (2)
  7641. @item 64-bit EFI chainloader @tab no (2) @tab no (2)
  7642. @item Appleloader @tab no (2) @tab no (2)
  7643. @end multitable
  7644. @multitable @columnfractions .50 .22 .22
  7645. @item @tab ia32 EFI @tab amd64 EFI
  7646. @item BIOS chainloading @tab no (1) @tab no (1)
  7647. @item NTLDR @tab no (1) @tab no (1)
  7648. @item Plan9 @tab no (1) @tab no (1)
  7649. @item FreeDOS @tab no (1) @tab no (1)
  7650. @item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
  7651. @item 32-bit kFreeBSD @tab headless @tab headless
  7652. @item 64-bit kFreeBSD @tab headless @tab headless
  7653. @item 32-bit kNetBSD @tab crashes (1) @tab crashes (1)
  7654. @item 64-bit kNetBSD @tab yes @tab yes
  7655. @item 32-bit kOpenBSD @tab headless @tab headless
  7656. @item 64-bit kOpenBSD @tab headless @tab headless
  7657. @item Multiboot @tab yes @tab yes
  7658. @item Multiboot2 @tab yes @tab yes
  7659. @item 32-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7660. @item 64-bit Linux (legacy protocol) @tab no (1) @tab no (1)
  7661. @item 32-bit Linux (modern protocol) @tab yes @tab yes
  7662. @item 64-bit Linux (modern protocol) @tab yes @tab yes
  7663. @item 32-bit XNU @tab yes @tab yes
  7664. @item 64-bit XNU @tab yes (4) @tab yes
  7665. @item 32-bit EFI chainloader @tab yes @tab no (3)
  7666. @item 64-bit EFI chainloader @tab no (3) @tab yes
  7667. @item Appleloader @tab yes @tab yes
  7668. @end multitable
  7669. @multitable @columnfractions .50 .22 .22
  7670. @item @tab ia32 IEEE1275
  7671. @item BIOS chainloading @tab no (1)
  7672. @item NTLDR @tab no (1)
  7673. @item Plan9 @tab no (1)
  7674. @item FreeDOS @tab no (1)
  7675. @item FreeBSD bootloader @tab crashes (1)
  7676. @item 32-bit kFreeBSD @tab crashes (5)
  7677. @item 64-bit kFreeBSD @tab crashes (5)
  7678. @item 32-bit kNetBSD @tab crashes (1)
  7679. @item 64-bit kNetBSD @tab ?
  7680. @item 32-bit kOpenBSD @tab ?
  7681. @item 64-bit kOpenBSD @tab ?
  7682. @item Multiboot @tab ?
  7683. @item Multiboot2 @tab ?
  7684. @item 32-bit Linux (legacy protocol) @tab no (1)
  7685. @item 64-bit Linux (legacy protocol) @tab no (1)
  7686. @item 32-bit Linux (modern protocol) @tab ?
  7687. @item 64-bit Linux (modern protocol) @tab ?
  7688. @item 32-bit XNU @tab ?
  7689. @item 64-bit XNU @tab ?
  7690. @item 32-bit EFI chainloader @tab no (2)
  7691. @item 64-bit EFI chainloader @tab no (2)
  7692. @item Appleloader @tab no (2)
  7693. @end multitable
  7694. @enumerate
  7695. @item Requires BIOS
  7696. @item EFI only
  7697. @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
  7698. @item Some modules may need to be disabled
  7699. @item Requires ACPI
  7700. @end enumerate
  7701. PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
  7702. and multiboot2.
  7703. @section Boot tests
  7704. 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.
  7705. Following variables must be defined:
  7706. @multitable @columnfractions .30 .65
  7707. @item GRUB_PAYLOADS_DIR @tab directory containing the required kernels
  7708. @item GRUB_CBFSTOOL @tab cbfstool from Coreboot package (for coreboot platform only)
  7709. @item GRUB_COREBOOT_ROM @tab empty Coreboot ROM
  7710. @item GRUB_QEMU_OPTS @tab additional options to be supplied to QEMU
  7711. @end multitable
  7712. Required files are:
  7713. @multitable @columnfractions .40 .55
  7714. @item kfreebsd_env.i386 @tab 32-bit kFreeBSD device hints
  7715. @item kfreebsd.i386 @tab 32-bit FreeBSD kernel image
  7716. @item kfreebsd.x86_64, kfreebsd_env.x86_64 @tab same from 64-bit kFreeBSD
  7717. @item knetbsd.i386 @tab 32-bit NetBSD kernel image
  7718. @item knetbsd.miniroot.i386 @tab 32-bit kNetBSD miniroot.kmod.
  7719. @item knetbsd.x86_64, knetbsd.miniroot.x86_64 @tab same from 64-bit kNetBSD
  7720. @item kopenbsd.i386 @tab 32-bit OpenBSD kernel bsd.rd image
  7721. @item kopenbsd.x86_64 @tab same from 64-bit kOpenBSD
  7722. @item linux.i386 @tab 32-bit Linux
  7723. @item linux.x86_64 @tab 64-bit Linux
  7724. @end multitable
  7725. @node Troubleshooting
  7726. @chapter Error messages produced by GRUB
  7727. @menu
  7728. * GRUB only offers a rescue shell::
  7729. * Firmware stalls instead of booting GRUB::
  7730. @end menu
  7731. @node GRUB only offers a rescue shell
  7732. @section GRUB only offers a rescue shell
  7733. GRUB's normal start-up procedure involves setting the @samp{prefix}
  7734. environment variable to a value set in the core image by
  7735. @command{grub-install}, setting the @samp{root} variable to match, loading
  7736. the @samp{normal} module from the prefix, and running the @samp{normal}
  7737. command (@pxref{normal}). This command is responsible for reading
  7738. @file{/boot/grub/grub.cfg}, running the menu, and doing all the useful
  7739. things GRUB is supposed to do.
  7740. If, instead, you only get a rescue shell, this usually means that GRUB
  7741. failed to load the @samp{normal} module for some reason. It may be possible
  7742. to work around this temporarily: for instance, if the reason for the failure
  7743. is that @samp{prefix} is wrong (perhaps it refers to the wrong device, or
  7744. perhaps the path to @file{/boot/grub} was not correctly made relative to the
  7745. device), then you can correct this and enter normal mode manually:
  7746. @example
  7747. @group
  7748. # Inspect the current prefix (and other preset variables):
  7749. set
  7750. # Find out which devices are available:
  7751. ls
  7752. # Set to the correct value, which might be something like this:
  7753. set prefix=(hd0,1)/grub
  7754. set root=(hd0,1)
  7755. insmod normal
  7756. normal
  7757. @end group
  7758. @end example
  7759. However, any problem that leaves you in the rescue shell probably means that
  7760. GRUB was not correctly installed. It may be more useful to try to reinstall
  7761. it properly using @kbd{grub-install @var{device}} (@pxref{Invoking
  7762. grub-install}). When doing this, there are a few things to remember:
  7763. @itemize @bullet{}
  7764. @item
  7765. Drive ordering in your operating system may not be the same as the boot
  7766. drive ordering used by your firmware. Do not assume that your first hard
  7767. drive (e.g. @samp{/dev/sda}) is the one that your firmware will boot from.
  7768. @file{device.map} (@pxref{Device map}) can be used to override this, but it
  7769. is usually better to use UUIDs or file system labels and avoid depending on
  7770. drive ordering entirely.
  7771. @item
  7772. At least on BIOS systems, if you tell @command{grub-install} to install GRUB
  7773. to a partition but GRUB has already been installed in the master boot
  7774. record, then the GRUB installation in the partition will be ignored.
  7775. @item
  7776. If possible, it is generally best to avoid installing GRUB to a partition
  7777. (unless it is a special partition for the use of GRUB alone, such as the
  7778. BIOS Boot Partition used on GPT). Doing this means that GRUB may stop being
  7779. able to read its core image due to a file system moving blocks around, such
  7780. as while defragmenting, running checks, or even during normal operation.
  7781. Installing to the whole disk device is normally more robust.
  7782. @item
  7783. Check that GRUB actually knows how to read from the device and file system
  7784. containing @file{/boot/grub}. It will not be able to read from encrypted
  7785. devices with unsupported encryption scheme, nor from file systems for which
  7786. support has not yet been added to GRUB.
  7787. @end itemize
  7788. @node Firmware stalls instead of booting GRUB
  7789. @section Firmware stalls instead of booting GRUB
  7790. The EFI implementation of some older MacBook laptops stalls when it gets
  7791. presented a grub-mkrescue ISO image for x86_64-efi target on an USB stick.
  7792. Affected are models of year 2010 or earlier. Workaround is to zeroize the
  7793. bytes 446 to 461 of the EFI partition, where mformat has put a partition table
  7794. entry which claims partition start at block 0. This change will not hamper
  7795. bootability on other machines.
  7796. @node User-space utilities
  7797. @chapter User-space utilities
  7798. @menu
  7799. * Invoking grub-install:: How to use the GRUB installer
  7800. * Invoking grub-mkconfig:: Generate a GRUB configuration file
  7801. * Invoking grub-mkpasswd-pbkdf2::
  7802. Generate GRUB password hashes
  7803. * Invoking grub-mkrelpath:: Make system path relative to its root
  7804. * Invoking grub-mkrescue:: Make a GRUB rescue image
  7805. * Invoking grub-mount:: Mount a file system using GRUB
  7806. * Invoking grub-probe:: Probe device information for GRUB
  7807. * Invoking grub-protect:: Protect a disk key with a key protector
  7808. * Invoking grub-script-check:: Check GRUB script file for syntax errors
  7809. @end menu
  7810. @node Invoking grub-install
  7811. @section Invoking grub-install
  7812. The program @command{grub-install} generates a GRUB core image using
  7813. @command{grub-mkimage} and installs it on your system. You must specify the
  7814. device name on which you want to install GRUB, like this:
  7815. @example
  7816. grub-install @var{install_device}
  7817. @end example
  7818. The device name @var{install_device} is an OS device name or a GRUB
  7819. device name.
  7820. @command{grub-install} accepts the following options:
  7821. @table @option
  7822. @item --help
  7823. Print a summary of the command-line options and exit.
  7824. @item --version
  7825. Print the version number of GRUB and exit.
  7826. @item --boot-directory=@var{dir}
  7827. Install GRUB images under the directory @file{@var{dir}/grub/}
  7828. This option is useful when you want to install GRUB into a
  7829. separate partition or a removable disk.
  7830. If this option is not specified then it defaults to @file{/boot}, so
  7831. @example
  7832. @kbd{grub-install /dev/sda}
  7833. @end example
  7834. is equivalent to
  7835. @example
  7836. @kbd{grub-install --boot-directory=/boot/ /dev/sda}
  7837. @end example
  7838. Here is an example in which you have a separate @dfn{boot} partition which is
  7839. mounted on
  7840. @file{/mnt/boot}:
  7841. @example
  7842. @kbd{grub-install --boot-directory=/mnt/boot /dev/sdb}
  7843. @end example
  7844. @item --recheck
  7845. Recheck the device map, even if @file{/boot/grub/device.map} already
  7846. exists. You should use this option whenever you add/remove a disk
  7847. into/from your computer.
  7848. @item --no-rs-codes
  7849. By default on x86 BIOS systems, @command{grub-install} will use some
  7850. extra space in the bootloader embedding area for Reed-Solomon
  7851. error-correcting codes. This enables GRUB to still boot successfully
  7852. if some blocks are corrupted. The exact amount of protection offered
  7853. is dependent on available space in the embedding area. R sectors of
  7854. redundancy can tolerate up to R/2 corrupted sectors. This
  7855. redundancy may be cumbersome if attempting to cryptographically
  7856. validate the contents of the bootloader embedding area, or in more
  7857. modern systems with GPT-style partition tables (@pxref{BIOS
  7858. installation}) where GRUB does not reside in any unpartitioned space
  7859. outside of the MBR. Disable the Reed-Solomon codes with this option.
  7860. @end table
  7861. @node Invoking grub-mkconfig
  7862. @section Invoking grub-mkconfig
  7863. The program @command{grub-mkconfig} generates a configuration file for GRUB
  7864. (@pxref{Simple configuration}).
  7865. @example
  7866. grub-mkconfig -o /boot/grub/grub.cfg
  7867. @end example
  7868. @command{grub-mkconfig} accepts the following options:
  7869. @table @option
  7870. @item --help
  7871. Print a summary of the command-line options and exit.
  7872. @item --version
  7873. Print the version number of GRUB and exit.
  7874. @item -o @var{file}
  7875. @itemx --output=@var{file}
  7876. Send the generated configuration file to @var{file}. The default is to send
  7877. it to standard output.
  7878. @end table
  7879. @node Invoking grub-mkpasswd-pbkdf2
  7880. @section Invoking grub-mkpasswd-pbkdf2
  7881. The program @command{grub-mkpasswd-pbkdf2} generates password hashes for
  7882. GRUB (@pxref{Security}).
  7883. @example
  7884. grub-mkpasswd-pbkdf2
  7885. @end example
  7886. @command{grub-mkpasswd-pbkdf2} accepts the following options:
  7887. @table @option
  7888. @item -c @var{number}
  7889. @itemx --iteration-count=@var{number}
  7890. Number of iterations of the underlying pseudo-random function. Defaults to
  7891. 10000.
  7892. @item -l @var{number}
  7893. @itemx --buflen=@var{number}
  7894. Length of the generated hash. Defaults to 64.
  7895. @item -s @var{number}
  7896. @itemx --salt=@var{number}
  7897. Length of the salt. Defaults to 64.
  7898. @end table
  7899. @node Invoking grub-mkrelpath
  7900. @section Invoking grub-mkrelpath
  7901. The program @command{grub-mkrelpath} makes a file system path relative to
  7902. the root of its containing file system. For instance, if @file{/usr} is a
  7903. mount point, then:
  7904. @example
  7905. $ @kbd{grub-mkrelpath /usr/share/grub/unicode.pf2}
  7906. @samp{/share/grub/unicode.pf2}
  7907. @end example
  7908. This is mainly used internally by other GRUB utilities such as
  7909. @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig}), but may
  7910. occasionally also be useful for debugging.
  7911. @command{grub-mkrelpath} accepts the following options:
  7912. @table @option
  7913. @item --help
  7914. Print a summary of the command-line options and exit.
  7915. @item --version
  7916. Print the version number of GRUB and exit.
  7917. @end table
  7918. @node Invoking grub-mkrescue
  7919. @section Invoking grub-mkrescue
  7920. The program @command{grub-mkrescue} generates a bootable GRUB rescue image
  7921. (@pxref{Making a GRUB bootable CD-ROM}).
  7922. @example
  7923. grub-mkrescue -o grub.iso
  7924. @end example
  7925. All arguments not explicitly listed as @command{grub-mkrescue} options are
  7926. passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
  7927. Options passed to @command{xorriso} will normally be interpreted as
  7928. @command{mkisofs} options; if the option @samp{--} is used, then anything
  7929. after that will be interpreted as native @command{xorriso} options.
  7930. Non-option arguments specify additional source directories. This is
  7931. commonly used to add extra files to the image:
  7932. @example
  7933. mkdir -p disk/boot/grub
  7934. @r{(add extra files to @file{disk/boot/grub})}
  7935. grub-mkrescue -o grub.iso disk
  7936. @end example
  7937. @command{grub-mkrescue} accepts the following options:
  7938. @table @option
  7939. @item --help
  7940. Print a summary of the command-line options and exit.
  7941. @item --version
  7942. Print the version number of GRUB and exit.
  7943. @item -o @var{file}
  7944. @itemx --output=@var{file}
  7945. Save output in @var{file}. This "option" is required.
  7946. @item --modules=@var{modules}
  7947. Pre-load the named GRUB modules in the image. Multiple entries in
  7948. @var{modules} should be separated by whitespace (so you will probably need
  7949. to quote this for your shell).
  7950. @item --rom-directory=@var{dir}
  7951. If generating images for the QEMU or Coreboot platforms, copy the resulting
  7952. @file{qemu.img} or @file{coreboot.elf} files respectively to the @var{dir}
  7953. directory as well as including them in the image.
  7954. @item --xorriso=@var{file}
  7955. Use @var{file} as the @command{xorriso} program, rather than the built-in
  7956. default.
  7957. @item --grub-mkimage=@var{file}
  7958. Use @var{file} as the @command{grub-mkimage} program, rather than the
  7959. built-in default.
  7960. @end table
  7961. @node Invoking grub-mount
  7962. @section Invoking grub-mount
  7963. The program @command{grub-mount} performs a read-only mount of any file
  7964. system or file system image that GRUB understands, using GRUB's file system
  7965. drivers via FUSE. (It is only available if FUSE development files were
  7966. present when GRUB was built.) This has a number of uses:
  7967. @itemize @bullet
  7968. @item
  7969. It provides a convenient way to check how GRUB will view a file system at
  7970. boot time. You can use normal command-line tools to compare that view with
  7971. that of your operating system, making it easy to find bugs.
  7972. @item
  7973. It offers true read-only mounts. Linux does not have these for journalling
  7974. file systems, because it will always attempt to replay the journal at mount
  7975. time; while you can temporarily mark the block device read-only to avoid
  7976. this, that causes the mount to fail. Since GRUB intentionally contains no
  7977. code for writing to file systems, it can easily provide a guaranteed
  7978. read-only mount mechanism.
  7979. @item
  7980. It allows you to examine any file system that GRUB understands without
  7981. needing to load additional modules into your running kernel, which may be
  7982. useful in constrained environments such as installers.
  7983. @item
  7984. Since it can examine file system images (contained in regular files) just as
  7985. easily as file systems on block devices, you can use it to inspect any file
  7986. system image that GRUB understands with only enough privileges to use FUSE,
  7987. even if nobody has yet written a FUSE module specifically for that file
  7988. system type.
  7989. @end itemize
  7990. Using @command{grub-mount} is normally as simple as:
  7991. @example
  7992. grub-mount /dev/sda1 /mnt
  7993. @end example
  7994. @command{grub-mount} must be given one or more images and a mount point as
  7995. non-option arguments (if it is given more than one image, it will treat them
  7996. as a RAID set), and also accepts the following options:
  7997. @table @option
  7998. @item --help
  7999. Print a summary of the command-line options and exit.
  8000. @item --version
  8001. Print the version number of GRUB and exit.
  8002. @item -C
  8003. @itemx --crypto
  8004. Mount encrypted devices, prompting for a passphrase if necessary.
  8005. @item -d @var{string}
  8006. @itemx --debug=@var{string}
  8007. Show debugging output for conditions matching @var{string}.
  8008. @item -K prompt|@var{file}
  8009. @itemx --zfs-key=prompt|@var{file}
  8010. Load a ZFS encryption key. If you use @samp{prompt} as the argument,
  8011. @command{grub-mount} will read a passphrase from the terminal; otherwise, it
  8012. will read key material from the specified file.
  8013. @item -r @var{device}
  8014. @itemx --root=@var{device}
  8015. Set the GRUB root device to @var{device}. You do not normally need to set
  8016. this; @command{grub-mount} will automatically set the root device to the
  8017. root of the supplied file system.
  8018. If @var{device} is just a number, then it will be treated as a partition
  8019. number within the supplied image. This means that, if you have an image of
  8020. an entire disk in @file{disk.img}, then you can use this command to mount
  8021. its second partition:
  8022. @example
  8023. grub-mount -r 2 disk.img mount-point
  8024. @end example
  8025. @item -v
  8026. @itemx --verbose
  8027. Print verbose messages.
  8028. @end table
  8029. @node Invoking grub-probe
  8030. @section Invoking grub-probe
  8031. The program @command{grub-probe} probes device information for a given path
  8032. or device.
  8033. @example
  8034. grub-probe --target=fs /boot/grub
  8035. grub-probe --target=drive --device /dev/sda1
  8036. @end example
  8037. @command{grub-probe} must be given a path or device as a non-option
  8038. argument, and also accepts the following options:
  8039. @table @option
  8040. @item --help
  8041. Print a summary of the command-line options and exit.
  8042. @item --version
  8043. Print the version number of GRUB and exit.
  8044. @item -d
  8045. @itemx --device
  8046. If this option is given, then the non-option argument is a system device
  8047. name (such as @samp{/dev/sda1}), and @command{grub-probe} will print
  8048. information about that device. If it is not given, then the non-option
  8049. argument is a filesystem path (such as @samp{/boot/grub}), and
  8050. @command{grub-probe} will print information about the device containing that
  8051. part of the filesystem.
  8052. @item -m @var{file}
  8053. @itemx --device-map=@var{file}
  8054. Use @var{file} as the device map (@pxref{Device map}) rather than the
  8055. default, usually @samp{/boot/grub/device.map}.
  8056. @item -t @var{target}
  8057. @itemx --target=@var{target}
  8058. Print information about the given path or device as defined by @var{target}.
  8059. The available targets and their meanings are:
  8060. @table @samp
  8061. @item fs
  8062. GRUB filesystem module.
  8063. @item fs_uuid
  8064. Filesystem Universally Unique Identifier (UUID).
  8065. @item fs_label
  8066. Filesystem label.
  8067. @item drive
  8068. GRUB device name.
  8069. @item device
  8070. System device name.
  8071. @item partmap
  8072. GRUB partition map module.
  8073. @item abstraction
  8074. GRUB abstraction module (e.g. @samp{lvm}).
  8075. @item cryptodisk_uuid
  8076. Crypto device UUID.
  8077. @item msdos_parttype
  8078. MBR partition type code (two hexadecimal digits).
  8079. @item hints_string
  8080. A string of platform search hints suitable for passing to the
  8081. @command{search} command (@pxref{search}).
  8082. @item bios_hints
  8083. Search hints for the PC BIOS platform.
  8084. @item ieee1275_hints
  8085. Search hints for the IEEE1275 platform.
  8086. @item baremetal_hints
  8087. Search hints for platforms where disks are addressed directly rather than
  8088. via firmware.
  8089. @item efi_hints
  8090. Search hints for the EFI platform.
  8091. @item arc_hints
  8092. Search hints for the ARC platform.
  8093. @item compatibility_hint
  8094. A guess at a reasonable GRUB drive name for this device, which may be
  8095. used as a fallback if the @command{search} command fails.
  8096. @item disk
  8097. System device name for the whole disk.
  8098. @end table
  8099. @item -v
  8100. @itemx --verbose
  8101. Print verbose messages.
  8102. @end table
  8103. @node Invoking grub-protect
  8104. @section Invoking grub-protect
  8105. The program @command{grub-protect} protects a disk encryption key with
  8106. a specified key protector.
  8107. @table @option
  8108. @item --help
  8109. Print a summary of the command-line options and exit.
  8110. @item --version
  8111. Print the version number of GRUB and exit.
  8112. @item -a add|remove
  8113. @itemx --action=add|remove
  8114. Add or remove a key protector to or from a key.
  8115. @item -p @var{protector}
  8116. @itemx --protector=@var{protector}
  8117. Set the key protector. Currently, @samp{tpm2} is the only supported key
  8118. protector.
  8119. @item --tpm2-asymmetric=@var{type}
  8120. Choose the the type of SRK. The valid options are @samp{RSA} (@samp{RSA2048})
  8121. and @samp{ECC} (@samp{ECC_NIST_P256}).(default: @samp{ECC})
  8122. @item --tpm2-bank=@var{alg}
  8123. Choose bank of PCRs used to authorize key release: @samp{SHA1}, @samp{SHA256},
  8124. @samp{SHA384}, or @samp{SHA512}. (default: @samp{SHA256})
  8125. @item --tpm2-device=@var{device}
  8126. Set the path to the TPM2 device. (default: @samp{/dev/tpm0})
  8127. @item --tpm2-evict
  8128. Evict a previously persisted SRK from the TPM, if any.
  8129. @item --tpm2-keyfile=@var{file}
  8130. Set the path to a file that contains the cleartext key to protect.
  8131. @item --tpm2-outfile=@var{file}
  8132. Set the path to the file that will contain the key after sealing
  8133. (must be accessible to GRUB during boot).
  8134. @item --tpm2-pcrs=@var{pcrs}
  8135. Set a comma-separated list of PCRs used to authorize key release e.g., @samp{7,11}.
  8136. Please be aware that PCR 0~7 are used by the firmware and the measurement result
  8137. may change after a firmware update (for baremetal systems) or a package
  8138. (OVMF/SLOF) update in the VM host. This may lead to the failure of key
  8139. unsealing. (default: @samp{7})
  8140. @item --tpm2-srk=@var{handle}
  8141. Set the SRK handle, e.g. @samp{0x81000000}, if the SRK is to be made persistent.
  8142. @item --tpm2key
  8143. Use TPM 2.0 Key File format.
  8144. @end table
  8145. Before sealing the key, please check the TPM PCR usage
  8146. (@pxref{TPM2 key protector, TPM PCR usage}) to choose a proper set of PCRs.
  8147. Assume that there is a key file, @file{luks.key}, to be sealed with PCR 0, 2,
  8148. 4, and 7, and here is the @command{grub-protect} command to create the sealed
  8149. key file:
  8150. @example
  8151. @group
  8152. # @kbd{grub-protect --action=add \
  8153. --protector=tpm2 \
  8154. --tpm2-pcrs=0,2,4,7 \
  8155. --tpm2key \
  8156. --tpm2-keyfile=luks.key \
  8157. --tpm2-outfile=/boot/efi/efi/grub/sealed.tpm}
  8158. @end group
  8159. @end example
  8160. Then, GRUB can unlock the target partition with the following commands:
  8161. @example
  8162. grub> @kbd{tpm2_key_protector_init -T (hd0,gpt1)/efi/grub/sealed.tpm}
  8163. grub> @kbd{cryptomount -u <UUID> -P tpm2}
  8164. @end example
  8165. In most of cases, the user only needs to create the key with the `add' action.
  8166. If auto-unlocking is unwanted, just remove the file and the
  8167. @command{tpm2_key_protector_init} command and invoke the @command{cryptomount}
  8168. command without @kbd{-P tpm2}.
  8169. The only use case for the `remove' action is when the SRK is made persistent.
  8170. There are two supported SRKs in @command{grub-protect}: @samp{RSA} and @samp{ECC}.
  8171. Due to slower key generation, some users of the @samp{RSA} SRK may prefer
  8172. making it persistent so that the TPM can skip the SRK generation when GRUB tries
  8173. to unseal the key.
  8174. The available persistent handles can be checked with @command{tpm2_getcap}.
  8175. @example
  8176. @group
  8177. # @kbd{tpm2_getcap properties-variable}
  8178. ...
  8179. TPM2_PT_HR_PERSISTENT: 0x0
  8180. TPM2_PT_HR_PERSISTENT_AVAIL: 0x41
  8181. ...
  8182. @end group
  8183. @end example
  8184. In this system, there is no persistent handle. A TPM handle is an unsigned
  8185. 32-bit integer, and the persistent handles starts with @samp{0x81}. Here
  8186. we choose the well-known persistent handle: @samp{0x81000000}.
  8187. @example
  8188. @group
  8189. # @kbd{grub-protect --action=add \
  8190. --protector=tpm2 \
  8191. --tpm2-pcrs=0,2,4,7 \
  8192. --tpm2-asymmetric=RSA \
  8193. --tpm2-srk=0x81000000 \
  8194. --tpm2key \
  8195. --tpm2-keyfile=luks.key \
  8196. --tpm2-outfile=/boot/efi/efi/grub/sealed.tpm}
  8197. @end group
  8198. @end example
  8199. The additional @kbd{--tpm2-asymmetric=RSA} and @kbd{--tpm2-srk=0x81000000}
  8200. options are used to make the key sealed with the RSA SRK and store the SRK
  8201. in @samp{0x81000000}.
  8202. For the @command{tpm2_key_protector_init} command, the additional @kbd{-s 0x81000000}
  8203. informs the TPM2 key protector to fetch the SRK from @samp{0x81000000}.
  8204. @example
  8205. grub> @kbd{tpm2_key_protector_init -s 0x81000000 -T (hd0,gpt1)/efi/grub/sealed.tpm}
  8206. grub> @kbd{cryptomount -u <UUID> -P tpm2}
  8207. @end example
  8208. After making the SRK handle persistent, we can check the status of the
  8209. persistent handles with @command{tpm2_getcap}.
  8210. @example
  8211. @group
  8212. # @kbd{tpm2_getcap properties-variable}
  8213. ...
  8214. TPM2_PT_HR_PERSISTENT: 0x1
  8215. TPM2_PT_HR_PERSISTENT_AVAIL: 0x40
  8216. ...
  8217. # @kbd{tpm2_getcap handles-persistent}
  8218. - 0x81000000
  8219. @end group
  8220. @end example
  8221. The sealed key can be removed once the user does not want to use the TPM2 key
  8222. protector anymore. Here is the command to remove the persistent SRK handle
  8223. (@samp{0x81000000}) with @kbd{--tpm2-srk} and @kbd{--tpm2-evict}.
  8224. @example
  8225. @group
  8226. # @kbd{grub-protect --action=remove \
  8227. --protector=tpm2 \
  8228. --tpm2-srk 0x81000000 \
  8229. --tpm2-evict}
  8230. @end group
  8231. @end example
  8232. @node Invoking grub-script-check
  8233. @section Invoking grub-script-check
  8234. The program @command{grub-script-check} takes a GRUB script file
  8235. (@pxref{Shell-like scripting}) and checks it for syntax errors, similar to
  8236. commands such as @command{sh -n}. It may take a @var{path} as a non-option
  8237. argument; if none is supplied, it will read from standard input.
  8238. @example
  8239. grub-script-check /boot/grub/grub.cfg
  8240. @end example
  8241. @command{grub-script-check} accepts the following options:
  8242. @table @option
  8243. @item --help
  8244. Print a summary of the command-line options and exit.
  8245. @item --version
  8246. Print the version number of GRUB and exit.
  8247. @item -v
  8248. @itemx --verbose
  8249. Print each line of input after reading it.
  8250. @end table
  8251. @node Obtaining and Building GRUB
  8252. @appendix How to obtain and build GRUB
  8253. @quotation
  8254. @strong{Caution:} GRUB requires binutils-2.9.1.0.23 or later because the
  8255. GNU assembler has been changed so that it can produce real 16bits
  8256. machine code between 2.9.1 and 2.9.1.0.x. See
  8257. @uref{http://sources.redhat.com/binutils/}, to obtain information on
  8258. how to get the latest version.
  8259. @end quotation
  8260. GRUB is available from the GNU alpha archive site
  8261. @uref{ftp://ftp.gnu.org/gnu/grub} or any of its mirrors. The file
  8262. will be named grub-version.tar.gz. The current version is
  8263. @value{VERSION}, so the file you should grab is:
  8264. @uref{ftp://ftp.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz}
  8265. To unbundle GRUB use the instruction:
  8266. @example
  8267. @kbd{zcat grub-@value{VERSION}.tar.gz | tar xvf -}
  8268. @end example
  8269. which will create a directory called @file{grub-@value{VERSION}} with
  8270. all the sources. You can look at the file @file{INSTALL} for detailed
  8271. instructions on how to build and install GRUB, but you should be able to
  8272. just do:
  8273. @example
  8274. @group
  8275. @kbd{cd grub-@value{VERSION}}
  8276. @kbd{./configure}
  8277. @kbd{make install}
  8278. @end group
  8279. @end example
  8280. Also, the latest version is available using Git. See
  8281. @uref{http://www.gnu.org/software/grub/grub-download.html} for more
  8282. information.
  8283. @node Reporting bugs
  8284. @appendix Reporting bugs
  8285. These are the guideline for how to report bugs. Take a look at this
  8286. list below before you submit bugs:
  8287. @enumerate
  8288. @item
  8289. Before getting unsettled, read this manual through and through. Also,
  8290. see the @uref{http://www.gnu.org/software/grub/grub-faq.html, GNU GRUB FAQ}.
  8291. @item
  8292. Always mention the information on your GRUB. The version number and the
  8293. configuration are quite important. If you build it yourself, write the
  8294. options specified to the configure script and your operating system,
  8295. including the versions of gcc and binutils.
  8296. @item
  8297. If you have trouble with the installation, inform us of how you
  8298. installed GRUB. Don't omit error messages, if any. Just @samp{GRUB hangs
  8299. up when it boots} is not enough.
  8300. The information on your hardware is also essential. These are especially
  8301. important: the geometries and the partition tables of your hard disk
  8302. drives and your BIOS.
  8303. @item
  8304. If GRUB cannot boot your operating system, write down
  8305. @emph{everything} you see on the screen. Don't paraphrase them, like
  8306. @samp{The foo OS crashes with GRUB, even though it can boot with the
  8307. bar boot loader just fine}. Mention the commands you executed, the
  8308. messages printed by them, and information on your operating system
  8309. including the version number.
  8310. @item
  8311. Explain what you wanted to do. It is very useful to know your purpose
  8312. and your wish, and how GRUB didn't satisfy you.
  8313. @item
  8314. If you can investigate the problem yourself, please do. That will give
  8315. you and us much more information on the problem. Attaching a patch is
  8316. even better.
  8317. When you attach a patch, make the patch in unified diff format, and
  8318. write ChangeLog entries. But, even when you make a patch, don't forget
  8319. to explain the problem, so that we can understand what your patch is
  8320. for.
  8321. @item
  8322. Write down anything that you think might be related. Please understand
  8323. that we often need to reproduce the same problem you encountered in our
  8324. environment. So your information should be sufficient for us to do the
  8325. same thing---Don't forget that we cannot see your computer directly. If
  8326. you are not sure whether to state a fact or leave it out, state it!
  8327. Reporting too many things is much better than omitting something
  8328. important.
  8329. @end enumerate
  8330. If you follow the guideline above, submit a report to the
  8331. @uref{http://savannah.gnu.org/bugs/?group=grub, Bug Tracking System}.
  8332. Alternatively, you can submit a report via electronic mail to
  8333. @email{bug-grub@@gnu.org}, but we strongly recommend that you use the
  8334. Bug Tracking System, because e-mail can be passed over easily.
  8335. Once we get your report, we will try to fix the bugs.
  8336. @node Future
  8337. @appendix Where GRUB will go
  8338. GRUB 2 is now quite stable and used in many production systems. We are
  8339. currently working towards a 2.0 release.
  8340. If you are interested in the development of GRUB 2, take a look at
  8341. @uref{http://www.gnu.org/software/grub/grub.html, the homepage}.
  8342. @node Copying This Manual
  8343. @appendix Copying This Manual
  8344. @menu
  8345. * GNU Free Documentation License:: License for copying this manual.
  8346. @end menu
  8347. @include fdl.texi
  8348. @node Index
  8349. @unnumbered Index
  8350. @c Currently, we use only the Concept Index.
  8351. @printindex cp
  8352. @bye
  8353. Some notes:
  8354. This is an attempt to make a manual for GRUB 2. The contents are
  8355. copied from the GRUB manual in GRUB Legacy, so they are not always
  8356. appropriate yet for GRUB 2.