Maintenance of .pacnew files?

Manjaro seems to suggest we occasionally handle .pacnew files: System Maintenance - Manjaro . Looking at their forums, there is a thread there 2023 about a tool to check for these automatically. This tool is supposed to popup a yad window and offer to open/edit/delete them: Check and manage pacnew files - QA - Manjaro Linux Forum .

Checking pamac, sure enough there is a manjaro-pacnew-checker which appears to be it. Installed, rebooted, tried pacman et. al. Haven’t noticed anything different yet. There are two executables, /bin/pacnew-checker and /bin/pacnew-checker0. Both of which cause some disk activity for about 30 seconds, but otherwise do not output anything.

Does anybody know, will this tool work in Mabox? Because I certainly have several .pacnew files that may need some tweaking:

me@my ~ $ sudo find / -name *.pacnew
find: ‘/proc/10531’: No such file or directory
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/run/user/1000/doc’: Permission denied
/etc/default/grub.pacnew
/etc/default/useradd.pacnew
/etc/systemd/logind.conf.pacnew
/etc/systemd/system.conf.pacnew
/etc/lightdm/lightdm.conf.pacnew
/etc/lightdm/lightdm-gtk-greeter.conf.pacnew
/etc/ssh/ssh_config.pacnew
/etc/clamav/clamd.conf.pacnew
/etc/clamav/freshclam.conf.pacnew
/etc/passwd.pacnew
/etc/shells.pacnew
/etc/makepkg.conf.pacnew
/etc/pacman.conf.pacnew
/etc/pamac.conf.pacnew
/etc/locale.gen.pacnew
/etc/mkinitcpio.conf.pacnew
/etc/pacman-mirrors.conf.pacnew
/etc/sudoers.pacnew
me@my ~ $ 

Thanks and have a great day! :slight_smile:

Noticed that now, a new post-transaction hook exists, Looking for Pacnew/Pacsave created, both in pamac and pacman:

:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Updating icon theme caches...
(3/4) Looking for Pacnew/Pacsave created.
(4/4) Updating the desktop file MIME type cache...

Does this tool only look for new .pacxxxx files? Was really hoping it would highlight all of the .pacxxxx files… looks like we still have to process the old ones manually.

A: It only pops up when a new .pacnew or .packsave file is created, then displays all of them.

Nice; there are a bunch. However, it did not include the ability to edit or merge changes - that must still be done manually.

So I created a python cli app to help do just that. It checks for xxdiff, python-send2trash, trash-cli, and installs these if needed. Then it finds all of the .pacnew and .packsave files on the disk, looks for the mating files, and presents a graphical diff to the user. They are then able to pick which parts they want to merge, and optionally, send the .pacnew file to the (root) trash.

So far I’ve tested this on two Mabox systems and it seems to work well, but sometimes the .conf file must still be manually edited.

Hi everyone, thanks for sharing these notes.
I am not an advanced user so You motivate me to investigate.
As I did not understand what You were talking about, I looked for information.
During updates I usually see the warning messages although I didn’t know what to do with that, I never worried because everything works, I assumed they were changes made by the update in the file location, I am not very clear about the structure of the operating systems so I never did anything with this.
I found in Archwiki the information I was missing and as far as I see the work has to be done manually, by looking at the number and size of changes I understand why they propose to do it after each update.
Mabox comes with Meld (diff viewer) so I did a search for the .pacnew and checked one as a test, I used pacman.conf against pacman.conf.pacnew.
I didn’t go any further because I’m not sure what I should do, not understanding what the changes I found in each file mean.
How do I know when to merge the files, when to delete them, when to replace the old ones with the new ones?
I am attaching some images because I see that you are looking at how to solve the file comparison issue, I don’t know if this helps or not, I hope I have contributed something.
I appreciate anything you can suggest me to solve this.
Thank You very much.
pacnew

Hi Claudio, I didn’t realize Mabox shipped with meld, which is very easy-to-use. So my script was changed to use that, thank you. I would like to share it soon.

In the photos you shared, meld shows the .conf file on left and .pacnew file on right. Differences in blue, and new content in green. But it will not let you make any changes (lock icon), as it must be run with sudo, because these files are owned by root.

Once meld is run as root (sudo meld file1 file2), the lock icon will change to a “download” or “save” icon. The blue and green sections will also have arrows on them, so you can move that entire block between sides. The files can also be edited by hand if desired.

For the pacman.conf file, look at the first blue match. The only differences are some spaces and the line is commented out in the .pacnew side. That must be the default behavior, however your setting is different (enabled), so leave that line alone.

For the second blue match, both are commented, so it is safe to move it to the left .conf file.

For the green match, your .conf has a commented option which does not appear in the defaults. Could be that this option was removed. I personally would manually remove this from the .conf file side, since it was not enabled anyways.

Once satisfied with the results, click the left .conf side “download” or “save” icon, and the file will be saved.

So the .pacnew files just contain default settings. But as a rolling-release changes and grows, sometimes those defaults may change. By merging these changes into your .conf files, you can keep your configuration up-to-date. :slight_smile:

1 Like

Hello @rdtsc, thank you very much for replying.
From what you tell me, can I consider the same criteria for all .conf vs .pacnew files?

I understand that I have to make the changes as sudo, I just put pacman.conf for reference.

In the picture above is a list of .pacnew files as shown by the find command where I can see “shells.pacnew” and “passwd.pacnew” but it doesn’t show any to compare and I also have “/run/user/1000gvfs” and “/run/user/1000doc” as permission denied at the bottom of the list.
I have no idea what to do with them, if you could give me some guidance or instructions, I would appreciate it.

I think I’m going to have to spend some time to understand this.
For now I’ll try using meld to get familiar with it and then I’ll try to make the changes, I’ll probably do some of them manually until I’m sure how to do it.

One last question, once the changes are made, do I delete the .pacnew files?

This is why I’m making a script - there are quite a few details to this. :slight_smile: Think I’m going to call this tool pacnewmerge.

When the find command lists a .pacnew file but nothing to compare it to, that program was removed or changed. So now only the .pacnew file remains and the original is gone. This will certainly happen for kernels, if you upgrade and remove the old one. Might be safe to delete such an “orphan”, but read on.

The /run/user/1000gvfs and other folders that are permission-denied are only an artifact of using the find command. Root actually cannot access those folders, well not directly anyway. The “gvfs” stands for “Gnome Virtual File System”, and that has historically been used to mount foreign devices into Linux, like smart phones. More info here: mountpoint - What is /run/user/1000/gvfs/ - Ask Ubuntu Anyways, this can be completely ignored.

In the pacnewmerge script being created, the “.pacnew with missing original files” are identified and the user is given the option to remove the .pacnew file. But rather than just delete them immediately with rm, these are sent to the (root) trash. So they may be restored if needed.

Once you merge any changes from a .pacnew into the original file, (say, pamac.conf), reboot and make sure that feature (pamac) still works as intended. If it does, you may trash or remove the .pacnew file.

It is possible to do this all by hand, but there are a lot of steps and it is cumbersome. Currently testing pacnewmerge on four Mabox machines. :slight_smile:

1 Like

Hi @rdtsc
Once again I am grateful for your explanations. And I hope your script works well.
Yesterday, after answering you, I googled meld and read about how it works, took an old configuration file that I don’t use, copied it with another name and modified some lines to test meld, compared them and made the modifications.
That allowed me to understand how it works. Now with your explanation I understand a little better what to do.
Let me see if I understood, the .pacnew file is the one that has the modifications but the current one is the original one, the one that ends in .conf so I understand that I must incorporate to the original file the modifications that the .pacnew file presents, restart the computer and if everything works well, I can delete the pacnew.
I also checked run/user/1000/gvfs etc. and found that they are directories and not files. Thanks to your explanation I now also understand what they are for and why it denies me access. This is clear.
Well, I’ll keep waiting for that script, meanwhile I’ll keep reading and learning.
Be well.

Interesting… unsure if this was by design, or a new addition to manjaro-pacnew-checker. But after a few times of that window popping up and us clicking OK, it now asks if you want to merge the .pacnew into the original file, just like how my script was working. Even asks if the .pacnew should be deleted afterwards. So looks like my script is now unneeded.

2 Likes

Hi @rdtsc I don’t understand what you mean by

Which window are you talking about?

Here you can see windows from this program →

This program uses pacman hook and systemd. It will start automatically after update, but only if .pacnew files are found. Then let you decide what to do.

The best option is: View & Merge. Which uses meld to compare the original with new file and to apply changes or not.

From my experience (already more than 10 years using Manjaro/Mabox):

  1. System will not break if you completly ignore .pacnew files
  2. Some Mabox users already broke Maboxlinux pacman repository configuration, because they applied new version of pacman.conf provided by .pacnew file. Without reviewing and understanding what they are doing.

So my advice is to either ignore or always use View & Merge option.

1 Like

Well, I’ve been reading what they say and the truth is that I couldn’t get much out of it.
It’s not clear to me if I have to install the script or pacman does it directly, I can’t find the commands to run it either, nor can I check if it’s running in the background.
I can use pacdiff the manual way as it always was but I find Meld more comfortable, probably due to my inexperience.
Some Manjaro users think that novices should not use it, much less Arch, I understand their position although I do not fully share it, first because Linus Torvalds created Linux to be accessible to all, not to create elites of users, in his own words, on the other hand if we do not use it how would we learn to use it? One told us to use Ubuntu, another sent us to Windows…
I started using Xubuntu, I moved away when it got heavy, when Cannonical got too Microsoft and the system stopped being what it was, I tried to use LMDE and it just didn’t work, I installed Manjaro Xfce and I had no problems, everything worked from the beginning, I had to investigate some things due to my lack of knowledge, I learned and moved on, at that time I met Mabox and I loved it for its design, usability, low resource consumption, in short, it is logical that new doubts arise, because as I advance I try things that I did not know.

I would really love to learn a lot more but I have limitations due to work, parenthood and I live in Argentina, which is not the most appropriate place in the world to develop when you live trying to make ends meet… And on top of that you are almost 64 years old.

My daughter is disabled, she requires a lot of attention from me, Linux appeared in my life as an option to Windows, I had no idea what could be done with it, I am discovering all this step by step, I had no big problems, when I have problems I look for information to solve them, sometimes I don’t understand what I read and I go to the community for help, I really like Mabox, I enjoy using it, surely, if I could acquire more knowledge I would do much better things, I would ask less, I would understand more, I do what I can. That’s the truth.

Anyway, it was not clear to me what to do with the .pacnew files.

Thank you all for reading.

1 Like

Followin the proposed link:

(System Maintenance - Manjaro)

I’m left with this suggestion:

“Unfortunately, there is no perfect roadmap on how to deal with these files. If you keep the original configuration file and the syntax has changed, the program may stop working or be unable to use the existing configuration. If you delete the original file and use the new file without any changes, all configuration settings may be overwritten. Sometimes you need to combine pieces of old and new files to make everything work. In these situations it is better to integrate the files manually”.