containers / containers/toolbox

"toolbox enter" attempts to execute the host shell even when the container login shell is different

Open
#1,833 0 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

### Description

When entering a Toolbx container, `toolbox enter` attempts to execute the user's host shell inside the container, even if the user's login shell in the container is different.

If the host shell is not installed in the container, Toolbx prints an error and falls back to `/bin/bash`.

### Environment

* Fedora 44
* toolbox-0.3-4.fc44
* Podman 5.8.4

### Steps to reproduce

Host:

```console
$ getent passwd $USER
user:x:1000:1000:...:/home/user:/usr/bin/fish
```

Container:

```console
$ getent passwd $USER
user:x:1000:1000:...:/home/user:/bin/bash
```

Enter the container:

```console
$ toolbox enter my-toolbox
bash: line 1: /usr/bin/fish: No such file or directory
Error: command /usr/bin/fish not found in container my-toolbox
Using /bin/bash instead.
```

### Expected behavior

Since the user's login shell inside the container is `/bin/bash`, I expected `toolbox enter` to start `/bin/bash` directly, without first attempting to execute the host shell.

### Actual behavior

`toolbox enter` ignores the shell configured for the user inside the container, attempts to execute the host shell, and only falls back to `/bin/bash` after the attempt fails.

I'm not sure whether this is the intended behavior or a bug, but it appears inconsistent with the shell configuration stored in the container.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `toolbox enter` entry point and the shell-selection logic it invokes. Reproduce the case with different host and container login shells, then verify that entering the container uses its configured shell without first attempting the host shell, while preserving the existing fallback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.