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

Trying to install nix but gives me vifs:editing error #6462

Closed
SCheekati opened this issue Apr 28, 2022 · 9 comments · Fixed by #6490
Closed

Trying to install nix but gives me vifs:editing error #6462

SCheekati opened this issue Apr 28, 2022 · 9 comments · Fixed by #6490
Labels

Comments

@SCheekati
Copy link

SCheekati commented Apr 28, 2022

Trying to install nix but it keeps giving me the vifs:editing error and asks me to open an issue on github

If you have a problem with a specific package or NixOS,
you probably want to file an issue at https://github.com/NixOS/nixpkgs/issues.

Steps To Reproduce

  1. Run command $ sh <(curl -L https://nixos.org/nix/install)
  2. Follow steps to install nix

Expected behavior

I want to download Nix with the recommended multi-user installation
sh <(curl -L https://nixos.org/nix/install)

nix-env --version output
-bash: nix-env: command not found

Additional context

USING macOS Monterey Version 12.3.1

~ shravancheekati$ sh <(curl -L https://nixos.org/nix/install)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 4053 100 4053 0 0 17242 0 --:--:-- --:--:-- --:--:-- 17242
downloading Nix 2.8.0 binary tarball for aarch64-darwin from 'https://releases.nixos.org/nix/nix-2.8.0/nix-2.8.0-aarch64-darwin.tar.xz' to '/var/folders/2q/z1fh09r147v5q2fzhgwr1p180000gn/T/nix-binary-tarball-unpack.XXXXXXXXXX.JqMnb0v3'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9128k 100 9128k 0 0 10.8M 0 --:--:-- --:--:-- --:--:-- 10.8M
Switching to the Multi-user Installer
Welcome to the Multi-User Nix Installation

This installation tool will set up your computer with the Nix package
manager. This will happen in a few stages:

  1. Make sure your computer doesn't already have Nix. If it does, I
    will show you instructions on how to clean up your old install.

  2. Show you what I am going to install and where. Then I will ask
    if you are ready to continue.

  3. Create the system users and groups that the Nix daemon uses to run
    builds.

  4. Perform the basic installation of the Nix files daemon.

  5. Configure your shell to import special Nix Profile files, so you
    can use Nix.

  6. Start the Nix daemon.

Would you like to see a more detailed list of what I will do?
[y/n] n

---- let's talk about sudo -----------------------------------------------------
This script is going to call sudo a lot. Every time I do, it'll
output exactly what it'll do, and why.

Just like this:

---- sudo execution ------------------------------------------------------------
I am executing:

$ sudo echo

to demonstrate how our sudo prompts look

This might look scary, but everything can be undone by running just a
few commands. I used to ask you to confirm each time sudo ran, but it
was too many times. Instead, I'll just ask you this one time:

Can I use sudo?
[y/n] y

Yay! Thanks! Let's get going!

~~> Fixing any leftover Nix volume state
Before I try to install, I'll check for any existing Nix volume config
and ask for your permission to remove it (so that the installer can
start fresh). I'll also ask for permission to fix any issues I spot.

---- Found existing Nix volume -------------------------------------------------
special: disk3s7
uuid: 1706D416-C2DA-4478-A52A-37E46EBDA931
encrypted: no

During install, I add 'nix' to /etc/synthetic.conf, which instructs
macOS to create an empty root directory for mounting the Nix volume.
Can I remove /etc/synthetic.conf?
[y/n] y

---- sudo execution ------------------------------------------------------------
I am executing:

$ sudo rm /etc/synthetic.conf

to remove /etc/synthetic.conf

Password:

~~> Checking for artifacts of previous installs
Before I try to install, I'll check for signs Nix already is or has
been installed on this system.

---- Nix config report ---------------------------------------------------------
Temp Dir: /var/folders/2q/z1fh09r147v5q2fzhgwr1p180000gn/T/tmp.zFY60hK869
Nix Root: /nix
Build Users: 32
Build Group ID: 30000
Build Group Name: nixbld

build users:
Username: UID
_nixbld1: 301
_nixbld2: 302
_nixbld3: 303
_nixbld4: 304
_nixbld5: 305
_nixbld6: 306
_nixbld7: 307
_nixbld8: 308
_nixbld9: 309
_nixbld10: 310
_nixbld11: 311
_nixbld12: 312
_nixbld13: 313
_nixbld14: 314
_nixbld15: 315
_nixbld16: 316
_nixbld17: 317
_nixbld18: 318
_nixbld19: 319
_nixbld20: 320
_nixbld21: 321
_nixbld22: 322
_nixbld23: 323
_nixbld24: 324
_nixbld25: 325
_nixbld26: 326
_nixbld27: 327
_nixbld28: 328
_nixbld29: 329
_nixbld30: 330
_nixbld31: 331
_nixbld32: 332

Ready to continue?
[y/n] y

---- Preparing a Nix volume ----------------------------------------------------
Nix traditionally stores its data in the root directory /nix, but
macOS now (starting in 10.15 Catalina) has a read-only root directory.
To support Nix, I will create a volume and configure macOS to mount it
at /nix.

~~> Configuring /etc/synthetic.conf to make a mount-point at /nix

---- sudo execution ------------------------------------------------------------
I am executing:

$ sudo /usr/bin/ex --noplugin /etc/synthetic.conf

to add Nix to /etc/synthetic.conf

~~> Creating a Nix volume

---- sudo execution ------------------------------------------------------------
I am executing:

$ sudo /usr/sbin/diskutil unmount force disk3s7

to ensure the Nix volume is not mounted

Volume Nix Store on disk3s7 force-unmounted

~~> Configuring /etc/fstab to specify volume mount options

---- sudo execution ------------------------------------------------------------
I am executing:

$ sudo /usr/sbin/vifs

to add nix to fstab

vifs: editing error

---- oh no! --------------------------------------------------------------------
Jeeze, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.

:(

We'd love to help if you need it.

You can open an issue at https://github.com/nixos/nix/issues

Or feel free to contact the team:

@SCheekati SCheekati added the bug label Apr 28, 2022
@SCheekati SCheekati changed the title Trying to install nix but gives me vids:editing error Trying to install nix but gives me vifs:editing error Apr 28, 2022
@abathur
Copy link
Member

abathur commented Apr 30, 2022

I suspect this is something similar to #5468.

If you can try the command below and then echo $? after, I am hoping it will output something other than 0 (this may create a file named foobar that you can rm after):

/usr/bin/sudo /usr/bin/ex --noplugin foobar <<EOF
:a
nix
.
:x
EOF

@abathur
Copy link
Member

abathur commented May 4, 2022

@SCheekati Any chance you'll be able to poke at this? (I don't think it'll be fixable without more info.)

@SCheekati
Copy link
Author

Hey sorry Travis for the late reply. So I followed:
https://stackoverflow.com/questions/67115985/error-installing-nix-on-macos-catalina-and-big-sur-on-filevault-encrypted-boot-v
I am on Monterey but after doing this, the nix install automatically cleaned up and deleted that volume and magically everything started working. No idea what fixed it, but if you do then definitely let me know because I am really curious! Thank you.

@abathur
Copy link
Member

abathur commented May 4, 2022

This worked because you manually set up the fstab file, but it doesn't really clarify why your install face-planted when it tried to do it the first time.

Can you run the below (just copy and paste the whole block at once) and report back what it prints?

/usr/bin/ex --noplugin boofar <<EOF
:a
nix
.
:x
EOF
echo $?
/bin/rm boofar
/usr/bin/sudo /usr/bin/ex --noplugin boofar <<EOF
:a
nix
.
:x
EOF
echo $?
/usr/bin/sudo /bin/rm boofar

@SCheekati
Copy link
Author

Did what u told me to do, copied the entire block and just pasted. The last line did not run on its own, so I clicked enter. Then entered my password.

image

Copy paste:

Shravans-Mac-Studio:~ shravancheekati$ /usr/bin/ex --noplugin boofar <<EOF

:a
nix
.
:x
EOF
Shravans-Mac-Studio:~ shravancheekati$ echo $?
1
Shravans-Mac-Studio:~ shravancheekati$ /bin/rm boofar
override rw-r--r-- root/staff for boofar? /usr/bin/sudo /usr/bin/ex --noplugin boofar <<EOF
:a
nix
.
:x
EOF
echo $?
/usr/bin/sudo /bin/rm boofarShravans-Mac-Studio:~ shravancheekati$ :a
-bash: 🅰️ command not found
Shravans-Mac-Studio:~ shravancheekati$ nix
error: no subcommand specified
Try 'nix --help' for more information.
Shravans-Mac-Studio:~ shravancheekati$ .
-bash: .: filename argument required
.: usage: . filename [arguments]
Shravans-Mac-Studio:~ shravancheekati$ :x
-bash: ❌ command not found
Shravans-Mac-Studio:~ shravancheekati$ EOF
-bash: EOF: command not found
Shravans-Mac-Studio:~ shravancheekati$ echo $?
127
Shravans-Mac-Studio:~ shravancheekati$ /usr/bin/sudo /bin/rm boofar
Password:
Shravans-Mac-Studio:~ shravancheekati$

@abathur
Copy link
Member

abathur commented May 4, 2022

Sorry about the mis-run on the 2nd; but the 1 in the output from the first half does make me think there's something in your vim startup files causing it to exit with an error code (and make vifs think the edit failed).

Can you try:

/usr/bin/ex --noplugin -u NONE boofar <<EOF
:a
nix
.
:x
EOF
echo $?
/bin/rm boofar

@SCheekati
Copy link
Author

No problem, thank you for helping me out.
image

@abathur
Copy link
Member

abathur commented May 5, 2022

Thanks for poking at this. I think I have a fix based on your feedback. Will open a PR in a bit if the tests smell right.

@SCheekati
Copy link
Author

Sounds good. Feel free to close the issue as you feel fit. Let me know if anything else is needed!

abathur added a commit to abathur/nix that referenced this issue May 5, 2022
It looks like the `--noplugin` flag added in NixOS#5489 wasn't enough to
skirt this class of vim-init error, so this is swing 2 at a full fix.
Fixes NixOS#6462.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants