-
-
Notifications
You must be signed in to change notification settings - Fork 165
Fix sudo password prompt #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Qubasa
wants to merge
5
commits into
nix-community:main
Choose a base branch
from
Qubasa:fix_password_prompt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+156
−15
Conversation
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
Mic92
reviewed
Jul 29, 2025
Mic92
reviewed
Jul 29, 2025
Mic92
reviewed
Jul 29, 2025
Mic92
reviewed
Jul 29, 2025
Mic92
reviewed
Jul 29, 2025
Mic92
reviewed
Jul 30, 2025
Mic92
reviewed
Jul 30, 2025
Adds an interactive debugging function that creates a temporary debug environment allowing inspection of variables and script state at runtime.
Enhances SSH debugging by adding colored output that displays the full SSH command being executed when debug mode is enabled.
Improves debug variable handling by temporarily disabling debug output during variable exports and re-enabling it afterward to reduce noise in debug logs.
Major refactoring of the kexec execution logic to improve error handling and fixing sudo password prompts which have been handled incorrectly before because of setsid not allowing input terminal. Also kexec errors are now displayed properly as bevore they were hidden.
When executing nixos-anywhere --phases disko myuser@<ip> for example we must assume that kexec has already been run and that the target user changed to root now. This will force nixos-anywhere to log in as root user if the kexec phase is not present.
641a7b2
to
0763ae8
Compare
Mic92
reviewed
Aug 25, 2025
KEXEC_SCRIPT | ||
|
||
# Run the script and let output flow naturally | ||
${maybeSudo} bash \"\$kexec_script_tmp\" 2>&1 | tee /tmp/kexec-output.log || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
${maybeSudo} bash \"\$kexec_script_tmp\" 2>&1 | tee /tmp/kexec-output.log || true | |
${maybeSudo} bash \"\$kexec_script_tmp\" 2>&1 | tee /root/kexec/output.log || true |
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.
Problem
the problem / bug is in the line above where we run kexec with sudo inside a setsid terminal, that sudo needs to re-prompt for the password, and doesn't have access to stdin so it fails.
My Changes
Add a
breakpoint
function, it halts execution and gives you an interactive bash shell with all the internal variables in scopeReduce log spamming by adding
set +x
to for loopsMake
remoteCommand
write a shell script that then get's called once with sudo, instead of calling sudo inside the setsid shellTested
I have tested it with the
--kexec ./nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz
flag--kexec https://gh-v6.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz
--kexec
flagsuccessfully on an
ubuntu24.04
image with non root userqubasa@<ip>