navidrome / navidrome

🎧☁️ Modern Music Server and Streamer compatible with Subsonic/Airsonic
https://www.navidrome.org
GNU General Public License v3.0
10.6k stars 804 forks source link

[Bug]: Status 78 when running as MacOS launchctl service #2796

Open jordaniac89 opened 5 months ago

jordaniac89 commented 5 months ago

I confirm that:

Version

v0.50.2

Current Behavior

When trying to run navidrome as a launchctl service, I receive a status code of 78. I get a launch log of

2024-01-17 21:56:29.449940 <Error> Service could not initialize: posix_spawn(/Users/jordanmiles/Documents/navidrome/navidrome), error 0x1 - Operation not permitted 2024-01-17 21:56:29.449950 <Error> initialization failure: 22G120: xpcproxy + 22544 [1097][D177A08D-D99B-3FFD-94E9-90882559A169]: 0x1

When I run the command outside of launchctl, it runs fine.

Expected Behavior

navidrome starts up correctly when running as a service

Steps To Reproduce

I'm using the standard plist file from the documentation. I've confirmed that the executable and the log files have wide open permissions for rwx. As mentioned, when I run the navidrome command from the command line, it works fine.

plist file below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>navidrome</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/jordanmiles/Documents/navidrome/navidrome</string>
            <string>-c</string>
            <string>/Users/jordanmiles/Documents/navidrome/navidrome.toml</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardOutPath</key>
        <string>/Users/jordanmiles/Documents/navidrome/navidrome.log</string>
        <key>StandardErrorPath</key>
        <string>/Users/jordanmiles/Documents/navidrome/navidrome.log</string>
    </dict>
</plist>

Environment

- OS: MacOS Ventura 13.6
- Browser:
- Client:

How Navidrome is installed?

Binary (from downloads page)

Configuration

LogLevel = 'DEBUG'
ScanSchedule = '@every 24h'
TranscodingCacheSize = '150MiB'
MusicFolder = '/Users/jordanmiles/Documents/music'
DataFolder = '/Users/jordanmiles/Documents/nd_data'

Relevant log output

2024-01-17 21:56:29.443828 <Notice> internal event: WILL_SPAWN, code = 0
2024-01-17 21:56:29.443851 <Notice> service state: spawn scheduled
2024-01-17 21:56:29.443853 <Notice> service state: spawning
2024-01-17 21:56:29.443869 <Notice> launching: one-shot
2024-01-17 21:56:29.444314 <Notice> xpcproxy spawned with pid 72633
2024-01-17 21:56:29.444333 <Notice> internal event: SPAWNED, code = 0
2024-01-17 21:56:29.444335 <Notice> service state: xpcproxy
2024-01-17 21:56:29.444364 <Notice> internal event: SOURCE_ATTACH, code = 0
2024-01-17 21:56:29.449940 <Error> Service could not initialize: posix_spawn(/Users/jordanmiles/Documents/navidrome/navidrome), error 0x1 - Operation not permitted
2024-01-17 21:56:29.449950 <Error> initialization failure: 22G120: xpcproxy + 22544 [1097][D177A08D-D99B-3FFD-94E9-90882559A169]: 0x1
2024-01-17 21:56:29.449952 <Notice> internal event: INIT, code = 1
2024-01-17 21:56:29.450291 <Notice> xpcproxy exited due to exit(78)
2024-01-17 21:56:29.450299 <Notice> exited due to exit(78)
2024-01-17 21:56:29.450301 <Notice> already handled failed init, ignoring
2024-01-17 21:56:29.450303 <Notice> service state: exited
2024-01-17 21:56:29.450314 <Notice> internal event: EXITED, code = 0
2024-01-17 21:56:29.450316 <Notice> service inactive: navidrome
2024-01-17 21:56:29.450319 <Notice> service state: not running

Anything else?

No response

Code of Conduct

jordaniac89 commented 5 months ago

I've also given full disk access to the executable, launchctl, sh, bash, and zsh. Looking at it closer, it's probably an issue with MacOS itself and not navidrome, but let me know if anything stands out.

ghost commented 1 month ago

I found this https://stackoverflow.com/questions/58442951/how-to-fix-operation-not-permitted-when-i-use-launchctl-in-macos-catalina But it sounds like you've already taken that into account. How about the Terminal? You didn't say that the Terminal has full disk access...