Skip to the content
pacman-master.com

.pacnew and .pacsave files

When an upgrade carries a new version of a file under /etc that you had edited, pacman does not overwrite yours. It writes the new one beside it with .pacnew on the end and prints a line saying so, and the two then sit there until somebody merges them.

sudo pacman -Syu
-S
--sync — install packages from the repositories and upgrade the system
-y
--refresh — refresh the package databases from the mirrors
-u
--sysupgrade — upgrade every installed package that is out of date

Needs root.

What it does. Upgrades print a line for each configuration file that was kept back, and that line is the only notice you get.

Watch out. Nothing breaks the day a .pacnew appears. It breaks later, when the file you kept no longer has the options the new program expects.

Which file gets which suffix

SuffixWhen it appearsWhich file is which
.pacnewAn upgrade brings a new version of a file you had editedYours stays in place; the new one is the .pacnew
.pacsaveA removal takes a package whose configuration you had editedThe package is gone; your edited file is kept as the .pacsave
.pacorigAn install finds a file already there that no package ownsThe new one takes the real name; what was there is kept as the .pacorig

The rule behind the three is the same: pacman does not throw away a file a person edited, and it does not silently keep a file that a package has replaced. It puts both on disk and leaves the decision to you.

When an upgrade writes a .pacnew file and what to do nextA branch. An upgrade carries a new version of a file in /etc. If you never edited your copy, yours is replaced and there is nothing to do. If you did edit it, yours is kept and the new one is written beside it ending in .pacnew, which you then compare, merge and delete. A note at the left says removal mirrors this: pacman -R keeps an edited file as .pacsave and -Rn deletes it instead.An upgrade carries a new /etc fileDid you edit yours?noyesyours is replacednothing to doyours is keptthe new one lands as .pacnewcompare them and mergedelete the .pacnewRemoval is the mirror of this.pacman -R keeps an edited fileas .pacsave; -Rn deletes itinstead of saving it.sudo pacman -Rn firefoxcaution
A .pacnew is a notice, not a failure. Nothing was lost; two files are now sitting side by side.

Finding the ones waiting

The upgrade prints the line once and it scrolls away. Two ways to get the list back: the log, which is plain text, or the filesystem itself.

not pacmangrep -i pacnew /var/log/pacman.log

The log records what every transaction did, including the lines about files kept back.

not pacmanfind /etc -name '*.pacnew'

Neither of these is a pacman command, which is why they carry no level here. The pacman.conf page covers the file people hit this with most often.

Merging one

  1. Look at the difference, not the whole file. Most .pacnew files differ from yours in a handful of lines: a new option with a default, a comment that changed, a section that moved.
    not pacmandiff /etc/pacman.conf /etc/pacman.conf.pacnew
  2. Carry the new options across into your file. Working in that direction keeps your edits and picks up what the package added. Working the other way round means re-applying your edits from memory.
  3. Delete the .pacnew when you are done. An old one left lying about is indistinguishable from a new one the next time an upgrade writes one, and that is how they pile up.

A .pacnew that is deleted without being read is not a failure on the day, but the option it carried is one the program may expect later. The file that bites hardest in practice is a service configuration, where a missing new option means the service starts and then behaves differently from the way the documentation describes.

The other direction: .pacsave

Removal is the mirror of this. A plain removal keeps an edited configuration file as a .pacsave; adding n deletes it instead. That makes -Rn the flag to reach for when you want the package gone and not a trace of its configuration left behind, and the flag to avoid when you might reinstall:

cautionsudo pacman -Rns firefox

The n is the part that deletes the configuration rather than keeping it. The s is separate and is described on the removal page.

Old .pacsave files are worth sweeping out for the same reason as .pacnew files: they are dead weight that looks live.

Common questions

What is a .pacnew file on Arch Linux?

It is the new version of a configuration file that an upgrade brought, written beside your edited copy instead of over it. Your file keeps the real name and the new one gets the .pacnew suffix.

Can I just delete a .pacnew file?

You can, and nothing breaks that day. What you lose is whatever the package added: a new option, a changed default, a section the program will look for later. Reading the difference first takes a moment and avoids that.

What is the difference between .pacnew and .pacsave?

A .pacnew appears on an upgrade and holds the new version of a file you had edited. A .pacsave appears on a removal and holds your edited file after the package that owned it has gone.

How do I find every pacnew file waiting on my system?

Search /etc with find for names ending in .pacnew, or read back through /var/log/pacman.log, which records the line pacman printed when each one was written.

How to check this page

Two commands on your own machine: pacman -<operation> --help lists the modifiers that operation accepts, and man pacman opens the pacman(8) manual page these descriptions are written from. Where the descriptions come from, and what this site is not, is set out on the about page.

This page was last edited on .