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

/nix does not mount after upgrading to macOS 15.1 #1261

Open
grebban-yamashita opened this issue Oct 30, 2024 · 11 comments
Open

/nix does not mount after upgrading to macOS 15.1 #1261

grebban-yamashita opened this issue Oct 30, 2024 · 11 comments
Labels
MacOS Darwin/MacOS

Comments

@grebban-yamashita
Copy link

Using completely factory-resetted M3 MacBook Pro.

$ sudo cat /etc/synthetic.conf
run	private/var/run
nix
$ cat /etc/fstab  

# nix-installer created volume labelled `Nix Store`
UUID=8474bf18-8044-4acc-b351-f8c214502e41 /nix apfs rw,noauto,nobrowse,suid,owners

Manually mounting the disk works.

Kitty permission issue

Since the update I am also getting the following error when trying to start kitty.
Screenshot 2024-10-30 at 9 00 46 AM

Other Home-Manager apps start without issue.

To bypass this I start kitty from the Terminal.app, which is less than optimal.

Installation commands

Commands run on fresh macOS install are as follows:

$ cat nix-master/install.sh 
#!/bin/sh

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
  sh -s -- install

xcode-select --install

. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh

nix run nix-darwin -- switch --flake .#work

No errors.

@cole-h
Copy link
Member

cole-h commented Oct 30, 2024

When you've freshly rebooted and the store is not mounted, what is the output of the following commands?

launchctl print system/org.nixos.darwin-store
diskutil info 8474bf18-8044-4acc-b351-f8c214502e41

When you say "Manually mounting the disk works", how do you do this? Via the Disk Utility app, or via the diskutil command line? If using the app, what happens if you run /usr/sbin/diskutil mount -mountPoint /nix 8474BF18-8044-4ACC-B351-F8C214502E41?

@grebban-yamashita
Copy link
Author

grebban-yamashita commented Oct 31, 2024

launchctl print system/org.nixos.darwin-store
diskutil info 8474bf18-8044-4acc-b351-f8c214502e41

Output here:

$ launchctl print system/org.nixos.darwin-store       
Bad request.
Could not find service "org.nixos.darwin-store" in domain for system
$ launchctl print system | grep darwin         
$ diskutil info 8474bf18-8044-4acc-b351-f8c214502e41
   Device Identifier:         disk3s7
   Device Node:               /dev/disk3s7
   Whole:                     No
   Part of Whole:             disk3

   Volume Name:               Nix Store
   Mounted:                   Yes
   Mount Point:               /nix

   Partition Type:            41504653-0000-11AA-AA11-00306543ECAC
   File System Personality:   APFS
   Type (Bundle):             apfs
   Name (User Visible):       APFS
   Owners:                    Enabled

   OS Can Be Installed:       Yes
   Booter Disk:               disk3s2
   Recovery Disk:             disk3s3
   Media Type:                Generic
   Protocol:                  Apple Fabric
   SMART Status:              Verified
   Volume UUID:               8474BF18-8044-4ACC-B351-F8C214502E41
   Disk / Partition UUID:     8474BF18-8044-4ACC-B351-F8C214502E41

   Disk Size:                 494.4 GB (494384795648 Bytes) (exactly 965595304 512-Byte-Units)
   Device Block Size:         4096 Bytes

   Volume Used Space:         10.1 GB (10050531328 Bytes) (exactly 19629944 512-Byte-Units)
   Container Total Space:     494.4 GB (494384795648 Bytes) (exactly 965595304 512-Byte-Units)
   Container Free Space:      442.1 GB (442072637440 Bytes) (exactly 863423120 512-Byte-Units)
   Allocation Block Size:     4096 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          No

   Device Location:           Internal
   Removable Media:           Fixed

   Solid State:               Yes
   Hardware AES Support:      Yes

   This disk is an APFS Volume.  APFS Information:
   APFS Container:            disk3
   APFS Physical Store:       disk0s2
   Fusion Drive:              No
   FileVault:                 No
   Sealed:                    No
   Locked:                    No

When you say "Manually mounting the disk works", how do you do this? Via the Disk Utility app

Yes, I use the Disk Utility app.

If using the app, what happens if you run [...]

$ /usr/sbin/diskutil mount -mountPoint /nix 8474BF18-8044-4ACC-B351-F8C214502E41
Volume Nix Store on 8474BF18-8044-4ACC-B351-F8C214502E41 mounted

NOTE: Every time I restart the MacBook I need to manually mount the disk again.

@cole-h
Copy link
Member

cole-h commented Oct 31, 2024

That bad request is very weird, and something I have never seen before................

However, after some searching I think I've found a similar issue on the NixOS Discourse: https://discourse.nixos.org/t/macos-upgrade-breakage/50691, and this post proposes a solution: https://discourse.nixos.org/t/macos-upgrade-breakage/50691/7. Could you give that a shot and see if it fixes your issue?

@grebban-yamashita
Copy link
Author

Two sh services are present, and enabled by default.

Screenshot 2024-10-31 at 5 36 15 PM

Clicking the icon next to them just shows the path to /bin/sh

@cole-h
Copy link
Member

cole-h commented Oct 31, 2024

Hm. I found another issue that also had the "Bad request" text: NixOS/nix#9978

If you run sudo launchctl print system | grep nix and sudo launchctl print-disabled system, do any nix-related services show up there? If so, you may need to enable them with sudo launchctl enable system/org.nixos.darwin-store, etc.

If that doesn't solve your issue, what is the output of ls -al /Library/LaunchDaemons/org.nixos*?

@grebban-yamashita
Copy link
Author

Hm. I found another issue that also had the "Bad request" text: NixOS/nix#9978

If you run sudo launchctl print system | grep nix and sudo launchctl print-disabled system, do any nix-related services show up there? If so, you may need to enable them with sudo launchctl enable system/org.nixos.darwin-store, etc.

$ sudo launchctl print system | grep nix
		   1752      - 	systems.determinate.nix-daemon
		      0      0 	systems.determinate.nix-installer.nix-hook
		      0      1 	systems.determinate.nix-store
		      0      0 	org.nixos.activate-system
		"systems.determinate.nix-store" => enabled
		"org.nixos.activate-system" => enabled
		"systems.determinate.nix-daemon" => enabled
$ sudo launchctl print-disabled system

	disabled services = {
		"com.apple.CSCSupportd" => disabled
		"com.apple.mdmclient.daemon.runatboot" => disabled
		"com.apple.ftpd" => disabled
		"systems.determinate.nix-store" => enabled
		"org.nixos.activate-system" => enabled
		"systems.determinate.nix-daemon" => enabled
	}

They all seem to be enabled.

If that doesn't solve your issue, what is the output of ls -al /Library/LaunchDaemons/org.nixos*?

-r--r--r--  1 root  wheel  591 Oct 30 08:32 /Library/LaunchDaemons/org.nixos.activate-system.plist

@grebban-yamashita
Copy link
Author

Also of note is that I did reinstall my MacBook twice. The first time I noticed this issue I thought it might be because of something I had done. The second time the issue still persisted, which is when I created this issue.

@grahamc
Copy link
Member

grahamc commented Nov 1, 2024

@grebban-yamashita interesting. Looking at your log, it looks like you're installing the standard upstream Nix:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
  sh -s -- install

and then applying your flake with nix-darwin, which uses Determinate Nix.

This is a huge hint for us.

Determinate has the strong assumption that your Nix store is an encrypted APFS volume. Which, yours isn't:

FileVault: No

Probably the most straightforward way forward is to uninstall Nix again (...sorry...) and reinstall with --determinate to start with Determinate Nix:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
  sh -s -- install --determinate

and then it should solve itself.

...another approach is we could help you with the commands you'd need to run to enable encryption on this volume, and correctly store the secret in the keychain for Determinate to use for unlocking and mounting.

@grahamc
Copy link
Member

grahamc commented Nov 1, 2024

p.s. @cole-h is working right now on improving this transition, so hopefully not a lot of people will run into this problem...

@grebban-yamashita
Copy link
Author

Thanks! I have not had the time to reinstall yet, so I will not be able to verify if this solves the issue. I am fine with closing this issue, and I can re-open it when I reinstall if the issue persists. 🙂

@0utkarsh
Copy link

0utkarsh commented Nov 5, 2024

I faced the same issue in Sonoma 14.4 M3 Pro. /nix was not mounted. Manually mounting it resolved the issue

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

No branches or pull requests

4 participants