Monday, June 15, 2015

Rasperry Pi - How can I fix broken sudo - sudo: parse error in /etc/sudoers near line 29?

I recently got a Rasperry Pi and I've googled for many little oddities so I figured I'd write them up here on this blog to save anyone else out there some time.

I decided to create a new account it administrative privileges. So I create a new account for myself and enable sudo for it.

sudo adduser chris

Then add a line to the /etc/sudoers like so.

sudo visudo

This will open the /etc/sudoers file in nano, add a line just like the one already there for the pi user.


However, I spelled PASSWD correctly. And consequently get:

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

Can't shutdown, can't edit /etc/sudoers. So I thought I was stuck. Looking online if you have Linux you can put the SD card in your card reader, and mount the file that is rasparian image and edit to your hearts content. On Mac you can sorta do it with Fuse-ext2. Here is the best set of directions for that But, I decided to try something I hadn't seen before:


Then I logged in with "root"! Now I could edit /etc/sudoers all I wanted.

No comments:

Post a Comment