Skip to content
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

Issue with installer script touch: /etc/bashrc: No such file or directory #7894

Open
1 of 3 tasks
brettmilford opened this issue Feb 23, 2023 · 3 comments
Open
1 of 3 tasks

Comments

@brettmilford
Copy link

Platform

  • Linux:
  • macOS Ventura 13.1
  • WSL

Additional information

Am attempting to reinstall nix after having removed it including the APFS volume.

Using the command:

curl -L https://nixos.org/nix/install | sh -s -- --daemon

I encounter 2 issues.

  1. the diff command provided errors
  2. the script exits after it can't stat /etc/bashrc

Output

Output

~~> Fixing any leftover Nix volume state
...
Nix isn't the only thing in /var/folders/87/pz89xbz16pdc5h_7ldfysrv80000gn/T/tmp.7DEypl98/synthetic.conf.edit,
but I think I know how to edit it out.
Here's the diff:
diff: unrecognized option `--unchanged-group-format=\033[2m%=\033[0m'
usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            [-I pattern] [-F pattern] [-L label] file1 file2
       diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            [-F pattern] -C number file1 file2
       diff [-aBbdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]
            [--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2
       diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]
            [-F pattern] -U number file1 file2
       diff [-aBbdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]
            [-F pattern] [-S name] [-X file] [-x pattern] dir1 dir2
       diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]
            [--ignore-blank-lines] [--ignore-case] [--minimal]
            [--no-ignore-file-name-case] [--strip-trailing-cr]
            [--suppress-common-lines] [--tabsize] [--text] [--width]
            -y | --side-by-side file1 file2
       diff [--help] [--version]

...

~~> Setting up shell profiles: /etc/bashrc /etc/profile.d/nix.sh /etc/zshrc /etc/bash.bashrc /etc/zsh/zshrc
touch: /etc/bashrc: No such file or directory

---- oh no! ------------------------------------------------------------------
...

@brettmilford
Copy link
Author

Issue seems a little more complex than just a missing file:

thamrys% ls -alh /etc/{bash,zsh}rc
lrwxr-xr-x  1 root  wheel    18B 23 Feb 21:52 /etc/bashrc -> /etc/static/bashrc
lrwxr-xr-x  1 root  wheel    17B 23 Feb 21:52 /etc/zshrc -> /etc/static/zshrc
thamrys% touch /etc/{bash,zsh}rc
touch: /etc/bashrc: No such file or directory
touch: /etc/zshrc: No such file or directory

@abathur
Copy link
Member

abathur commented Feb 23, 2023

It sounds like you may have had nix-darwin (or maybe home-manager) installed at some point and linked the files to the copies that it would generate (which it links in to /etc/static, iirc). I don't think this is the normal way to do it, but my install is a little old by this point. I know my /etc/bashrc just has a statement at the top like if test -e /etc/static/bashrc; then . /etc/static/bashrc; fi to accomplish more or less the same thing.

Unclear whether you followed the full uninstall instructions https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos, so I'd start by following those and try installing again.

@abathur
Copy link
Member

abathur commented Feb 23, 2023

Ah. Sorry. I cheated and just read the 2nd comment.

The diff issue in the original output is the same one reported in #7286. TL;DR: in Ventura, Apple's replaced GNU diff with their own home-grown version that now lacks some flags that the installer would use to show you a diff of the edit it's trying to make if it looks like there's something other than Nix in your /etc/synthetic.conf.

The ~cheapest workarounds are probably to:

  1. use brew install diffutils to temporarily install GNU diff; can uninstall it after getting Nix installed
  2. temporarily remove whatever non-nix item is in /etc/synthetic.conf and replace it after the installer runs (this should just avoid the code path that uses the now-unsupported flag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants