Skip to content

[Noob Question] How to deal with *.pacnew files

During an update, pacman warned that /etc/group, /etc/passwd, /etc/gshadow, and /etc/shadow had been added as pacnew files. I'm a bit lost as to what I'm supposed to do. After reading the wiki and some threads on the forum I gathered I am supposed to merge the files keeping user-specific modifications. I know how to use vimdiff but I can't find anything related to how these configuration files work. For instance, with the /etc/group file I figured lines related to user accounts should be preserved, but lines that look like 'uuid:x:{number}:' and 'dbus:x:{number}:' are absent from the pacnew file. Where can I find out what is needed and what is okay to remove?

I'm still new to Arch so please forgive me if I'm missing something obvious. Is there a somewhere I can read about how these files are supposed to look?

19 points22 comments
Open on Reddit
About this post
Posted
Archived
Score
19 · 100% up
Kind
Text
ID
62ppd3

Author

2
posts
4
comments
0
media
View profile

23 comments

Merge the pacnew into the old, not the old into the pacnew. The point of the pacnew is to indicate a default config has changed. Once you get the hang of it, you'll notice that most of the time you can just delete the pacnew. What you're looking for is new config options. You'll merge those in and perhaps customize them.

14 points

Is there a tool to assist users with this?

3 points

There's pacdiff, but it's not really a tool in the sense that you're hoping for. Basically, it just searches for *.pac{old,new,save} files, presents them to you, and gives you the option to view, skip, remove, or overwrite with them.

Personally, I use vimdiff to merge the pacnew file into my custom file (as /u/stonebit suggested), by doing this:

  • add stuff to old that has been added to pacnew
  • delete stuff from old that has been deleted from pacnew
  • modify stuff in old that has been modified in pacnew

Of course, in the last two cases, you need to be careful. For instance, if you've added a custom line in old, then vimdiff won't know that it was added to old as opposed to deleted from pacnew --- it'll look exactly the same in both cases. So you need to be aware of which changes are your own customizations, which need to be kept, vs. actual changes from upstream that need to be merged.

Afaik, there's no tool for dealing with this, but I guess you could find a copy of the default old file (without your own changes) and do a 3-way diff.

Edit: In the specific case of /etc/group.pacnew (and its ilk), see https://bbs.archlinux.org/viewtopic.php?id=182428 and https://bbs.archlinux.org/viewtopic.php?id=150119.

Edit2: I just ran pacdiff and, after vimdiffing each file, ended up just removing /etc/{group,passwd,shadow,gshadow}.pacnew without merging anything.

11 points

Diff to find the new options then I use a file editor to do changes and firefox to read up on them. There is no magic bullet because you have to understand what's new and what to do about it.

1 points

Merge the pacnew into the old, not the old into the pacnew.

So when the pacnew is strictly a subset of the old, as seems to be the case with /etc/group, we can simply delete the pacnew?

1 points

This is what seems to have changed. Apparently the default uuid and dbus users are not created in filesystem anymore, but instead in their respective packages. So simply ignoring this change and removing the pacnew files should be fine.

9 points

Would be nice to have a diff between the old default config file and the pacnew. Anyone got a one-liner handy for that?

2 points

I think you would need to download and extract the previous version of the package, unfortunately. So no fun 1 liners, instead a rather complex script.

1 points

A lot of the time the previous version would still be in the pacman cache. If not then it would be much more difficult.

1 points

What's wrong with the diff command ?

0 points

Diff against what? You need the unmodified original config file. Which would have to be extracted from the previous package. Which may need to be downloaded from an archive.

6 points
unknown author

Deleted before we saved it.

1 points

"git init" in all directories where that could happen. How bad is this idea?

0 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.