You are not logged in.

#1 2012-04-13 23:53:23

SternGerlachExperiment
Member
Registered: 2009-10-11
Posts: 51

[Solved] My terminal environment is messed up

I have several terminal / virtual console related problems bugging me.

1) I cannot delete certain characters/typos and be sure they are gone. For example, if I have a variable VAR and I accidentally type

$ echo $äVAR
$äVAR

Then I delete the accidental character "ä" (move the cursor on it and press delete and enter). I get:

$ echo $VAR
$ÃVAR

When I press up to see the previous commands these remaining wrong characters are displayed, but not so whenever I'm correcting my typos.

This happens specifically with umlauts. Common characters get deleted properly.

2) I'm trying to build LFS. The manual (http://www.linuxfromscratch.org/lfs/vie … nment.html) says that the line

"exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash" in ~/.bash_profile

replaces the running shell with a new one with a completely empty environment, except for the HOME, TERM, and PS1 variables.

I can't get this to happen, no matter which way I try to login. Not even executing the line manually changes a thing. My PS1 is still what is set in /etc/profile, not what the exec env line says. And several other variables are still present, like PS{2,3,4}.

I guess I don't understand something very critical about this. The way I see it, the quote above says PS2 should not be set. What am I doing wrong / what am I not getting?

3) Bash (in a terminal window under X) doesn't wrap long lines properly. If I press up to see lines in ~/.bash_history, sufficiently long lines get garbled up. For example the configure command here spans several lines. The last two are okay, but when moving to the beginning of the command, the words begin to overlap and I can't make any sense out of them.

This happens both in xterm and urxvt. In urxvt $TERM is "rxvt", in xterm just "xterm".

-----------------

To my knowledge I have no funny configs in any related places. I haven't touched /etc/profile or /etc/bash.bashrc.

My LFS-building user has its environment set up exactly as in here:
http://www.linuxfromscratch.org/lfs/vie … nment.html

But these problems still occur.

Last edited by SternGerlachExperiment (2012-04-15 20:49:16)

Offline

#2 2012-04-14 12:31:15

biltong
Member
From: South Africa
Registered: 2011-09-01
Posts: 118

Re: [Solved] My terminal environment is messed up

SternGerlachExperiment wrote:

3) Bash (in a terminal window under X) doesn't wrap long lines properly. If I press up to see lines in ~/.bash_history, sufficiently long lines get garbled up. For example the configure command here spans several lines. The last two are okay, but when moving to the beginning of the command, the words begin to overlap and I can't make any sense out of them.

This happens both in xterm and urxvt. In urxvt $TERM is "rxvt", in xterm just "xterm".

I have this problem too, running xfce4 and terminal. Can't remember which terminal though, I'm in windows at the moment.

Offline

#3 2012-04-14 13:15:23

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] My terminal environment is messed up

There was an older bug about the bash option 'checkwinsize' not being set, https://bugs.archlinux.org/task/16539.  You can check with 'echo $BASHOPTS'.

The cure was:

Comment by Ionut Biru (wonder) - Friday, 09 October 2009, 07:46 GMT-4
add in .basrhrc
shopt -s checkwinsize

Edit:  Another bash option to check to see if it is set is 'cmdhist'.

`cmdhist'
          If set, Bash attempts to save all lines of a multiple-line
          command in the same history entry.  This allows easy
          re-editing of multi-line commands.

Last edited by thisoldman (2012-04-14 13:21:23)

Offline

#4 2012-04-14 15:19:40

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [Solved] My terminal environment is messed up

I've had the multiline bug for as long as I can remember in bash regardless of bash version, OS and terminal emulator. Yet:

$ echo $BASHOPTS
autocd:cdspell:checkjobs:checkwinsize:cmdhist:dirspell:dotglob:expand_aliases:extglob:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath

Is there anything else worth checking?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2012-04-14 16:30:08

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] My terminal environment is messed up

I have set only a few less BASHOPTS (edited for readability):

BASHOPTS=checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore: \
         histappend:hostcomplete:interactive_comments:login_shell:progcomp:promptvars:sourcepath
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor

Do you have a complex PS1?  That has caused problems for some people.

Are TERM or TERMINFO being set to a bad value somehow?

xterm $ set | grep -i term    ## for xterm I set XTerm*termName in ~/.Xdefaults
TERM=xterm-256color
XTERM_LOCALE=en_US.UTF-8
XTERM_SHELL=/bin/bash
XTERM_VERSION='XTerm(278)'

urxvt $ set | grep -i term
COLORTERM=rxvt-xpm
TERM=rxvt-unicode-256color
TERMINFO=/usr/share/terminfo

Edit:  Does the problem persist after using 'su' or 'su -' ?

Last edited by thisoldman (2012-04-14 16:37:10)

Offline

#6 2012-04-14 23:39:32

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [Solved] My terminal environment is messed up

$ echo $BASHOPTS
autocd:cdspell:checkjobs:checkwinsize:cmdhist:dirspell:dotglob:expand_aliases:extglob:extquote:force_fignore: \
hostcomplete:interactive_comments:progcomp:promptvars:sourcepath

$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:noclobber

$ echo $PS1
\e[22;36m$SHLVL \w \u\$ \e[0m

$ set | grep -i term
TERM=xterm-256color
            COMPREPLY=($( compgen -W 'throughput pausetime deterministic'                 -- "${cur#*:}" ));
_terms () 
    COMPREPLY+=($( compgen -W         "$( sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap             2>/dev/null )" -- "$cur" ));

Is it safe to assume that something weird is happening?

EDIT: Incidentally, in case it matters, I'm using konsole. But I have the same issue with gnome-terminal on debian (on another machine which cannot run arch!) and in apple's terminal (also on the other machine).

EDIT 2: It persists for me if I do "su". It actually  gets worse if I do "su -" - I cannot edit the beginning of a previous command even if the command is not multi-line. It isn't even just that the display is garbled, it just cannot be done.

Last edited by cfr (2012-04-14 23:57:25)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#7 2012-04-14 23:41:32

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [Solved] My terminal environment is messed up

SternGerlachExperiment wrote:

This happens specifically with umlauts. Common characters get deleted properly.

It isn't specific to umlauts. It happens with the tor bach, too and, also, apparently logic symbols. It's actually worse for me in vim than it is at the command line.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#8 2012-04-15 00:37:57

SternGerlachExperiment
Member
Registered: 2009-10-11
Posts: 51

Re: [Solved] My terminal environment is messed up

thisoldman wrote:

The cure was:

Comment by Ionut Biru (wonder) - Friday, 09 October 2009, 07:46 GMT-4
add in .basrhrc
shopt -s checkwinsize

This actually helped. Thank you for the suggestion!

Curiously, it fixes things with urxvt, xterm and xfterm4, but not with konsole.

cfr wrote:
SternGerlachExperiment wrote:

This happens specifically with umlauts. Common characters get deleted properly.

It isn't specific to umlauts. It happens with the tor bach, too and, also, apparently logic symbols. It's actually worse for me in vim than it is at the command line.

Part of the problem in my case is that I've set LC_ALL=POSIX for the user building the LFS (as advised in the LFS manual). If I set LC_ALL to some UTF-8 locale, then this does not happen.

For me this isn't too big a deal, as the LC_ALL=POSIX is only a temporary setting.

Edit: While I was at it, I also managed to find out the thing about "env -i".

That is, the variable can be set, but that doesn't mean that it is in the environment. "env -i" clears the environment but doesn't unset variables.

This means my problems are mostly solved, but I'll postpone marking the thread solved, while cfr still has problems.

Last edited by SternGerlachExperiment (2012-04-15 01:06:02)

Offline

#9 2012-04-15 02:22:01

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [Solved] My terminal environment is messed up

$ printenv | grep LC
LC_ALL=C

Should I set it to something else? LOCALE seems not to be set in my environment at all, although it is set in /etc/rc.conf:

LOCALE="en_GB.UTF-8"
DAEMON_LOCALE="no"

but:

$ printenv | grep LOC

returns nothing.

I would by preference set LOCALE (and LC_ALL?) to cy_GB.UTF-8 but I'm worried about doing that...

I think that LC_ALL is set as it is because I had problems running python programmes with it set to something local. (Hence the worry.)

I wonder why it doesn't work for you in konsole, either.

EDIT: I have the problem in both LilyTerm and xterm as well. I don't usually use these and they are not really configured but bash is bash is bash... right?

Last edited by cfr (2012-04-15 02:28:41)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#10 2012-04-15 03:14:49

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] My terminal environment is messed up

With the way kde apps leave bits and pieces resident, it may take a restart of X or a reboot to completely change to new settings for konsole.  I just installed and removed konsole; it reports $TERM as xterm with its default settings.

@cfr, Try changing 'DAEMON_LOCALE' to 'yes' in rc.conf.  It's what I have set.

My locale:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

I wonder if bash-completion is part of the problem.  I don't have bash-completion installed, so I can't test anything about it – bash-completion was discarded after I found it slowed my terminals' response times.

Offline

#11 2012-04-15 12:52:55

SternGerlachExperiment
Member
Registered: 2009-10-11
Posts: 51

Re: [Solved] My terminal environment is messed up

I'll have to see how rebooting affects the behaviour in Konsole.

cfr wrote:
$ printenv | grep LC
LC_ALL=C

Should I set it to something else? LOCALE seems not to be set in my environment at all, although it is set in /etc/rc.conf:

LOCALE="en_GB.UTF-8"
DAEMON_LOCALE="no"

but:

$ printenv | grep LOC

returns nothing.

I would by preference set LOCALE (and LC_ALL?) to cy_GB.UTF-8 but I'm worried about doing that...

I think that LC_ALL is set as it is because I had problems running python programmes with it set to something local. (Hence the worry.)

Do you have locale settings in ~/.bashrc or .bash_profile or .profile?

LC_ALL=POSIX is the same thing as LC_ALL=C, so you could try setting
LOCALE="cy_GB.UTF-8" in rc.conf and then have

export LC_MESSAGES = C

in .bashrc and .profile, and see what effect this has on your Python programs. Or you could just set LOCALE in rc.conf and start the problematic Python programs with

$ LANG=C NameOfThePythonProgram

I wonder why it doesn't work for you in konsole, either.

EDIT: I have the problem in both LilyTerm and xterm as well. I don't usually use these and they are not really configured but bash is bash is bash... right?

How about urxvt?

Last edited by SternGerlachExperiment (2012-04-15 12:55:24)

Offline

#12 2012-04-15 15:09:01

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] My terminal environment is messed up

@SternGerlachExperiment,

cfr has other keyboard problems – https://bbs.archlinux.org/viewtopic.php … 8#p1087868.

For your remaining problems with konsole, are we missing a KDE system locale or keyboard setting?  I wouldn't know.  I think if you wish to call this topic solved it would be OK.  Perhaps open another thread with Konsole in the topic; this thread has become too confused at this point for most people to follow easily.

@cfr, after your keyboard problems are sorted, if you still suffer from this you should open another, new thread and reference this one.

Last edited by thisoldman (2012-04-15 15:09:44)

Offline

#13 2012-04-15 20:48:16

SternGerlachExperiment
Member
Registered: 2009-10-11
Posts: 51

Re: [Solved] My terminal environment is messed up

thisoldman wrote:

I think if you wish to call this topic solved it would be OK.

I'll do that. I don't actually even have the time to look into this Konsole issue, as I don't usually need Konsole.

Thanks for the help.

Offline

#14 2012-04-16 02:19:50

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [Solved] My terminal environment is messed up

Sure. Anyway, I've lived with the terminal issues for ages and on multiple computers - my lack of certain keys is very muc* more problematic at current time...


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB