On Wed Jul 01 01:54 PM, wastelander1972(a)gmail.com wrote:
Running KDE DE and after entering the su command, I have an
unreadable
name as root user:
jordan on Adelie-BC80D0 ~ % su
Password:
%n on %B%F{white}%m%f%b %~ %B%F{green}%#%f%b apk update
I have the default regional settings enabled, and the encoding in
konsole is set to UTF-8. Any help? Thanks.
This is unrelated to UTF-8 but rather the various shells in play.
The default user interactive shell we use is zsh, but the default root
shell (except for the live CD) is /bin/sh, which is a symlink to dash
for some time now.
What's happening here is when you run "su", the prompt variable $PS1 is
being retained in the environment from your user's zsh session, and it
contains a bunch of zsh-specific escapes that dash doesn't understand,
so it just prints them literally (and thus the prompt looks really
weird).
Typically my advice is that you should always login as root using "su -"
instead of "su", the difference being the new shell will be run as a
"login shell" (/etc/profile and ~/.profile will be sourced) and the
environment will be cleared properly. You should then get a nice simple
"<hostname> #" prompt in that case from our default /etc/profile. This
is applicable to anywhere you use the "su" command to login as root, or
even as another user ("su - user" instead of "su user").
Max