Ubuntu – sudo: unable to stat /etc/sudoers: No such file or directory, sudo: no valid sudoers sources found, quitting

command linenvidiapermissionssudo

This is the error message I get any time I run sudo:

ubuntu@tegra-ubuntu:/$ sudo apt-get update
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Right now I'm trying to boot ubuntu 14.04 on jetson tx1 (nvidia's most recent development board) using an SD card. I am able to boot Ubuntu without the GUI. However the sudo command is seriously broken.

When creating the filesystem on my sd card, I used sudo to do it. I found lots of other posts about it and verified that

  1. Both user and group have permission to execute /etc/ (sudo: unable to stat /etc/sudoers: No such file or directory – File Exists)

  2. Using pkexec visudo /etc/sudoers gives me this error:

    ** (process:1784): WARNING **:
    Error enumerating actions:  GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files
    Error checking for authorization org.freedesktop.policykit.exec: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files
    

    (How to modify an invalid '/etc/sudoers' file?)

  3. The GRUB menu is not accessible because I don't have the GUI. Holding shift down didn't do the trick…

Best Answer

In order to fix this, you can either reinstall sudo, or download a default /etc/sudoers and edit it. Both ways require these steps: First, restart your computer. When the Grub screen displays, instead of choosing Ubuntu xxx, choose Advanced options for Ubuntu xxx. Under Advanced Options, choose Recovery mode. The second step is to mount your partitions rw. To do this, choose Clean packages, Ok, and then when you see the recovery screen again, select Root shell. Enable the wifi from the root shell. Either reinstall sudo:

apt-get install --reinstall sudo

or insert this into /etc/sudoers:

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults    env_reset

# Uncomment to allow members of group sudo to not need a password
%sudo ALL=NOPASSWD: ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL) ALL

# Members of the admin group may gain root privileges
# %admin ALL=(ALL) ALL

(from Sudoers Ubuntu Wiki)

Before restarting, su back to your normal user, and try sudo apt-get upgrade or anything with sudo. If it works, then reboot. Otherwise, comment with the error message.

Related Question