MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.8k stars 494 forks source link

default /etc/sudoers doesn't allow use of dietpi-* tools #6335

Open thinkpanzer opened 1 year ago

thinkpanzer commented 1 year ago

Creating a bug report/issue

Required Information

returns null

Linux 5.10.110 #1 SMP Tue Mar 14 21:59:07 CST 2023 aarch64 GNU/Linux

NanoPi R6S

Additional Information (if applicable)

Yes

Steps to reproduce

Expected behaviour

Extra details

Thanks!

MichaIng commented 1 year ago

When trying to run sudo dietpi-updater manually, sudo returns sudo: dietpi-updater: command not found

The following should work:

sudo dietpi-update
thinkpanzer commented 1 year ago

Sorry, the original string was a transcription error on my part.

sudo dietpi-update generates the error, and the root cause/fix was because /boot/dietpi was not part of secure_path in /etc/sudoers. I have changed my default login shell to zsh and made a few other customizations, so I'll retry on a newly installed image to see if I can understand why it apparently works on a fresh system. Thanks.

MichaIng commented 1 year ago

Ah, this is because zsh does not load the dietpi-* aliases from /etc/bashrc.d/dietpi.bash. The scripts are not added to PATH but added as alias. Furthermore, sudo itself cannot make use of aliases via sudo <alias>, but only if it is made an alias of itself.

If I remember right, it generally works wo source this script in zsh, but some of the G_* functions won't work correctly, e.g. since zsh counts array indices from 1 up instead of 0, right? But the aliases, login banner and autostart options should work that way.

Generally support for other shells is tracked here: #6118