Coder Social home page Coder Social logo

Comments (9)

Hoverbear avatar Hoverbear commented on September 26, 2024

Thanks for raising this! The next version of the installer lowers this from an error to a warning so the situation will be a bit better! Still, labelling this as a bug.

from nix-installer.

dnkmmr69420 avatar dnkmmr69420 commented on September 26, 2024

also use #!/usr/bin/env bash not #!/bin/bash

from nix-installer.

Hoverbear avatar Hoverbear commented on September 26, 2024

The installer does not use #!/bin/bash anywhere, and the relevant scripts also don't use a hashbang, please open a new issue if you have something unrelated, thanks!

from nix-installer.

Hoverbear avatar Hoverbear commented on September 26, 2024

I was thinking about this issue more and I think that skipping the self-test is not what we want, for shells that are links to other shells, we may want to avoid editing the shell profile all together.

I'd not want to place a user in a situation where we leave them with a broken sh and simply skip the self-test on sh.

That being said, the culprit of this issue is like stemming from /etc/profile.d/logic.sh as stated in the error message. The nix-installer does not edit that file, so unless the error message is reporting the wrong error, I do not think this issue is caused by the installer, but by an already broken sh config?

from nix-installer.

metaminimalist avatar metaminimalist commented on September 26, 2024

Greetings from the same debian 11 machine which raised the error :)

/etc/profile.d/logic.sh is a bash script:

#!/bin/bash

function extend_path_for_swipl {
   local SWIPL="/usr/local/logic/swipl"
   local BIN="${SWIPL}/bin"
   if [[ -d "${BIN}" ]]; then
      export PATH="${BIN}:${PATH}"
      export SWIPL_HOME="$SWIPL"
   fi
}

extend_path_for_swipl
unset extend_path_for_swipl

so I guess defining a "function" in it is legal.
It is not a debian thing, but stems from an installation of SWI prolog, it can be found here: https://www.swi-prolog.org/Download.html

No error would have occurred if not something had started /bin/sh -> /bin/dash.

This machine is like all my boxes somewhat modified to run /bin/zsh as the login shell for all accounts but root and postgres which run /bin/zsh-static. Most of the /bin/zsh accounts have a local zsh profile with command line completion for the task of the account.

So I can be pretty sure that I/my accounts/my machine did not start /bin/sh (which at the time pointed to /bin/dash).

The start of /bin/sh (which pointed to /bin/dash) may have happened from here


or maybe by the elevation to root `nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Other candidates would be running things with sudo like curl $URL | sudo sh, by cron - IIRC all these stubbornly use /bin/sh regardless of the users login shell set in /etc/passwd.

I did not find any such things in the code, but then I am not firm enough in rust to guess what is in the sudo cstring.

from nix-installer.

Hoverbear avatar Hoverbear commented on September 26, 2024

It's my assumption that /etc/profile.d/logic.sh existed (and thus sh was broken) before the nix install ever occured, so it being broken during self test makes sense since it was already broken.

Is this correct?

from nix-installer.

metaminimalist avatar metaminimalist commented on September 26, 2024

This ist definitely correct, I installed SWI Prolog in last winter after xmas, and nix in July.

from nix-installer.

metaminimalist avatar metaminimalist commented on September 26, 2024

So I spent a little bit of my sunday on that debian11 machine which triggered this issue:

  • uninstalled nix
  • uninstalled SWI Prolog
  • made sure that there are no remnants in /etc and user profiles
  • reverted to dash as /bin/sh
  • kept /bin/zsh and /bin/zsh-static as login shells
  • did a system upgrade to the latest packages for debian 11
  • rebooted

After that the installer worked as intended :)

Conclusion:

  • it works with /bin/sh -> dash on unmodified systems
  • it works with /bin/sh -> bash even on modified systems
  • it does not work with /bin/sh -> dash on modified systems and leaves a non-functioning nix install

("modified" means that this machine has eight foreign repositories configured, and heavily personalized shell profiles. The SWI prolog installation was only a software package, and any of the installation could have written to /etc/profile.d/)

Maybe you should threat this like the test for Apple's ksh93 which I found in the installer.

I consider this thing "worksforme" now, but the mileage or stamina of others will vary.

from nix-installer.

Hoverbear avatar Hoverbear commented on September 26, 2024

If the user has a broken sh before the install, it seems like the self test reporting that sh is broken is expected, so I am not sure this is a bug or is in need of fixing. SWI prolog shipping a broken profile.d for dash is neither the installers problem nor responsibility.

I really appreciate your report and help debugging the issue! It's good Nix is working for you now.

from nix-installer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.