Pacnew/Pacsave hook issues

Since few updates I see every times something like this:

(17/19) Looking for Pacnew/Pacsave created.
sudo: unknown user michaldy
sudo: plugin initiation error of audit sudoers_audit
error: command was not performed correctly

This doesn’t seem to create any problems, but my user is “michaldybczak”, not “michaldy” so this alone shows some issue. I have no idea what this part is for and why the problem occurred, but it seems it won’t go away by itself.
Any suggestions?

a bad pacman hook ? at you to find it; for example

 grep 'Pacnew.Pacsave' /etc/pacman.d/hooks/* /usr/share/libalpm/hooks/*

pacman hooks run as admin

1 Like
 omano  ~ $  cat /usr/share/libalpm/scripts/pacnew-check
#!/bin/bash

#Test if pacnew/pacsave are created and create the spy file
/usr/bin/test "$(/usr/bin/pacdiff -o)"

if [[ "$?" -eq "0" ]]; then
    last_user=$(last | head -1 | cut -d' ' -f1) 
    sudo -u $last_user usr/bin/touch /tmp/pacnew-check.file
fi

Here is the target script. It is part of Manjaro Pacnew Checker by @Ste74

Neither do we without more information.

Note that I’ve moved this to a new topic.

1 Like

I suggest check last | head -1 to see if response shows the full username

and check if truncated username is a member of any groups

groups michaldy
1 Like

and that user name doesn’t ring a bell?

If user exists, then it was a race condition I guess, and the expected username was not at the expected position when that part of the script executed. If the user doesn’t exist, then more investigation is needed to understand where and what broke.

why we set a user ? more simple to make a chmod 666 ?

Since that doesn’t seem to ring a bell:
search the whole content of /etc for that phrase.

I don’t know how to do it with a graphical file manager
nor do I know the find or grep command to do it.

I use the “mc” file manager - and it’s search function would easily do it.

Something along the lines of:
grep michaldy /etc/*

This message has to be triggered somewhere …

maybe for recursion

grep -r michaldy /etc/

yes, at you to compare names, for example

last --since="-1d" | grep -i micha
grep -i micha /etc/passwd

with last, we have also ssh connections …

The message is triggered because it doesn’t find the “$user” in sudoers when trying to run the sudo -u $user command, and that $user is the first word of the first line of the last command output. Without any answer from michaldybczak, it is pointless to continue to try to help finding the reason. Output of last command? Output of cut -d: -f1 /etc/passwd?

Thank you for all your replays. It will take some time to process them and try things out. I will let you know how it went, once I’m done.

No hooks in first location, plenty in the second one.

/usr/share/libalpm/hooks/pacnew-checker.hook:Description = Looking for Pacnew/Pacsave created.

sudo: unknown user usr/bin/touch
sudo: intitiation error of audit plugin sudoers_audit

I guess we have a winner. This is the culprit - the pacnew-check script, generating the same error with “audit”. Besides, the place where the error shows suggests also that this is the script that is not working well. I could uninstall it, but it would be nice to have some automatic solution for pacnew files.

There was an app, “pacnew-chaser” written by some Manjaro member, and it worked well for years, but it was not developed anymore and is also producing errors, so I uninstalled it. It was way more convinient then this script…

All the various greps suggested here return my whole username, so it’s hard to spot the incorrect, shortened version. However, if we know this is the part of that new script, what now?

slight adaption - quote the name

not:
grep -r michaldy /etc/

but:
grep -r "michaldy" /etc/
instead :man_shrugging:

Can’t you use your file manager to do the search?
I don’t usually use the graphical tools, so I do not know how to use them.
I use “mc” - you could try that …

If I read it correctly, the script is digging out some incorrect username from somewhere, then applying it, then failing, since it doesn’t exists. So I need to find where the name is located…?

As to:

This also finds full “michaldybczak” name in results. However, I copied the result into text editor, removed the full name and searched for “michaldy” and… nothing.

Is it possible that the scrip is doing unexpected action dynamically truncating my user name, and this it doesn’t exist anywhere, but is error of that script?

Maybe it’s just better to use this command to manage pacnew files:

sudo DIFFPROG=meld pacdiff

which works fine, instead of some convoluted script that is a clear downgrade compared to already existing, old pacnew-chaser app, that should have been forged and upgraded, so it would simply work.

Just to check it, I reinstalled the script, run some update (I’m on unstable branch) and the issue still exists.

I use a BASH script that was originally posted on the old forum

#!/bin/bash
## ~/.local/bin/pacmeld
## Merge *.pacnew files with original configuration files
## requires pacman-contrib and meld

if [[ $(/usr/bin/pacdiff -o | /usr/bin/grep pacnew | /usr/bin/wc -l) == 0 ]]; then
  echo " no .pacnew files found"
else
  echo " .pacnew files found..."
  for i in $(/usr/bin/pacdiff -o | grep -e pacnew); do
    echo " Launching meld to merge $i with ${i/.pacnew/}"
    sleep 2
    /usr/bin/meld "admin://$i" "admin://${i/.pacnew/}"
  done
fi
1 Like

Doesn’t work. It complains about the syntax error with “fi” part.

insert another line before the final
fi

so the end looks like this:

done
fi
2 Likes

Just so you know, Manjaro Pacnew Checker works.

Now why does the command truncate your name in the result? I don’t know. And as you don’t provide what people ask, good luck.