sudo su

This is more of an annoyance than a problem. I probably messed up a file somewhere and want to understand what I did wrong.

When I type sudo su at the end of the banner of the root login, I get this error message:
bash: y#: command not found

I suppose there’s a file that’s ran at the end of sudo su? Where is it? Thanks!

If you have # at the command prompt you are already root

Hi,

probably you could explain a little bit more in detail what you are trying to achieve. Maybe you can share your output from SSH terminal. And what do you mean by at the end of the banner of the root login?? This I don’t understand. :thinking:

Sorry for not being clear.

Here’s what I do:

  • ssh dietpi@ZeroW
  • enter dietpi user password

then I get the “regular banner”:

 ─────────────────────────────────────────────────────
 DietPi v7.1.2 : 18:42 - Wed 05/05/21
 ─────────────────────────────────────────────────────
 - Device model : RPi Zero W (armv6l)
 - CPU temp : 41'C : 105'F (Optimal temperature)
 - MOTD : Did you know that you can run "dietpi-banner" to change its content?
 ─────────────────────────────────────────────────────

 DietPi Team     : MichaIng (lead), Daniel Knight (founder), Joulinar (support)
 Image by        : DietPi Core Team (pre-image: Raspbian Lite)
 Web             : https://dietpi.com | https://twitter.com/DietPi_
 Patreon Legends : Camry2731
 Contribute      : https://dietpi.com/contribute.html
 DietPi Hosting  : Powered by https://myvirtualserver.com

 dietpi-launcher : All the DietPi programs in one place.
 dietpi-config   : Feature rich configuration tool for your device.
 dietpi-software : Select optimized software for installation.
 htop            : Resource monitor.
 cpu             : Shows CPU information and stats.

dietpi@ZeroW:~$

After that I type “sudo su” and I get this banner:

 ─────────────────────────────────────────────────────
 DietPi v7.1.2 : 18:44 - Wed 05/05/21
 ─────────────────────────────────────────────────────
 - Device model : RPi Zero W (armv6l)
 - CPU temp : 40'C : 104'F (Optimal temperature)
 - MOTD : Did you know that you can run "dietpi-banner" to change its content?
 ─────────────────────────────────────────────────────

 DietPi Team     : MichaIng (lead), Daniel Knight (founder), Joulinar (support)
 Image by        : DietPi Core Team (pre-image: Raspbian Lite)
 Web             : https://dietpi.com | https://twitter.com/DietPi_
 Patreon Legends : Camry2731
 Contribute      : https://dietpi.com/contribute.html
 DietPi Hosting  : Powered by https://myvirtualserver.com

 dietpi-launcher : All the DietPi programs in one place.
 dietpi-config   : Feature rich configuration tool for your device.
 dietpi-software : Select optimized software for installation.
 htop            : Resource monitor.
 cpu             : Shows CPU information and stats.

bash: y#: command not found
root@ZeroW:/home/dietpi#

Notice the before last line in there (bash: y#…).
I am root and everything works, but that line is strange; I know it should not be there, because when I install a fresh image, it’s definitively not there!

So, what file does “sudo su” run? I must have made an error in that file somewhere.

Thanks!

can you try running sudo su - to load root environment. How does it looks if you login as root directly.

There is quite a good explanation for the difference. See first answer https://askubuntu.com/questions/376199/sudo-su-vs-sudo-i-vs-sudo-bin-bash-when-does-it-matter-which-is-used

Thank you Joulinar for that link, it explained a lot to me!

I found the culprit: my /root/.bashrc file had an extra line with the command y# in it! I probably messed that up when I tried to modify it to allow the colorized ls command aliases.

Thanks again for your help and your awesome work!

ah yes that’s actually a good reason for having such a line in. Good you found it :sunglasses:

Seems like you answered “do you want to save” with y and didn’t press Enter but #
:wink: