0

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...

  • @bc2946088 sorry just fixed that. I could not copy and paste because it was on jetson tx1 – MoneyBall Jun 8 '16 at 20:42
  • Ahh, I'm not sure if you can actually change the path anyway. – bc2946088 Jun 8 '16 at 20:43
  • what does ls -l /usr/bin/sudo produce? – Olu Smith Jun 8 '16 at 20:58
  • @OluDouglas i get -rwsr-xr-x 1 root root 11178 Apr 1 2015 /usr/bin/sudo – MoneyBall Jun 8 '16 at 21:02
  • What does ls -l /etc/sudoers and cat /etc/sudoers produce? – fosslinux Jun 8 '16 at 21:07
3

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.

  • 1
    That wiki page is old. Current Ubuntu practice is to use the sudo group rather than admin by default. You should uncomment the sudo group . (In the default install the admin group line is uncommented for backwards compat for people who have never reinstalled. – chaskes Jun 9 '16 at 2:59
0

You obviously can access the internet on another machine because you posted this question. You can create an Ubuntu live CD, boot into it, and fix sudo with the following steps. Mount the partitions of your installation to recreate the filesystem at /mnt (sudo mount /dev/<whatever> /mnt, mkdir -p /mnt/home && sudo mount /dev/<whatever2> /mnt/home...). Insert the default sudoers file from the Ubuntu wiki into /mnt/etc/sudoers. Reboot into your system and sudo should work.

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.