[MacPorts] #27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process)
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: --------------------------+------------------------------------------------- I have installed mpd 0.15.15 and made just enough changes to /opt/local/etc/mpd.conf so that mpd runs usefully. I can start the daemon with {{{ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mpd.plist }}} And now I can see two processes running: {{{ $ ps -Aj | grep mpd | grep -v grep root 17635 1 17635 1edfd1c 0 Ss ?? 0:00.02 /opt/local/bin/daemondo --label=mpd --start-cmd /opt/local/etc/Launch root 17637 1 17635 1edfd1c 0 S ?? 0:03.69 /opt/local/bin/mpd --no-daemon /opt/local/etc/mpd.conf }}} Note that one of these processes is mpd itself, and the other a daemondo instance that is presumably responsible for mpd. Seems reasonable. Now let's say I decide to stop the daemon. My limited understanding of launchd leads me to believe that I am supposed to run {{{ sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mpd.plist }}} However, this has no visible effect: mpd keeps running and the music keeps playing. What seems to have happened is that the daemondo instance started by "launchctl load" was killed: {{{ $ ps -Aj | grep mpd | grep -v grep root 17637 1 17635 1edfd1c 0 S ?? 0:20.20 /opt/local/bin/mpd --no-daemon /opt/local/etc/mpd.conf }}} I expected both that daemondo instance and mpd to be killed. -- Ticket URL: <https://trac.macports.org/ticket/27578> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: milosh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: mpd --------------------------+------------------------------------------------- Changes (by ryandesign@…): * owner: macports-tickets@… => milosh@… * cc: rmstonecipher@… (added) * port: => mpd -- Ticket URL: <https://trac.macports.org/ticket/27578#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: milosh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: mpd --------------------------+------------------------------------------------- Comment(by ryandesign@…): Replying to [ticket:27578 greg@…]:
I can start the daemon with [[br]] [[br]] sudo launchctl load -w /Library/LaunchDaemons/org.macports.mpd.plist
Or, equivalently (but easier to remember): {{{ sudo port load mpd }}}
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mpd.plist
Or: {{{ sudo port unload mpd }}}
I expected both that daemondo instance and mpd to be killed.
Right, that's how it's supposed to work. I'm not sure why it's not working that way here. -- Ticket URL: <https://trac.macports.org/ticket/27578#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: milosh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: mpd --------------------------+------------------------------------------------- Comment(by greg@…): Forgot to mention I'm on OS X 10.4.11. Perhaps launchd behaved a little differently back in ye olden days of Tiger. (This is on a G4, and I've tried running Leopard. Too slow. Tiger is just fine on this machine.) Anyways, I "fixed" this for now by modifying the launchd properties file for mpd. Specifically, I made it a lot simpler, completely avoiding mpd.wrapper and daemondo: {{{ <key>ProgramArguments</key> <array> <string>/opt/local/bin/mpd</string> <string>--no-daemon</string> <string>/opt/local/etc/mpd.conf</string> </array> }}} Now launchd and mpd interact as I expected: "load -w" starts mpd and "unload -w" kills it. Obviously, this is a short-term kludge: I assume it will be clobbered by the next upgrade of mpd. -- Ticket URL: <https://trac.macports.org/ticket/27578#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: milosh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: mpd --------------------------+------------------------------------------------- Comment(by rmstonecipher@…): Greg,[[br]] I am glad you found a solution which works for you.[[br]][[br]] The launchd plist for dbus is much simpler than that for mpd.[[br]] In r49300, lines 121 through 167 explicitly write every line of the plist rather than utilizing MacPorts' startupitem routine.[[br]] One cannot run 'port load dbus' or 'port unload dbus' because load/unload looks for org.macports.[foo].plist and dbus provides org.freedesktop.dbus- system.plist.[[br]][[br]] Does your revised plist work with 'port load', or only with 'launchctl load'?[[br]] If you can either borrow from r49300 to write a simpler org.macports.mpd.plist or write a post-destroot routine to trim the fat from the startupitem generated files, ''and'' it can be run using port load/unload (i.e. no custom how-to-load message required), I take no issue with incorporating such a change into the mpd Portfile.[[br]][[br]] Ryan Stonecipher -- Ticket URL: <https://trac.macports.org/ticket/27578#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: milosh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: mpd --------------------------+------------------------------------------------- Comment(by snc@…): See #24042 for another solution (create a user for mpd). -- Ticket URL: <https://trac.macports.org/ticket/27578#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: milosh@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: mpd --------------------------+------------------------------------------------- Comment(by jmr@…): Replying to [comment:6 snc@…]:
See #24042 for another solution (create a user for mpd). If #24042 is another solution for this problem, and it is fixed, that would mean that this is also fixed, no?
-- Ticket URL: <https://trac.macports.org/ticket/27578#comment:7> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) --------------------------+------------------------------------------------- Reporter: greg@… | Owner: rmstonecipher@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Keywords: | Port: mpd --------------------------+------------------------------------------------- Changes (by ryandesign@…): * owner: milosh@… => rmstonecipher@… * cc: rmstonecipher@… (removed) -- Ticket URL: <https://trac.macports.org/ticket/27578#comment:8> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27578: mpd: killing daemon with "launchctl -w unload ..." has no visible effect (kills wrong process) -------------------------+----------------------------- Reporter: greg@… | Owner: rmstonecipher@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 1.9.1 Resolution: worksforme | Keywords: Port: mpd | -------------------------+----------------------------- Changes (by rmstonecipher@…): * status: new => closed * resolution: => worksforme Comment: I am going to trust that the lack of conversation in this ticket means 'port load' and 'add_users' fixed the glitch. -- Ticket URL: <https://trac.macports.org/ticket/27578#comment:10> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts