containers / containers/toolbox
Better error handling when entrypont process fails
- Dominant language
- Go
- Stars
- 3.5k
- Forks
- 262
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 1
Description
**Is your feature request related to a problem? Please describe.**
I'm new to `toolbox` and so far I've run into this error a lot:
```
$ toolbox enter centos-stream8
Error: invalid entry point PID of container centos-stream8
```
This error message has a variety of underlying causes:
* `useradd` refuses to create the user inside the container becaues my username is not valid (contains an `@` character)
* `toolbox init-container` won't run because it's linked against a newer glibc than is present inside the container (yeah this is fixed in `main` but it's still present in the last release...)
* `capsh` not present inside the container image
As a new user you have to learn now to see the true error, either by running `podman log centos-stream8` or `podman start --attach centos-stream8`. This isn't explained anywhere and leads to wasted time and inaccurate bug reports.
**Describe the solution you'd like**
```
$ toolbox enter centos-stream8
Error: container entrypoint process failed.
The most recent log messages from the entrypoint process are displayed below.
...
2022-11-17T18:08:30.993935000Z level=debug msg=--home
2022-11-17T18:08:30.994324000Z level=debug msg=/home/domain.example.com/sam
2022-11-17T18:08:30.994743000Z level=debug msg=--shell
2022-11-17T18:08:30.995154000Z level=debug msg=/bin/bash
2022-11-17T18:08:30.995546000Z level=debug msg=--uid
2022-11-17T18:08:30.995930000Z level=debug msg=14235136
2022-11-17T18:08:30.996249000Z level=debug msg=sam@domain.example.com
2022-11-17T18:08:31.009748000Z level=debug msg="Removing password for user sam@domain.example.com"
2022-11-17T18:08:31.055186000Z passwd: Libuser error at line: 210 - name contains invalid char `@'.
2022-11-17T18:08:31.059351000Z Error: failed to remove password for user sam@domain.example.com: failed to invoke passwd(1)
...
To see the full output, run 'podman logs centos-stream8'.
```
Contributor guide
Research direction
Start at the `toolbox enter` flow that reports an invalid entry point PID, then compare how `podman logs` and `podman start --attach` expose the entrypoint output. The change is done when entrypoint failures show recent log messages and explain how to view the full output with `podman logs `.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100