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

while installing nix - 'nss-cacert-3.46' error: unexpected EOF reading a line #3137

Closed
iamnewspecies opened this issue Oct 11, 2019 · 3 comments · Fixed by #8049
Closed

while installing nix - 'nss-cacert-3.46' error: unexpected EOF reading a line #3137

iamnewspecies opened this issue Oct 11, 2019 · 3 comments · Fixed by #8049
Assignees

Comments

@iamnewspecies
Copy link

I run this
sh <(curl https://nixos.org/nix/install) --daemon
to install nix on my mac and I get the following error

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

    $ sudo HOME=/var/root /nix/store/6639l9815ggdnb4aka22qcjy7p8w4hb9-nix-2.3.1/bin/nix-env -i /nix/store/6639l9815ggdnb4aka22qcjy7p8w4hb9-nix-2.3.1

to installing a bootstrapping Nix in to the default Profile

installing 'nix-2.3.1'
building '/nix/store/m4ndmx2w66z5kjrhfbfkc25c8g91wdis-user-environment.drv'...
created 7 symlinks in user environment

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

    $ sudo HOME=/var/root /nix/store/6639l9815ggdnb4aka22qcjy7p8w4hb9-nix-2.3.1/bin/nix-env -i /nix/store/cccvqs6cx963yrgb3svj7h7iplqb12np-nss-cacert-3.46

to installing a bootstrapping SSL certificate just for Nix in to the default Profile

installing 'nss-cacert-3.46'
error: unexpected EOF reading a line

---- 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.

:(
@stale
Copy link

stale bot commented Feb 18, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 18, 2021
@Grubben
Copy link

Grubben commented Feb 5, 2022

I just got a very similar error while trying to install nix on my macBook Pro that still runs High Sierra

@stale stale bot removed the stale label Feb 5, 2022
@stale stale bot added the stale label Aug 12, 2022
@jessestricker
Copy link

I encountered the same issue, #7242.

@stale stale bot removed the stale label Oct 31, 2022
edolstra added a commit to edolstra/nix that referenced this issue Mar 15, 2023
Hopefully this fixes "unexpected EOF" failures on macOS (NixOS#3137, NixOS#3605,

The problem appears to be that under some circumstances, macOS
discards the output written to the slave side of the
pseudoterminal. Hence the parent never sees the "sandbox initialized"
message from the child, even though it succeeded. The conditions are:

* The child finishes very quickly. That's why this bug is likely to
  trigger in nix-env tests, since that uses a builtin builder. Adding
  a short sleep before the child exits makes the problem go away.

* The parent has closed its duplicate of the slave file
  descriptor. This shouldn't matter, since the child has a duplicate
  as well, but it does. E.g. moving the close to the bottom of
  startBuilder() makes the problem go away. However, that's not a
  solution because it would make Nix hang if the child dies before
  sending the "sandbox initialized" message.

* The system is under high load. E.g. "make installcheck -j16" makes
  the issue pretty reproducible, while it's very rare under "make
  installcheck -j1".

As a fix/workaround, we now open the pseudoterminal slave in the
child, rather than the parent. This removes the second condition
(i.e. the parent no longer needs to close the slave fd) and I haven't
been able to reproduce the "unexpected EOF" with this.
edolstra added a commit to edolstra/nix that referenced this issue Mar 15, 2023
Hopefully this fixes "unexpected EOF" failures on macOS
(NixOS#3137, NixOS#3605, NixOS#7242, NixOS#7702).

The problem appears to be that under some circumstances, macOS
discards the output written to the slave side of the
pseudoterminal. Hence the parent never sees the "sandbox initialized"
message from the child, even though it succeeded. The conditions are:

* The child finishes very quickly. That's why this bug is likely to
  trigger in nix-env tests, since that uses a builtin builder. Adding
  a short sleep before the child exits makes the problem go away.

* The parent has closed its duplicate of the slave file
  descriptor. This shouldn't matter, since the child has a duplicate
  as well, but it does. E.g. moving the close to the bottom of
  startBuilder() makes the problem go away. However, that's not a
  solution because it would make Nix hang if the child dies before
  sending the "sandbox initialized" message.

* The system is under high load. E.g. "make installcheck -j16" makes
  the issue pretty reproducible, while it's very rare under "make
  installcheck -j1".

As a fix/workaround, we now open the pseudoterminal slave in the
child, rather than the parent. This removes the second condition
(i.e. the parent no longer needs to close the slave fd) and I haven't
been able to reproduce the "unexpected EOF" with this.
Ericson2314 pushed a commit to Ericson2314/nix that referenced this issue Oct 31, 2023
Hopefully this fixes "unexpected EOF" failures on macOS
(NixOS#3137, NixOS#3605, NixOS#7242, NixOS#7702).

The problem appears to be that under some circumstances, macOS
discards the output written to the slave side of the
pseudoterminal. Hence the parent never sees the "sandbox initialized"
message from the child, even though it succeeded. The conditions are:

* The child finishes very quickly. That's why this bug is likely to
  trigger in nix-env tests, since that uses a builtin builder. Adding
  a short sleep before the child exits makes the problem go away.

* The parent has closed its duplicate of the slave file
  descriptor. This shouldn't matter, since the child has a duplicate
  as well, but it does. E.g. moving the close to the bottom of
  startBuilder() makes the problem go away. However, that's not a
  solution because it would make Nix hang if the child dies before
  sending the "sandbox initialized" message.

* The system is under high load. E.g. "make installcheck -j16" makes
  the issue pretty reproducible, while it's very rare under "make
  installcheck -j1".

As a fix/workaround, we now open the pseudoterminal slave in the
child, rather than the parent. This removes the second condition
(i.e. the parent no longer needs to close the slave fd) and I haven't
been able to reproduce the "unexpected EOF" with this.

(cherry picked from commit c536e00)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants