Error line when loggin in with ssh

Required Information

  • DietPi version | G_DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=8
    G_DIETPI_VERSION_RC=1
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
  • Distro version | bullseye 0
  • Kernel version | Linux octopi 5.15.56-v8+ #1575 SMP PREEMPT Fri Jul 22 20:31:26 BST 2022 aarch64 GNU/Linux
  • SBC model | RPi Model B (aarch64)

When i SSH into the machine i get a strange error line:

/etc/bashrc.d/dietpi.bash:74: closing brace expected

Also a would like to know where is written the code that run the command that create this line when i login with ssh. Linux octopi 5.15.56-v8+ #1575 SMP PREEMPT Fri Jul 22 20:31:26 BST 2022 aarch64

It’s right in the file /etc/bashrc.d/dietpi.bash. Every time you open a terminal, this config file, besides some others, is loaded.
Line 74 in my case is term="/${TERM::1}/$TERM", but let’s have a look at yours:

sed -n 74p /etc/bashrc.d/dietpi.bash

This is part of

 # Workaround if SSH client sets an unsupported $TERM string: 
        term="/${TERM::1}/$TERM"
        if [[ $SSH_TTY && ! -f /lib/terminfo$term && ! -f /usr/share/terminfo$term && ! -f ~/.terminfo$term && ! -f /etc/terminfo$term ]]
        then

So maybe another unsupported string triggered this?

The command output is this:
term="/${TERM::1}/$TERM"
Temporary i can try to comment out that section of code?

Maybe some data corruption. Let’s simply try to get e new file from GitHub

rm /etc/bashrc.d/dietpi.bash
curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/master/rootfs/etc/bashrc.d/dietpi.bash' -o /etc/bashrc.d/dietpi.bash

Now, try to login on a 2nd session. Hopefully it has been fixed.

Hi, sorry I didn’t answer earlier, I wasn’t home this week.
I tried doing what you say but it keeps giving the same error. Could it be because I use zsh? I forgot to mention that.
Temporarily I commented out that whole block of code but it would be interesting to understand why it doesn’t work.
Thanks @Joulinar @Jappe
Update:
I tried to switch to the bash shell and the original file is working perfectly. But when I use zsh it doesn’t work anymore, it only work if i comment like this: Hastebin: Send and Save Text or Code Snippets for Free | Toptal®
The problem is that i don’t know what is the difference between zsh and bash that create the problem.

@MichaIng
can you have a look

Can you show:

cd ~
cat .zprofile .zshenv .zshrc .zlogin /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin

Some zsh login script must contain a line to source /etc/bash.bashrc which loads /etc/bashrc.d on DietPi. Of course /etc/bash.bashrc is intended for bash, so shouldn’t be loaded by other shells, if you want to rule out compatibility issues.

This is the output: Hastebin: Send and Save Text or Code Snippets for Free | Toptal®
With this errors:

cat: .zprofile: No such file or directory
cat: .zlogin: No such file or directory
cat: /etc/zshenv: No such file or directory
cat: /etc/zprofile: No such file or directory
cat: /etc/zshrc: No such file or directory
cat: /etc/zlogin: No such file or directory

Ok so i think that i will just comment the block of code that block the execution of bashrc.d

The other way round: Comment/remove the line which does load /etc/bash.bashrc. But actually I can’t find it in your output :thinking:. Does zsh have a debug flag so that each executed command and sourced script is shown on login?

I would like to keep the dietpi-banner output at the login.
Meanwhile, I found where zsh loads bashrc from, the file /etc/zsh/zshrc has this line:

source /etc/bashrc.d/dietpi.bash

For this, add /boot/dietpi/func/dietpi-banner 1 to one of the zsh login scripts.