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

Commands hang when run as an SSH command #981

Closed
dylanPowers opened this issue Mar 29, 2015 · 8 comments
Closed

Commands hang when run as an SSH command #981

dylanPowers opened this issue Mar 29, 2015 · 8 comments
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) topic/commands Topic commands

Comments

@dylanPowers
Copy link
Member

When running an IPFS command over SSH as a command parameter, the process will hang. Simplest test:

ssh <host> 'ipfs cat <some_hash>'

I figured this is possibly because a terminal isn't present, so I went digging around the ssh man pages and what do you know running ssh <host> -t 'ipfs cat <some_hash>' works because it adds in a "pseudo-tty". That's a suitable workaround for ssh, but I'm sure this could trip up other applications that like to run commands without a terminal present.

dylanPowers added a commit to dylanPowers/dylanPowers.github.io that referenced this issue Mar 29, 2015
@jbenet
Copy link
Member

jbenet commented Mar 29, 2015

@dylanPowers agreed! this likley needs to be fixed in the cmds lib

@jbenet jbenet added the topic/commands Topic commands label Mar 29, 2015
@whyrusleeping whyrusleeping added the kind/bug A bug in existing code (including security flaws) label Apr 7, 2015
@whyrusleeping
Copy link
Member

this is still an issue

@ghost
Copy link

ghost commented Jan 2, 2016

The fixes in #1263 are possibly related

@jbenet
Copy link
Member

jbenet commented Jan 13, 2016

Would be nice to have a test case-- if we figure out what's hanging them we
can send those signals. Worst case if we cannot repro otherwise, maybe with
docker?
On Sat, Jan 2, 2016 at 13:28 Lars Gierth notifications@github.com wrote:

The fixes in #1263 #1263 are
possibly related


Reply to this email directly or view it on GitHub
#981 (comment).

@RichardLitt RichardLitt added exp/expert Having worked on the specific codebase is important and removed difficulty: moderate labels Feb 2, 2016
@RichardLitt RichardLitt added help wanted Seeking public contribution on this issue and removed help wanted Seeking public contribution on this issue labels May 31, 2016
@magik6k
Copy link
Member

magik6k commented May 14, 2019

This is fixed now

@magik6k magik6k closed this as completed May 14, 2019
@hbarcelos
Copy link

I have a functional IPFS node. If I run:

ssh <host> 'ipfs add test.txt'

I get:

Error: no IPFS repo found in /home/ubuntu/.ipfs.
please run: 'ipfs init'

If I SSH into the VM and run the command interactively, it works just fine.

@aschmahmann
Copy link
Contributor

@hbarcelos your issue seems fairly different from this one. go-ipfs is not hanging but instead cannot find the repo. If the solution for you isn't apparent from my comments below could you open a new issue specifically for this that contains more info about your setup such as the output of ipfs version --all, where you installed the binary from, and if you've changed the IPFS_PATH environment variable?

go-ipfs uses the IPFS_PATH environment variable to locate where the repository is. My guess is that you installed go-ipfs using snap and the IPFS_PATH is set to be handled by snap https://github.com/ipfs/go-ipfs/blob/0d63fbb6059ac3a5fa9b658984cb1de12ec6c80f/snap/snapcraft.yaml#L24

Or alternatively you manually set IPFS_PATH to a different location.

If the correct IPFS_PATH environment variables (whether yours or snap's) are not available to the non-interactive shell the you'll run into problems. For more info on how environment variables differ in interactive vs non-interactive shells see here.

@hbarcelos
Copy link

@aschmahmann thanks a lot for the pointers.

In deed I had a custom IPFS_PATH and it was not being set on SSH non-interactive sessions because it was defined on my ~/.bash_profile.

I managed to workaround by setting it to the correct value on ~/.ssh/environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) topic/commands Topic commands
Projects
None yet
Development

No branches or pull requests

7 participants