Skip to content

scp to fish throws 'Could not set up terminal'  #4432

Closed

Description

@3xp10it

Mostly the same as issues/3165
I try to scp file from machine B to machine A with machine A's fish.

machine A(127.0.0.1) is the one I am using locally with fish,machine A installed fish as the default login shell.
machine B(25.41.29.133)is the remote one I try to copy file from,machine B installed fish as the default login shell.

when I try to execute below command in machine A,it tellls me open terminal failed: not a terminal

scp [email protected]:/Users/3xp10it/mypypi/exp10it.py /tmp/
Password:
open terminal failed: not a terminal
TERM environment variable not set.

env:
fish 2.6.0
iterm2
tmux
macOS sierra

Activity

  1. mqudsi commented on Sep 27, 2017

    @mqudsi
    Contributor

    You provided some configuration information, but it’s not clear which of the two PCs it pertains to. Is the remote machine running the same environment?

  2. 3xp10it commented on Sep 27, 2017

    @3xp10it
    Author
  3. zanchey commented on Sep 27, 2017

    @zanchey
    Member

    Do you really run tmux on every start of a new shell?

    If so, you need to protect that with:

    if status is-interactive
       tmux
       clear
    end
    

    See #3473.

  4. 3xp10it commented on Sep 27, 2017

    @3xp10it
    Author

    @zanchey I modify it to

    if status is-interactive
       tmux
       clear
    end
    

    And no more open terminal failed: not a terminal TERM environment variable not set. error comes out,but after I have run the command:

    ⋊> /p/tmp scp [email protected]:/Users/3xp10it/mypypi/exp10it.py /tmp/xxx.py                                                                                                                                                                                                                                       22:37:22
    Password:
    

    I found it didn't copy the file successfully,and I tried it 3 times,the result is the same.

  5. zanchey commented on Oct 1, 2017

    @zanchey
    Member

    Try running scp with -vv in order to get verbose output.

  6. faho commented on Jan 1, 2018

    @faho
    Member

    Closing for lack of response. @3xp10it: If you would try scp -vv, I'll gladly reopen.

  7. MVarga12 commented on Apr 2, 2018

    @MVarga12

    If I may, I'm also having this issue, and it was fixed when I changed the remote server's default terminal to bash. Attached is my scp -vv output, starting after successful authentication and hopefully scrubbed of server-identifying information.

    debug1: Authentication succeeded (publickey).
    
    Authenticated to
    
    debug2: fd 6 setting O_NONBLOCK
    
    debug2: fd 7 setting O_NONBLOCK
    
    debug1: channel 0: new [client-session]
    
    debug2: channel 0: send open
    
    debug1: Requesting [email protected]
    
    debug1: Entering interactive session.
    
    debug1: pledge: network
    
    debug1: client_input_global_request: rtype [email protected] want_reply 0
    
    debug2: channel_input_open_confirmation: channel 0: callback start
    
    debug2: fd 5 setting TCP_NODELAY
    
    debug2: client_session2_setup: id 0
    
    debug1: Sending environment.
    
    debug1: Sending env LANG = en_US.UTF-8
    
    debug2: channel 0: request env confirm 0
    
    debug1: Sending command: scp -v -t /home/mvarga/personal_site/web/test.pdf
    
    debug2: channel 0: request exec confirm 1
    
    debug2: channel_input_open_confirmation: channel 0: callback done
    
    debug2: channel 0: open confirm rwindow 0 rmax 32768
    
    debug2: channel 0: rcvd adjust 2097152
    
    debug2: channel_input_status_confirm: type 99 id 0
    
    debug2: exec request accepted on channel 0
    
    debug2: channel 0: rcvd ext data 1
    
    fdebug2: channel 0: written 1 to efd 8
    
    debug2: channel 0: rcvd ext data 1
    
    idebug2: channel 0: written 1 to efd 8
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    sh: Cdebug2: channel 0: written 5 to efd 8
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    oudebug2: channel 0: written 2 to efd 8
    
    debug2: channel 0: rcvd ext data 1
    
    ldebug2: channel 0: written 1 to efd 8
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd ext data 1
    
    debug2: channel 0: rcvd eof
    
    debug2: channel 0: output open -> drain
    
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    
    debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
    
    debug2: channel 0: rcvd eow
    
    debug2: channel 0: close_read
    
    debug2: channel 0: input open -> closed
    
    debug2: channel 0: rcvd close
    
    debug2: channel 0: obuf_empty delayed efd 8/(22)
    
    d not set up terminal
    debug2: channel 0: written 22 to efd 8
    
    debug2: channel 0: obuf empty
    
    debug2: channel 0: close_write
    
    debug2: channel 0: output drain -> closed
    
    debug2: channel 0: almost dead
    
    debug2: channel 0: gc: notify user
    
    debug2: channel 0: gc: user detached
    
    debug2: channel 0: send close
    
    debug2: channel 0: is dead
    
    debug2: channel 0: garbage collecting
    
    debug1: channel 0: free: client-session, nchannels 1
    
    debug1: fd 0 clearing O_NONBLOCK
    
    debug1: fd 1 clearing O_NONBLOCK
    
    Transferred: sent 2768, received 3708 bytes, in 0.2 seconds
    
    Bytes per second: sent 13953.5, received 18692.1
    
    debug1: Exit status 1
    
    lost connection
    
    
  8. faho commented on Apr 4, 2018

    @faho
    Member

    @MVarga12: The most likely cause of this is that your fish configuration prints something even if it isn't interactive.

    So please confirm that, on the remote machine, fish -c exit | wc -c prints 0. If it doesn't, you need to guard everything that prints in your config.fish with if status is-interactive.

    Also, an scp log using bash would be of use.

    Reopening!

  9. reopened this on Apr 4, 2018
  10. MVarga12 commented on Apr 4, 2018

    @MVarga12

    @faho
    The included command does indeed print 0 on the remote machine. Just to be sure, I systematically deleted lines from my config.fish file. The problem seems to be in the fish_vi_key_bindings command. Without this line, scp works properly. Included below is my config.fish file and an scp -vv output with bash as the default shell.


    config.fish

    set PATH $HOME/.jenv/bin $PATH
    fish_vi_key_bindings
    
    if not set -q abbrs_initialized
        set -U abbrs_initialized
        #COMMAND LINE ALIASES
        abbr lt "ls -l --block-size=M | less"
        abbr rm "rm -i"
        
        #MARCC ALIASES
        abbr starthpc "redacted"
        abbr start_gateway "redacted"
        abbr stop_gateway "redacted"
        
        #PROGRAM ALIASES
        abbr rendervmd "/Applications/VMD\ 1.9.3.app/Contents/vmd/tachyon_MACOSXX86 -aasamples 12 vmdscene.dat -format TARGA -o vmdscene.dat.tga"
        abbr prev "open -a Preview"
        abbr fixbox "epstool --addtiff4-preview --bbox"
        abbr rulebender "/Applications/RuleBender-2.2.1-osx64/RuleBender.app/Contents/MacOS/RuleBender ; exit;"
        abbr vmd "/Applications/VMD\ 1.9.3.app/Contents/MacOS/startup.command ; exit;"
        abbr rsy "rsync -r -p -t -l -D -u -v"
        abbr cpr "cp -r"
        abbr back "cd -"
        abbr run_bng "/Applications/RuleBender-2.2.1-osx64/BioNetGen-2.3/BNG2.pl"
        abbr pathogen_dir "cd ~/.vim/bundle"
        abbr gdat_plot "~/Google\ Drive/github_repos/jhu_scripts/nfsim_analysis_scripts/gdat_plot.py" #gdat_plot filename target
        abbr emacs "/usr/local/Cellar/emacs/25.3/Emacs.app/Contents/MacOS/Emacs"
        abbr emacsnw "/usr/local/Cellar/emacs/25.3/Emacs.app/Contents/MacOS/Emacs -nw"
    end
    

    scp output

    debug1: Authentication succeeded (publickey).
    
    Authenticated to redacted.
    
    debug2: fd 6 setting O_NONBLOCK
    
    debug2: fd 7 setting O_NONBLOCK
    
    debug1: channel 0: new [client-session]
    
    debug2: channel 0: send open
    
    debug1: Requesting [email protected]
    
    debug1: Entering interactive session.
    
    debug1: pledge: network
    
    debug1: client_input_global_request: rtype [email protected] want_reply 0
    
    debug2: channel_input_open_confirmation: channel 0: callback start
    
    debug2: fd 5 setting TCP_NODELAY
    
    debug2: client_session2_setup: id 0
    
    debug1: Sending environment.
    
    debug1: Sending env LANG = en_US.UTF-8
    
    debug2: channel 0: request env confirm 0
    
    debug1: Sending command: scp -v -t /home/mvarga/Downloads
    
    debug2: channel 0: request exec confirm 1
    
    debug2: channel_input_open_confirmation: channel 0: callback done
    
    debug2: channel 0: open confirm rwindow 0 rmax 32768
    
    debug2: channel 0: rcvd adjust 2097152
    
    debug2: channel_input_status_confirm: type 99 id 0
    
    debug2: exec request accepted on channel 0
    
    Sending file modes: C0644 0 test
    debug2: channel 0: rcvd ext data 19
    
    Sink: C0644 0 test
    debug2: channel 0: written 19 to efd 8
    
    
    test                          100%    0     0.0KB/s   00:00    
    debug2: channel 0: read<=0 rfd 6 len 0
    
    debug2: channel 0: read failed
    
    debug2: channel 0: close_read
    
    debug2: channel 0: input open -> drain
    
    debug2: channel 0: ibuf empty
    
    debug2: channel 0: send eof
    
    debug2: channel 0: input drain -> closed
    
    debug2: channel 0: rcvd eof
    
    debug2: channel 0: output open -> drain
    
    debug2: channel 0: obuf empty
    
    debug2: channel 0: close_write
    
    debug2: channel 0: output drain -> closed
    
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    
    debug2: channel 0: rcvd close
    
    debug2: channel 0: almost dead
    
    debug2: channel 0: gc: notify user
    
    debug2: channel 0: gc: user detached
    
    debug2: channel 0: send close
    
    debug2: channel 0: is dead
    
    debug2: channel 0: garbage collecting
    
    debug1: channel 0: free: client-session, nchannels 1
    
    debug1: fd 0 clearing O_NONBLOCK
    
    debug1: fd 1 clearing O_NONBLOCK
    
    Transferred: sent 2828, received 2880 bytes, in 0.5 seconds
    
    Bytes per second: sent 5644.7, received 5748.5
    
    debug1: Exit status 0
    
  11. zanchey commented on Apr 4, 2018

    @zanchey
    Member

    Don't run fish_vi_key_bindings, set the variable instead:

    set -g fish_key_bindings fish_vi_key_binding
    
  12. MVarga12 commented on Apr 4, 2018

    @MVarga12

    Well that's embarrassing. All is well now. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions