sudo chown -R openhabian /etc was not so smart, I guess.
Why id did it? I added the samba srv config to share /etc
I wanted to be able to change the config files in /etc directly over the share (Visual Studio Code is great for editing config files), without opening the terminal an using the annoying nano editor.
Result:
I can’t do any sudo any more. I each time get the complaint:
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
So I should try to make root owner again of /etc/sudoers. How?
I could try to run as root, or just type “su”, but these users are, as far as I know, disabled op OpenHABIANPI.
Who can help me?
What I cannot do:
I cannot do chown root /etc/sudoers (permissions denied)
I cannot do “sudo chown root /etc/sudoers” (as I cannot sudo any more)
I edited cmdline.txt, by adding init=/bin/sh and then boot in single user mode: the problem is then that the disk is in read-only mode (I cannot edit files). When doing
mount -o remount,rw /
I get an issue that the PARTUUID=2F93…b not found (that is afaik the equivalent of te non-boot partition on the sd-card).
@vzorglub & @mueslee thanks for these suggestions. I will try the next scenario:
shutdown the raspberry, take the SDcard out and add to /boot/cmdline.txt
rw init=/bin/sh
I didn’t know rc.local, and did some research. this info is in rc.local:
This script is executed at the end of each multiuser runlevel.
cmdline.txt makes me boot in single user mode - I am not sure, but it sounds like a contradition. I derive that I will first not add commands to this script, but rather I will run them manually & directly on the raspberry (not over ssh). If that doesn’t work, I can try it with rc.local.
Great news: it worked the way described above in my last post (using rw init=/bin/sh to cmdline.txt )
I did it the manual way as descibed (=without rc.local), but that is not the most essential, I guess.
I now can smoothly sudo again
Thanks to you all folks, I can be proud of this experience & learning. All my appreciations!
Happy OpenHAB to all of you!
*** POST-LEARNINGS ***
I now can sudo, but I get another error msg:
sudo: /etc/sudoers.d is owned by uid 1000, should be 0
Thanks for this post Peter, I made exactly the same stupid mistake and have been googling for hours before I found this post. I was ready to give up on this installation, but your post got my openhabian in perfect shape again! Thanx again, Robl