SSH login lanuage error

Hi,

Using NanoPi Neo with fresh install of current download version (DietPi_v145_NanoPiNEO-armv7-(Jessie)) which has been auto updated to current version.

No software installed. SSH into device using ethernet.

Not much changed in dietpi-config - Canadian English, time zone, LEDs - and I don’t think much else.


gordon@gordon-linux ~ $ ssh root@192.168.1.27
root@192.168.1.27’s password:
-bash: export: `#LANG=en_GB.UTF-8’: not a valid identifier

[3;J
───────────────────────────────────────
DietPi | 14:31 | Thu 11/16/17
───────────────────────────────────────
V158 | NanoPi Neo (armv7l)
───────────────────────────────────────
IP Address | 192.168.1.27
───────────────────────────────────────

There are some funny characters in the line above the DietPi time - date line too.

Regards,
Gordon Williams

Hi Gordon,

Please ensure en_GB.UTF-8 is installed on the system. Its required by DietPi to ensure all scripts scrape correctly, you can select another default if needed, but en_GB.UTF-8 must be installed.

I didn’t uninstall en_GB, just added Canadian English. I will go back and do a fresh install from the start and see if I can repeat the problem.

From the error message, it looked like LANG=en_GB.UTF-8 was commented out.

Gordon

Hi Gordon,

Yep, seen the comment, which is strange as the banner script is coded as below:
https://github.com/Fourdee/DietPi/blob/master/dietpi/dietpi-banner#L21

If it happens again, please check which of the following scripts causes the “export” error:

/DietPi/dietpi/login
/DietPi/dietpi/dietpi-banner

Now doing a fresh install. During the first run right after after ssh login I get the same funny characters as seen below.
Will check to see what else happens.
Gordon

DietPi-Set_Hardware
─────────────────────────────────────────────────────
Mode: preferipversion (auto)
Please wait…

[Ok] preferipversion auto | Completed

[3;J
───────────────────────────────────────
DietPi | 17:45 | Sun 19/11/17
───────────────────────────────────────
V144 | NanoPi Neo (armv7l)
───────────────────────────────────────
IP Address | 192.168.1.10
───────────────────────────────────────

Welcome to DietPi-Software

Edit: by funny characters I mean [3;J
before the [ is a square box with very small printing in it.

With no locale or language change when I log on I get

gordon@gordon-linux ~ $ ssh root@192.168.1.10
root@192.168.1.10’s password:
[3;J

(same funny characters written to screen on line below PW.)

Next I will change locale and language.

language changed

Generating locales (this might take a while)…
en_CA.UTF-8… done
en_GB.UTF-8… done
Generation complete.
[3;J

I guess the box and [3;J are some sort of messed up screen control characters??

Now rebooting …
SHH in

Yes! got it again!

Connection to 192.168.1.10 closed by remote host.
Connection to 192.168.1.10 closed.
gordon@gordon-linux ~ $ ssh root@192.168.1.10
root@192.168.1.10’s password:
-bash: export: `#LANG=en_GB.UTF-8’: not a valid identifier
[3;J

Now for the files that you asked for …

The only place that I can see LANG in /DietPi/dietpi/login
#Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales.
LANG=en_GB.UTF-8
same for /DietPi/dietpi/dietpi-banner
#Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales.
LANG=en_GB.UTF-8

The scripts are kind of long to post here and I have already made lots of posts detailing what I have done so that you can hopefully repeat it.
I can send them to you separately.

thanks,
Gordon Williams

Hmm,
One other thing that may or may not be of interest to you.

root@DietPi:~# locale
LANG=
LANGUAGE=
LC_CTYPE=“POSIX”
LC_NUMERIC=“POSIX”
LC_TIME=“POSIX”
LC_COLLATE=“POSIX”
LC_MONETARY=“POSIX”
LC_MESSAGES=“POSIX”
LC_PAPER=“POSIX”
LC_NAME=“POSIX”
LC_ADDRESS=“POSIX”
LC_TELEPHONE=“POSIX”
LC_MEASUREMENT=“POSIX”
LC_IDENTIFICATION=“POSIX”
LC_ALL=

That is different than my personal computer.

Gordon

Which SSH client are you running? Seems to be running in POSIX compatibility mode.

Gordon,

Seems related to SSH client, please see below:
https://serverfault.com/questions/792252/posix-locale-when-i-use-ssh-with-a-command-line

I don’t see why the ssh client on my desktop would change the output of the dietpi locale command.
It is the same as far as I know that I have been using for the last few years in Linux Mint 17.x

gordon@gordon-linux ~ $ ssh -V
OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8, OpenSSL 1.0.1f 6 Jan 2014

Is the output that I’m showing for dietpi what you are expecting for a Nanopi Neo with everything set to POSIX, No Language? I expected to see either en_CA or en_GB as these are the languages that are set on the dietpi.

Were you able to find the source file that created the error?


Gordon

Hmmm… Aren’t I using the second of the two examples? E.G. the normal ssh method? That gives what should be correct output.

Edit:
OK, found how to test my shell
gordon@gordon-linux ~ $ echo $SHELL
/bin/bash
gordon@gordon-linux ~ $ echo $0
bash

I’m using the bash shell on my desktop.

Gordon

Edit2:
Just in case I’m completely out to lunch and I’m miss-understanding you.
root@DietPi:~# echo $0
bash
root@DietPi:~# echo $SHELL
/bin/bash
The dietpi shell is also bash.

A couple of more data points for you to consider:

I’ve tried 2 other computers, one linux and one windows with putty and both give me the -bash: export: `#LANG=en_GB.UTF-8’: not a valid identifier

error just after the PW when sshing in.

Both show POSIX when locale command is used.

Trying to follow through your scripts is beyond my pay grade, so I’m not much help there. Sorry :thinking:

This is what is installed on dietpi

root@DietPi:~# locale -a
C
C.UTF-8
POSIX
en_CA.utf8
en_GB.utf8

Regards,
Gordon

Dan,
This may or may not be of help.

in
root@DietPi:/etc# cat bash.bashrc

------------- snip -------------------------
else
printf “%s: command not found\n” “$1” >&2
return 127
fi
}
fi
if [[ -f /etc/bash.bashrc.custom ]]; then
. /etc/bash.bashrc.custom
fi
export $(cat /etc/default/locale | grep LANG=)
#DietPi Additions
alias sudo=‘sudo ’ # https://github.com/Fourdee/DietPi/issues/424
alias dietpi-process_tool=’/DietPi/dietpi/dietpi-process_tool’
alias dietpi-letsencrypt=’/DietPi/dietpi/dietpi-letsencrypt’
----------------- snip --------------------------------------------------------------------------

note double brackets in
if [[ -f /etc/bash.bashrc.custom ]]; then
That section is new and wasn’t in an earlier version of dietpi that I was using.

  1. export $(cat /etc/default/locale | grep LANG=)
    takes us to

File generated by update-locale

LANGUAGE=en_GB.UTF-8
#LANG=en_GB.UTF-8
LC_MESSAGES=en_GB.UTF-8

You will note that the #LANG line is the line that is barfing during the login process.

What should I try?

Regards,
Gordon

Dan,

I uncommented the
#LANG=en_GB.UTF-8
above and rebooted

now locale shows

root@DietPi:~# locale
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE=“en_GB.UTF-8”
LC_NUMERIC=“en_GB.UTF-8”
LC_TIME=“en_GB.UTF-8”
LC_COLLATE=“en_GB.UTF-8”
LC_MONETARY=“en_GB.UTF-8”
LC_MESSAGES=“en_GB.UTF-8”
LC_PAPER=“en_GB.UTF-8”
LC_NAME=“en_GB.UTF-8”
LC_ADDRESS=“en_GB.UTF-8”
LC_TELEPHONE=“en_GB.UTF-8”
LC_MEASUREMENT=“en_GB.UTF-8”
LC_IDENTIFICATION=“en_GB.UTF-8”
LC_ALL=

The characters in dietpi-software have been fixed too.

Running update-locale doesn’t comment the LANG out again:

root@DietPi:~# update-locale
root@DietPi:~# cat /etc/default/locale

File generated by update-locale

LANGUAGE=en_GB.UTF-8
LANG=en_GB.UTF-8
LC_MESSAGES=en_GB.UTF-8

So there is a bug somewhere either in the setup or the files that are downloaded as this happen twice on fresh installs.

Not sure why it is en_GB rather than en_CA which was installed. How do I get en_CA ?

Gordon