CopyrightIBMCorporation2005TrademarksBootloadershowdown:GettingtoknowLILOandGRUBPage1of11Bootloadershowdown:GettingtoknowLILOandGRUBContrastandcomparethesetwocontendersLaurenceBonneyAugust24,2005MostLinuxusers,fromthecasualdesktopusertotheLinuxsystemadministrator,haveusedautilityknownasabootloader.
Differentvariationsofthisutilityprovidevaryinglevelsofsupportandfunctionality.
Inmanycases,thedefaultbootloaderinstalledwithaLinuxdistributionisnotalwaysthebestforyourneeds;thesamecanbesaidforthedefaultsettingsofeachbootloader.
Inthisarticle,LaurenceBonneydiscussestheprosandconsoftwoofthemorepopularbootloaders--LILOandGRUB--andsuggestsanumberofconfigurationstogetthemostfromyourmachine.
WhatutilitydopracticallyallLinuxusersuse--regardlessoftheirjoborexpertiseAbootloader.
Inthisarticle,seehowabootloaderworks,meettwopopularloaders--LILO(LInuxLOader)andGNUGRUB(GRandUnifiedBootloader)--andreviewtheprosandconsofeach.
WhatisabootloaderMostsimply,abootloaderloadstheoperatingsystem.
Whenyourmachineloadsitsoperatingsystem,theBIOSreadsthefirst512bytesofyourbootablemedia(whichisknownasthemasterbootrecord,orMBR).
YoucanstorethebootrecordofonlyoneoperatingsysteminasingleMBR,soaproblembecomesapparentwhenyourequiremultipleoperatingsystems.
Hencetheneedformoreflexiblebootloaders.
Themasterbootrecorditselfholdstwothings--eithersomeoforallofthebootloaderprogramandthepartitiontable(whichholdsinformationregardinghowtherestofthemediaissplitupintopartitions).
WhentheBIOSloads,itlooksfordatastoredinthefirstsectoroftheharddrive,theMBR;usingthedatastoredintheMBR,theBIOSactivatesthebootloader.
DuetotheverysmallamountofdatatheBIOScanaccess,mostbootloadersloadintwostages.
Inthefirststageoftheboot,theBIOSloadsapartofthebootloaderknownastheinitialprogramloader,orIPL.
TheIPLinterrogatesthepartitiontableandsubsequentlyisabletoloaddatawhereveritmayexistonthevariousmedia.
Thisactionisusedinitiallytolocatethesecondstagebootloader,whichholdstheremainderoftheloader.
developerWorksibm.
com/developerWorks/Bootloadershowdown:GettingtoknowLILOandGRUBPage2of11Thesecondstagebootloaderistherealmeatofthebootloader;manyconsiderittheonlyrealpartofthebootloader.
Thiscontainsthemoredisk-intensivepartsoftheloader,suchasuserinterfacesandkernelloaders.
Theseuserinterfacescanrangefromasimplecommandlinetotheall-singing,all-dancingGUIs.
Bootloadersareusuallyconfiguredinoneoftwoways:eitherasaprimarybootloaderorasasecondarybootloader.
PrimarybootloadersarewherethefirststageofthebootloaderisinstalledontheMBR(perthepreviousdescription).
Secondarybootloadersarewherethefirststageofthebootloaderisinstalledontoabootablepartition.
AseparatebootloadermustthenbeinstalledintotheMBRandconfiguredtopasscontroltothesecondarybootloader.
ManynewerLinuxbootloaderscanbeespeciallyusefulsincetheygiveyouvaryingdegreesofinteraction,suchasadvancedGUIandencryptedpasswords,alongwiththeabilitytoloadfromaselectionofoperatingsystems.
Thusyoucanhavemanyoperatingsystemscoexistingonthesamemachinespanningmultiplephysicaldisks.
ThissetuphasbecomecommonbecauseithelpsmanyusersreconcilethetreasuresofvaluabledatafilesoriginallygeneratedbytheirWindowsmachineswiththeirshinynewLinuxinstalls.
Personally,Ithinkthissetupisgreat;IuseasingleboxforbothLinuxandWindows.
Overtime,bootloadershavebeenenhancedtoincludeagreaterrangeoffunctionalityfortheuser.
Suchfunctionalityandconfigurationvaryfromloadertoloader,althoughthebasicpurposeremainsthesame.
Nowlet'slookattwoofthemorepopularbootloaders:LILOandGRUB.
LILOLInuxLOader,orLILO,comesasstandardonalldistributionsofLinux.
Asoneoftheolder/oldestLinuxbootloaders,itscontinuedstrongLinuxcommunitysupporthasenabledittoevolveovertimeandstayviableasausablemodern-daybootloader.
SomenewfunctionalityincludesanenhanceduserinterfaceandexploitationofnewBIOSfunctionsthateliminatetheold1024-cylinderlimit.
AlthoughLILOcontinuestobedeveloped,thebasicprinciplesofhowLILOworksstillremainthesame.
MakingLILOyourbootloaderWhatyouwillneedtodotouseLILOasyourbootloaderdependsonwhetheryouareinstallingtheOSfreshorhavealreadyinstalledLinuxandareplanningonmovingtoLILO.
Ifyou'restartingfresh,youcanjumpstraighttotheConfiguringLILOsection.
IfyoualreadyhaveaLinuxdistributioninstalled,youusuallygetanoptiontoinstallandconfigureLILO(andcanbootyourmachineintoyournewLinuxinstall).
ForexistingLinuxusersmigratingtoLILO,firstyouhavetoacquirethelatestversionofLILO.
Beforedoinganythingelse,IadviseyoutomakesureyouhaveaLinuxbootdiskhandy--itmakeslifealoteasierifyouaccidentallymesssomethingupandwouldliketobeabletogetbackibm.
com/developerWorks/developerWorksBootloadershowdown:GettingtoknowLILOandGRUBPage3of11intoyouroriginalLinuxconfiguration!
OnceyouhaveLILOonyoursystem,makingittakeoveryourMBRisveryeasy.
Astherootuser,type:#/sbin/lilo-v-vThiswillusethecurrentLILOdefaultsandsplatanythingthatiscurrentlyintheMBR.
However,readaboutConfiguringLILOtomakesureyouareabletobootupasexpected.
AlsonotethatifyouwanttorunWindowsandLinuxonasinglemachine,youshouldinstallyourWindowsOSfirstandthentheLinuxOS,sothatthebootloaderyouchooseintheLinuxinstallwon'tbewrittenoverbytheWindowsbootloader.
UnliketheLinuxbootloaders,themajorityofWindowsbootloaderswillnotallowyoutoloadLinux.
Ifyou'vealreadyinstalledLinuxfirst,don'tfret;justcreateyourselfaLinuxbootdisksothatafteryouhaveinstalledWindows,youcangetbackintoyourLinuxinstallandoverwritetheMBR.
ConfiguringLILOLILOconfigurationisalldonethroughaconfigurationfilelocatedin/etc/lilo.
conf.
Listing1showsanexampleconfiguration,relatingtomyhomemachine,fordualbootingaLinuxandWindowsmachine.
Youcanvisualizehowthisconfigurationrelatestoanactualmachinebylookingatmybasicworkstationsetup:PrimaryHDD(physicaldisk1)withWindowsXPinstalled(initiallyalltherewasonthemachine).
InLinuxterms,thisHDDis/dev/hda(hd0,0inGRUBterms).
SecondaryHDD(physicaldisk2)withRedHatLinuxinstalled;therootpartitionisonthethirdpartitionofthisharddrive,/dev/hdb3(hd1,2inGRUBterms).
Listing1.
Examplelilo.
conffileboot=/dev/hdamap=/boot/mapinstall=/boot/boot.
bprompttimeout=100compactdefault=Linuximage=/boot/vmlinuz-2.
4.
18-14label=Linuxroot=/dev/hdb3read-onlypassword=linuxother=/dev/hdalabel=WindowsXPTheoptionsusedinListing1are:Theboot=linetellsLILOwheretoinstallthebootloader.
Inthepreviousexample,thiswillinstallittotheMBRoffirstharddisk.
YoucouldalternativelyinstallLILOin/dev/hdb3(theLinuxpartitionintheexample),whichwouldthenrequireyoutoinstallanotherbootloaderinto/dev/hdathatpointsittotheLILObootloader;thenyoujustletLILOactasasecondarybootloader.
Ingeneral,/dev/hdaisthemostcommonplaceforyourbootloadertoreside.
YoucanalsomakeaLILOfloppybootdiskbypointingthisparametertothefloppydrive,mostcommonly/dev/fd0.
developerWorksibm.
com/developerWorks/Bootloadershowdown:GettingtoknowLILOandGRUBPage4of11map=pointstothemapfileusedbyLILOinternallyduringbootup.
WhenyouinstallLILOusingthe/sbin/lilocommand,itautomaticallygeneratesthisfile,whichholdsthedescriptortable(amongotherthings).
Myadviceistoleavethisasitis!
install=isoneofthefilesusedinternallybyLILOduringthebootprocess.
Thisholdsboththeprimaryandsecondarypartsofthebootloader.
Asegmentofthisboot.
bfileiswrittentotheMBR(theprimarypartofthebootloader),whichthenpointstothemapandsubsequentlypointstothesecondarybootloader.
Again,leavethisasitis!
prompt=tellsLILOtousetheuserinterface(givingyouinthisexampletwoselections--LinuxandWindowsXP).
Inadditionusingtheprompt/userinterface,yougettheoptiontospecifyspecificparametersfortheLinuxkernelorothersifappropriate.
Ifyoudonotspecifythisoptionintheconfigurationfile,LILOwillbootintothedefaultOSwithnouserinteractionandnowaiting.
(It'sworthnoting,though,thatifyouholdtheSHIFTkeydownduringboot,youcangetthepromptupanyway,whichisquiteusefulifyoudon'twanttheaverageJoetobeexposedtothebootloader).
timeout=isthenumberoftenthsofasecondthatthebootpromptwillwaitbeforeautomaticallyloadingthedefaultOS,inthiscaseLinux.
Ifpromptisnotspecifiedinthelilo.
conf,thisparameterisignored.
Thecompactoptionmagicallymakesthebootprocessquickerbymergingadjacentdiskreadrequestsintoasinglerequest.
Itcanbeamixedblessing,though,asI'veseenanumberofpostsonforumsregardingissueswiththisoption.
Thisoptionespeciallyusefulifyouwishtobootfromafloppy.
Thedefault=optiontellsLILOwhichimagetobootfrombydefault,suchasafterthetimeoutperiod.
Thisrelatestoalabelofoneoftheimagesinthelilo.
conffile.
Ifyoudon'tspecifythisoptionintheconfigurationfile,itwillbootthefirstimagespecifiedinthefile.
ForeachversionofLinuxyouwanttomakeavailableforuserstobootinto,youshouldspecifyimage=andthefollowingthreeoptions.
Theimageoptionspecifiesthekernelversionyouwishtobootto.
label=identifiesthedifferentOSyouwanttobootfromattheuserinterfaceatruntime.
Inaddition,thislabelisusedforspecifyingthedefaultOStobootfrom.
(Note:Avoidspacesinthelabelname;otherwise,youwillgetanunexpectederrorwhenloadingthefile.
)Theroot=optiontellsLILOwheretheOSfilesystemactuallylives.
Inourexample,itis/dev/hdb3,whichisthethirdpartitionoftheseconddisk.
read-onlytellsLILOtoperformtheinitialboottothefilesystemreadonly.
OncetheOSisfullybooted,itismountedread-write.
Thepassword=optionallowsyoutosetapasswordforthespecificOSyouarebootinginto.
Intheexamplethispasswordisheldinthelilo.
conffileasreadabletext,soiseasilyaccessibleforalltoread.
Alternativelyifyousetpassword=""youcansetthepasswordwhenthebootloaderisinstalled.
Thesecanbesetoneachoftheoperatingsystemsyouwishtobootfromifrequired(inourexampleweonlysetapasswordontheLinuxboot).
other=actslikeacombinationoftheimageandrootoptions,butforoperatingsystemsotherthanLinux.
Inourexample,ittellsLILOwheretofindtheWindowsOS,whichresidesonthefirstdiskinthefirstpartition.
ThiswillusuallybethecaseifyouhaveinstalledWindowsfirst,thenLinux.
label=isthesameasallotherlabeloptions.
ibm.
com/developerWorks/developerWorksBootloadershowdown:GettingtoknowLILOandGRUBPage5of11Youcanusemanyotherparametersinthelilo.
conffile,buttheparametersinListing1shouldgetyouintoafairlyusablestateonyourmachine.
Forfurtherinformationontheseandotherlilo.
confparameters,refertothemanualpages(manlilo.
conf).
Sincelilo.
confisnotreadatboottime,theMBRneedstobe"refreshed"whenthisischanged.
Ifyoudonotdothisuponrebooting,noneofyourchangestolilo.
confwillbereflectedatstartup.
LikegettingLILOintotheMBRinthefirstplace,youneedtorun:$/sbin/lilo-v-vThe-v-vflagsgiveyouveryverboseoutput.
ThereareafairnumberofparametersyoucanspecifywhenrunningLILOlikewedid.
Seethemanualpagesforfurtherinformation(manlilo).
TheinitialbootprocessWhenLILOinitiallyloads,itbringsupinordereachoftheletters--L-I-L-O.
Ifalltheletterscomeup,thefirststagebootwassuccessful.
Anythinglessindicatesaproblem:L:Thefirststagebootloaderhasbeenloaded.
IfLILOstopshere,therewereproblemsloadingthesecondstagebootloader.
Thisisusuallyaccompaniedbyanerrorcode.
Thecommonproblemsatthisstagearemediaproblemsorincorrectdiskparametersspecifiedinyourlilo.
conffile.
LI:Thesecondstagebootloaderhasbeenloaded.
LILOhaltingatthispointindicatesthesecondstagebootloadercouldnotbeexecuted.
Again,thiscanbeduetoproblemssimilartojustL:loadingoriftheboot.
bfilehasbeencorrupted,moved,ordeleted.
LIL:Thesecondstagebootloaderhasnowbeenexecuted.
Atthispoint,mediaproblemcouldagainberesponsibleorthemapfile(asspecifiedinthelilo.
conffile)couldhavehadproblemsfindingthedescriptortables.
LIL:Loadedtothesamepointasabove.
Thisusuallymeansthesecondstagebootloaderloadedatanincorrectaddress,causedmostlikelybyboot.
bbeinginadifferentplacethanspecifiedinthelilo.
conffile.
LIL-:Loadedtothesamepointasabove.
Problemloadingthedescriptortable,mostlikelyduetoacorruptdescriptortable.
LILO:LILOhassuccessfullyloadedwithnoerrors.
AdditionalconfigurationatboottimeOnceLILOhassuccessfullyloaded,youwillseeaLILOprompt.
Stillusingtheexamplelilo.
conffileasbefore,atthispointyouhavetwochoices,whichmaynotbeimmediatelyobvioustoLILOnewbies.
First,youmayletLILOtimeout(after10seconds),whichwillboot/dev/hdb3,theLinuxpartition.
Second,youcanpresstheTABkey,whichwilllistaselectionofoperatingsystemstobootfrom.
Inourexamplelilo.
conf,wewouldget"Linux"and"WindowsXP"asouroptions.
TypingeitherofthesewillloadupthatOS.
SpecificallyloadingtheLinuxoptionwillthenpromptyoutoenterapassword,whichinthiscaseislinux.
IncorrectlyenteringthepasswordwilltakeyoubacktotheLILOprompt.
AfinalwordofadvicewhentryingoutLILOforthefirsttime:IfounditalotsafertoworkoutmyLILOconfigurationusingafloppybootdiskratherthanmyharddisk.
Todothis,youmustreplacedeveloperWorksibm.
com/developerWorks/Bootloadershowdown:GettingtoknowLILOandGRUBPage6of11theboot=/dev/hdawithboot=/dev/fd0inthelilo.
conffile.
Thatway,ifImessedupanyoftheconfigurationinmylilo.
conffile,IcouldtakeoutthebootdiskandbootintoLinuxasbefore.
OnceIwashappyeverythingbootedfineusingthefloppydisk,Ithenchangedmylilo.
confbacktouseboot=/dev/hdaandran/sbin/liloafinaltimetouploadmychanges.
GNUGRUBMorerecently,theGRandUnifiedBootloader(commonlyknownasGRUB)seemstohavesomewhattakenthebootloaderscrownfromLILO.
GNUGRUBisactivelydevelopedbytheFreeSoftwareFoundationandbasedontheoriginalGRUBprogram,originallycreatedbyErichStefanBoleyn.
MakeGRUByourbootloaderAswithLILO,thestepsyouwillneedtoperformtouseGRUBasyouractivebootloaderdependonwhetheryouareinstallingtheOSfreshorhavealreadyinstalledLinuxandareplanningonmovingtoGRUB.
Ifyou'restartingfresh,youcanjumpstraighttotheConfiguringGRUBsection.
IfyoualreadyhaveaLinuxdistributioninstalled,youusuallygetanoptiontoinstallandconfigureLILO(andcanbootyourmachineintoyournewLinuxinstall).
ForexistingLinuxuserswantingtomigratetoGRUB,getthelatestversionofGRUB(seeRelatedtopics).
Again,aswithLILO,beforedoinganythingelse,haveaLinuxbootdiskhandy.
Withtheinteractivemode(describedbelow),thisdiskshouldnotberequired,butit'snicetohavejustincaseyougetoutofyourdepth.
OnceyouhaveGRUBinstalledonyoursystem,makingittakeoveryourMBRiseasy.
Astherootuser,type:#/boot/grub/grubThiswillloadupaBASH-likecommandpromptwhereyounowusetheGRUBcommand:grub>install(hd1,2)/boot/grub/stage1(hd1)(hd1,2)/boot/grub/stage2p(hd1,2)/boot/grub/menu.
confThiscommandusestheGRUBinstallcommand,whichrequiresthelocationofthestageoneimageandthelocationoftheMBR(install(hd1,2)/boot/grub/stage1(hd1)).
Alsothelocationofthestagetwoimage((hd1,2)/boot/grub/stage2)isrequired.
Finally,anoptionalp(hd1,2)/boot/grub/menu.
conftellsGRUBthelocationoftheGUImenuconfigurationfile.
Inthepreviousexample,hd1ismyLinuxDiskandhd0ismyWindowsdisk.
ThiswillusethecurrentGRUBdefaultsandsplatanythingthatiscurrentlyintheMBR(readConfiguringGRUBtomakesureyouareabletobootupasexpected).
ConfiguringGRUBGRUBconfigurationisalldonethroughaconfigurationfilelocatedin/boot/grub/grub.
conf.
Listing2showsanexampleconfigurationthatrelatestomyhomesetup,adual-bootingLinuxandWindowsmachine:ibm.
com/developerWorks/developerWorksBootloadershowdown:GettingtoknowLILOandGRUBPage7of11Listing2.
Examplegrub.
conffiledefault=0timeout=10splashimage=(hd1,2)/grub/splash.
xpm.
gzpassword--md5$1$opeVt0$Y.
br.
18LyAasRsGdSKLYlp1titleRedHatLinuxpassword--md5$1$0peVt0$Y.
br.
18LyAasRsGdSKLYlp1root(hd1,2)kernel/vmlinuz-2.
4.
18-14roroot=LABEL=/initrd/initrd-2.
4.
18-14.
imgtitleWindowsXPpassword--md5$1$0peVt0$Y.
br.
18LyAasRsGdSKLYlp1rootnoverify(hd0,0)chainloader+1TheoptionsusedinListing2are:Thedefault=optionsignalstoGRUBwhichimagetobootfrombydefaultafterthetimeoutperiod.
Thisrelatestooneoftheimagesinthegrub.
conffile.
0isthefirstspecified,1isthesecondspecified,etc.
Ifyoudon'tspecifythisoptionintheconfigurationfile,itwillbootthefirstimagespecifiedinthefile.
timeout=isthenumberofsecondsthebootpromptwillwaitbeforeautomaticallyloadingthedefaultOS,inthiscase,RedHatLinux.
splashimage=isthelocationoftheimagetobeusedasthebackgroundfortheGRUBGUI.
ThepasswordoptionspecifiestheMD5-encryptedpasswordusedtogainaccesstoGRUB'sinteractivebootoptions.
NotethisdoesnotstopusersloadingyourdefinedOSchoices;thisneedstobesetonaper-titlebasis.
Togenerateanmd5password,runthetoolgrub-md5-crypt(asroot),whichcomeswithGRUB.
Itwillpromptyouforthepasswordyouwanttoencrypt.
ItthenwilloutputtheMD5-encryptedpassword.
Copythisintoyourgrub.
confafterpassword-md5butonthesameline.
Usuallythispasswordcanbesettotherootpassword,sinceitisonlyrootwhocanreadthegrub.
conffileanyway.
titleidentifiesthespecificOSthatwillbebootedfromattheuserinterfaceatruntime.
UnlikewithLILO,youcanincludespacesinthisname.
passwordissetinthesamewayasthepasswordabove.
Donotsetthispasswordtotherootpasswordifyouareplanningonsharingthismachinewithotherusers.
TherootoptiontellsGRUBwheretheOSfilesystemactuallylives.
Asyoucansee,GRUBreferencesthemediainadifferentwaythanLILO.
InourLILOexample,/dev/hdb3isthethirdpartitionoftheseconddisk.
Grubreferencesthisdiskas(hd1,2),againthethirdpartitionoftheseconddisk(disk0beingthefirstdisk,partition0beingthefirstpartition).
kernel:vmlinuz-X.
X.
XX-XXisthenameofthedefaultbootkernelimagewithinyourrootdirectory.
initrd:initrd-X.
X.
XX-XX.
imgisthenameofthedefaultinitrdfilewithinyourrootdirectory.
titleisthesameasallothertitleoptions.
password:Seeotherpasswordoptions.
TherootnoverifyoptiontellsGRUBtonottrytovarytherootoftheOS.
ThissavesloaderrorsifthefilesystemisnotasupportedbyGRUB.
chainloader+1tellsGRUBtouseachainloadertoloadthisOS,whichisrequiredforloadingWindows.
developerWorksibm.
com/developerWorks/Bootloadershowdown:GettingtoknowLILOandGRUBPage8of11Youcanusemanyotherparametersinthegrub.
conffile,buttheparametersinListing2shouldgetyouintoafairlyusablestateonyourmachine.
Forfurtherinformationontheseandothergrub.
confparameters,seethemanualpages(mangrub.
conf).
UnlikeLILO'sconfigurationfile,grub.
confisreadatboottime,andtheMBRdoesnotneedtoberefreshedwhenthisischanged.
TheinitialbootprocessWhenGRUBinitiallyloads,likeLILOitloadsitsfirststagefromtheMBR.
Oncethishasloaded,itthenentersanintermediatestagebetweenthecommonbootloaderstagesoneandtwo(orforargument'ssake,Stage1.
5).
Stage1.
5ispresenttoenableregularfilesystemaccesstotheGRUBconfigurationfilesin/boot/grubratherthanaccessingusingdiskblocks.
WethenenterstagetwoofthebootloaderwhereGRUBloadsthegrub.
conffile.
YoushouldnowseetheGRUBGUI.
ForanynativeWindowsuser,thisseemsamuchmorefriendlyexperiencethanthatofLILO.
Butdon'tthinkbyhavingaGUIthatGRUBisadumbed-downbootloader.
Thewealthofoptionsisastonishing.
(Seethetipsforadditionalconfigurationatboottime.
)Ifyourconfigurationislikemine,youshouldnowbelookingatascreengivingyoutwooptions:tobootintoRedHatLinuxortobootintoWindowsXP.
Bydefault,itwillloadLinux.
Theresultofselectingeitheroneoftheseisselfexplanatory.
Nowforthegoodstuff.
AdditionalconfigurationatboottimeAttheGRUBGUI,pressinganykeywillstopthetimeoutfromkickingin.
ThenbypressingthePkey,youcanenteryourGRUBpasswordandgainfullaccesstoGRUB'sinteractivebootingoptions.
Youshouldnowbeabletouseoneofthethreeoptionsbypressingtheoneofthefollowingkeys:Foreditcommandsbeforebooting,pressE.
ThisallowsyoutoeditthespecificoptionsforthecurrentlyhighlightedOS.
GRUBwillthenshowonlytheoptionsspecifictothebootingofthatOS,whichyoucantheneditasyouseefit.
ThisisespeciallyusefulifyouhavespecifiedthewrongHDDfortherootfilesystem.
Ifyouneedtoaccessthemachineinsingle-usermode(givingyourootaccesswithoutspecifyingapassword!
),selecttheLinuxOSattheGRUBmainscreen.
Thenasbefore,pressEandmovetothekernelline(inmyexample,thisiskernel/vmlinuz-2.
4.
18-14roroot=LABEL=/).
Youthenappendsingletotheendofthisline,andpressBtobootusingyourchangedgrub.
conf.
Anychangesyoumakeineditmodearenotsavedtothegrub.
conffile.
Tomodifykernelarguments,pressA.
IfyouareanexperiencedLinuxuser,youcantweakthekernelargumentstosuityourneeds.
TogettoaBASH-likecommand-lineinterface,pressC.
Thisminimalcommand-lineinterfaceallowsyoutofindGRUBconfigurationfilesonyoursystem,loadanalternateconfigurationfile,andeditlinesintheconfigurationfile,aswellasenterGRUBcommandsdirectly.
Youibm.
com/developerWorks/developerWorksBootloadershowdown:GettingtoknowLILOandGRUBPage9of11mightusethisifaconfigurationchange,suchasdeletingapartition,hasmadeyoursystemunbootable.
Youmightalsouseitifyouneedtobootasystemintosingle-usermodeorperhapsrunlevel3insteadofyournormalrunlevel.
Themanyusesfortheseoptionsarebeyondthescopeofthisarticle.
Asyoucansee,GRUBreallyopensupthepossibilitiesatboottime.
Thiscanbeamixedblessing,though,asGRUBalsopotentiallyallowsattackerstogainaccesstothesystembeforetheOShasloaded.
Themainareasopentomisuseare:Accesstosingle-usermode.
Anyoneloadingintosingle-usermodeisgivenrootaccess,leavingyourLinuxsystemwideopentoabuse.
Accesstootheroperatingsystems.
Anybootableoperatingsystemsyouhaveconfiguredthatdonotrequireapassword,suchasDOS,willbeopen.
AccesstotheGRUBeditor.
ThisallowsusersfullaccesstochangetheGRUBconfiguration.
SettingsecurityplaysanimportantpartinyourGRUBconfiguration;settingapasswordandusingMD5encryptionpaysdividendstoyouroverallsystemsecurity.
FutureofGRUBGRUBisnowbeingreplacedbyGRUB2.
TheoriginalGRUBisbeingrenamedtoGRUBLegacy;apartfromfixingbugs,itwillnolongerbeactivelydeveloped.
GRUB2willbeacompleterewriteoftheoriginalbootloader.
Todate,thefollowingfeaturesarethecoreofthechanges:ReplacementofStage1.
5withthecreationofacompactcoreimageSupportfordynamicloadingtothecoreimageTrendtowardsmakingtheoverallGRUBframeworkobjectorientedSupportforinternationalization,suchasnon-ASCIIcharactersetsSupportfordifferenthardwarearchitecturesanddifferentplatforms(otherthanLinux)RefertotheGRUBWebsite(seetheRelatedtopicssectionbelowforthelatestdevelopments.
GRUBvs.
LILOAsstatedatthestartofthisarticle,allbootloadersworkinasimilarwaytofulfillacommonpurpose.
ButLILOandGRUBdohaveanumberofdifferences:LILOhasnointeractivecommandinterface,whereasGRUBdoes.
LILOdoesnotsupportbootingfromanetwork,whereasGRUBdoes.
LILOstoresinformationregardingthelocationoftheoperatingsystemsitcantoloadphysicallyontheMBR.
IfyouchangeyourLILOconfigfile,youhavetorewritetheLILOstageonebootloadertotheMBR.
ComparedwithGRUB,thisisamuchmoreriskyoptionsinceamisconfiguredMBRcouldleavethesystemunbootable.
WithGRUB,iftheconfigurationfileisconfiguredincorrectly,itwillsimplydefaulttotheGRUBcommand-lineinterface.
ConclusionAswithallsoftware,thebestchoiceforoneuserisn'talwaysthebestforall.
Ofthetwobootloaderscoveredhere,mypersonalfavoriteisGNUGRUB.
Itisagoodall-aroundloader,developerWorksibm.
com/developerWorks/Bootloadershowdown:GettingtoknowLILOandGRUBPage10of11combiningaslickuserinterfacewithawealthoffunctionality.
AndyetmanypeoplewhohaveusedandlovedLILOstillfindittobethebootloaderofchoice.
Fortunately,ifyouarenewtotheworldofLinuxbootloading,youwon'tgofarwrongwitheither.
Regardingsecurity,anyonewithaccesstoabootdisk/CDcangetpastanyofthesecuritymeasuresmentionedinthisarticlebysimplybootingusingagrub.
conforlilo.
confthatdoesnothavesecurityset.
WithGRUBinparticular,beingabletobootintosingle-usermodecouldposeaserioussecurityhole.
AsimplewaytogetaroundthisproblemistodisablebootingfromCDandfloppyinyourmachine'sBIOSandmakesureyourBIOSissetwithapasswordsootherscannotchangethesesettings.
Havefun!
ibm.
com/developerWorks/developerWorksBootloadershowdown:GettingtoknowLILOandGRUBPage11of11RelatedtopicsThetutorial"BuildaLinuxtestnetwork"(developerWorks,May2003)showshowtocombineSambaandGRUBtobuildacompact,highlyadaptable,cross-platformtestnetwork,capableofbootingandnetworkingalargenumberofoperatingsystemsonasmallnumberofmachines.
GetthelatestversionoftheGRUBbootloader.
BuildyournextdevelopmentprojectonLinuxwithIBMtrialsoftware,availablefordownloaddirectlyfromdeveloperWorks.
CopyrightIBMCorporation2005(www.
ibm.
com/legal/copytrade.
shtml)Trademarks(www.
ibm.
com/developerworks/ibm/trademarks/)
进入6月,各大网络平台都开启了618促销,腾讯云目前也正在开展618云上Go活动,上海/北京/广州/成都/香港/新加坡/硅谷等多个地区云服务器及轻量服务器秒杀,最低年付95元起,参与活动的产品还包括短信包、CDN流量包、MySQL数据库、云存储(标准存储)、直播/点播流量包等等,本轮秒杀活动每天5场,一直持续到7月中旬,感兴趣的朋友可以关注本页。活动页面:https://cloud.tencent...
Hostiger商家我们可能以前也是有见过的,以前他们的域名是Hostigger,后来进行微调后包装成现在的。而且推出Columbus Day哥伦布日优惠活动,提供全场的VPS主机首月7折月付2.79美元起的优惠。这里我们普及一下基础知识,Columbus Day ,即为每年10月12日,是一些美洲国家的节日,纪念克里斯托弗·哥伦布在北美登陆,为美国的联邦假日。Hostiger 商家是一个成立于2...
关于Linode,这是一家运营超过18年的VPS云主机商家,产品支持随时删除(按小时计费),可选包括美国、英国、新加坡、日本、印度、加拿大、德国等全球十多个数据中心,最低每月费用5美元($0.0075/小时)起。目前,注册Linode的新用户添加付款方式后可以获得100美元赠送,有效期为60天,让更多新朋友可以体验Linode的产品和服务。Linode的云主机产品分为几类,下面分别列出几款套餐配置...
unexpectederror为你推荐
空间主机网站服务器,主机,空间 有什么区别?台湾vps台湾服务器租用托管那里好台湾主机台湾的第一台电脑网站空间免备案想买一个网站空间,大家给推荐个稳定的,速度的,免备案的?什么是虚拟主机虚拟主机是什么?虚拟主机评测浅谈建站新手如何挑选虚拟主机安徽虚拟主机安徽众仁联合科技有限公司是做什么的啊??虚拟主机提供商哪个虚拟主机的服务商比较好?免费域名给我一个最有用的申请免费域名的地址备案域名网站备案分为哪几种?域名备案跟网站备案有什么不同?
网站域名注册 私服服务器租用 淘宝二级域名 wordpress主机 westhost cpanel suspended 京东云擎 国外免费空间 合肥鹏博士 炎黄盛世 php空间推荐 域名和空间 爱奇艺会员免费试用 华为云服务登录 服务器是干什么用的 双线asp空间 永久免费空间 杭州电信 magento主机 更多