kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.15k stars 972 forks source link

Automatically downloaded kitty binary on remote #5025

Closed ser3n1ty87 closed 2 years ago

ser3n1ty87 commented 2 years ago

Describe the bug There seems to be an issue with the download of kitty on a remote when using the ssh kitten.

Connecting to a remote using kitty +kitten ssh <my-remote> everything works fine, except that there seems to be an issue with the automagically downloaded kitty binary. It gets downloaded to "~/.local/share/kitty-ssh-kitten/kitty/bin/kitty", however, it is not made executable such that a subsequent call of kitty or any of its kittens (I wanted to try the icat kitten on a remote) on the remote doesn't work and leads to a "Permission denied" error. Is this the actual problem or is there any other issue on my side? I am using the current kitty 0.25.0 installed via my system package manager (openSUSE Tumbleweed). Thank you!

To Reproduce Steps to reproduce the behavior:

  1. kitty +kitten ssh
  2. kitty +kitten icat
  3. See error: "Permission denied"
kovidgoyal commented 2 years ago

This will probably be caused by the umask on your remote system being set to prevent creation of executable files. If you delete the installed kitty and run

umask 022; kitty

it should now be created with correct permissions. I should update the bootstrap script to set and restore umask before untarring.

GabeDuarteM commented 2 years ago

@kovidgoyal I'm having a similar problem, but in my case umask didn't fix it...

it outputs zsh: permission denied: kitty

If I then do, on the SSH'ed machine:

I get zsh: command not found: kitty

If I then exit SSH, relaunch kitty +kitten ssh w, and then run echo hooray | kitty +kitten clipboard, I again get zsh: permission denied: kitty

if I then run chmod +x /home/gabriel/.local/share/kitty-ssh-kitten/kitty/bin/kitty to make it executable, and run echo hooray | kitty +kitten clipboard, I get the following output:

/home/gabriel/.local/share/kitty-ssh-kitten/kitty/bin/kitty: 27: [: 0: unexpected operator
/home/gabriel/.local/share/kitty-ssh-kitten/kitty/install/bin/kitty: error while loading shared libraries: libpython3.9.so.1.0: cannot open shared object file: No such file or directory

Kitty was installed using the script curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin Host machine is running MacOS 12.2.1 (21D62) SSH machine is running Ubuntu 20.04.4 LTS (Focal Fossa)

Any idea whats the problem?

kovidgoyal commented 2 years ago

Look at the commit closing this issue.

GabeDuarteM commented 2 years ago

@kovidgoyal Ok, I have a different error now... What I did:

/home/gabriel/.local/share/kitty-ssh-kitten/kitty/bin/kitty: 27: [: 0: unexpected operator
kitty needs to be installed

Downloading kitty from: https://github.com/kovidgoyal/kitty/releases/download/v0.25.0/kitty-0.25.0-x86_64.txz

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 13.6M  100 13.6M    0     0  7619k      0  0:00:01  0:00:01 --:--:-- 9530k
Traceback (most recent call last):
  File "runpy.py", line 197, in _run_module_as_main
  File "runpy.py", line 87, in _run_code
  File "kitty_main.py", line 185, in <module>
  File "kitty_main.py", line 176, in main
  File "kitty_main.py", line 129, in namespaced
  File "kitty_main.py", line 111, in run_kitten
  File "bypy-importer.py", line 279, in exec_module
  File "kittens/runner.py", line 14, in <module>
  File "bypy-importer.py", line 279, in exec_module
  File "kitty/utils.py", line 25, in <module>
  File "bypy-importer.py", line 127, in create_module
ImportError: libfontconfig.so.1: cannot open shared object file: No such file or directory

Any idea whats going on?

I tried using both zsh and bash, both with the same results...

Also, not sure if its related, but there is an error at the start of the script: /home/gabriel/.local/share/kitty-ssh-kitten/kitty/bin/kitty: 27: [: 0: unexpected operator and one at the end ImportError: libfontconfig.so.1: cannot open shared object file: No such file or directory, which seems to be a python error... I have Python 3.8.10, if that's relevant

kovidgoyal commented 2 years ago

You are missing fontconfig on the server. Currently kitty does not load it dynamically so it needs to be installed. Someday I may change that.

GabeDuarteM commented 2 years ago

@kovidgoyal Awesome, that actually worked after doing sudo apt-get install fontconfig on the shh server, thanks!

The only thing is that whenever I exit and enter shh again, I have to chmod the script, is that intended? I could automate it by putting it on my rc file, but seems like a hack to have to do that in the first place...

Also, whenever I use it, I do get that /home/gabriel/.local/share/kitty-ssh-kitten/kitty/bin/kitty: 27: [: 0: unexpected operator error... Any idea what that is? Doesn't seem to affect the functionality, but seems to be related to this line, https://github.com/kovidgoyal/kitty/commit/289028b46870347e2b614511bbb2f830c32f9573#diff-3468e507dd46d3bf94c6c31e9bba42815cf13ca3f1202d501fe95b235f900dc2R27

image

I'm also having some problems while using this inside nvim... My whole intention on this is to share the local OS clipboard with an nvim instance running on the remote server (both for copy and paste) and finally get to ditch tmux, as Kitty pretty much does everything i'd use tmux to... I managed to make copy work with OSC52, I thought I could also use it for pasting, but I couldn't find much resources on how to do it, then I found this clipboard kitten, but running it through vim gives a different OSError: [Errno 6] No such device or address: '/dev/tty' error, which I'm also not sure what that is. The full error:

/home/gabriel/.local/share/kitty-ssh-kitten/kitty/bin/kitty: 27: [: 0: unexpected operator                                                             
Traceback (most recent call last):                                                                                                                     
  File "runpy.py", line 197, in _run_module_as_main                                                                                                    
  File "runpy.py", line 87, in _run_code                                                                                                               
  File "kitty_main.py", line 185, in <module>                                                                                                          
  File "kitty_main.py", line 176, in main                                                                                                              
  File "kitty_main.py", line 129, in namespaced                                                                                                        
  File "kitty_main.py", line 112, in run_kitten                                                                                                        
  File "kittens/runner.py", line 112, in run_kitten                                                                                                    
  File "runpy.py", line 213, in run_module                                                                                                             
  File "runpy.py", line 87, in _run_code                                                                                                               
  File "kittens/clipboard/main.py", line 107, in <module>                                                                                              
  File "kittens/clipboard/main.py", line 96, in main                                                                                                   
OSError: [Errno 6] No such device or address: '/dev/tty'                                                                                               

Press ENTER or type command to continue

File "kittens/clipboard/main.py", line 96 currently is https://github.com/kovidgoyal/kitty/blob/master/kittens/clipboard/main.py#L96, but I don't understand much of what that should do...

Also, if you have any tips on getting that to work in an easier way, I know that this doesn't relate specifically to kitty, but I'd really appreciate it... And sorry for the many questions 😅 (I could also post this as a separate issue if preferred)

kovidgoyal commented 2 years ago

neovim should be able to use osc 52 natively. Ask in its community for help. And again, read the commit that closed this issue for the rest of your questions.

GabeDuarteM commented 2 years ago

@kovidgoyal to be honest, I'm not sure where to look for the answers at on that commit:

kovidgoyal commented 2 years ago

The first two are fixed by the commit. The last is a neovim bug you will need to wait for it to be fixed, you cant use the clipbaord kitten from a program that doesnt make the tty device available.

GabeDuarteM commented 2 years ago

I see... I'll try checking the neovim thing with them then...

About the first two issues, sorry about the back and forth, not sure if I'm missing something, there's only one file on that commit, so I replaced ~/.local/share/kitty-ssh-kitten/kitty/bin/kitty with the file on the commit, and I still get the error... Am I supposed to do something different?

For the first issue, on that commit, the problematic line is still there (line 27, [ $? == 0 ] || script_path="$0"),

And for the second issue, the permission denied error that I get is for the file you committed, and not for whatever comes out of fetch "$url" | command tar -C "$install_dir" -xJof -, so I cannot run it unless I explicitly give it permissions with chmod, so it doesn't seem to fix the problem, at least in my part...

kovidgoyal commented 2 years ago

Dont replace files, use the nightly kitty build. Both your issues will be resolved.