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

macOS: /etc/bashrc and /etc/zshrc converted from links to regular files each reboot #721

Closed
eripa opened this issue Nov 12, 2023 · 18 comments
Labels
bug Something isn't working MacOS Darwin/MacOS
Milestone

Comments

@eripa
Copy link

eripa commented Nov 12, 2023

Hi,

I have a slightly different issue than #593, but seem related. The workaround in #593 only checks the content of the file, and not the file type. I'll try and get a PR submitted.

Instead of the below files being overwritten on upgrades, each time I reboot my machine the symbolic links are dereferenced and "converted" to real files.

Before reboot (symlinks):

$ ls -l /etc/zshrc /etc/bashrc
lrwxr-xr-x 1 root wheel 18 Nov 12 12:16 /etc/bashrc -> /etc/static/bashrc
lrwxr-xr-x 1 root wheel 17 Nov 12 12:16 /etc/zshrc -> /etc/static/zshrc

After reboot (regular files):

$ ls -l /etc/zshrc /etc/bashrc
-rw-r--r-- 1 root wheel 1.2K Nov 12 12:11 /etc/bashrc
-rw-r--r-- 1 root wheel 1.2K Nov 12 12:11 /etc/zshrc

Which then results in:

error: Unexpected files in /etc, aborting activation
The following files have unrecognized content and would be overwritten:

  /etc/bashrc
  /etc/zshrc

Please check there is nothing critical in these files, rename them by adding .before-nix-darwin to the end, and then try again.

nix installed via using the Determinate systems installer 0.14.0.

$ nix --version
nix (Nix) 2.18.1

macOS:

 System Version:	macOS 14.1.1 (23B2082)
  Kernel Version:	Darwin 23.1.0

Installation receipt:
receipt.json

@Hoverbear Hoverbear changed the title /etc/bashrc and /etc/zshrc converted from links to regular files each reboot /etc/bashrc and /etc/zshrc converted from links to regular files each reboot Nov 14, 2023
@Hoverbear
Copy link
Contributor

I believe this may be caused by #672 . 🤔

@eripa eripa changed the title /etc/bashrc and /etc/zshrc converted from links to regular files each reboot macOS: /etc/bashrc and /etc/zshrc converted from links to regular files each reboot Nov 14, 2023
@eripa eripa changed the title macOS: /etc/bashrc and /etc/zshrc converted from links to regular files each reboot macOS: /etc/bashrc and /etc/zshrc converted from links to regular files each reboot Nov 14, 2023
@eripa eripa changed the title macOS: /etc/bashrc and /etc/zshrc converted from links to regular files each reboot macOS: /etc/bashrc and /etc/zshrc converted from links to regular files each reboot Nov 14, 2023
@eripa
Copy link
Author

eripa commented Nov 14, 2023

Thanks for the reply @Hoverbear. Yes, I was running nix from the determinate installer installed a few months ago that didn't experience this behaviour, so something has regressed since then. (it was also on macOS Sonoma back then)

@dhess
Copy link

dhess commented Nov 14, 2023

Yes, I'm seeing this behavior as well with dac0adc.

@Hoverbear
Copy link
Contributor

We're investigating, thanks for this report. We are cutting a new release soon, it may not have a fix for this specific problem, that'll have to wait for a future release.

@purplenoodlesoop
Copy link

purplenoodlesoop commented Dec 3, 2023

+1, experiencing this too and it makes using nix-darwin far less comfortable. My error is slightly different though

error: Unexpected files in /etc, aborting activation
The following files have unrecognized content and would be overwritten:

  /etc/bashrc
  /etc/zshrc
  /etc/zshenv

@Hoverbear Hoverbear added bug Something isn't working MacOS Darwin/MacOS labels Dec 4, 2023
@Hoverbear
Copy link
Contributor

I discussed this with @grahamc and the planned solution would be to not do the shell recovery if the files are symlinks.

@Hoverbear
Copy link
Contributor

This should be fixed in the next release!

@eripa
Copy link
Author

eripa commented Dec 5, 2023

Love it, thank you!!

@purplenoodlesoop
Copy link

@Hoverbear tysm!

@jakzale
Copy link

jakzale commented Dec 18, 2023

I am hit by the same issue. I guess in the meantime I can disable systems.determinate.nix-installer.nix-hook.

What will be the process of upgrading from 15.1 to 15.2? Will it require re-running nix-installer?

@Hoverbear
Copy link
Contributor

Yes it will be that. I expect we'll cut a new release soon -- Sorry about the delay. The holidays are a thing. 😅

@steinuil
Copy link

steinuil commented Jan 18, 2024

I'm a bit lost on the upgrading steps.

  • Running curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install prompted me to run /nix/nix-installer uninstall
  • Running /nix/nix-installer uninstall prompted me to uninstall nix-darwin
  • I ran nix run nix-darwin#darwin-uninstaller (the nix-build method didn't work because I don't have a nixpkgs channel), which seemed to successfully remove nix-darwin

Though after that /nix/nix-installer uninstall still tells me that a nix-darwin installation was detected.

@Hoverbear
Copy link
Contributor

Those should be the steps!

The installer looks for the binaries darwin-option, darwin-rebuild and runs launchctl print system/org.nixos.activate-system. Do any of those exist for you?

@eripa
Copy link
Author

eripa commented Jan 19, 2024

I tried to just run the installer again, but it prompted me to uninstall or just upgrade nix. So I figured I had to uninstall/reinstall. So I did the dance, but failed with a bunch of issues related to APFS etc. Had to reboot and clean up the remnants manually (I looked at the regular nix docs for some inspiration).

After that was done I rebooted and re-ran the installer and applied my flake again, it worked well. After another reboot it all seems to work fine, I don't have this issue anymore! 😄

Thanks a lot for fixing this! 🙏 ❤️

It would be great to have a way to upgrade the hooks/helpers that this nix-installer puts in place w/o having to completely nuke the entire installation. 😊

@Hoverbear
Copy link
Contributor

@eripa I'm sorry about the apfs issues! Out of curiousity was this on Sonoma with Filevault?

@eripa
Copy link
Author

eripa commented Jan 22, 2024

No problem @Hoverbear, I'm using macoS Sonoma with Filevault yes (fresh install, new computer)

@Hoverbear
Copy link
Contributor

Okay, we've seen several reports of the same situation.

@Hoverbear Hoverbear removed this from the 0.16.1 milestone Jan 25, 2024
@cole-h cole-h added this to the 0.16.0 milestone Apr 15, 2024
@cole-h
Copy link
Member

cole-h commented Apr 15, 2024

I believe this was fixed by #767 (which was released in https://github.com/DeterminateSystems/nix-installer/releases/tag/v0.16.0) -- please let me know if that is not the case!

@cole-h cole-h closed this as completed Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working MacOS Darwin/MacOS
Projects
None yet
Development

No branches or pull requests

7 participants