setup drop-through: drop bash -i to fix Step 6 hang#221
Closed
uzyn wants to merge 1 commit into
Closed
Conversation
The previous fix (b9c1fa1) switched the Step 6 drop-through from `runuser -l USER -c CMD` to `runuser -l USER -s /bin/bash -- -ic CMD` so stock Ubuntu's `~/.bashrc` body would actually run and put `~/.npm-global/bin` (the canonical Claude Code install location) on PATH for the auto-`mcp add` call. That fix introduced a worse regression: `bash -i` calls `initialize_job_control()`, which `tcsetpgrp(0, shell_pgrp)`'s the controlling terminal. This bash sits at the bottom of `sudo -> aimx setup -> runuser -> bash`, several pgrps away from the foreground, so the kernel raises SIGTTOU and bash either self-stops or spin-retries. Symptom: the wizard prints "Dropping through to `aimx agents setup` as <user>..." and then the terminal freezes. No TUI ever renders. Reproducible on stock Ubuntu (no exotic ~/.bashrc content needed). Fix: switch `-ic` to `-lc` so bash never enables job control, and explicitly prepend `$HOME/.npm-global/bin` and `$HOME/.local/bin` to PATH inside the shell command body. That replaces the `~/.bashrc`-sourced PATH edits the previous commit was reaching for, without the deadlock-inducing `-i`. `bash -l` still sources `/etc/profile` and `~/.profile`. `exec` replaces the bash wrapper with the aimx process so the parent observes aimx's exit status directly. The renamed regression test `drop_through_uses_login_bash_with_path_augmentation` locks in the new shape and adds a positive guard that the shell command body contains `PATH=` and `.npm-global/bin`, so a future refactor cannot silently drop the augmentation and re-introduce the `CliMissing` fallback. Verified on Ubuntu 24.04 (Docker): the new `runuser -l ubuntu -s /bin/bash -- -lc 'PATH=...:$HOME/.npm-global/bin:... exec ...'` shape exits 0 and resolves `claude` from `~/.npm-global/bin/`.
Owner
Author
|
Too kludgy. Considering dropping direct MCP user setup with a message instructing user to run as regular user instead. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aimx setuphanging at Step 6 with the terminal frozen afterDropping through to aimx agents setup as <user>.... Regression introduced four days ago by b9c1fa1, which addedbash -ito the drop-through. Interactive bash here is several pgrps below the foreground (sudo -> aimx setup -> runuser -> bash); itstcsetpgrp(0, shell_pgrp)raises SIGTTOU and bash either self-stops or spin-retries.bash -ictobash -lc(no job control) and explicitly prepends$HOME/.npm-global/binand$HOME/.local/binto PATH inside the shell command body. That replaces the~/.bashrc-sourced PATH edits the prior fix was reaching for, without the deadlock.drop_through_uses_login_bash_with_path_augmentationand adds positive assertions on the new shape (-lc,PATH=,.npm-global/bin) plus a negative assertion that-iccannot return.Test plan
cargo test --bin aimx drop_through— 2 passed (renamed regression + companion banner-reprint guard).cargo clippy -- -D warnings— clean.cargo fmt -- --check— clean.cargo test— 1144 passed locally; the 3uds_authzfailures are macOS-specific nsswitch flake (UID 4294967294 resolves tonobodyon macOS), confirmed to also fail on the unmodified branch. AIMX is Linux-only; CI on Ubuntu is unaffected.runuser -l ubuntu -s /bin/bash -- -lc 'PATH=$HOME/.npm-global/bin:... exec ...'exits 0 and resolvesclaudefrom the canonical~/.npm-global/bin/.sudo aimx setup, walk to Step 6. Expect the agents-setup TUI to render (orNo AI agents detected on this user's filesystem.if none installed) instead of a frozen terminal.