--detach not working
manuel220x opened this issue · comments
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
- create an alias
mole add alias remote pi4gameserver -S 0.0.0.0:2222 -d localhost:22 -s user@server-chido.dominiochido.com:666
- 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
- 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.
- Running without --detach works fine
This functionality is broken for me as well.
same for me, detach not working, version 2.0.0
@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.
Yep, definitely broken, otherwise works like a charm! 😅 happy holidays.
I found start alias --detach
not work as expected, then a found this issue, i try to debug and fix it:
- 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
- fix it #184.
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
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/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:136:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:151:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:166:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190626221950-04f50cda93cb/unix/zsyscall_darwin_arm64.go:166:3: too many errors
make: *** [build] Error 2
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.
Not working as well, I've manually installed golang version with go1.17.12 darwin/arm64
by brew install go@1.17