lix-installer repair action seems to work when Nix is not installed #32

Open
opened 2024-10-27 13:26:20 +00:00 by akechishiro · 0 comments
image

Haven't tried with determinate system installer but they could have the same issue.

Trace output (I ran it two times first time was without any trace output, so there might have changes done to the filesystem which do not show up here) :

info: downloading installer (https://install.lix.systems/lix/lix-installer-x86_64-linux)
2024-10-27T13:19:11.845122Z TRACE execute:execute: lix_installer::cli: Running as EUID 1000
`lix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
2024-10-27T13:19:11.845351Z TRACE execute:execute: lix_installer::cli: Execvp'ing `"sudo"` with args `["sudo", "env", "NIX_INSTALLER_LOG_DIRECTIVES=1", "SHELL=/bin/bash", "/tmp/tmp.DvQR3rA5AR/lix-installer", "--logger", "full", "-vv", "repair"]`
2024-10-27T13:19:12.979964Z TRACE execute:execute: lix_installer::cli: Running as EUID 0
2024-10-27T13:19:12.980039Z  INFO execute:execute: lix_installer::cli::subcommand::repair: Will ensure the Nix shell profiles are still being sourced
2024-10-27T13:19:12.980522Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/bashrc` already complete
2024-10-27T13:19:12.980931Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/profile.d/nix.sh` already complete
2024-10-27T13:19:12.981341Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/bash.bashrc` already complete
2024-10-27T13:19:12.981550Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/zshrc` already complete
2024-10-27T13:19:12.981737Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/zsh/zshrc` already complete
2024-10-27T13:19:12.981807Z TRACE execute:execute:plan:plan:execute_command{command="mount" "-f"}: lix_installer: Executing
2024-10-27T13:19:12.984832Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_directory: Creating directory `/usr/share/fish/vendor_conf.d` already complete is_mountpoint=false
2024-10-27T13:19:12.985205Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/usr/share/fish/vendor_conf.d/nix.fish` already complete
2024-10-27T13:19:12.985254Z DEBUG execute:execute:try_execute: lix_installer::action::stateful: Executing: Configure the shell profiles
2024-10-27T13:19:12.985282Z TRACE execute:execute:try_execute:execute:create_directory{path=/usr/share/fish/vendor_conf.d mode=0o755}: lix_installer::action::stateful: Completed: (Already done) Create directory `/usr/share/fish/vendor_conf.d`
2024-10-27T13:19:12.985450Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/bashrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n    . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n        \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/bashrc`
2024-10-27T13:19:12.985506Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/bash.bashrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n    . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n        \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/bash.bashrc`
2024-10-27T13:19:12.985571Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/zsh/zshrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n    . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n        \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/zsh/zshrc`
2024-10-27T13:19:12.985646Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/profile.d/nix.sh mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n    . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n        \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/profile.d/nix.sh`
2024-10-27T13:19:12.985691Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/zshrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n    . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n        \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/zshrc`
2024-10-27T13:19:12.985727Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/usr/share/fish/vendor_conf.d/nix.fish mode=0o644 buf="\n# Nix\nif test -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish'\n    . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish'\nend\n# End Nix\n\n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/usr/share/fish/vendor_conf.d/nix.fish`
2024-10-27T13:19:12.985914Z DEBUG execute:execute:try_execute: lix_installer::action::stateful: Completed: Configure the shell profiles
2024-10-27T13:19:12.986020Z  INFO execute:execute: lix_installer::cli::subcommand::repair: Finished repairing successfully!

EDIT: I've also tried all the others steps (beside install, some throw a backtrace/rust panic), I may try and expand the test framework after having discussed this in Matrix, I believe the installer would be able to handle gracefully cases where Nix is not installed, I think by checking if the path /nix/store exists and if the nix command exists or not we can fail pretty early.

<img width="734" alt="image" src="/attachments/2941ee11-f4bf-422b-8c3a-03af7834bd4d"> Haven't tried with determinate system installer but they could have the same issue. Trace output (I ran it two times first time was without any trace output, so there might have changes done to the filesystem which do not show up here) : <summary> <details> <pre> info: downloading installer (https://install.lix.systems/lix/lix-installer-x86_64-linux) 2024-10-27T13:19:11.845122Z TRACE execute:execute: lix_installer::cli: Running as EUID 1000 `lix-installer` needs to run as `root`, attempting to escalate now via `sudo`... 2024-10-27T13:19:11.845351Z TRACE execute:execute: lix_installer::cli: Execvp'ing `"sudo"` with args `["sudo", "env", "NIX_INSTALLER_LOG_DIRECTIVES=1", "SHELL=/bin/bash", "/tmp/tmp.DvQR3rA5AR/lix-installer", "--logger", "full", "-vv", "repair"]` 2024-10-27T13:19:12.979964Z TRACE execute:execute: lix_installer::cli: Running as EUID 0 2024-10-27T13:19:12.980039Z INFO execute:execute: lix_installer::cli::subcommand::repair: Will ensure the Nix shell profiles are still being sourced 2024-10-27T13:19:12.980522Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/bashrc` already complete 2024-10-27T13:19:12.980931Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/profile.d/nix.sh` already complete 2024-10-27T13:19:12.981341Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/bash.bashrc` already complete 2024-10-27T13:19:12.981550Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/zshrc` already complete 2024-10-27T13:19:12.981737Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/etc/zsh/zshrc` already complete 2024-10-27T13:19:12.981807Z TRACE execute:execute:plan:plan:execute_command{command="mount" "-f"}: lix_installer: Executing 2024-10-27T13:19:12.984832Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_directory: Creating directory `/usr/share/fish/vendor_conf.d` already complete is_mountpoint=false 2024-10-27T13:19:12.985205Z DEBUG execute:execute:plan:plan: lix_installer::action::base::create_or_insert_into_file: Inserting into `/usr/share/fish/vendor_conf.d/nix.fish` already complete 2024-10-27T13:19:12.985254Z DEBUG execute:execute:try_execute: lix_installer::action::stateful: Executing: Configure the shell profiles 2024-10-27T13:19:12.985282Z TRACE execute:execute:try_execute:execute:create_directory{path=/usr/share/fish/vendor_conf.d mode=0o755}: lix_installer::action::stateful: Completed: (Already done) Create directory `/usr/share/fish/vendor_conf.d` 2024-10-27T13:19:12.985450Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/bashrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/bashrc` 2024-10-27T13:19:12.985506Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/bash.bashrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/bash.bashrc` 2024-10-27T13:19:12.985571Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/zsh/zshrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/zsh/zshrc` 2024-10-27T13:19:12.985646Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/profile.d/nix.sh mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/profile.d/nix.sh` 2024-10-27T13:19:12.985691Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/etc/zshrc mode=0o644 buf="\n# Nix\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n\n \n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/etc/zshrc` 2024-10-27T13:19:12.985727Z TRACE execute:execute:try_execute:execute:create_or_insert_file{path=/usr/share/fish/vendor_conf.d/nix.fish mode=0o644 buf="\n# Nix\nif test -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish'\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish'\nend\n# End Nix\n\n"}: lix_installer::action::stateful: Completed: (Already done) Create or insert file `/usr/share/fish/vendor_conf.d/nix.fish` 2024-10-27T13:19:12.985914Z DEBUG execute:execute:try_execute: lix_installer::action::stateful: Completed: Configure the shell profiles 2024-10-27T13:19:12.986020Z INFO execute:execute: lix_installer::cli::subcommand::repair: Finished repairing successfully! <pre/> </details> </summary> EDIT: I've also tried all the others steps (beside install, some throw a backtrace/rust panic), I may try and expand the test framework after having discussed this in Matrix, I believe the installer would be able to handle gracefully cases where Nix is not installed, I think by checking if the path `/nix/store` exists and if the `nix` command exists or not we can fail pretty early.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix-installer#32
No description provided.