pacman
pacman
Thepacman(https://www.archlinux.org/pacman/)packagemanagerisoneofthemajordistinguishingfeaturesofArch
Relatedarticles
Linux.Itcombinesasimplebinarypackageformatwithaneasy-to-usebuildsystem.Thegoalofpacmanistomakeit
possibletoeasilymanagepackages,whethertheyarefromtheofficialrepositoriesortheuser'sownbuilds.
Creatingpackages
Pacmankeepsthesystemuptodatebysynchronizingpackagelistswiththemasterserver.Thisserver/clientmodelalso
allowstheusertodownload/installpackageswithasimplecommand,completewithallrequireddependencies.
Downgradingpackages
PacmaniswrittenintheCprogramminglanguageandusesthetarformatforpackaging.
pacman/PacnewandPacsave
Tip:Thepacman(https://www.archlinux.org/packages/?name=pacman)packagecontainsotherusefultoolssuchasmakepkg,
pactree,vercmp,andcheckupdates.Run pacman-Qlqpacman|grepbin toseethefulllist.
pacman/Packagesigning
pacman/Restorelocaldatabase
pacman/Rosetta
pacman/Tipsandtricks
Contents
FAQ#Packagemanagement
Systemmaintenance
1 Usage
ArchBuildSystem
1.1 Installingpackages
1.1.1 Installingspecificpackages
Officialrepositories
ArchUserRepository
1.1.2 Installingpackagegroups
1.2 Removingpackages
1.3 Upgradingpackages
1.4 Queryingpackagedatabases
1.4.1 Databasestructure
1.5 Cleaningthepackagecache
1.6 Additionalcommands
1.7 Installationreason
1.8 Searchforapackagethatcontainsaspecificfile
2 Configuration
2.1 Generaloptions
2.1.1 Comparingversionsbeforeupdating
2.1.2 Skippackagefrombeingupgraded
2.1.3 Skippackagegroupfrombeingupgraded
2.1.4 Skipfilefrombeingupgraded
2.1.5 Skipfilesfrombeinginstalledtosystem
2.1.6 Maintainseveralconfigurationfiles
2.1.7 Hooks
2.2 Repositoriesandmirrors
2.2.1 Packagesecurity
3 Troubleshooting
3.1 "Failedtocommittransaction(conflictingfiles)"error
3.2 "Failedtocommittransaction(invalidorcorruptedpackage)"error
3.3 "Failedtoinittransaction(unabletolockdatabase)"error
3.4 Packagescannotberetrievedoninstallation
3.5 Manuallyreinstallingpacman
3.6 Pacmancrashesduringanupgrade
3.7 "Unabletofindrootdevice"errorafterrebooting
3.8 Signaturefrom"User<email@example.org>"isunknowntrust,installationfailed
3.9 RequestonimportingPGPkeys
3.10 Error:key"0123456789ABCDEF"couldnotbelookedupremotely
3.11 Signaturefrom"User<email@archlinux.org>"isinvalid,installationfailed
3.12 "Warning:currentlocaleisinvalid;usingdefault"C"locale"error
3.13 Pacmandoesnothonorproxysettings
3.14 HowdoIreinstallallpackages,retaininginformationonwhethersomethingwasexplicitlyinstalledorasa
dependency?
3.15 "Cannotopensharedobjectfile"error
3.16 Freezeofpackagedownloads
3.17 Failedretrievingfile'core.db'frommirror
4 Understanding
4.1 Whathappensduringpackageinstall/upgrade/removal
5 Seealso
Usage
Whatfollowsisjustasmallsampleoftheoperationsthatpacmancanperform.Toreadmoreexamples,refertopacman(8)(https://jlk.fjfi.cvut.cz/arch/manpages/man/pac
man.8).
Tip:ForthosewhohaveusedotherLinuxdistributionsbefore,thereisahelpfulPacmanRosettaarticle.
Installingpackages
Note:Packagesoftenhaveaseriesofoptionaldependencieswhicharepackagesthatprovideadditionalfunctionalitytotheapplication,albeitnotstrictlyrequired
forrunningit.Wheninstallingapackage,pacmanwilllistitsoptionaldependenciesamongtheoutputmessages,buttheywillnotbefoundin pacman.log :usethe
pacman-Sicommandtoviewtheoptionaldependenciesofapackage,togetherwithshortdescriptionsoftheirfunctionality.
Note:Wheninstallingapackagewhichyourequireonlyas(optional)dependencyofsomeotherpackage(i.e.notrequiredbyyouexplicitlyotherwise),itis
recommendedtouse --asdeps option.FordetailsseeInstallationreason.
Warning:WheninstallingpackagesinArch,avoidrefreshingthepackagelistwithoutupgradingthesystem(forexample,whenapackageisnolongerfoundin
theofficialrepositories).Inpractice,donotrun pacman-Sypackage_name insteadof pacman-Syupackage_name ,asthiscouldleadtodependencyissues.SeeSystem
maintenance#PartialupgradesareunsupportedandBBS#89328(https://bbs.archlinux.org/viewtopic.php?id=89328).
Installingspecificpackages
Toinstallasinglepackageorlistofpackages(includingdependencies),issuethefollowingcommand:
#pacman-Spackage_name1package_name2...
Toinstallalistofpackageswithregex(seethisforumthread(https://bbs.archlinux.org/viewtopic.php?id=7179)):
#pacman-S$(pacman-Ssqpackage_regex)
Sometimestherearemultipleversionsofapackageindifferentrepositories,e.g.extraandtesting.Toinstalltheformerversion,therepositoryneedstobedefinedin
front:
#pacman-Sextra/package_name
Toinstallanumberofpackagessharingsimilarpatternsintheirnames--nottheentiregroupnorallmatchingpackages;eg.plasma(https://www.archlinux.org/groups/x8
6_64/plasma/):
#pacman-Splasma-{desktop,mediacenter,nm}
Ofcourse,thatisnotlimitedandcanbeexpandedtohowevermanylevelsneeded:
#pacman-Splasma-{workspace{,-wallpapers},pa}
Installingpackagegroups
Somepackagesbelongtoagroupofpackagesthatcanallbeinstalledsimultaneously.Forexample,issuingthecommand:
#pacman-Sgnome
willpromptyoutoselectthepackagesfromthegnome(https://www.archlinux.org/groups/x86_64/gnome/)groupthatyouwishtoinstall.
Sometimesapackagegroupwillcontainalargeamountofpackages,andtheremaybeonlyafewthatyoudoordonotwanttoinstall.Insteadofhavingtoenterall
thenumbersexcepttheonesyoudonotwant,itissometimesmoreconvenienttoselectorexcludepackagesorrangesofpackageswiththefollowingsyntax:
Enteraselection(default=all):1-1015
whichwillselectpackages1through10and15forinstallation,or:
Enteraselection(default=all):^5-8^2
whichwillselectallpackagesexcept5through8and2forinstallation.
Toseewhatpackagesbelongtothegnomegroup,run:
#pacman-Sggnome
Alsovisithttps://www.archlinux.org/groups/toseewhatpackagegroupsareavailable.
Note:Ifapackageinthelistisalreadyinstalledonthesystem,itwillbereinstalledevenifitisalreadyuptodate.Thisbehaviorcanbeoverriddenwiththe --needed
option.
Removingpackages
Toremoveasinglepackage,leavingallofitsdependenciesinstalled:
#pacman-Rpackage_name
Toremoveapackageanditsdependencieswhicharenotrequiredbyanyotherinstalledpackage:
#pacman-Rspackage_name
Toremoveapackage,itsdependenciesandallthepackagesthatdependonthetargetpackage:
Warning:Thisoperationisrecursive,andmustbeusedwithcaresinceitcanremovemanypotentiallyneededpackages.
#pacman-Rscpackage_name
Toremoveapackage,whichisrequiredbyanotherpackage,withoutremovingthedependentpackage:
#pacman-Rddpackage_name
Pacmansavesimportantconfigurationfileswhenremovingcertainapplicationsandnamesthemwiththeextension:.pacsave.Topreventthecreationofthesebackup
filesusethe -n option:
#pacman-Rnpackage_name
Note:Pacmanwillnotremoveconfigurationsthattheapplicationitselfcreates(forexample"dotfiles"inthehomefolder).
Upgradingpackages
Warning:
UsersareexpectedtofollowtheguidanceintheSystemmaintenance#Upgradingthesystemsectiontoupgradetheirsystemsregularlyandnotblindlyrun
thefollowingcommand.
Archonlysupportsfullsystemupgrades.SeeSystemmaintenance#Partialupgradesareunsupportedand#Installingpackagesfordetails.
Pacmancanupdateallpackagesonthesystemwithjustonecommand.Thiscouldtakequiteawhiledependingonhowup-to-datethesystemis.Thefollowing
commandsynchronizestherepositorydatabasesandupdatesthesystem'spackages,excluding"local"packagesthatarenotintheconfiguredrepositories:
#pacman-Syu
Queryingpackagedatabases
Pacmanqueriesthelocalpackagedatabasewiththe -Q flag,thesyncdatabasewiththe -S flagandthefilesdatabasewiththe -F flag.See pacman-Q--help ,
pacman-S--help and pacman-F--help fortherespectivesuboptionsofeachflag.
Pacmancansearchforpackagesinthedatabase,searchingbothinpackages'namesanddescriptions:
$pacman-Ssstring1string2...
Sometimes, -s 'sbuiltinERE(ExtendedRegularExpressions)cancausealotofunwantedresults,soithastobelimitedtomatchthepackagenameonly;notthe
descriptionnoranyotherfield:
$pacman-Ss'^vim-'
Tosearchforalreadyinstalledpackages:
$pacman-Qsstring1string2...
Tosearchforpackagefilenamesinremotepackages:
$pacman-Fsstring1string2...
Todisplayextensiveinformationaboutagivenpackage:
$pacman-Sipackage_name
Forlocallyinstalledpackages:
$pacman-Qipackage_name
Passingtwo -i flagswillalsodisplaythelistofbackupfilesandtheirmodificationstates:
$pacman-Qiipackage_name
Toretrievealistofthefilesinstalledbyapackage:
$pacman-Qlpackage_name
Toretrievealistofthefilesinstalledbyaremotepackage:
$pacman-Flpackage_name
Toverifythepresenceofthefilesinstalledbyapackage:
$pacman-Qkpackage_name
Passingthe k flagtwicewillperformamorethoroughcheck.
Toquerythedatabasetoknowwhichpackageafileinthefilesystembelongsto:
$pacman-Qo/path/to/file_name
Toquerythedatabasetoknowwhichremotepackageafilebelongsto:
$pacman-Fo/path/to/file_name
Tolistallpackagesnolongerrequiredasdependencies(orphans):
$pacman-Qdt
Tip:Addtheabovecommandtoapacmanpost-transactionhooktobenotifiedifatransactionorphanedapackage.Thiscanbeusefulforbeingnotifiedwhena
packagehasbeendroppedfromarepository,sinceanydroppedpackagewillalsobeorphanedonalocalinstallation(unlessitwasexplicitlyinstalled).Toavoidany
"failedtoexecutecommand"errorswhennoorphansarefound,usethefollowingcommandfor Exec inyourhook:
/usr/bin/bash-c"/usr/bin/pacman-Qtd||/usr/bin/echo'=>Nonefound.'"
Tolistallpackagesexplicitlyinstalledandnotrequiredasdependencies:
$pacman-Qet
Tolistadependencytreeofapackage:
$pactreepackage_name
Tolistallthepackagesrecursivelydependingonaninstalledpackage,usewhoneedsfrompkgtools(https://aur.archlinux.org/packages/pkgtools/)AUR:
$whoneedspackage_name
orthereverseflagtopactree:
$pactree-rpackage_name
SeePacman/Tipsandtricksformoreexamples.
Databasestructure
Thepacmandatabasesarenormallylocatedat /var/lib/pacman/sync .Foreachrepositoryspecifiedin /etc/pacman.conf therewillbeacorrespondingdatabasefile
locatedthere.Databasefilesaretar-gzippedarchivescontainingonedirectoryforeachpackage,forexampleforthewhich(https://www.archlinux.org/packages/?name=whic
h)package:
%treewhich-2.20-6
which-2.20-6
|--depends
`--desc
The depends fileliststhepackagesthispackagedependson,while desc hasadescriptionofthepackagesuchasthefilesizeandtheMD5hash.
Cleaningthepackagecache
Pacmanstoresitsdownloadedpackagesin /var/cache/pacman/pkg/ anddoesnotremovetheoldoruninstalledversionsautomatically.Therefore,itisnecessaryto
deliberatelycleanupthatfolderperiodicallytopreventsuchfoldertogrowindefinitelyinsize.
Thebuilt-inoptiontoremoveallthecachedpackagesthatarenotcurrentlyinstalledis:
#pacman-Sc
Warning:
Onlydothiswhencertainthatpreviouspackageversionsarenotrequired,forexampleforalaterdowngrade. pacman-Sc onlyleavestheversionsofpackages
whicharecurrentlyinstalledavailable,olderversionswouldhavetoberetrievedthroughothermeans,suchastheArchive.
Itispossibletoemptythecachefolderfullywith pacman-Scc .Inadditiontotheabove,thisalsopreventsfromreinstallingapackagedirectlyfromthecache
folderincaseofneed,thusrequiringanewdownload.Itshouldbeavoidedunlessthereisanimmediateneedfordiskspace.
Becauseoftheabovelimitations,consideranalternativeformorecontroloverwhichpackages,andhowmany,aredeletedfromthecache:
Thepaccachescript,providedbythepacman(https://www.archlinux.org/packages/?name=pacman)packageitself,deletesallcachedversionsofeachpackageregardlessof
whethertheyareinstalledornot,exceptforthemostrecent3,bydefault:
#paccache-r
Tip:Youcancreate#Hookstorunthisautomaticallyaftereverypacmantransaction.Seethisthread(https://bbs.archlinux.org/viewtopic.php?pid=1694743#
p1694743)forexamples.
Youcanalsodefinehowmanyrecentversionsyouwanttokeep:
#paccache-rk1
Toremoveallcachedversionsofuninstalledpackages,re-runpaccachewith:
#paccache-ruk0
See paccache-h formoreoptions.
pkgcacheclean(https://aur.archlinux.org/packages/pkgcacheclean/)AURandpacleaner(https://aur.archlinux.org/packages/pacleaner/)AURaretwofurtheralternatives.
Additionalcommands
Downloadapackagewithoutinstallingit:
#pacman-Swpackage_name
Installa'local'packagethatisnotfromaremoterepository(e.g.thepackageisfromtheAUR):
#pacman-U/path/to/package/package_name-version.pkg.tar.xz
Tokeepacopyofthelocalpackageinpacman'scache,use:
#pacman-Ufile:///path/to/package/package_name-version.pkg.tar.xz
Installa'remote'package(notfromarepositorystatedinpacman'sconfigurationfiles):
#pacman-Uhttp://www.example.com/repo/example.pkg.tar.xz
Toinhibitthe -S , -U and -R actions, -p canbeused.
Pacmanalwayslistspackagestobeinstalledorremovedandasksforpermissionbeforeittakesaction.
Installationreason
Thepacmandatabasedistinguishestheinstalledpackagesintwogroupsaccordingtothereasonwhytheywereinstalled:
explicitly-installed:thepackagesthatwereliterallypassedtoagenericpacman -S or -U command;
dependencies:thepackagesthat,despitenever(ingeneral)havingbeenpassedtoapacmaninstallationcommand,wereimplicitlyinstalledbecauserequired
byanotherpackagethatwasexplicitlyinstalled.
Wheninstallingapackage,itispossibletoforceitsinstallationreasontodependencywith:
#pacman-S--asdepspackage_name
Tip:Installingoptionaldependencieswith --asdeps willcauseitsuchthatifyouremoveorphans,pacmanwillalsoremoveleftoveroptionaldependencies.
Whenreinstallingapackage,though,thecurrentinstallationreasonispreservedbydefault.
Thelistofexplicitly-installedpackagescanbeshownwith pacman-Qe ,whilethecomplementarylistofdependenciescanbeshownwith pacman-Qd .
Tochangetheinstallationreasonofanalreadyinstalledpackage,execute:
#pacman-D--asdepspackage_name
Use --asexplicit todotheoppositeoperation.
Searchforapackagethatcontainsaspecificfile
Syncthefilesdatabase:
#pacman-Fy
Searchforapackagecontainingafile,e.g.:
#pacman-Fspacman
core/pacman5.0.1-4
usr/bin/pacman
usr/share/bash-completion/completions/pacman
extra/xscreensaver5.36-1
usr/lib/xscreensaver/pacman
Tip:Youcansetacronjoborasystemdtimertosyncthefilesdatabaseregularly.
Foradvancedfunctionalityinstallpkgfile,whichusesaseparatedatabasewithallfilesandtheirassociatedpackages.
Configuration
Pacman'ssettingsarelocatedin /etc/pacman.conf :thisistheplacewheretheuserconfigurestheprogramtoworkinthedesiredmanner.In-depthinformationabout
theconfigurationfilecanbefoundinpacman.conf(5)(https://jlk.fjfi.cvut.cz/arch/manpages/man/pacman.conf.5).
Generaloptions
Generaloptionsareinthe [options] section.Readpacman(8)(https://jlk.fjfi.cvut.cz/arch/manpages/man/pacman.8)orlookinthedefault pacman.conf forinformationon
whatcanbedonehere.
Comparingversionsbeforeupdating
Toseeoldandnewversionsofavailablepackages,uncommentthe"VerbosePkgLists"linein /etc/pacman.conf .Theoutputof pacman-Syu willbelikethis:
Package(6)OldVersionNewVersionNetChangeDownloadSize
extra/libmariadbclient10.1.9-410.1.10-10.03MiB4.35MiB
extra/libpng1.6.19-11.6.20-10.00MiB0.23MiB
extra/mariadb10.1.9-410.1.10-10.26MiB13.80MiB
Skippackagefrombeingupgraded
Warning:Becarefulinskippingpackages,sincepartialupgradesareunsupported.
Tohaveaspecificpackageskippedwhenupgradingthesystem,specifyitassuch:
IgnorePkg=linux
Formultiplepackagesuseaspace-separatedlist,oruseadditional IgnorePkg lines.Also,globpatternscanbeused.Ifyouwanttoskippackagesjustonce,youcanalso
usethe --ignore optiononthecommand-line-thistimewithacomma-separatedlist.
Itwillstillbepossibletoupgradetheignoredpackagesusing pacman-S :inthiscasepacmanwillremindyouthatthepackageshavebeenincludedinan IgnorePkg
statement.
Skippackagegroupfrombeingupgraded
Warning:Becarefulinskippingpackagegroups,sincepartialupgradesareunsupported.
Aswithpackages,skippingawholepackagegroupisalsopossible:
IgnoreGroup=gnome
Skipfilefrombeingupgraded
Allfileslistedwitha NoUpgrade directivewillneverbetouchedduringapackageinstall/upgrade,andthenewfileswillbeinstalledwitha.pacnewextension.
NoUpgrade=path/to/file
Note:Thepathreferstofilesinthepackagearchive.Therefore,donotincludetheleadingslash.
Skipfilesfrombeinginstalledtosystem
Toalwaysskipinstallationofspecificdirectorieslistthemunder NoExtract .Forexample,toavoidinstallationofsystemdunitsusethis:
NoExtract=usr/lib/systemd/system/*
Laterrulesoverridepreviousones,andyoucannegatearulebyprepending ! .
Tip:Pacmanissueswarningmessagesaboutmissinglocaleswhenupdatingapackageforwhichlocaleshavebeenclearedbylocalepurgeorbleachbit.Commenting
the CheckSpace optionin pacman.conf suppressessuchwarnings,butconsiderthatthespace-checkingfunctionalitywillbedisabledforallpackages.
Maintainseveralconfigurationfiles
Ifyouhaveseveralconfigurationfiles(e.g.mainconfigurationandconfigurationwithtestingrepositoryenabled)andwouldhavetoshareoptionsbetween
configurationsyoumayuse Include optiondeclaredintheconfigurationfiles,e.g.:
Include=/path/to/common/settings
where /path/to/common/settings filecontainsthesameoptionsforbothconfigurations.
Hooks
Pacmancanrunpre-andpost-transactionhooksfromthe /usr/share/libalpm/hooks/ directory;moredirectoriescanbespecifiedwiththe HookDir optionin pacman.conf ,
whichdefaultsto /etc/pacman.d/hooks .Hookfilenamesmustbesuffixedwith.hook.
Pacmanhooksareused,forexample,incombinationwith systemd-sysusers and systemd-tmpfiles toautomaticallycreatesystemusersandfilesduringtheinstallationof
packages.Forexample,package tomcat8 specifiesthatitwantsasystemusercalled tomcat8 andcertaindirectoriesownedbythisuser.Thepacmanhooks
systemd-sysusers.hook and systemd-tmpfiles.hook invoke systemd-sysusers and systemd-tmpfiles whenpacmandeterminesthatpackage tomcat8 containsfilesspecifying
usersandtmpfiles.
Formoreinformationonalpmhooks,seealpm-hooks(5)(https://jlk.fjfi.cvut.cz/arch/manpages/man/alpm-hooks.5).
Repositoriesandmirrors
Besidesthespecial[options]section,eachother [section] in pacman.conf definesapackagerepositorytobeused.Arepositoryisalogicalcollectionofpackages,
whicharephysicallystoredononeormoreservers:forthisreasoneachserveriscalledamirrorfortherepository.
Repositoriesaredistinguishedbetweenofficialandunofficial.Theorderofrepositoriesintheconfigurationfilematters;repositorieslistedfirstwilltakeprecedence
overthoselistedlaterinthefilewhenpackagesintworepositorieshaveidenticalnames,regardlessofversionnumber.Inordertousearepositoryafteraddingit,you
willneedtoupgradethewholesystemfirst.
Eachrepositorysectionallowsdefiningthelistofitsmirrorsdirectlyorinadedicatedexternalfilethroughthe Include directive:forexample,themirrorsforthe
officialrepositoriesareincludedfrom /etc/pacman.d/mirrorlist .SeetheMirrorsarticleformirrorconfiguration.
Packagesecurity
Pacmansupportspackagesignatures,whichaddanextralayerofsecuritytothepackages.Thedefaultconfiguration, SigLevel=RequiredDatabaseOptional ,enables
signatureverificationforallthepackagesonagloballevel:thiscanbeoverriddenbyper-repository SigLevel lines.Formoredetailsonpackagesigningandsignature
verification,takealookatpacman-key.
Troubleshooting
"Failedtocommittransaction(conflictingfiles)"error
Ifyouseethefollowingerror:[1](https://bbs.archlinux.org/viewtopic.php?id=56373)
error:couldnotpreparetransaction
error:failedtocommittransaction(conflictingfiles)
package:/path/to/fileexistsinfilesystem
Errorsoccurred,nopackageswereupgraded.
Whythisishappening:pacmanhasdetectedafileconflict,andbydesign,willnotoverwritefilesforyou.Thisisadesignfeature,notaflaw.
Theproblemisusuallytrivialtosolve.Asafewayistofirstcheckifanotherpackageownsthefile( pacman-Qo/path/to/file ).Ifthefileisownedbyanotherpackage,
fileabugreport.Ifthefileisnotownedbyanotherpackage,renamethefilewhich'existsinfilesystem'andre-issuetheupdatecommand.Ifallgoeswell,thefile
maythenberemoved.
Ifyouhadinstalledaprogrammanuallywithoutusingpacmanorafrontend,forexamplethrough makeinstall ,youhavetoremoveitandallitsfilesandreinstall
properlyusingpacman.SeealsoPacmantips#Identifyfilesnotownedbyanypackage.
Everyinstalledpackageprovidesa /var/lib/pacman/local/$package-$version/files filethatcontainsmetadataaboutthispackage.Ifthisfilegetscorrupted,isemptyor
goesmissing,itresultsin fileexistsinfilesystem errorswhentryingtoupdatethepackage.Suchanerrorusuallyconcernsonlyonepackage.Insteadofmanually
renamingandlaterremovingallthefilesthatbelongtothepackageinquestion,youmayexceptionallyrun pacman-S--force$package toforcepacmantooverwrite
thesefiles.
Warning:Takecarewhenusingthe --force switch(forexample pacman-Syu--force )asitcancausemajorproblemsifusedimproperly.Itishighlyrecommendedto
onlyusethisoptionwhentheArchnewsinstructstheusertodoso.
"Failedtocommittransaction(invalidorcorruptedpackage)"error
Lookfor.partfiles(partiallydownloadedpackages)in /var/cache/pacman/pkg andremovethem(oftencausedbyusageofacustom XferCommand in pacman.conf ).
#find/var/cache/pacman/pkg/-iname"*.part"-execrm{}\;
"Failedtoinittransaction(unabletolockdatabase)"error
Whenpacmanisabouttoalterthepackagedatabase,forexampleinstallingapackage,itcreatesalockfileat /var/lib/pacman/db.lck .Thispreventsanotherinstanceof
pacmanfromtryingtoalterthepackagedatabaseatthesametime.
Ifpacmanisinterruptedwhilechangingthedatabase,thisstalelockfilecanremain.Ifyouarecertainthatnoinstancesofpacmanarerunningthendeletethelock
file:
#rm/var/lib/pacman/db.lck
Packagescannotberetrievedoninstallation
Thiserrormanifestsas Notfoundinsyncdb , Targetnotfound or Failedretrievingfile .
Firstly,ensurethepackageactuallyexists(andwatchoutfortypos!).Ifcertainthepackageexists,yourpackagelistmaybeout-of-dateoryourrepositoriesmaybe
incorrectlyconfigured.Tryrunning pacman-Syyu toforcearefreshofallpackagelistsandupgrade.
Itcouldalsobethattherepositorycontainingthepackageisnotenabledonyoursystem,e.g.thepackagecouldbeinthemultilibrepository,butmultilibisnot
enabledinyour pacman.conf .
SeealsoFAQ#Whyisthereonlyasingleversionofeachsharedlibraryintheofficialrepositories?.
Manuallyreinstallingpacman
Warning:Itisextremelyeasytobreakyoursystemevenworseusingthisapproach.Usethisonlyasalastresortifthemethodfrom#Pacmancrashesduringan
upgradeisnotanoption.
Evenifpacmanisterriblybroken,youcanfixitmanuallybydownloadingthelatestpackagesandextractingthemtothecorrectlocations.Theroughstepstoperform
are
1.
2.
3.
4.
5.
Determinedependenciestoinstall
Downloadeachpackagefromamirrorofyourchoice
Extracteachpackagetoroot
Reinstallthesepackageswith pacman-S--force toupdatethepackagedatabaseaccordingly
Doafullsystemupgrade
IfyouhaveahealthyArchsystemonhand,youcanseethefulllistofdependencieswith
$pacman-Q$(pactree-upacman)
butyoumayonlyneedtoupdateafewofthemdependingonyourissue.Anexampleofextractingapackageis
#tar-xvpwfpackage.tar.xz-C/--exclude.PKGINFO--exclude.INSTALL--exclude.MTREE--exclude.BUILDINFO
Notetheuseofthe w flagforinteractivemode.Runningnon-interactivelyisveryriskysinceyoumightendupoverwritinganimportantfile.Alsotakecaretoextract
packagesinthecorrectorder(i.e.dependenciesfirst).Thisforumpost(https://bbs.archlinux.org/viewtopic.php?id=95007)containsanexampleofthisprocess
whereonlyacouplepacmandependenciesarebroken.
Pacmancrashesduringanupgrade
Inthecasethatpacmancrasheswitha"databasewrite"errorwhileremovingpackages,andreinstallingorupgradingpackagesfailsthereafter,dothefollowing:
BootusingtheArchinstallationmedia.Preferablyusearecentmediasothatthepacmanversionmatches/isnewerthanthesystem.
Mountthesystem'srootfilesystem,e.g. mount/dev/sdaX/mnt asroot,andcheckthemounthassufficientspacewith df-h
Mounttheproc,sysanddevfilesystemsaswell: mount-tprocproc/mnt/proc;mount--rbind/sys/mnt/sys;mount--rbind/dev/mnt/dev
Ifthesystemusesdefaultdatabaseanddirectorylocations,youcannowupdatethesystem'spacmandatabaseandupgradeitvia
pacman--root=/mnt--cachedir=/mnt/var/cache/pacman/pkg-Syyu asroot.
5. Aftertheupgrade,onewaytodouble-checkfornotupgradedbutstillbrokenpackages: find/mnt/usr/lib-size0
6. Followedbyare-installofanystillbrokenpackagevia pacman--root/mnt--cachedir=/mnt/var/cache/pacman/pkg-Spackage .
1.
2.
3.
4.
"Unabletofindrootdevice"errorafterrebooting
Mostlikelyyourinitramfsgotbrokenduringakernelupdate(improperuseofpacman's --force optioncanbeacause).Youhavetwooptions;first,trytheFallback
entry.
Tip:IncaseyouremovedtheFallbackentry,youcanalwayspressthe Tab keywhenthebootloadermenushowsup(forSyslinux)or e (forGRUBorsystemd-boot),
renameit initramfs-linux-fallback.img andpress Enter or b (dependingonyourbootloader)tobootwiththenewparameters.
Oncethesystemstarts,runthiscommand(forthestocklinux(https://www.archlinux.org/packages/?name=linux)kernel)eitherfromtheconsoleorfromaterminalto
rebuildtheinitramfsimage:
#mkinitcpio-plinux
Ifthatdoesnotwork,fromacurrentArchrelease(CD/DVDorUSBstick),mountyourrootandbootpartitions.Thenchrootusingarch-chroot:
#arch-chroot/mnt
#pacman-Syumkinitcpiosystemdlinux
Note:
Ifyoudonothaveacurrentreleaseorifyouonlyhavesomeother"live"Linuxdistributionlayingaround,youcanchrootusingtheoldfashionedway.
Obviously,therewillbemoretypingthansimplyrunningthe arch-chroot script.
Ifpacmanfailswith Couldnotresolvehost ,pleasecheckyourinternetconnection.
Ifyoucannotenterthearch-chrootorchrootenvironmentbutneedtore-installpackagesyoucanusethecommand pacman-r/mnt-Syufoobar tousepacman
onyourrootpartition.
Reinstallingthekernel(thelinux(https://www.archlinux.org/packages/?name=linux)package)willautomaticallyre-generatetheinitramfsimagewith mkinitcpio-plinux .
Thereisnoneedtodothisseparately.
Afterwards,itisrecommendedthatyourun exit , umount/mnt/{boot,} and reboot .
Signaturefrom"User<email@example.org>"isunknowntrust,installationfailed
Youcantrytoeither:
updatetheknownkeys,i.e. pacman-key--refresh-keys
manuallyupgradearchlinux-keyring(https://www.archlinux.org/packages/?name=archlinux-keyring)packagefirst,i.e. pacman-Syarchlinux-keyring&&pacman-Su
followpacman-key#Resettingallthekeys
RequestonimportingPGPkeys
IfinstallingArchwithanoutdatedISO,youarelikelypromptedtoimportPGPkeys.Agreetodownloadthekeytoproceed.IfyouareunabletoaddthePGPkey
successfully,updatethekeyringorupgradearchlinux-keyring(https://www.archlinux.org/packages/?name=archlinux-keyring)(seeabove).
Error:key"0123456789ABCDEF"couldnotbelookedupremotely
Ifpackagesaresignedwithnewkeys,whichwereonlyrecentlyaddedtoarchlinux-keyring(https://www.archlinux.org/packages/?name=archlinux-keyring),thesekeysare
notlocallyavailableduringupdate(chicken-egg-problem).Theinstalledarchlinux-keyring(https://www.archlinux.org/packages/?name=archlinux-keyring)doesnotcontain
thekey,untilitisupdated.Pacmantriestobypassthisbyalookupthroughakey-server,whichmightnotbepossiblee.g.behindproxysorfirewallsandresultsinthe
statederror.Upgradearchlinux-keyring(https://www.archlinux.org/packages/?name=archlinux-keyring)firstasshownabove.
Signaturefrom"User<email@archlinux.org>"isinvalid,installationfailed
Whenthesystemtimeisfaulty,signingkeysareconsideredexpired(orinvalid)andsignaturechecksonpackageswillfailwiththefollowingerror:
error:package:signaturefrom"User<email@archlinux.org>"isinvalid
error:failedtocommittransaction(invalidorcorruptedpackage(PGPsignature))
Errorsoccured,nopackageswereupgraded.
Makesuretocorrectthetime,forexamplewith ntpd-qg runasroot,andrun hwclock-w asrootbeforesubsequentinstallationsorupgrades.
"Warning:currentlocaleisinvalid;usingdefault"C"locale"error
Astheerrormessagesays,yourlocaleisnotcorrectlyconfigured.SeeLocale.
Pacmandoesnothonorproxysettings
Makesurethattherelevantenvironmentvariables( $http_proxy , $ftp_proxy etc.)aresetup.Ifyouusepacmanwithsudo,youneedtoconfiguresudotopassthese
environmentvariablestopacman.
HowdoIreinstallallpackages,retaininginformationonwhethersomethingwasexplicitlyinstalledorasadependency?
Toreinstallallthenativepackages: pacman-Qnq|pacman-S- (the -S optionpreservestheinstallationreasonbydefault).
Youwillthenneedtoreinstallalltheforeignpackages,whichcanbelistedwith pacman-Qmq .
"Cannotopensharedobjectfile"error
Itlookslikepreviouspacmantransactionremovedorcorruptedsharedlibrariesneededforpacmanitself.
Torecoverfromthissituationyouneedtounpackrequiredlibrariestoyourfilesystemmanually.Firstfindwhatpackagecontainsthemissedlibraryandthenlocateit
inthepacmancache( /var/cache/pacman/pkg/ ).Unpackrequiredsharedlibrarytothefilesystem.Thiswillallowtorunpacman.
Nowyouneedtoreinstallthebrokenpackage.Notethatyouneedtouse --force flagasyoujustunpackedsystemfilesandpacmandoesnotknowaboutit.Pacman
willcorrectlyreplaceoursharedlibraryfilewithonefrompackage.
That'sit.Updatetherestofthesystem.
Freezeofpackagedownloads
Someissueshavebeenreportedregardingnetworkproblemsthatpreventpacmanfromupdating/synchronizingrepositories.[2](https://bbs.archlinux.org/viewtop
ic.php?id=68944)[3](https://bbs.archlinux.org/viewtopic.php?id=65728)WheninstallingArchLinuxnatively,theseissueshavebeenresolvedbyreplacingthe
defaultpacmanfiledownloaderwithanalternative(seeImprovepacmanperformanceformoredetails).WheninstallingArchLinuxasaguestOSinVirtualBox,
thisissuehasalsobeenaddressedbyusingHostinterfaceinsteadofNATinthemachineproperties.
Failedretrievingfile'core.db'frommirror
Ifyoureceivethiserrormessagewithcorrectmirrors,trysettingadifferentnameserver.
Understanding
Whathappensduringpackageinstall/upgrade/removal
Whensuccessfullycompletingapackagetransaction,pacmanperformsforthefollowinghigh-levelsteps:
1.
2.
3.
4.
pacmanobtainstheto-beinstalledpackagefileforallpackagesqueuedinatransaction
pacmanperformsvariouschecksthatthepackagescanlikelybeinstalled
ifpre-existingpacman PreTransaction hooksapply,theyareexecuted
Eachpackageisinstalled/upgraded/removedinturn
1. ifthepackagehasaninstallscript,its pre_install functionisexecuted(or pre_upgrade or pre_remove inthecaseofanupgradedorremovedpackage)
2. pacmandeletesallthefilesfromapre-existingversionofthepackage(inthecaseofanupgradedorremovedpackage)
3. pacmanuntarsthepackageanddumpsitsfilesintothefilesystem(inthecaseofaninstalledorupgradedpackage)
4. ifthepackagehasaninstallscript,its post_install functionisexecuted(or post_upgrade or post_remove inthecaseofanupgradedorremovedpackage)
5. ifpacman PostTransaction hooksthatexistattheendofthetransactionapply,theyareexecuted
Seealso
PacmanHomePage(https://www.archlinux.org/pacman/)
libalpm(3)(https://jlk.fjfi.cvut.cz/arch/manpages/man/libalpm.3)
pacman(8)(https://jlk.fjfi.cvut.cz/arch/manpages/man/pacman.8)
pacman.conf(5)(https://jlk.fjfi.cvut.cz/arch/manpages/man/pacman.conf.5)
repo-add(8)(https://jlk.fjfi.cvut.cz/arch/manpages/man/repo-add.8)
Retrievedfrom"https://wiki.archlinux.org/index.php?title=Pacman&oldid=514872"
Thispagewaslasteditedon25March2018,at05:49.
ContentisavailableunderGNUFreeDocumentationLicense1.3orlaterunlessotherwisenoted.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising