How do I edit an invalid sudoers file?

I started looking at this question: How to modify an invalid /etc/sudoers file? It throws an error and it's not allowing me to edit again to fix it

But the voted answer assumes that I am allowed to run program as root using Policykit, which is unfortunately not the case.

Here is what happens:

$ sudo visudo

>>> /etc/sudoers: syntax error near line 29 <<<
sudo: parse error in /etc/sudoers near line 29
sudo: no valid sudoers sources found, quitting

What should I do? I have no root access

1 Answer 1


Try this:

  • Switch on your computer.

  • Press and hold the Shift key, which will bring up the Grub menu.

  • Select the line which starts with Advanced options.

  • Select the line ending with (recovery mode)

  • Your PC should display a menu with a number of options.

  • Select the option will be Drop to root shell prompt

  • Run the commands

    mount -o remount,rw /
    mount --all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.