Sudo to dietpi menus not working via SSH using fish

DietPi utility aliases fail to work with sudo #424
I am getting the same symptoms as this bug reported in 2016.
When logging in as normal user via ssh and using sudo I get an error ‘Command not found’ when calling the dietpi- menus although it works for linux commands
Also works as root lgin without sudo

If I uninstall fish it reverts to bash and everything works.
A new Fish install - same problem

Checked the Alias’s in ‘Dietpi.fish’,
alias sudo='sudo ’ exists
as does alias’s for menus with correct paths


Dietpi v9.13.2
Fish v3.6.0
Headless Raspberry Pi 5

I guess the regular user is missing the alias for our scripts we created for root and dietpi user. And how did you install fish?

Known issue. We still need to find out how this can be achieved in fish. In bash, sudo can call aliases when defining an alias for sudo itself:

alias sudo='sudo '

This does not work in fish. No alias doesn’t work either. Some research so far gave only very complicated workarounds which all have certain limitations. And I do not like to bloat the sudo command with large complicated code block running to take apart and recombine passed arguments.

I just have the following idea, if there is no good solution for calling aliases via sudo in fish: Our scripts do a root permission check where required. This check could just try to call itself with sudo, like so:

exec sudo "$0" "$@"

wIth some sanity check, that $0 is one of:

  • dietpi-*
  • /boot/dietpi/dietpi-*
  • /boot/dietpi/func/dietpi-*

It does not solve the sudo problem, but makes using sudo manually obsolete, at least. I hope $0 and $@ have the same meaning in fish :sweat_smile:.

True solution is to put the scripts into $PATH to make the aliases obsolete.

Thanks for the info.

Fish was just a ‘nice to have’ so I think I’ll just uninstall it for now - its a minimal loss