containers / containers/toolbox
gdb in toolbox unable to attach to processes running on host
- Dominant language
- Go
- Stars
- 3.5k
- Forks
- 262
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 1
Description
**Describe the bug**
I'd like to attach gdb from within toolbox to a process running as my user on the host. Unfortunately, `gdb -p [PID]` returns the following error:
```
Attaching to process 22615
ptrace: Operation not permitted.
```
The process `22615` in this case is gnome-software, but the same error is returned for any other process regardless of its UID.
According to `podman inspect fedora-toolbox-33`, the toolbox container does have `CAP_SYS_PTRACE`.
**Steps how to reproduce the behaviour**
1. Start a (rootless) toolbox container and install gdb if it isn't already installed.
2. Find any process running with the same UID as your user, and try to run `gdb -p [PID]` inside the container.
3. See error.
**Expected behaviour**
gdb should let me attach to the process.
**Actual behaviour**
gdb complains that ptrace is not permitted.
**Toolbox package info (`rpm -q toolbox`)**
e.g., `toolbox-0.0.97-1.fc33.x86_64`
**Podman package info (`rpm -q podman`)**
`podman-2.2.1-1.fc33.x86_64`
**Info about your OS**
e.g., Fedora Silverblue 33
**Additional context**
It would be very convenient for Silverblue users if toolbox can debug processes on the host. Layering a whole bunch of debuginfo packages on the base system would be quite cumbersome. My temporary workaround is to run gdb from a privileged root container.
Contributor guide
Assessment
This issue has not been assessed yet.