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

Remote file kitten errors out with return code 255 #3929

Closed
yodahuang opened this issue Aug 13, 2021 · 5 comments
Closed

Remote file kitten errors out with return code 255 #3929

yodahuang opened this issue Aug 13, 2021 · 5 comments
Labels

Comments

@yodahuang
Copy link

Describe the bug
Python exception is thrown in a non-descriptive way when trying to use the remote file kitten.

To Reproduce
Steps to reproduce the behavior:

  1. run /bin/ls $FOLDER
  2. Ctrl + shift + click
  3. See error

Screenshots

Traceback (most recent call last):
  File "kittens/remote_file/main.py", line 212, in main
  File "kittens/remote_file/main.py", line 282, in handle_action
  File "kittens/remote_file/main.py", line 125, in __enter__
  File "subprocess.py", line 373, in check_call
subprocess.CalledProcessError: Command '['ssh', '-o', 'ControlPath=~/.ssh/kitty-master-27691-%r@%h:%p', '-o', 'TCPKeepAlive=yes', '-o', 'ControlPersist=yes', '-o', 'ControlMaster=auto', '-fN', 'sh -c \'#!/bin/sh\n# macOS ships with an ancient version of tic that cannot read from stdin, so we\n# create a temp file for it\ntmp=$(mktemp)\ncat >$tmp << \'"\'"\'TERMEOF\'"\'"\'\n#\tReconstructed via infocmp from file: /home/yhuang/.local/kitty.app/lib/kitty/terminfo/x/xterm-kitty\nxterm-kitty|KovIdTTY,\n\tam, ccc, hs, km, mc5i, mir, msgr, npc, xenl, Su, Tc, fullkbd,\n\tcolors#0x100, cols#80, it#8, lines#24, pairs#0x7fff,\n\tacsc=++\\,\\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,\n\tbel=^G, bold=\\E[1m, cbt=\\E[Z, civis=\\E[?25l,\n\tclear=\\E[H\\E[2J, cnorm=\\E[?12l\\E[?25h, cr=\\r,\n\tcsr=\\E[%i%p1%d;%p2%dr, cub=\\E[%p1%dD, cub1=^H,\n\tcud=\\E[%p1%dB, cud1=\\n, cuf=\\E[%p1%dC, cuf1=\\E[C,\n\tcup=\\E[%i%p1%d;%p2%dH, cuu=\\E[%p1%dA, cuu1=\\E[A,\n\tcvvis=\\E[?12;25h, dch=\\E[%p1%dP, dch1=\\E[P, dim=\\E[2m,\n\tdl=\\E[%p1%dM, dl1=\\E[M, dsl=\\E]2;\\007, ech=\\E[%p1%dX,\n\ted=\\E[J, el=\\E[K, el1=\\E[1K, flash=\\E[?5h$<100/>\\E[?5l,\n\tfsl=^G, home=\\E[H, hpa=\\E[%i%p1%dG, ht=^I, hts=\\EH,\n\tich=\\E[%p1%d@, il=\\E[%p1%dL, il1=\\E[L, ind=\\n,\n\tindn=\\E[%p1%dS,\n\tinitc=\\E]4;%p1%d;rgb\\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\\E\\\\,\n\tkDC=\\E[3;2~, kEND=\\E[1;2F, kHOM=\\E[1;2H, kIC=\\E[2;2~,\n\tkLFT=\\E[1;2D, kNXT=\\E[6;2~, kPRV=\\E[5;2~, kRIT=\\E[1;2C,\n\tka1=, ka3=, kbs=^?, kc1=, kc3=, kcbt=\\E[Z, kcub1=\\EOD,\n\tkcud1=\\EOB, kcuf1=\\EOC, kcuu1=\\EOA, kdch1=\\E[3~, kend=\\EOF,\n\tkf1=\\EOP, kf10=\\E[21~, kf11=\\E[23~, kf12=\\E[24~,\n\tkf13=\\E[1;2P, kf14=\\E[1;2Q, kf15=\\E[1;2R, kf16=\\E[1;2S,\n\tkf17=\\E[15;2~, kf18=\\E[17;2~, kf19=\\E[18;2~, kf2=\\EOQ,\n\tkf20=\\E[19;2~, kf21=\\E[20;2~, kf22=\\E[21;2~,\n\tkf23=\\E[23;2~, kf24=\\E[24;2~, kf25=\\E[1;5P, kf26=\\E[1;5Q,\n\tkf27=\\E[1;5R, kf28=\\E[1;5S, kf29=\\E[15;5~, kf3=\\EOR,\n\tkf30=\\E[17;5~, kf31=\\E[18;5~, kf32=\\E[19;5~,\n\tkf33=\\E[20;5~, kf34=\\E[21;5~, kf35=\\E[23;5~,\n\tkf36=\\E[24;5~, kf37=\\E[1;6P, kf38=\\E[1;6Q, kf39=\\E[1;6R,\n\tkf4=\\EOS, kf40=\\E[1;6S, kf41=\\E[15;6~, kf42=\\E[17;6~,\n\tkf43=\\E[18;6~, kf44=\\E[19;6~, kf45=\\E[20;6~,\n\tkf46=\\E[21;6~, kf47=\\E[23;6~, kf48=\\E[24;6~,\n\tkf49=\\E[1;3P, kf5=\\E[15~, kf50=\\E[1;3Q, kf51=\\E[1;3R,\n\tkf52=\\E[1;3S, kf53=\\E[15;3~, kf54=\\E[17;3~,\n\tkf55=\\E[18;3~, kf56=\\E[19;3~, kf57=\\E[20;3~,\n\tkf58=\\E[21;3~, kf59=\\E[23;3~, kf6=\\E[17~, kf60=\\E[24;3~,\n\tkf61=\\E[1;4P, kf62=\\E[1;4Q, kf63=\\E[1;4R, kf7=\\E[18~,\n\tkf8=\\E[19~, kf9=\\E[20~, khlp=, khome=\\EOH, kich1=\\E[2~,\n\tkind=\\E[1;2B, kmous=\\E[M, knp=\\E[6~, kpp=\\E[5~,\n\tkri=\\E[1;2A, kund=, oc=\\E]104\\007, op=\\E[39;49m, rc=\\E8,\n\trep=%p1%c\\E[%p2%{1}%-%db, rev=\\E[7m, ri=\\EM,\n\trin=\\E[%p1%dT, ritm=\\E[23m, rmacs=\\E(B, rmam=\\E[?7l,\n\trmcup=\\E[?1049l, rmir=\\E[4l, rmkx=\\E[?1l, rmso=\\E[27m,\n\trmul=\\E[24m, rs1=\\E]\\E\\\\\\Ec, sc=\\E7,\n\tsetab=\\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,\n\tsetaf=\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,\n\tsgr=%?%p9%t\\E(0%e\\E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T6=\\E[1;6C,\n\tkRIT7=\\E[1;7C, kUP=\\E[1;2A, kUP3=\\E[1;3A, kUP4=\\E[1;4A,\n\tkUP5=\\E[1;5A, kUP6=\\E[1;6A, kUP7=\\E[1;7A, rmxx=\\E[29m,\n\tsetrgbb=\\E[48\\:2\\:%p1%d\\:%p2%d\\:%p3%dm,\n\tsetrgbf=\\E[38\\:2\\:%p1%d\\:%p2%d\\:%p3%dm, smxx=\\E[9m,\n\nTERMEOF\n\ntic_out=$(tic -x -o $HOME/.terminfo $tmp 2>&1)\nrc=$?\nrm $tmp\nif [ "$rc" != "0" ]; then echo "$tic_out"; exit 1; fi\nif [ -z "$USER" ]; then export USER=$(whoami); fi\nexport TERMINFO="$HOME/.terminfo"\nlogin_shell=""\npython=""\n\nlogin_shell_is_ok() {\n    if [ -z "$login_shell" ] || [ ! -x "$login_shell" ]; then return 1; fi\n    case "$login_shell" in\n        *sh) return 0;\n    esac\n    return 1;\n}\n\ndetect_python() {\n    python=$(command -v python3)\n    if [ -z "$python" ]; then python=$(command -v python2); fi\n    if [ -z "$python" ]; then python=python; fi\n}\n\nusing_getent() {\n    cmd=$(command -v getent)\n    if [ -z "$cmd" ]; then return; fi\n    output=$($cmd passwd $USER 2>/dev/null)\n    if [ $? = 0 ]; then login_shell=$(echo $output | cut -d: -f7); fi\n}\n\nusing_id() {\n    cmd=$(command -v id)\n    if [ -z "$cmd" ]; then return; fi\n    output=$($cmd -P $USER 2>/dev/null)\n    if [ $? = 0 ]; then login_shell=$(echo $output | cut -d: -f7); fi\n}\n\nusing_passwd() {\n    cmd=$(command -v grep)\n    if [ -z "$cmd" ]; then return; fi\n    output=$($cmd "^$USER:" /etc/passwd 2>/dev/null)\n    if [ $? = 0 ]; then login_shell=$(echo $output | cut -d: -f7); fi\n}\n\nusing_python() {\n    detect_python\n    if [ ! -x "$python" ]; then return; fi\n    output=$($python -c "import pwd, os; print(pwd.getpwuid(os.geteuid()).pw_shell)")\n    if [ $? = 0 ]; then login_shell=$output; fi\n}\n\nexecute_with_python() {\n    detect_python\n    exec $python -c "import os; os.execl(\'"\'"\'$login_shell\'"\'"\', \'"\'"\'-\'"\'"\' \'"\'"\'$shell_name\'"\'"\')"\n}\n\ndie() { echo "$*" 1>&2 ; exit 1; }\n\nusing_getent\nif ! login_shell_is_ok; then using_id; fi\nif ! login_shell_is_ok; then using_python; fi\nif ! login_shell_is_ok; then using_passwd; fi\nif ! login_shell_is_ok; then die "Could not detect login shell"; fi\n\n\n# If a command was passed to SSH execute it here\n\n\n# We need to pass the first argument to the executed program with a leading -\n# to make sure the shell executes as a login shell. Note that not all shells\n# support exec -a so we use the below to try to detect such shells\nshell_name=$(basename $login_shell)\nif [ -z "$PIPESTATUS" ]; then\n    # the dash shell does not support exec -a and also does not define PIPESTATUS\n    execute_with_python\nfi\nexec -a "-$shell_name" $login_shell\n\'']' returned non-zero exit status 255.
Failed with unhandled exception

Environment details
On the local machine

kitty 0.22.2 (13e59df1f8) created by Kovid Goyal
Linux yhuang-dell 5.4.0-80-generic #90~18.04.1-Ubuntu SMP Tue Jul 13 19:40:02 UTC 2021 x86_64
Ubuntu 18.04.5 LTS \n \l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
Running under:X11
Loaded config files:
  /home/yhuang/.config/kitty/kitty.conf

Config options different from defaults:
background_opacity 0.8
font_family        MesloLGS NF
font_size          14.0
Colors:
	background         #2e3440   
	color0             #3b4252   
	color1             #bf616a   
	color10            #a3be8c   
	color11            #ebcb8b   
	color12            #81a1c1   
	color13            #b48ead   
	color14            #8fbcbb   
	color15            #eceff4   
	color2             #a3be8c   
	color3             #ebcb8b   
	color4             #81a1c1   
	color5             #b48ead   
	color6             #88c0d0   
	color7             #e5e9f0   
	color8             #4c566a   
	color9             #bf616a   
	cursor             #81a1c1   
	foreground         #d8dee9   

On the machine I'm ssh into: (there's kitty installed there too as I sometimes do virtual desktop in):

kitty 0.22.2 (13e59df1f8) created by Kovid Goyal
Linux yhuang-vdesk 5.4.0-1054-aws #57~18.04.1-Ubuntu SMP Thu Jul 15 03:21:36 UTC 2021 x86_64
Ubuntu 18.04.5 LTS \n \l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
Running under:X11
Loaded config files:
  /home/yhuang/.config/kitty/kitty.conf

Config options different from defaults:
background_opacity 0.8
font_family        MesloLGS NF
font_size          14.0
Colors:
	background         #2e3440   
	color0             #3b4252   
	color1             #bf616a   
	color10            #a3be8c   
	color11            #ebcb8b   
	color12            #81a1c1   
	color13            #b48ead   
	color14            #8fbcbb   
	color15            #eceff4   
	color2             #a3be8c   
	color3             #ebcb8b   
	color4             #81a1c1   
	color5             #b48ead   
	color6             #88c0d0   
	color7             #e5e9f0   
	color8             #4c566a   
	color9             #bf616a   
	cursor             #81a1c1   
	foreground         #d8dee9   

Additional context
I can reproduce the issue with kitty --config NONE. I use /bin/ls in my command since in my shell I've aliased ls to exa. If I switch shell and no longer have the alias, the problem is still there.

@obenno
Copy link

obenno commented Feb 8, 2022

Hi,

I've encountered the same issue with the latest version of kitty kitty 0.24.2 created by Kovid Goyal:

Traceback (most recent call last):
  File "kittens/remote_file/main.py", line 212, in main
  File "kittens/remote_file/main.py", line 283, in handle_action
  File "kittens/remote_file/main.py", line 126, in __enter__
  File "subprocess.py", line 373, in check_call
subprocess.CalledProcessError: Command '['ssh', '-o', 'ControlPath=~/.ssh/kitty-master-4858-%r@%h:%p', '-o', 'TCPKeepAlive=yes', '-o', 'ControlPersist=yes', '-o', 'ControlMaster=auto', '-fN', 'sh -c \'#!/bin/sh\n# macOS ships with an ancient version of tic that cannot read from stdin, so we\n# create a temp file for it\ntmp=$(mktemp)\ncat >$tmp << \'"\'"\'TERMEOF\'"\'"\'\n#\tReconstructed via infocmp from file: /home/xzx/.local/kitty.app/lib/kitty/terminfo/x/xterm-kitty\nxterm-kitty|KovIdTTY,\n\tam, ccc, hs, km, mc5i, mir, msgr, npc, xenl, Su, Tc, fullkbd,\n\tcolors#0x100, cols#80, it#8, lines#24, pairs#0x7fff,\n\tacsc=++\\,\\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,\n\tbel=^G, bold=\\E[1m, cbt=\\E[Z, civis=\\E[?25l,\n\tclear=\\E[H\\E[2J, cnorm=\\E[?12h\\E[?25h, cr=\\r,\n\tcsr=\\E[%i%p1%d;%p2%dr, cub=\\E[%p1%dD, cub1=^H,\n\tcud=\\E[%p1%dB, cud1=\\n, cuf=\\E[%p1%dC, cuf1=\\E[C,\n\tcup=\\E[%i%p1%d;%p2%dH, cuu=\\E[%p1%dA, cuu1=\\E[A,\n\tcvvis=\\E[?12;25h, dch=\\E[%p1%dP, dch1=\\E[P, dim=\\E[2m,\n\tdl=\\E[%p1%dM, dl1=\\E[M, dsl=\\E]2;\\007, ech=\\E[%p1%dX,\n\ted=\\E[J, el=\\E[K, el1=\\E[1K, flash=\\E[?5h$<100/>\\E[?5l,\n\tfsl=^G, home=\\E[H, hpa=\\E[%i%p1%dG, ht=^I, hts=\\EH,\n\tich=\\E[%p1%d@, il=\\E[%p1%dL, il1=\\E[L, ind=\\n,\n\tindn=\\E[%p1%dS,\n\tinitc=\\E]4;%p1%d;rgb\\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\\E\\\\,\n\tkBEG=\\E[1;2E, kDC=\\E[3;2~, kEND=\\E[1;2F, kHOM=\\E[1;2H,\n\tkIC=\\E[2;2~, kLFT=\\E[1;2D, kNXT=\\E[6;2~, kPRV=\\E[5;2~,\n\tkRIT=\\E[1;2C, ka1=, ka3=, kbeg=\\EOE, kbs=^?, kc1=, kc3=,\n\tkcbt=\\E[Z, kcub1=\\EOD, kcud1=\\EOB, kcuf1=\\EOC, kcuu1=\\EOA,\n\tkdch1=\\E[3~, kend=\\EOF, kf1=\\EOP, kf10=\\E[21~, kf11=\\E[23~,\n\tkf12=\\E[24~, kf13=\\E[1;2P, kf14=\\E[1;2Q, kf15=\\E[1;2R,\n\tkf16=\\E[1;2S, kf17=\\E[15;2~, kf18=\\E[17;2~,\n\tkf19=\\E[18;2~, kf2=\\EOQ, kf20=\\E[19;2~, kf21=\\E[20;2~,\n\tkf22=\\E[21;2~, kf23=\\E[23;2~, kf24=\\E[24;2~,\n\tkf25=\\E[1;5P, kf26=\\E[1;5Q, kf27=\\E[1;5R, kf28=\\E[1;5S,\n\tkf29=\\E[15;5~, kf3=\\EOR, kf30=\\E[17;5~, kf31=\\E[18;5~,\n\tkf32=\\E[19;5~, kf33=\\E[20;5~, kf34=\\E[21;5~,\n\tkf35=\\E[23;5~, kf36=\\E[24;5~, kf37=\\E[1;6P, kf38=\\E[1;6Q,\n\tkf39=\\E[1;6R, kf4=\\EOS, kf40=\\E[1;6S, kf41=\\E[15;6~,\n\tkf42=\\E[17;6~, kf43=\\E[18;6~, kf44=\\E[19;6~,\n\tkf45=\\E[20;6~, kf46=\\E[21;6~, kf47=\\E[23;6~,\n\tkf48=\\E[24;6~, kf49=\\E[1;3P, kf5=\\E[15~, kf50=\\E[1;3Q,\n\tkf51=\\E[1;3R, kf52=\\E[1;3S, kf53=\\E[15;3~, kf54=\\E[17;3~,\n\tkf55=\\E[18;3~, kf56=\\E[19;3~, kf57=\\E[20;3~,\n\tkf58=\\E[21;3~, kf59=\\E[23;3~, kf6=\\E[17~, kf60=\\E[24;3~,\n\tkf61=\\E[1;4P, kf62=\\E[1;4Q, kf63=\\E[1;4R, kf7=\\E[18~,\n\tkf8=\\E[19~, kf9=\\E[20~, khlp=, khome=\\EOH, kich1=\\E[2~,\n\tkind=\\E[1;2B, kmous=\\E[M, knp=\\E[6~, kpp=\\E[5~,\n\tkri=\\E[1;2A, kund=, oc=\\E]104\\007, op=\\E[39;49m, rc=\\E8,\n\trep=%p1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OM4=\\E[1;4H, kHOM5=\\E[1;5H, kHOM6=\\E[1;6H,\n\tkHOM7=\\E[1;7H, kIC3=\\E[2;3~, kIC4=\\E[2;4~, kIC5=\\E[2;5~,\n\tkIC6=\\E[2;6~, kIC7=\\E[2;7~, kLFT3=\\E[1;3D, kLFT4=\\E[1;4D,\n\tkLFT5=\\E[1;5D, kLFT6=\\E[1;6D, kLFT7=\\E[1;7D,\n\tkNXT3=\\E[6;3~, kNXT4=\\E[6;4~, kNXT5=\\E[6;5~,\n\tkNXT6=\\E[6;6~, kNXT7=\\E[6;7~, kPRV3=\\E[5;3~,\n\tkPRV4=\\E[5;4~, kPRV5=\\E[5;5~, kPRV6=\\E[5;6~,\n\tkPRV7=\\E[5;7~, kRIT3=\\E[1;3C, kRIT4=\\E[1;4C,\n\tkRIT5=\\E[1;5C, kRIT6=\\E[1;6C, kRIT7=\\E[1;7C, kUP=\\E[1;2A,\n\tkUP3=\\E[1;3A, kUP4=\\E[1;4A, kUP5=\\E[1;5A, kUP6=\\E[1;6A,\n\tkUP7=\\E[1;7A, rmxx=\\E[29m,\n\tsetrgbb=\\E[48\\:2\\:%p1%d\\:%p2%d\\:%p3%dm,\n\tsetrgbf=\\E[38\\:2\\:%p1%d\\:%p2%d\\:%p3%dm, smxx=\\E[9m,\n\nTERMEOF\n\ntic_out=$(tic -x -o $HOME/.terminfo $tmp 2>&1)\nrc=$?\nrm $tmp\nif [ "$rc" != "0" ]; then echo "$tic_out"; exit 1; fi\nif [ -z "$USER" ]; then export USER=$(whoami); fi\nexport TERMINFO="$HOME/.terminfo"\nlogin_shell=""\npython=""\n\nlogin_shell_is_ok() {\n    if [ -z "$login_shell" ] || [ ! -x "$login_shell" ]; then return 1; fi\n    case "$login_shell" in\n        *sh) return 0;\n    esac\n    return 1;\n}\n\ndetect_python() {\n    python=$(command -v python3)\n    if [ -z "$python" ]; then python=$(command -v python2); fi\n    if [ -z "$python" ]; then python=python; fi\n}\n\nusing_getent() {\n    cmd=$(command -v getent)\n    if [ -z "$cmd" ]; then return; fi\n    output=$($cmd passwd $USER 2>/dev/null)\n    if [ $? = 0 ]; then login_shell=$(echo $output | cut -d: -f7); fi\n}\n\nusing_id() {\n    cmd=$(command -v id)\n    if [ -z "$cmd" ]; then return; fi\n    output=$($cmd -P $USER 2>/dev/null)\n    if [ $? = 0 ]; then login_shell=$(echo $output | cut -d: -f7); fi\n}\n\nusing_passwd() {\n    cmd=$(command -v grep)\n    if [ -z "$cmd" ]; then return; fi\n    output=$($cmd "^$USER:" /etc/passwd 2>/dev/null)\n    if [ $? = 0 ]; then login_shell=$(echo $output | cut -d: -f7); fi\n}\n\nusing_python() {\n    detect_python\n    if [ ! -x "$python" ]; then return; fi\n    output=$($python -c "import pwd, os; print(pwd.getpwuid(os.geteuid()).pw_shell)")\n    if [ $? = 0 ]; then login_shell=$output; fi\n}\n\nexecute_with_python() {\n    detect_python\n    exec $python -c "import os; os.execl(\'"\'"\'$login_shell\'"\'"\', \'"\'"\'-\'"\'"\' \'"\'"\'$shell_name\'"\'"\')"\n}\n\ndie() { echo "$*" 1>&2 ; exit 1; }\n\nusing_getent\nif ! login_shell_is_ok; then using_id; fi\nif ! login_shell_is_ok; then using_python; fi\nif ! login_shell_is_ok; then using_passwd; fi\nif ! login_shell_is_ok; then die "Could not detect login shell"; fi\n\n\n# If a command was passed to SSH execute it here\n\n\n# We need to pass the first argument to the executed program with a leading -\n# to make sure the shell executes as a login shell. Note that not all shells\n# support exec -a so we use the below to try to detect such shells\nshell_name=$(basename $login_shell)\nif [ -z "$PIPESTATUS" ]; then\n    # the dash shell does not support exec -a and also does not define PIPESTATUS\n    execute_with_python\nfi\nexec -a "-$shell_name" $login_shell\n\'']' returned non-zero exit status 255.

I'm new to kitty, not sure it's caused by any misconfiguration or the bug persists, but I use most of the default settings with automatically shell integration. thanks.

@page-down
Copy link
Contributor

Check the local ssh client, and remote ssh server version & config.
Check if the local ssh is a symlink to other software.
Try using the above parameters with verbose argument to connect via ssh.
Check the ssh verbose messages to see if there are incompatibility issues, or connection issues.

Try to connect to other remote ssh server with minimal configuration to see if there is a problem and find out the difference.

@obenno
Copy link

obenno commented Feb 8, 2022

Hi,

Thanks for your prompt reply.

After some testing I was able to make it work, but not with the ssh kitten.

After a reinstallation of kitty, the issue persist. But after rm -rf ~/.terminfo on the remote server, and login again with the normal ssh command (not the kitten), the remote files kitten works. Without terminfo, there will be malfunction, like no auto-completion and delete and backspace don't work.

After use kitty +kitten ssh myserver to connect the server and generate a new terminfo folder, the remote file issue occurs. But if connect again with a normal ssh, the remote files works, as well as the auto-completion and backspace.

If I understand correctly, the ssh kitten is used to replace the normal ssh command, so every time I login the remote server, I should use the kitten, right?

ssh version was checked by ssh -v server:

debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.3

The issue occurs when I connect to another centos server, but I could not access it now.

@kovidgoyal
Copy link
Owner

You only need to run the ssh kitten once, per server.

@obenno
Copy link

obenno commented Feb 8, 2022

Thanks. Then there is no need to set the alias ssh="kitty +kitten ssh" as mentioned in the FAQ. I guess this part is a little bit misleading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants