Pi User Keeps Losing Sudo

Octoprint 1.4.0
Octopi 0.17.0

I have re-flashed the image 3 times. for some reason the first day that I am using it to configure everything in the terminal the pi user has sudo privileges. but if I leave it overnight or for a few days come back to the terminal the Pi user has lost sudo privileges. everything I try to sudo I get

Sorry, user pi is not allowed to execute '/usr/bin/raspi-config' as root on octopi.

Promotion to the root user by pi is something that's been built into UNIX for some time now. By forcing us to authenticate, it's a way of not accidentally doing something drastic from an accidental typo.

So when you remote into the OctoPrint instance, it will immediately ask you to credential if you run a command prepended by sudo. It will remember this for a bit but this promotion will eventually timeout. If you then run the very same command or others after the timeout event, you'll again be prompted for your password. This is the way sudo works.

Just to be clear when I say go back to the terminal, it is closed I open a new session enter user PI and password. But I am still not able to sudo. Even of I reboot from the web interface. Everything works fine for the first day

So you're saying that the pi user is dropped from the sudoers group and you have to manually usermod -aG sudo pi?

sudo cat /etc/sudoers

It's possible that something has trashed the formatting of this file.

I can't run either of those commands. Both require sudo. And the only user I have is pi.

You might be able to get away with:

cat /etc/sudoers

permission denied :cry:

If weird stuff keeps happening to things that involve persisted data, the first thing I'd try is a new as card because the one you have might be faulty to begin with or dying. After confirming that things are not reporting undervoltage that is.

replaced the SD Card After the 3rd re-image. as for under voltage I do get it form time to time but I am not entirely sure why. I bought a bundle RPI 3, PiCam, and 3A power supply.

It feels to me like there's more here than meets the eye. You've gone through the motions three times and it repeats this behavior of dropping pi from the sudoers group (you'd said).

Can you list any plugins you've installed each time? Have you installed anything else? Did you run a script for a TFT screen? Did you install the X11 Desktop or TouchUI or similar? Something is very much different in your case.

If this were power-related it wouldn't randomly corrupt your microSD in the same way three times.

only two plugins that are installed each time are "octolapse" and "MultiCam" everything else stays the same.

  1. use etcher and flash the sd card
  2. go through basic setup in web interface
  3. install both plugins
  4. ssh in to make changes to resolution of camera and to turn on picam. (all require sudo)
  5. Then I will have an issue with the steam of the camera a few days later.I will ssh back in to see that I cant do anything since Pi user has been dropped form sudoers.

I've just looked at the source for MultiCam and there are no external dependencies which could run installation scripts. There's nothing being spawned/forked/threaded from it.

OctoLapse has ["pillow", "sarge", "six", "psutil"] as external requirements but one would need to research to see if any of their installation scripts try to adjust that group list for sudoers. I don't see anything that's bringing up external scripts.

Try to flash the OctoPi image, setup your networking as required and run the Setup Wizard. Don't install any plugins and don't change any of the settings on your camera. Repeat your game from before where you leave it for a day. Return to it and verify that the pi user is still in sudoers. Let us know how that turns out.