guysoft / OctoPi

Scripts to build OctoPi, a Raspberry PI distro for controlling 3D printers over the web
GNU General Public License v3.0
2.45k stars 368 forks source link

nightly build: 64 bit 2021-01-12 - pi user not in sudoers #712

Open dan-and opened 3 years ago

dan-and commented 3 years ago

What were you doing?

I tried to install the new 0.18 RC2 64 Bit version: http://unofficialpi.org/Distros/OctoPi/nightly-arm64/2021-01-12_octopi-20.10-preinstalled-server-arm64+raspi-0.18.0.zip on a raspberry pi4

Booting and logging in as user pi works fine

What did you expect to happen?

I can login with the user pi and sudo to root

What happened instead?

The user pi is not allowed to sudo

Suggestion:

I loaded the sdcard on another linux machine and added the user pi to /etc/sudoers, but I think that should not be the right way.

Since two days, the new 64 build is based on ubuntu, so checking /etc/passwd did lightened me up: I have to login as ubuntu (pw: ubuntu for the first time) as well.

The ubuntu user is ofcourse allowed to sudo.

The main issue with this is: Either kick out the whole ubuntu user and continue using just the pi user for sudo and octoprint or switch over to the ubuntu user.

But most important: Let the people know that there are two users with default passwords on the current "preinstalled-server-arm64" images: user pi with "raspberry" and user ubuntu with "ubuntu" These users should not stay untouched

Version of OctoPi

0.18.0 RC2 "nightly Build" http://unofficialpi.org/Distros/OctoPi/nightly-arm64/2021-01-12_octopi-20.10-preinstalled-server-arm64+raspi-0.18.0.zip

I have read the FAQ.

guysoft commented 3 years ago

Yep, its an issue. I think the ubuntu user is generated from cloudinit. Will have to test how to remove it, and give user pi sudo.

https://askubuntu.com/questions/1183370/ubuntu-1910-server-install-on-raspberry-pi-4-hangs-on-cloud-init

I think this should make it work, will commit and you can test the nightly/executing in your image as root:

usermod -a -G sudo pi
chrislavender commented 2 years ago

None of the above worked for me. Including trying to disable cloud init via the referenced askubuntu link. However, what did work was switching to the root user (after setting up a password for root), cd-ing into /etc/sudoers.d and adding the logged in user to the 90-cloud-init-users file in the same way one would add them to the regular sudoers file.

From what I can surmise it appears that 90-cloud-init-users is overriding anything else with regard to sudo access.

guysoft commented 2 years ago

Hey, So I tested the latest nightly from today and sudo works on the pi user. So unless anyone has any other input I am closing this. Also note that if you flash form rpi-imager with custom settings the image has booting issues and reaches this issue: https://github.com/raspberrypi/linux/issues/4458