sudo su Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
DietCH
Posts: 19
Joined: Tue May 12, 2020 10:15 am

sudo su

Post by DietCH »

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!
User avatar
WarHawk
Posts: 725
Joined: Thu Jul 20, 2017 8:55 am

Re: sudo su

Post by WarHawk »

If you have # at the command prompt you are already root
User avatar
Joulinar
Posts: 4536
Joined: Sat Nov 16, 2019 12:49 am

Re: sudo su

Post by Joulinar »

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. :?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
DietCH
Posts: 19
Joined: Tue May 12, 2020 10:15 am

Re: sudo su

Post by DietCH »

Sorry for not being clear.

Here's what I do:
* ssh dietpi@ZeroW
* enter dietpi user password

then I get the "regular banner":

Code: Select all

 ─────────────────────────────────────────────────────
 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:

Code: Select all

 ─────────────────────────────────────────────────────
 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!
User avatar
Joulinar
Posts: 4536
Joined: Sat Nov 16, 2019 12:49 am

Re: sudo su

Post by Joulinar »

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/ ... ch-is-used
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
DietCH
Posts: 19
Joined: Tue May 12, 2020 10:15 am

Re: sudo su

Post by DietCH »

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!
User avatar
Joulinar
Posts: 4536
Joined: Sat Nov 16, 2019 12:49 am

Re: sudo su

Post by Joulinar »

ah yes that's actually a good reason for having such a line in. Good you found it 8)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
zackdvd
Posts: 8
Joined: Sun May 09, 2021 9:45 am

Re: sudo su

Post by zackdvd »

DietCH wrote: Wed May 05, 2021 8:48 pm 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!
Seems like you answered "do you want to save" with y and didn't press Enter but #
;-)
Post Reply