nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

`fonts` module currently broken on macOS Ventura

Open malob opened this issue 1 year ago • 2 comments

The issue is related to this line: https://github.com/LnL7/nix-darwin/blob/54a24f042f93c79f5679f133faddedec61955cf2/modules/fonts/default.nix#L61

At the moment fontrestore is killed (SIGKILL) immediately after being launched.

I've filed a report with Apple about this using Feedback Assistant. Hopefully this is addressed before launch, otherwise we'll need to refactor the fonts module to not use fontrestore.

malob avatar Aug 03 '22 00:08 malob

Issue is currently present in public beta 2.

malob avatar Aug 03 '22 00:08 malob

Issue is currently present in public beta 7.

r17x avatar Sep 10 '22 17:09 r17x

Confirmed that this issue has been fixed on public beta 8

aarnphm avatar Sep 23 '22 06:09 aarnphm

Issue is currently present in public beta 8.

image

r17x avatar Sep 27 '22 04:09 r17x

I was able to build perfectly fine. Strange.

aarnphm avatar Sep 27 '22 09:09 aarnphm

I'm also seeing failures on Ventura Beta 8

...
user defaults...
setting up user launchd services...
setting up ~/Applications...
setting up pam...
applying patches...
setting up /etc...
system defaults...
setting up launchd services...
reloading nix-daemon...
waiting for nix-daemon
configuring networking...
configuring fonts...
/nix/store/7m2dl2h3ilikjlcws7fwg3z1byhg5nqc-darwin-system-22.11pre400298.bc4b4a50c7a+darwin4.0000000/activate: line 226: 34135 Killed: 9               fontrestore default -n 2>&1
     34136 Done                    | while read -r f; do
    case $f in 
        /Library/Fonts/*)
            font=${f##*/}; if [ ! -e "$systemConfig/Library/Fonts/$font" ]; then
                echo "removing font $font..." 1>&2; rm "/Library/Fonts/$font";
            fi
        ;;
        /*)

        ;;
    esac;
done
[137] cbzehner@Chriss-MBP> fontrestore --help                                                                                                                             ~/Projects
zsh: killed     fontrestore --help

cbzehner avatar Sep 29 '22 06:09 cbzehner

Still seeing this on the latest beta of macOS Ventura (build 22A5358e). From looking at the crash report it seems like a code sign issue maybe?

On my machine /usr/bin/fontrestore is a symlink to /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Support/fontmover. The same Support folder also contains fontd and fontworker as executables, both of which crash when run as well.

Crash report summary from Console.app for fontrestore:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: AF91FC0A-35B4-4E0C-B927-721321CA5FC0
CrashReporter Key:   D78E9276-041C-774C-35F4-023DF5350DEB
Hardware Model:      MacBookPro18,3
Process:             fontmover [5270]
Path:                /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Support/fontmover
Identifier:          fontmover
Version:             ???
Code Type:           ARM-64 (Native)
Role:                Unspecified
Parent Process:      bash [5147]
Coalition:           com.apple.Terminal [574]
Responsible Process: Terminal [569]

Date/Time:           2022-10-03 00:10:57.1702 +0100
Launch Time:         2022-10-03 00:10:57.1648 +0100
OS Version:          macOS 13.0 (22A5358e)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL (Code Signature Invalid))
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: CODESIGNING 4 Launch Constraint Violation

Highlighted by Thread:  0

Backtrace not available

No thread state (register information) available

Binary Images:
Binary images description not available

Error Formulating Crash Report:
_dyld_process_info_create failed with 30
dyld_process_snapshot_get_shared_cache failed
Failed to create CSSymbolicatorRef - corpse still valid ¯\_(ツ)_/¯
thread_get_state(PAGEIN) returned 0x10000003: (ipc/send) invalid destination port
thread_get_state(EXCEPTION) returned 0x10000003: (ipc/send) invalid destination port
thread_get_state(FLAVOR) returned 0x10000003: (ipc/send) invalid destination port

EOF

caius avatar Oct 02 '22 23:10 caius

This happens on current release Ventura build (22A380) as well. Essentially same crash report as above.

mikroskeem avatar Oct 24 '22 20:10 mikroskeem

Same issue here. Wonder if this has to do with the new AMFI Launch Constraints introduced in Ventura: https://theevilbit.github.io/posts/amfi_launch_constraints/

fmoda3 avatar Oct 24 '22 20:10 fmoda3

From dmesg when running fontrestore default -n:

AMFI: Launch Constraint Violation (enforcing), error info: c[1]p[1]m[1]e[1], (Constraint not matched) launching proc[vc: 1 pid: 6667]: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Support/fontmover, launch type 0, failure proc [vc: 1 pid: 6667]: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Support/fontmover

Might be also helpful - in feedback app under Ventura notes: image

mikroskeem avatar Oct 24 '22 21:10 mikroskeem

It doesn't look like fontrestore default -n is doing anything on Monterey. I'd expect this block to delete anything that's not installed by default, but it doesn't delete anything.

Right now, deleting that block would keep the current functionality, and nobody would need to solve the AMFI issue. Fonts won't be deleted when removed from darwin-configuration.nix, but that's already happening in Monterey.

joedevivo avatar Oct 24 '22 21:10 joedevivo

Resolved by #560.

malob avatar Oct 28 '22 18:10 malob