Sudo doesn't work [duplicate]

Solution 1:

Had the same problem,

sudo: >>> /etc/sudoers: syntax error near line 25 <<<
sudo: parse error in /etc/sudoers near line 25
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Easier way to fix it is :

pkexec visudo 

Solution 2:

Boot into recovery mode from the GRUB menu (hold the SHIFT key during boot to reveal this menu), enter the root shell.

  1. First you need write permission to edit sudoers, so run

    mount -o remount,rw /
    
  2. Then use visudo and revert your mistake. visudo will check if the resulting sudoers file conforms to the required syntax.

    By default visudo uses vi as editor, but you can tell it to use your favourite text editor with the EDITOR environment variable, e. g.:

    EDITOR=nano visudo
    

Solution 3:

This fixed the same problem for me:

pkexec chmod 440 /etc/sudoers

pkexec chmod 775 /etc/sudoers.d

pkexec chmod 440 /etc/sudoers.d/README