Closed bagasislamay closed 9 months ago
I also encountered the same issue.
This is the same case for Ubuntu 22.04.3 LTS (jammy) from the AWS marketplace.
Steps to reproduce:
$ docker run -it --rm archlinux bash
[root@ef0ad1363234 /]# pacman -Syu
...
[root@ef0ad1363234 /]# pacman -S go
...
[root@ef0ad1363234 /]# go install -v github.com/projectdiscovery/pdtm/cmd/pdtm@latest
...
[root@ef0ad1363234 ~]# /root/go/bin/pdtm
fatal error: _cgo_pthread_key_created missing
goroutine 1 [running, locked to thread]:
runtime.throw({0xf0a07d?, 0x0?})
/usr/lib/go/src/runtime/panic.go:1077 +0x5c fp=0xc000062740 sp=0xc000062710 pc=0x438edc
runtime.main()
/usr/lib/go/src/runtime/proc.go:213 +0x409 fp=0xc0000627e0 sp=0xc000062740 pc=0x43ba09
runtime.goexit()
/usr/lib/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc0000627e8 sp=0xc0000627e0 pc=0x46b301
goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/lib/go/src/runtime/proc.go:398 +0xce fp=0xc000062fa8 sp=0xc000062f88 pc=0x43bd0e
runtime.goparkunlock(...)
/usr/lib/go/src/runtime/proc.go:404
runtime.forcegchelper()
/usr/lib/go/src/runtime/proc.go:322 +0xb3 fp=0xc000062fe0 sp=0xc000062fa8 pc=0x43bb93
runtime.goexit()
/usr/lib/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc000062fe8 sp=0xc000062fe0 pc=0x46b301
created by runtime.init.6 in goroutine 1
/usr/lib/go/src/runtime/proc.go:310 +0x1a
goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/lib/go/src/runtime/proc.go:398 +0xce fp=0xc000063778 sp=0xc000063758 pc=0x43bd0e
runtime.goparkunlock(...)
/usr/lib/go/src/runtime/proc.go:404
runtime.bgsweep(0x0?)
/usr/lib/go/src/runtime/mgcsweep.go:280 +0x94 fp=0xc0000637c8 sp=0xc000063778 pc=0x427c94
runtime.gcenable.func1()
/usr/lib/go/src/runtime/mgc.go:200 +0x25 fp=0xc0000637e0 sp=0xc0000637c8 pc=0x41ce25
runtime.goexit()
/usr/lib/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc0000637e8 sp=0xc0000637e0 pc=0x46b301
created by runtime.gcenable in goroutine 1
/usr/lib/go/src/runtime/mgc.go:200 +0x66
goroutine 4 [GC scavenge wait]:
runtime.gopark(0xc00007a000?, 0x10fd6d8?, 0x1?, 0x0?, 0xc0000071e0?)
/usr/lib/go/src/runtime/proc.go:398 +0xce fp=0xc000063f70 sp=0xc000063f50 pc=0x43bd0e
runtime.goparkunlock(...)
/usr/lib/go/src/runtime/proc.go:404
runtime.(*scavengerState).park(0x1727a60)
/usr/lib/go/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000063fa0 sp=0xc000063f70 pc=0x425529
runtime.bgscavenge(0x0?)
/usr/lib/go/src/runtime/mgcscavenge.go:653 +0x3c fp=0xc000063fc8 sp=0xc000063fa0 pc=0x425abc
runtime.gcenable.func2()
/usr/lib/go/src/runtime/mgc.go:201 +0x25 fp=0xc000063fe0 sp=0xc000063fc8 pc=0x41cdc5
runtime.goexit()
/usr/lib/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc000063fe8 sp=0xc000063fe0 pc=0x46b301
created by runtime.gcenable in goroutine 1
/usr/lib/go/src/runtime/mgc.go:201 +0xa5
Looks like this can be fixed with installing gcc on the linux distribution so that pthread
is automatically added to the compilation flags:
$ go env
...
GOGCCFLAGS='-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2242934390=/tmp/go-build -gno-record-gcc-switches'
$ pacman -S gcc
$ go env
...
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3322364864=/tmp/go-build -gno-record-gcc-switches'
Hey @Mzack9999 I have gcc installed and go env
listed out similar GOGCCFLAGS
value, but still facing the same issue. With gcc installed on your end, can you run any pdtm
command?
@bagasislamay yeah, by installing gcc everything worked for me. Could you provide more info about the host operating system. I've tested it with ubuntu 23.10 64bit running arch on docker
Hey @Mzack9999 I am on Ubuntu 22.04.3 LTS running on WSL with gcc installed. I have no idea about OS versioning and package management stuff and still couldn't find any way around to solve this issue up until this day
@bagasislamay Ubuntu 22.04.xx LTS on WSL usually has a very old go version (go1.13), I was able to run pdtm successfully on windows 11 with WSL and manual installation of go 1.21.4. What is the host OS?
Also, could you try to locate the position of libpthread.so
, usually:
$ ls /usr/lib/x86_64-linux-gnu/ | grep thread
Hey @Mzack9999, thanks to you the issue is now resolved. For those who still face the issue:
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
go install -v github.com/projectdiscovery/pdtm/cmd/pdtm@latest
so my current PDTM version is v0.0.9Then PDTM is now working properly and also I will close this issue😊
pdtm version:
Latest
Current Behavior:
Error while running
pdtm --help
Expected Behavior:
Can list out the content of
pftm --help
commandSteps To Reproduce:
go install -v github.com/projectdiscovery/pdtm/cmd/pdtm@latest
pdtm --help