Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to start based on TERM #21

Closed
szuecs opened this issue Apr 24, 2019 · 14 comments
Closed

failed to start based on TERM #21

szuecs opened this issue Apr 24, 2019 · 14 comments
Labels
bug Confirmed to be a bug please try it

Comments

@szuecs
Copy link

szuecs commented Apr 24, 2019

% termshark
Error: terminal entry not found [TERM: screen.xterm-256color]
zsh: exit 1 termshark
% TERM=xterm-256color termshark
Packets read from interface eth0 have been saved in /$home/.cache/termshark/eth0-921608986.pcap

@pocc
Copy link
Collaborator

pocc commented Apr 25, 2019

Please post tshark -v and any other relevant facts about your system.

@szuecs
Copy link
Author

szuecs commented Apr 25, 2019

Relevant facts: I use screen

% tshark -v
TShark (Wireshark) 2.6.6 (Git v2.6.6 packaged as 2.6.6-1~ubuntu18.04.0)

Copyright 1998-2019 Gerald Combs <[email protected]> and contributors.
License GPLv2+: GNU GPL version 2 or later <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with libpcap, with POSIX capabilities (Linux), with libnl 3,
with GLib 2.56.2, with zlib 1.2.11, with SMI 0.4.8, with c-ares 1.14.0, with Lua
5.2.4, with GnuTLS 3.5.18, with Gcrypt 1.8.1, with MIT Kerberos, with MaxMind DB
resolver, with nghttp2 1.30.0, with LZ4, with Snappy, with libxml2 2.9.4.

Running on Linux 4.15.0-47-generic, with Intel(R) Core(TM) i5-5300U CPU @
2.30GHz (with SSE4.2), with 15740 MB of physical memory, with locale
en_US.UTF-8, with libpcap version 1.8.1, with GnuTLS 3.5.18, with Gcrypt 1.8.1,
with zlib 1.2.11, binary plugins supported (13 loaded).

Built using gcc 7.3.0.

The same problem I had with some other Go tool, I don't remember which one it was. They fixed it by adding something to $TERM check if I recall correctly.

@pocc
Copy link
Collaborator

pocc commented Apr 25, 2019

  • Can you check whether updating tshark/Wireshark to v3.0.0 affects this problem?
  • It's possible that there are builtin bash assumptions that shouldn't be there. If you have bash installed, can you check whether using that shell ameliorates this issue?
  • Do you see this problem using a different terminal, not using screen?

@pocc
Copy link
Collaborator

pocc commented May 9, 2019

@szuecs Do you have any updates? Were you able to find the $TERMINAL_VAR that fixed?

@pocc pocc added need info Potentially a bug but we need more data stale No update from poster in 2 weeks labels May 9, 2019
@pocc
Copy link
Collaborator

pocc commented May 9, 2019

Noting this may be the same issue as #7.

@szuecs
Copy link
Author

szuecs commented May 9, 2019

Sorry @pocc I did not see notifications.
It only happens if I use screen.
I did not tested a different tshark version.
As in #7 , I also use xfce4-terminal. So it might be a related problem.

The funny thing is that TERM=xterm-256color termshark starts, but does not show the cursor as in #7, too. Without screen (but with xfce4-terminal) everything works with cursor. I also had a problem in some other project with the TERM settings and a Go project. Maybe you use the same library and the problem is there.

@pocc pocc removed the stale No update from poster in 2 weeks label May 9, 2019
@gcla
Copy link
Owner

gcla commented May 22, 2019

Hi - I found an explanation for this TERM variable setting here in the screen manual:

https://www.gnu.org/software/screen/manual/screen.html#Window-Termcap

Here's a quick summary:

When screen tries to figure out a terminal name for itself, it first looks for an entry named screen.term, where term is the contents of your $TERM variable. If no such entry exists, screen tries ‘screen’ (or ‘screen-w’, if the terminal is wide (132 cols or more)). If even this entry cannot be found, ‘vt100’ is used as a substitute.

The idea is that if you have a terminal which doesn’t support an important feature (e.g. delete char or clear to EOS) you can build a new termcap/terminfo entry for screen (named ‘screen.dumbterm’) in which this capability has been disabled. If this entry is installed on your machines you are able to do a rlogin and still keep the correct termcap/terminfo entry. The terminal name is put in the $TERM variable of all new windows. screen also sets the $TERMCAP variable reflecting the capabilities of the virtual terminal emulated. Furthermore, the variable $WINDOW is set to the window number of each window.

I can reproduce this problem running screen on Ubuntu 18.10. In my shell, TERM=xterm-256color and when I start screen, TERM=screen.xterm-256color. Running screen with strace, I found a terminfo file at /lib/terminfo/s/screen.xterm-256color.

The reason termshark returns an error is that tcell has a compiled-in terminfo database, which is generated by running a small program that converts terminfo files into Go source code - for example

https://github.com/gdamore/tcell/blob/master/terminfo/term_xterm_256color.go

and that database does not contain an entry for screen.xterm-256color.

Having written all that, I'm not sure why tcell doesn't try to compile a terminfo file on-the-fly, on the machine on which it's running.

Setting TERM is fine, or I believe something like this in your ~/.screenrc will do it for new screen sessions

term screen-256color

@szuecs
Copy link
Author

szuecs commented May 22, 2019

@gcla thanks for your investigation!
Do you want to file a bug to tcell or should I follow up?

@gcla
Copy link
Owner

gcla commented May 23, 2019

Hi @szuecs - no prob, I'll add a tcell issue to figure this out.

@gcla
Copy link
Owner

gcla commented May 23, 2019

I asked here:

gdamore/tcell#279

@gcla gcla added bug Confirmed to be a bug and removed need info Potentially a bug but we need more data labels Jun 7, 2019
gcla added a commit that referenced this issue Jun 15, 2019
This includes fixes for the 11-character paste limit, a jumpy cursor on
Windows, AND features a new terminfo generator which works on the fly if your
TERM isn't part of tcell's database. See issue
gdamore/tcell#279. Thanks to @gdamore :-) This
should address termshark issue #21.
@gcla
Copy link
Owner

gcla commented Jun 15, 2019

Hi @szuecs - @gdamore updated tcell so that it now builds a terminal description on-the-fly, if one is not found in tcell's database. I've updated termshark to depend on the latest tcell. This seems to fix this issue for me. Now if I launch screen, then run termshark, it runs correctly. If you want to try it out, here are build instructions:

git clone https://github.com/gcla/termshark
cd termshark
export GO111MODULE=on
go install ./...

Then termshark will be in ~/go/bin. Let me know!

@szuecs
Copy link
Author

szuecs commented Jun 16, 2019

termshark starts successfully, now.
I have some problems seeing packets, but I will check it tomorrow again

@gcla
Copy link
Owner

gcla commented Jun 16, 2019

ok, thank you

@szuecs
Copy link
Author

szuecs commented Jun 17, 2019

The problem was that I ran it as root and not as user. If I run as normal user it works.
Thanks again for solving this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed to be a bug please try it
Projects
None yet
Development

No branches or pull requests

3 participants