-2

I have Ubuntu 16.04 and every time I try to install an app using the terminal (e.g. apt-get install git,) I get this message:

dpkg: error: requested operation requires superuser privilege
W: Could not open file '/var/log/apt/term.log' - OpenLog (13: Permission denied)
E: Sub-process /usr/bin/dpkg returned an error code (2)

So I executed sudo apt-get install git and I got this:

sudo: error in /etc/sudo.conf, line 0 while loading plugin 'sudoers_policy'
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins

How do I fix this?

David
  • 3,367

1 Answers1

0

Your issue is most likely one of file ownership and permissions. You will need to become root without the help of sudo and then use root privileges to make sure root owns /usr/lib/sudo/sudoers.so and is able to read and write to it.

First check whether root owns /usr/lib/sudo/sudoers.so

ls -l /usr/lib/sudo/sudoers.so

You will want to see:

-rw-r--r-- 1 root root [...] /usr/lib/sudo/sudoers.so

But if you don't see "root root," that is the problem. You must reboot in recovery mode and execute the command below. The reason for using recovery mode is that by default ubuntu does not allow logging in directly as root without the help of sudo.

Once in recovery mode, execute:

chown root:root /usr/lib/sudo/sudoers.so

You can also make sure the correct permissions are set by executing:

chmod 644 /usr/lib/sudo/sudoers.so

You should be able to reboot and use sudo again.

Check out https://askubuntu.com/a/637437 as your question appears to be a duplicate question with a similar answer. Also check out the question sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0 for another alternative to using recovery mode.

I checked out this problem by changing the permissions on /usr/lib/sudo/sudoers.so to my user instead of root. As a result I got nearly the same error as you:

sudo: error in /etc/sudo.conf, line 0 while loading plugin 'sudoers_policy' 
sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins

I also checked it out by making /usr/lib/sudo/sudoers.so unwritable by root. For some reason that change did not create the exact same error for me, even though write permissions are what your error information gives as the reason for the problem. I did not go so far as rebooting into recovery mode, however, as I already had a root terminal open before I made sudo unusable. I was helped along the way by the answer from aldwinaldwin https://askubuntu.com/a/637437.

dg_u
  • 1