When I executed “sudo chown root:root /usr/”, something erroneous happened. The “sudo” command was unable to execute until I ran “chmod 4755 /usr/bin/sudo”. However, there are still some issues.
I am unable to log back in after my system goes to sleep, even though my password is correct.
Also, When I ran “passwd” or “chsh -s /bin/zsh”, I received an error message that says “Authentication service cannot retrieve authentication info” after input my password, I was able to run the “sudo” command using the same password.
I suspect that the reason for this issue is due to running the command “sudo chown root:root /usr/”. Can someone help me with this?
I bet.
This is a difficult question - there is no one-size-fits-all here.
You could let pacman tell you what has changed … lines beginning with warning:
pacman -Qkk | grep -e 'warning:'
Or you could search using sudo (to avoid unreadable files) and the keyword mismatch
pacman -Qkk | grep -e "mismatch"
Or limiting to files installed to /usr
pacman -Qkk | grep -e "/usr" | grep -e "mismatch"
You would then have to decide what to do … but be careful - a lot will have changed and most of them will be valid changes - and not everything needs to be reverted
Example is pacman-mirrors mirror pool will give errors because it is downloaded when pacman-mirrors is executed.
warning: pacman-mirrors: /usr/share/pacman-mirrors/mirrors.json (Modification time mismatch)
warning: pacman-mirrors: /usr/share/pacman-mirrors/mirrors.json (Size mismatch)
warning: pacman-mirrors: /usr/share/pacman-mirrors/mirrors.json (MD5 checksum mismatch)
warning: pacman-mirrors: /usr/share/pacman-mirrors/mirrors.json (SHA256 checksum mismatch)
if you look at the mtree file for each package in /var/lib/pacman/local there is a mode for files and folders - the mode being permissions.
It would likely be possible to parse the data and apply package default modes to files - and I would be very surprised if the util has not already been created.
This wiki section describes a rescue of an USB stick but it could be your system booted using a live USB
This article describes a similar approach as @Mirdarthos has described below - also using a live ISO
Hmm, it doesn’t look as if that works:
$ pacman -Qkk /usr | grep -e 'warning:'
error: package '/usr' was not found
warning: '/usr' is a file, you might want to use -p/--file.
$ pacman -pQkk /usr | grep -e 'warning:'
error: could not open file /usr: Error reading fd 5
error: could not load package '/usr': cannot open package file
Yeah, I’m very curious and just wanted to see what it reports.
I know - the /usr was an untested attempt to only list files from /usr - it should likely be a part of the grep expression instead
pacman -Qkk | grep -e "/usr" | grep -e "mismatch"
Could do something like this:
This is only a theory, unverified.
- Boot into a live environment;
- Mount the Linux installation;
- Run the following to set the permissions the same on the installation as on the live environment:
sudo find /usr/ -exec 'sudo chown /path/to/mounted/installation{} --reference={}' \;
Or that’s the theory anyway. Any file not on the original ISO will obviously not be changed…
Thanks. But the problem was not solved after I executed “sudo find /usr/ -exec sudo chown --reference={} /mnt/usr/ ;” in live image.
As root run this - remember not everything is an error …
Your resulting output may be entirely different.
E.g. I changed permission on /usr/share/pacman-mirrors/mirrors.json
from 644 to 666 for the purpose of testing this
chmod 666 /usr/share/pacman-mirrors/mirrors.json
Then I excuted
# paccheck --file-properties $(pacman -Qq) | grep -e '/usr' | grep -e 'permission mismatch'
libutempter: '/usr/lib/utempter/utempter' permission mismatch (expected 2711)
pacman-mirrors: '/usr/share/pacman-mirrors/mirrors.json' permission mismatch (expected 644)
Perhaps this helps:
I don’t know, I’ve just come across it.