Home Arch LinuxWhat Are .pacnew Files in Arch Linux and How to Handle Them Safely

What Are .pacnew Files in Arch Linux and How to Handle Them Safely

By sk
Published: Updated: 999 views 5 mins read

If you use Arch Linux or an Arch-based distro like Manjaro or EndeavourOS, you've probably seen some files ending in .pacnew inside your /etc directory. These files often appear after system updates, and many new users aren't sure what to do with them. Ignoring them can lead to outdated settings or configuration conflicts later on.

In this brief tutorial, we will learn what pacnew files are, why they appear, and how you can safely deal with them in Arch Linux and its variants.

What is a .pacnew File?

The .pacnew files in Arch Linux are new versions of configuration files that appear when you update packages containing files you've previously modified. They let you safely review and merge new upstream changes without losing your custom settings. You can manage and merge them using the pacdiff tool from the pacman-contrib package.

When you update your system with pacman -Syu, the package manager checks whether your configuration files have been changed locally. If you or an application have modified one of those files, pacman does not overwrite it during the update.

Instead, it installs the new version from the package as a .pacnew file right next to your existing one.

For example:

/etc/ssh/sshd_config
/etc/ssh/sshd_config.pacnew

This means your current sshd_config file remains active, while the .pacnew file contains the latest version from the updated package.

Why Pacman Creates .pacnew Files

Pacman uses a simple logic:

  • If the file in /etc is unchanged since installation, it gets overwritten automatically with the new version.
  • If it has been modified locally, pacman creates a .pacnew file instead.

That's why a .pacnew is a sign that something changed your file, either you, a system utility, the maintainer, or a configuration tool.

Why You Should Not Ignore .pacnew Files

It's easy to overlook .pacnew files, but doing so can cause issues later.

Here's why they matter:

  • They often include security updates and new default options.
  • They can fix outdated settings that may stop working in future releases.
  • They help you keep your system aligned with upstream package defaults.

If you ignore them, your system may run with old configurations that no longer match the software version you're using.

How to Find .pacnew Files on Your System

To locate every .pacnew file in your system, run:

sudo find /etc -type f -name "*.pacnew"

For an easier method, use pacdiff (part of pacman-contrib):

sudo pacman -S pacman-contrib
sudo pacdiff

pacdiff scans your system for .pacnew, .pacsave, and .pacorig files, then helps you view and merge them interactively.

How to Handle .pacnew Files Correctly

Here's the step-by-step process for safely reviewing and merging .pacnew files.

Step 1: Compare the Files

Use a terminal diff tool to compare the current file and its .pacnew counterpart:

sudo diff -u /etc/ssh/sshd_config /etc/ssh/sshd_config.pacnew

Or use a graphical diff tool, for example Meld:

sudo meld /etc/ssh/sshd_config /etc/ssh/sshd_config.pacnew

This shows exactly what changed.

Step 2: Decide Whether to Merge or Replace

SituationWhat You Should Do
You never changed the old fileReplace it with the .pacnew version
You modified it yourselfMerge the new lines manually
You're unsureReview the diff carefully before deciding

If you didn't make any edits, you can safely replace the old file:

sudo mv /etc/ssh/sshd_config.pacnew /etc/ssh/sshd_config

If you have custom settings, merge the new options manually and keep your existing changes.

Step 3: Clean Up and Restart Services

After merging or replacing, remove leftover .pacnew files:

sudo rm /etc/ssh/sshd_config.pacnew

Then restart the related service to apply changes:

sudo systemctl restart sshd

Best Practice: Review After Every System Update

After every full system upgrade or kernel update, run:

sudo pacdiff

This quick check helps you catch new .pacnew files right away, keeping your configuration files fresh and consistent with upstream packages.

Summary: Keep Your Arch Linux System Clean and Secure

TaskCommand
Find all .pacnew filessudo find /etc -type f -name "*.pacnew"
Review and merge themsudo pacdiff or diff -u old new
Replace unchanged configssudo mv file.pacnew file
Remove merged onessudo rm file.pacnew

Frequently Asked Questions (FAQ) About .pacnew Files

Q: Why does Arch Linux create .pacnew files?

A: Pacman creates .pacnew files when a package upgrade includes a configuration file that you or a program previously modified. It preserves your existing file and saves the new version for you to review.

Q: Can I delete .pacnew files right away?

A: Only after you compare and merge them. Deleting them blindly can cause you to miss important security or compatibility changes.

Q: What is the easiest way to manage .pacnew files?

A: Install pacman-contrib and use the pacdiff tool. It automatically finds and lets you merge .pacnew files.

Q: Do .pacnew files appear on every Linux distribution?

A: No. They're specific to Arch Linux and other systems that use pacman as their package manager.

Conclusion

The .pacnew files aren't problems. They're part of pacman's functionality to protect your settings. By reviewing them after each system update, you'll keep your configuration files safe, secure, and in sync with upstream changes.

Make it a habit to check them regularly, and your Arch system will stay stable and future-proof.

Read Next:

References:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More