Skip to content

acq shell/attach on msb launch /bin/sh -l, so the user's bash environment (.bashrc, rc.d drop-ins, prompt init) never loads #426

Closed

Description

@basiliskus

Summary

On the msb backend, acq shell and the interactive attach path exec /bin/sh -l with SHELL=/bin/sh (_acq_msb_shell_exec, and the parallel attach exec). On Debian-family images /bin/sh is dash, which never reads .bashrc — so everything kits wire into bash (rc.d drop-in loops, prompt init like starship, nix PATH additions in .bashrc) is silently inert, and the user lands in a bare $ prompt. The same sandbox contents through the sbx backend get an interactive bash and the full environment.

Repro

  1. Apply a kit that wires ~/.bashrc (e.g. an rc.d drop-in loop with a prompt initializer) and create an msb sandbox from a Debian-family image.
  2. acq --backend msb shell <name> → bare dash $ prompt; none of the .bashrc wiring ran.
  3. Typing bash inside the session brings the full environment up — proving the guest-side wiring is fine and only the launched shell is wrong.

A second wrinkle: bash -l doesn't recover it

acq's agent-user setup appends export SHELL=/bin/sh to ~/.profile as its only content. A login bash therefore reads that .profile and stops — there is no Debian-style .profile → .bashrc bridge — so even a user who knows to start bash gets the bare environment unless they start it non-login.

Proposed fix

Follow the passwd-driven convention that sshd, machinectl shell, toolbox, and distrobox use: the environment declares its shell in the account database, and the transport honors it.

  1. When _acq_msb_ensure_agent_user creates the agent user, set its passwd shell to bash when the image has it, keeping /bin/sh otherwise — the portability fallback moves to user creation, where it's decided once.
  2. Have the shell/attach paths exec the agent user's passwd shell with login semantics (and set SHELL to match), instead of hardcoding /bin/sh per session.
  3. Write a Debian-skel-style ~/.profile — one that sources .bashrc when running under bash, as /etc/skel does — instead of the current bare export SHELL= line, so login shells behave on images whose baked home ships no .profile.

A per-session probe-and-prefer-bash (bash || sh) would also fix the symptom, but it's the weaker form: the passwd-driven design keeps the call sites trivial and matches what users expect from every other shell transport.

Related

Third member of the msb exec/attach session-parity family, with #421 (working directory) and #425 (TERM/COLORTERM): each is session context sbx provides that the msb path drops, and all three fixes land in the same few functions — one small parity PR could close the set.

Activity

  1. self-assigned this
    on Aug 31, 2026
  2. added a commit that references this issue on Sep 2, 2026
    6261eda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions