Freitag, 30. November 2012

Making yast2-ncurses look better when using through screen

In openSUSE on CuBox (Day 5) I posted a screenshot of how yast looks terrible when used in ncurses mode over the serial connection (i.e. when you connect to e.g. the CuBox using screen /dev/ttyUSB0 115200). Here is that screenshot again.
 As you can see, the background is really messed up. Things get much worse if there is any "movement" involved - for example progress bars.

I think I have found a solution - or at least a workaround. Alex Graf got me thinking that the problem is more than likely that yast in ncurses mode just can't deal with the $TERM that is set when coming through the serial connection. I researched this a little more.

When coming over a serial connection
echo $TERM
told me "linux".

When coming over SSH
echo $TERM
told me "xterm"

Now, that probably isn't altogether incorrect. Alex Graf and Juergen Weigert got me thinking that maybe the screen/ncurses combination just didn't support color in "linux" or "xterm" $TERM modes. I tried using TERM=vt100, TERM=vt200 and TERM=vt500 (as well as the color modes TERM=screen256-color, TERM=vt200-color) but that made things worse, in my opinion. What happened was that YaST was displayed in black and white with no highlighting to show which entry was selected. YaST became pretty much impossible to use.

It turned out that there is an informative page on the openSUSE wiki which deals with YaST Tips and Tricks. There I saw the information "The default setting of the YaST ncurses UI is that the init routine detects the terminal type and automatically chooses the appropriate color theme." However, then I saw the hint:

Since openSUSE 10.3 it's possible to set the color theme manually in /etc/sysconfig/yast2. E.g. if you want a black/white YaST set Y2NCURSES_COLOR_THEME to "mono". 
After some playing around and testing I found that, to get YaST working in ncurses mode over the serial connection (without messing up YaST over SSH), the following combination did the job:

Change the line Y2NCURSES_COLOR_THEME in the file /etc/sysconfig/yast2 from:
Y2NCURSES_COLOR_THEME=""
to
Y2NCURSES_COLOR_THEME="linux"
and also change:
TERM=screen; export TERM

For me, I then got an acceptable YaST. This is probably a bit of a hacky workaround, but maybe it could help somebody in the know identify the real problem and fix it properly.

That's all for now folks! Here's a screenshot of YaST in ncurses mode on the CuBox, over the serial connection...




2 Kommentare:

jorygen hat gesagt…

The three TERM settings linux, xterm, screen should be very similar. There must be some magic in YaST, that actively messes up.

A reproducer for the initial issue: run screen in GnomeTerminal, set TERM =xterm (was TERM=screen), start yast.

Anonym hat gesagt…

Thank you!