[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?
About this post
- Posted
- Archived
- Score
- 19 · 100% up
- Kind
- Text
- ID
- 62ppd3
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.
Is there a tool to assist users with this?
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
vimdiffto merge the pacnew file into my custom file (as /u/stonebit suggested), by doing this:Of course, in the last two cases, you need to be careful. For instance, if you've added a custom line in old, then
vimdiffwon'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
pacdiffand, after vimdiffing each file, ended up just removing/etc/{group,passwd,shadow,gshadow}.pacnewwithout merging anything.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.
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?
Yes. That is correct.
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.
Would be nice to have a diff between the old default config file and the pacnew. Anyone got a one-liner handy for that?
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.
A lot of the time the previous version would still be in the pacman cache. If not then it would be much more difficult.
What's wrong with the diff command ?
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.
etc-update
I don't know how to proceed either, so wait until https://www.archlinux.org/news/ tells you what to do.
Arch news won't tell you what to do with pacnew files.
Deleted before we saved it.
"git init" in all directories where that could happen. How bad is this idea?