.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
| Suffix | When it appears | Which file is which |
|---|---|---|
.pacnew | An upgrade brings a new version of a file you had edited | Yours stays in place; the new one is the .pacnew |
.pacsave | A removal takes a package whose configuration you had edited | The package is gone; your edited file is kept as the .pacsave |
.pacorig | An install finds a file already there that no package owns | The 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.
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.
grep -i pacnew /var/log/pacman.logThe log records what every transaction did, including the lines about files kept back.
find /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
- 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 pacman
diff /etc/pacman.conf /etc/pacman.conf.pacnew - 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.
- 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:
sudo pacman -Rns firefoxThe 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.