containers/buildah

How to debug buildah?

PaleNeutron opened this issue · 5 comments

Breakpoints set in sub command will not hit.

Steps to reproduce the issue:

  1. dlv debug ./cmd/buildah --build-flags="-mod=vendor -ldflags '-X main.GitCommit=ad9c34540f250181a8126acb33cd62387f9ef027 -X main.buildInfo=1695113377 -X main.cniVersion=v1.1.2 ' -tags 'apparmor seccomp exclude_graphdriver_devicemapper btrfs_noversion exclude_graphdriver_btrfs ' " -- login -u xxx -p xxx docker.io
  2. break main.loginCmd
  3. continue

Describe the results you received:
breakpoint not work

Describe the results you expected:
stop at breakpoint

Output of rpm -q buildah or apt list buildah:

buildah/jammy,now 1.23.1+ds1-2 amd64 [installed]

Output of buildah version:

Version:         1.33.0-dev
Go Version:      go1.20.7
Image Spec:      1.1.0-rc.5
Runtime Spec:    1.1.0
CNI Spec:        1.0.0
libcni Version:  v1.1.2
image Version:   5.28.0
Git Commit:      ad9c34540f250181a8126acb33cd62387f9ef027-dirty
Built:           Tue Sep 19 17:16:44 2023
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64

Output of cat /etc/*release:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Output of uname -a:

Linux 049171BG01 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Output of cat /etc/containers/storage.conf:

cat: /etc/containers/storage.conf: No such file or directory
nalind commented

If you're an unprivileged user, it will create a user namespace and run a copy of itself in that user namespace to do the real work. Try debugging inside of a session created with buildah unshare?

Try debugging inside of a session created with buildah unshare?

Not work although I add unshare ./bin/buildah before login command:

$ make bin/buildah SECURITYTAGS="apparmor seccomp" BUILDDEBUG=1 
make: 'bin/buildah' is up to date.
$ ~/go/bin/dlv exec  ./bin/buildah  -- unshare ./bin/buildah  login -u xxx -p xxx docker.io
Type 'help' for list of commands.
(dlv) break main.loginCmd
Breakpoint 1 set at 0x18f6272 for main.loginCmd() ./cmd/buildah/login.go:50
(dlv) continue
Error: authenticating creds for "docker.io": Get "https://auth.docker.io/token?account=xxx&service=registry.docker.io": net/http: TLS handshake timeout
Process 2477504 has exited with status 125
(dlv) q
nalind commented

That's not what I suggested. It would look more like

buildah unshare dlv exec ./bin/buildah -- login ...

Is this issue still needed @PaleNeutron or your issue is resolved ?

@flouthoc , yes! Thanks @nalind .