OmniSSHAgent: Named pipe stops working after a while the system is on

It seems that named pipe stops working after a while the system is on:

PS C:\Users\Maicol> ssh-add -l
Error connecting to agent: No such file or directory
PS C:\Users\Maicol> Get-ChildItem \\.\pipe\|findstr open
------        01/01/1601     01:00              1 openssh-ssh-agent

WSL:

  ~ ❯ ssh-add -l                                                                                              19:43:23
error fetching identities: communication with agent failed

However, Git bash works:

$ ssh-add -l
3072 SHA256:xInBcA48YT6jmmOEWQrXtC+xw+c6V2V2cVgAWT6K9hg id_rsa (RSA)
256 SHA256:ZgvmgA5CNIpEbTZWepclAdXC9fVBFsB1kvmM14Egjm8 id_ed25519 (ED25519)

I’ve currently tested the named pipe mode and the 1password proxy mode and the two modes are affected. Do you have any clue? Thanks

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 31 (28 by maintainers)

Most upvoted comments

It was working on Friday (May 27) but broke between then and today (May 31).

I tried:

  • building omni-socat from source
  • switching to npiperelay
  • switching omni-socat.exe to windows 8 compatability mode

None of those worked

Rebooted my laptop, and it’s back to working again 🤷

I think I’m seeing the same issue: image

What’s strange is it runs outside of socat:

$ curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip -sLo omni-socat.zip
$ unzip omni-socat.zip
Archive:  omni-socat.zip
  inflating: omni-socat.exe
$ ls -l
total 5612
-rwxrwxrwx 1 ddrown ddrown 3675648 May 27 07:16 omni-socat.exe
-rw-rw-r-- 1 ddrown ddrown 2067854 May 31 10:17 omni-socat.zip
$ sha1sum omni-socat.exe
d34e4797eaa493b301356d361a8d5473913b41fb  omni-socat.exe
$ ./omni-socat.exe -h
Usage of omni-socat.exe:
  -debug
        Output debug log
$ socat UNIX-LISTEN:/home/ddrown/.ssh/agent.sock,fork EXEC:"./omni-socat.exe -debug" &
$ ssh-add -l
error fetching identities: communication with agent failed

I’ve been using this every day since I added my comments, and it’s been stable ever since then. I guess something changed, but I don’t know what.

No, I’m not using Cygwin and the others.

I’m only using WSL2 and rarely Powershell

I’ve debugged a bit and it seems Omni overwrites the pipe used by Microsoft OpenSSH:

 Maicol    ~  ﮫ0ms⠀   ssh-add.exe -L                                            pwsh   100  09:24:29 
Error connecting to agent: No such file or directory
 Maicol    ~  ﮫ39ms⠀   echo $env:SSH_AUTH_SOCK                                  pwsh   100  09:24:34 
/c/Users/Maicol/OmniSSHCygwin.sock
 Maicol    ~  ﮫ18ms⠀   $env:SSH_AUTH_SOCK = '\\.\pipe\openssh-ssh-agent'        pwsh   100  09:24:40 
 Maicol    ~  ﮫ2ms⠀   echo $env:SSH_AUTH_SOCK                                   pwsh   100  09:24:44 
\\.\pipe\openssh-ssh-agent
 Maicol    ~  ﮫ30ms⠀   ssh-add.exe -l                                           pwsh   100  09:24:48 
3072 SHA256:xInBcA48YT6jmmOEWQrXtC+xw+c6V2V2cVgAWT6K9hg id_rsa (RSA)
256 SHA256:ZgvmgA5CNIpEbTZWepclAdXC9fVBFsB1kvmM14Egjm8 id_ed25519 (ED25519)

I’ve checked in env variables and there was a manually added SSH_AUTH_SOCK variable that was causing this issue.

I’ll keep you updated if I have the previous issues

@masahide windows ssh-add never worked for me (in the PC I’m currrently using. On another PC works):

PS C:\Users\Maicol> ssh-add -L
Error connecting to agent: No such file or directory
PS C:\Users\Maicol> ssh-add.exe -L
Error connecting to agent: No such file or directory

I’m not sure whether restarting 1Password fixes the original test (I will try that when I get it), but it fixes this one: https://github.com/masahide/OmniSSHAgent/issues/20#issuecomment-1152414315

Yes, I only restart 1Password. Other things and services are untouched

Useful detail (maybe): restarting 1password when this happens fixes the issue

New issue today, but I don’t know if it’s related:

sign_and_send_pubkey: signing failed for RSA "/home/maicol07/.ssh/id_rsa" from agent: agent refused operation
sign_and_send_pubkey: signing failed for ED25519 "id_ed25519" from agent: agent refused operation
maicol07@192.168.1.111: Permission denied (publickey)

Log:

2022/06/10 16:16:59 npipe2stdin.go:44: Started omni-socat
2022/06/10 16:16:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/10 16:16:59 npipe2stdin.go:58: Disconnected. [<nil>]

Thanks. From the information you gave us, it looks like the omni-socat.exe is fine and the socat process is causing the problem.

It may be a problem with the combination of socat and WSL2. https://github.com/microsoft/WSL/issues/7560

I’ll look into it some more, but if there’s nothing I can do about it. I think I can solve this problem by creating something like socat myself. Please give me some time.

@masahide new case:

  ~ ❯ ssh-add -l                                                                                              17:41:18
error fetching identities: communication with agent failed
  ~ ❯ cat /mnt/c/Users/Maicol/omni-socat.log                                                                  22:10:52
2022/05/28 12:27:59 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:27:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:27:59 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:28:03 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:28:03 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:28:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:14 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:14 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:14 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:44 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:44 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:44 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 20:53:24 npipe2stdin.go:44: Started omni-socat
2022/05/28 20:53:24 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 20:53:28 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:16 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:16 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:16 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:19 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:19 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:19 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 16:28:28 npipe2stdin.go:44: Started omni-socat
2022/05/29 16:28:28 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 16:28:33 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 12:45:21 npipe2stdin.go:44: Started omni-socat
2022/05/31 12:45:21 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 12:45:27 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 15:36:39 npipe2stdin.go:44: Started omni-socat
2022/05/31 15:36:39 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 15:36:39 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 01:27:35 npipe2stdin.go:44: Started omni-socat
2022/06/01 01:27:35 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 01:27:40 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:25:59 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:25:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:26:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:45:46 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:45:46 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:45:49 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:42:04 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:42:04 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:42:10 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:56:12 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:56:12 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:56:12 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:10:22 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:10:22 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:10:22 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:20:15 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:20:15 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:20:15 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:27:34 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:27:34 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:27:34 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:40:48 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:40:48 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:40:48 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 09:00:37 npipe2stdin.go:44: Started omni-socat
2022/06/03 09:00:37 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 09:00:37 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 09:01:08 npipe2stdin.go:44: Started omni-socat
2022/06/03 09:01:08 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 09:01:08 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 09:01:22 npipe2stdin.go:44: Started omni-socat
2022/06/03 09:01:22 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 09:01:24 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 15:16:45 npipe2stdin.go:44: Started omni-socat
2022/06/03 15:16:45 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 15:16:48 npipe2stdin.go:58: Disconnected. [<nil>]
  ~ ❯ ps axuw|grep socat                                                                                      22:12:16
maicol07   497  0.0  0.0  10276  2964 ?        Ss   10:29   0:00 socat UNIX-LISTEN:/home/maicol07/.ssh/agent.sock,fork EXEC:/home/maicol07/omni-socat/omni-socat.exe -debug
maicol07  2972  0.0  0.0   6476  2328 pts/1    S+   22:12   0:00 grep --color=auto socat
  ~ ❯ /home/maicol07/omni-socat/omni-socat.exe -h                                                             22:12:36
Usage of omni-socat.exe:
  -debug
        Output debug log
  ~ ❯ sha1sum /home/maicol07/omni-socat/omni-socat.exe                                                        22:12:46
d34e4797eaa493b301356d361a8d5473913b41fb  /home/maicol07/omni-socat/omni-socat.exe
  ~ ❯ ls -la $SSH_AUTH_SOCK                                                                                   22:13:01
srwxr-xr-x 1 maicol07 maicol07 0 giu  6 10:29 /home/maicol07/.ssh/agent.sock=

Rebooted and works… next time!

@masahide got this again and nothing has been logged

~ ❯ ssh-add -l                                                                                              23:45:45
error fetching identities: communication with agent failed
~ ❯ cat /mnt/c/Users/Maicol/omni-socat.log                                                                  23:45:47
2022/05/28 12:27:59 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:27:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:27:59 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:28:03 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:28:03 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:28:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:14 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:14 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:14 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:44 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:44 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:44 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 20:53:24 npipe2stdin.go:44: Started omni-socat
2022/05/28 20:53:24 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 20:53:28 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:16 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:16 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:16 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:19 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:19 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:19 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 16:28:28 npipe2stdin.go:44: Started omni-socat
2022/05/29 16:28:28 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 16:28:33 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 12:45:21 npipe2stdin.go:44: Started omni-socat
2022/05/31 12:45:21 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 12:45:27 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 15:36:39 npipe2stdin.go:44: Started omni-socat
2022/05/31 15:36:39 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 15:36:39 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 01:27:35 npipe2stdin.go:44: Started omni-socat
2022/06/01 01:27:35 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 01:27:40 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:25:59 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:25:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:26:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:45:46 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:45:46 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:45:49 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:42:04 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:42:04 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:42:10 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:56:12 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:56:12 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:56:12 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:10:22 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:10:22 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:10:22 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:20:15 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:20:15 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:20:15 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:27:34 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:27:34 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:27:34 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:40:48 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:40:48 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:40:48 npipe2stdin.go:58: Disconnected. [<nil>]
~ ❯ ps axuw|grep socat                                                                                      23:45:51
maicol07   484  0.0  0.0  10276  3008 ?        Ss   15:54   0:00 socat UNIX-LISTEN:/home/maicol07/.ssh/agent.sock,fork EXEC:/home/maicol07/omni-socat/omni-socat.exe -debug
maicol07 11729  0.0  0.0   6476  2248 pts/2    S+   23:46   0:00 grep --color=auto socat
~ ❯ ssh-add -l                                                                                              11:49:18
error fetching identities: communication with agent failed
~ ❯ cd omni-socat/                                                                                  1m 51s 11:51:13
~/omni-socat ❯ curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip -sLo omni-socat
.zip
~/omni-socat ❯ unzip omni-socat.zip                                                                         12:26:02
Archive:  omni-socat.zip
replace omni-socat.exe? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: omni-socat.exe
~/omni-socat ❯ sha1sum omni-socat.exe                                                                   4s 12:26:17
d34e4797eaa493b301356d361a8d5473913b41fb  omni-socat.exe
~/omni-socat ❯ ls -la omni-socat.exe                                                                        12:26:30
-rwxrwxrwx 1 maicol07 maicol07 3675648 mag 27 14:16 omni-socat.exe*
~/omni-socat ❯ ./omni-socat.exe -h                                                                          12:26:44
Usage of omni-socat.exe:
  -debug
        Output debug log
~/omni-socat ❯ uname -a                                                                                     12:26:52
Linux MAICOL-ROG 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
~/omni-socat ❯ ssh-add -l                                                                                   12:27:02
error fetching identities: communication with agent failed
~/omni-socat ❯ killall socat                                                                                12:27:28
~/omni-socat ❯ socat UNIX-LISTEN:$HOME/.ssh/agent.sock,fork EXEC:"$HOME/omni-socat/omni-socat.exe -debug"   12:27:37
2022/05/28 12:27:44 socat[3705] E "/home/maicol07/.ssh/agent.sock" exists

~/omni-socat ❯ ssh-add -l                                                                                   12:28:00
3072 SHA256:xInBcA48YT6jmmOEWQrXtC+xw+c6V2V2cVgAWT6K9hg id_rsa (RSA)
256 SHA256:ZgvmgA5CNIpEbTZWepclAdXC9fVBFsB1kvmM14Egjm8 id_ed25519 (ED25519)

I don’t know redownloading helped, I’ll let you know in some days if I get the error again.

Chmodded. Now I get:

~ ❯ ls -la ~/omni-socat/omni-socat.exe                                                                      11:46:55
-rw-r--r-- 1 maicol07 maicol07 3675648 mag 27 21:16 /home/maicol07/omni-socat/omni-socat.exe

Let me try to chmod it

First console:

~ ❯ ssh-add -l                                                                                              09:20:12
error fetching identities: communication with agent failed
~ ❯ echo $SSH_AUTH_SOCK                                                                                     09:20:23
/home/maicol07/.ssh/agent.sock
~ ❯ ~/omni-socat/omni-socat.exe -h                                                                          09:20:29
fish: The file '/home/maicol07/omni-socat/omni-socat.exe' is not executable by this user
~ ❯ killall socat                                                                                     ✘ 126 09:20:42
~ ❯ socat UNIX-LISTEN:$HOME/.ssh/agent.sock,fork EXEC:"$HOME/omni-socat/omni-socat.exe -debug"              09:21:07
2022/05/28 09:21:12 socat[855] E "/home/maicol07/.ssh/agent.sock" exists

Second console:

~ ❯ ls -la $SSH_AUTH_SOCK                                                                                   09:21:25
srwxr-xr-x 1 maicol07 maicol07 0 mag 28 09:21 /home/maicol07/.ssh/agent.sock=
~ ❯ ssh-add -l                                                                                              09:21:28
error fetching identities: communication with agent failed

When does this occur?

There isn’t a specific time when this occurs

Does it always result in an error?

Yes, the error of the OP

Please ps the socat process startup in WSL.

This after updating to 0.3.1:

~ ❯ ps axuw|grep socat  12s 15:44:40
maicol07 3558 0.0 0.0 10280 2952 ? Ss 15:10 0:00 socat UNIX-LISTEN:/home/maicol07/.ssh/agent.sock,fork E
XEC:/home/maicol07/omni-socat/omni-socat.exe -debug
maicol07 4837 0.0 0.0 6476 2272 pts/0 S+ 15:44 0:00 grep --color=auto socat

After update the result is:

~ ❯ ssh-add -l                                                                                              15:44:42
error fetching identities: communication with agent failed
~ ❯ cat /mnt/c/Users/Maicol/omni-socat.log                                                                  15:46:17
cat: /mnt/c/Users/Maicol/omni-socat.log: No such file or directory