go: syscall: TestAmbientCapsUserns fails on Ubuntu 24.04/Linux 6.8.0
Go version
go version go1.22.2 linux/amd64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/kunitz/.cache/go-build'
GOENV='/home/kunitz/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/kunitz/work/pkg/mod'
GONOPROXY='github.com/ulikunitz,doppelwuerfel.de/home/kunitz/git'
GONOSUMDB='github.com/ulikunitz,doppelwuerfel.de/home/kunitz/git'
GOOS='linux'
GOPATH='/home/kunitz/work'
GOPRIVATE='github.com/ulikunitz,doppelwuerfel.de/home/kunitz/git'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/kunitz/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/kunitz/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/kunitz/go/src/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2527480546=/tmp/go-build -gno-record-gcc-switches'
What did you do?
I installed Ubuntu 24.04 and compiled go 1.22.2 using go 1.20.14 for bootstrapping. all.bash ran into two errors. Investigating the second I changed into go/src/syscall and executed go test and run into the failure again.
Interestingly TestAmbientCaps is skipped because the exec returns operation not permitted.
What did you see happen?
~/go/src/syscall$ go test
CAP_SYS_TIME unexpectedly not in the effective capability mask
--- FAIL: TestAmbientCapsUserns (0.01s)
exec_linux_test.go:752: exit status 2
FAIL
exit status 1
FAIL syscall 0.565s
Info about environment:
##### Test execution environment.
# GOARCH: amd64
# CPU: AMD Ryzen 7 3700X 8-Core Processor
# GOOS: linux
# OS Version: Linux 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
What did you expect to see?
No error executing go test in go/src/syscall.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- syscall: skip TestAmbientCapsUserns when restricted, document fixes golang/go#67088 Change-Id: I42e7a8d02b161187772f147e3e136ab6e0f71d7f Reviewed-on: https://go-review.googlesource.com/c/go/+/585059... — committed to AbdulmelikKalkan/go by stapelberg 3 years ago
- [release-branch.go1.22] syscall: skip TestAmbientCapsUserns when restricted, document For #67088 Fixes #69366 Change-Id: I42e7a8d02b161187772f147e3e136ab6e0f71d7f Reviewed-on: https://go-review.goog... — committed to golang/go by stapelberg 3 years ago
I have been made aware that there is a section in the Ubuntu release notes that describes the issue.
I put AppArmor in complain mode and the test is now successful. Note that I did the default install and didn’t change anything on the apparmor configuration. It appears that profile unprivileged_userns is causing the issue.
I find the following in syslog in complain mode:
With app_armor in enforce mode in I find the following: