grub.texi 250 KB

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