containers / containers/toolbox

unable to find user

Open
#1,578 7 comments 0 reactions 0 assignees View on GitHub
1. Bug
Dominant language
Go
Stars
3.5k
Forks
262
Avg merge
3d 1h
Merged PRs (30d)
1

Description

**Describe the bug**

As we discussed face to face previously, when using a trick to disable sudoer password during the build process of a qcow image and re-enabling it later, toolbox fails to find the user.

The disabling of the password happens using the following ansible book

```yaml
---
- hosts: all
tasks:
- name: Configure "{{ansible_user_id}}" user to temporarily use sudo without password
ansible.builtin.lineinfile:
line: "{{ansible_user_id}} ALL=(ALL) NOPASSWD:ALL"
dest: /etc/sudoers.d/90-autosd-demo
mode: "0440"
state: present
create: true
validate: visudo -cf %s
become: true

```
and then at the end re-enabled with
```yaml
---
- hosts: all
tasks:
- name: Restore sudo configuration for "{{ansible_user_id}}"
ansible.builtin.lineinfile:
line: "{{ansible_user_id}} ALL=(ALL) NOPASSWD:ALL"
dest: /etc/sudoers.d/90-autosd-demo
mode: "0440"
state: absent
validate: visudo -cf %s
become: true
```

Entering the toolbox container after that process is over, gives the following output
```
user@fedora ~> toolbox enter --verbose --log-level debug
DEBU Running as real user ID 1000
DEBU Resolved absolute path to the executable as /usr/bin/toolbox
DEBU Running on a cgroups v2 host
DEBU Looking up sub-GID and sub-UID ranges for user user
DEBU TOOLBX_DELAY_ENTRY_POINT is
DEBU TOOLBX_FAIL_ENTRY_POINT is
DEBU TOOLBOX_PATH is /usr/bin/toolbox
DEBU Migrating to newer Podman
DEBU Toolbx config directory is /home/user/.config/toolbox
DEBU Current Podman version is 5.2.5
DEBU Creating runtime directory /run/user/1000/toolbox
DEBU Old Podman version is 5.2.5
DEBU Migration not needed: Podman version 5.2.5 is unchanged
DEBU Setting up configuration
DEBU Setting up configuration: file /home/user/.config/containers/toolbox.conf not found
DEBU Resolving container and image names
DEBU Container: ''
DEBU Distribution (CLI): ''
DEBU Image (CLI): ''
DEBU Release (CLI): ''
DEBU Resolved container and image names
DEBU Container: 'fedora-toolbox-41'
DEBU Image: 'fedora-toolbox:41'
DEBU Release: '41'
DEBU Resolving container and image names
DEBU Container: ''
DEBU Distribution (CLI): ''
DEBU Image (CLI): ''
DEBU Release (CLI): ''
DEBU Resolved container and image names
DEBU Container: 'fedora-toolbox-41'
DEBU Image: 'fedora-toolbox:41'
DEBU Release: '41'
DEBU Checking if container fedora-toolbox-41 exists
DEBU Inspecting container fedora-toolbox-41
DEBU Entry point of container fedora-toolbox-41 is toolbox (PID=9606)
DEBU Inspecting mounts of container fedora-toolbox-41
DEBU Generating Container Device Interface for NVIDIA
DEBU Generating Container Device Interface for NVIDIA: Management Library not found: could not load NVML library: libnvidia-ml.so.1: cannot open shared object file: No such file or directory
DEBU Generating Container Device Interface for NVIDIA: not a Tegra system: /sys/devices/soc0/family file not found
DEBU Generating Container Device Interface for NVIDIA: skipping
DEBU Creating runtime directory /run/user/1000/toolbox
DEBU Checking if initialization stamp /run/user/1000/toolbox/container-initialized-9606 exists
DEBU Container fedora-toolbox-41 is initialized
DEBU Checking if 'podman exec' supports disabling the detach keys
DEBU 'podman exec' supports disabling the detach keys
DEBU Creating list of environment variables to forward
DEBU COLORTERM=truecolor
DEBU CONTAINERS_STORAGE_CONF is unset
DEBU DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DEBU DBUS_SYSTEM_BUS_ADDRESS is unset
DEBU DESKTOP_SESSION=gnome
DEBU DISPLAY=:0
DEBU HISTCONTROL is unset
DEBU HISTFILE is unset
DEBU HISTFILESIZE is unset
DEBU HISTIGNORE is unset
DEBU HISTSIZE is unset
DEBU HISTTIMEFORMAT is unset
DEBU KONSOLE_VERSION is unset
DEBU LANG=en_GB.UTF-8
DEBU SHELL=/bin/fish
DEBU SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
DEBU TERM=xterm-256color
DEBU TOOLBOX_PATH=/usr/bin/toolbox
DEBU USER=user
DEBU VTE_VERSION=7800
DEBU WAYLAND_DISPLAY=wayland-0
DEBU XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.ARN1V2
DEBU XDG_CURRENT_DESKTOP=GNOME
DEBU XDG_DATA_DIRS=/home/user/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
DEBU XDG_MENU_PREFIX=gnome-
DEBU XDG_RUNTIME_DIR=/run/user/1000
DEBU XDG_SEAT is unset
DEBU XDG_SESSION_CLASS=user
DEBU XDG_SESSION_DESKTOP=gnome
DEBU XDG_SESSION_ID is unset
DEBU XDG_SESSION_TYPE=wayland
DEBU XDG_VTNR is unset
DEBU XTERM_VERSION is unset
DEBU Running in container fedora-toolbox-41:
DEBU podman
DEBU --log-level
DEBU error
DEBU exec
DEBU --detach-keys
DEBU
DEBU --env=COLORTERM=truecolor
DEBU --env=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DEBU --env=DESKTOP_SESSION=gnome
DEBU --env=DISPLAY=:0
DEBU --env=LANG=en_GB.UTF-8
DEBU --env=SHELL=/bin/fish
DEBU --env=SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
DEBU --env=TERM=xterm-256color
DEBU --env=TOOLBOX_PATH=/usr/bin/toolbox
DEBU --env=USER=user
DEBU --env=VTE_VERSION=7800
DEBU --env=WAYLAND_DISPLAY=wayland-0
DEBU --env=XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.ARN1V2
DEBU --env=XDG_CURRENT_DESKTOP=GNOME
DEBU --env=XDG_DATA_DIRS=/home/user/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
DEBU --env=XDG_MENU_PREFIX=gnome-
DEBU --env=XDG_RUNTIME_DIR=/run/user/1000
DEBU --env=XDG_SESSION_CLASS=user
DEBU --env=XDG_SESSION_DESKTOP=gnome
DEBU --env=XDG_SESSION_TYPE=wayland
DEBU --interactive
DEBU --preserve-fds
DEBU 0
DEBU --tty
DEBU --user
DEBU user
DEBU --workdir
DEBU /home/user
DEBU fedora-toolbox-41
DEBU capsh
DEBU --caps=
DEBU --
DEBU -c
DEBU exec "$@"
DEBU bash
DEBU /bin/fish
DEBU -l
Error: unable to find user user: no matching entries in passwd file
```

**Steps how to reproduce the behaviour**

See above ^

**Expected behaviour**

The user should be found, and the container should work just fine

**Actual behaviour**

The user is not found in passwd file, the container fails to enter even after the state is restored as it was

**Output of `toolbox --version` (v0.0.90+)**

`toolbox version 0.1.0`

**Toolbx package info (`rpm -q toolbox`)**

`toolbox-0.1.0-1.fc41.x86_64`

**Output of `podman version`**

```
Client: Podman Engine
Version: 5.2.5
API Version: 5.2.5
Go Version: go1.23.2
Built: Fri Oct 18 02:00:00 2024
OS/Arch: linux/amd64
```

**Podman package info (`rpm -q podman`)**

`podman-5.2.5-1.fc41.x86_64`

**Info about your OS**

Fedora 41

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.