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

--detach not working #182

Open
manuel220x opened this issue Oct 26, 2021 · 8 comments · May be fixed by #184
Open

--detach not working #182

manuel220x opened this issue Oct 26, 2021 · 8 comments · May be fixed by #184

Comments

@manuel220x
Copy link

Affected Version

master, I also tried 2.0 but I didn't look at the logs then, so I am not sure if the same error was showing there.

Expected Behavior

starting a remote alias with --detach flag should make the tunnel available

Current Behavior

after starting using the alias, I get the proper messages on the output, but the tunnel is not actually running, looking at the logs, I can see the following:

cat mole.log

Error: unknown flag: --id
Usage:
  mole start [flags]
  mole start [command]

Available Commands:
  alias       Starts a ssh tunnel by alias
  local       Starts a ssh local port forwarding tunnel
  remote      Starts a ssh remote port forwarding tunnel

Flags:
  -h, --help   help for start

Use "mole start [command] --help" for more information about a command.

Steps to Reproduce

  1. create an alias mole add alias remote pi4gameserver -S 0.0.0.0:2222 -d localhost:22 -s [email protected]:666
  2. start mole detached mole start alias pi4gameserver --detach, this one outputs the following:
INFO[0000] instance identifier is pi4gameserver
INFO[0000] execute "mole stop pi4gameserver" if you like to stop it at any time
  1. Nothing works, checking ps, there is no mole, checking the tunnel it doesn't exist and the logs show what I mentioned above:
Error: unknown flag: --id
Usage:
  mole start [flags]
  mole start [command]

Available Commands:
  alias       Starts a ssh tunnel by alias
  local       Starts a ssh local port forwarding tunnel
  remote      Starts a ssh remote port forwarding tunnel

Flags:
  -h, --help   help for start

Use "mole start [command] --help" for more information about a command.
  1. Running without --detach works fine
@ianrgraham
Copy link

This functionality is broken for me as well.

@zieglar
Copy link

zieglar commented Dec 1, 2021

same for me, detach not working, version 2.0.0

@davrodpin
Copy link
Owner

@manuel220x, thank you for reporting it.

I want to apologize for the time it is taking for fixing this bug but I’ve been busy with work and family and had no time to spend on this project. Hopefully I can find some time to fix it soon.

@asabi
Copy link

asabi commented Dec 31, 2021

Yep, definitely broken, otherwise works like a charm! 😅 happy holidays.

hanjm added a commit to hanjm/mole that referenced this issue Jan 24, 2022
@hanjm hanjm linked a pull request Jan 24, 2022 that will close this issue
@hanjm
Copy link

hanjm commented Jan 24, 2022

I found start alias --detach not work as expected, then a found this issue, i try to debug and fix it:

  1. cat ~/.mole/pg}/mole.log and found the problem is missing --id flag logic.
Error: unknown flag: --id
Usage:
  mole start alias [name] [flags]

Flags:
  -x, --detach     run process in background
  -h, --help       help for alias
  -i, --insecure   skip host key validation when connecting to ssh server
  -v, --verbose    increase log verbosity
  1. fix it start alias: fix start alias with --detach #184.
  2. go run main.go start alias pg -x works find.
git clone https://github.com/hanjm/mole.git && \
cd mole && \
git checkout fix/fix-start-alias-detach && \
go build -o $(go env GOPATH)/bin/mole 

@brianchul
Copy link

brianchul commented Jul 10, 2022

There might be build error on Mac OS 12.4 with go1.18.3 while build make and build test on @hanjm's fix
a simple upgrade may fix go get -u golang.org/x/sys

error code:

# golang.org/x/sys/unix
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:136:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:151:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:166:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:166:3: too many errors
make: *** [build] Error 2

@akashkroy
Copy link

Detach is not working on Ubuntu :
I am using the latest release v2.0

After creating the tunnel when I check the log this is the output

time="2022-10-30T18:45:25Z" level=error msg="can't start. Another instance is already using the same id" id=bbee01f4
time="2022-10-30T18:45:25Z" level=error msg="error starting mole" error="can't start. Another instance is already using the same id bbee01f4"

There are no tunnels with the same ID.
Happens every time I run this but works fine when I run it without the detach parameter.

@caryyu
Copy link

caryyu commented Aug 1, 2023

Not working as well, I've manually installed golang version with go1.17.12 darwin/arm64 by brew install [email protected]

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

Successfully merging a pull request may close this issue.

9 participants