''root is not in the sudoers file.' - Sudo broken after update

Hi there, I know this is probably trivial to most of you. I just need a bit of guidance to solve this issue.

During a system update (where ‘sudo’ was one of the upgrading package) my computer crashed. I rebooted my computer to find that running sudo pacman -Syu would result in the output USER is not in the sudoers file.. After a quick search on the forum here I found someone who seemed to have encountered the same issue and I followed the steps they took to solve the issue. I ran:

run0 rm -r /var/lib/pacman/db.lck

run0 pacman -Syu

run0 pacman -S sudo

This allowed for all the packages to be reinstalled correctly this time, and I reinstalled ‘sudo’ but this did not solve the issue. So I tried running run0 visudo to manually add my username to the sudo file, only to find an empty file. With sudo not functioning, I have not been able to install packages from the AUR which is not nice.

Also, I forgot to mention that running su then sudo visudo results in a funny error message of root is not in the sudoers file..

What steps should I take to solve this problem?

Put a stock sudoers file into place, I suppose.

Try this: run0 mv /etc/sudoers.pacnew /etc/sudoers

As a side note, you shouldn’t edit /etc/sudoers. Instead, add a drop-in to /etc/sudoers.d/.

Thanks for your help :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.