Opened 10 years ago

Closed 9 years ago

Last modified 7 years ago

#45434 closed enhancement (fixed)

base should create var/log, var/run and other common directories

Reported by: p.perroud@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.3.5
Component: base Version:
Keywords: haspatch Cc: ryandesign (Ryan Carsten Schmidt)
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

mongodb is building fine on yosemite with macports 2.3.2 but refuses to connect:

$ mongo
MongoDB shell version: 2.6.5
connecting to: test
2014-10-18T08:00:52.404+0200 warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2014-10-18T08:00:52.405+0200 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed

A pretty generic error that does'nt mean much but this port was not configured correctly at installation time.

No log written to /opt/local/var/log/mongodb/

But this trace in system.log:

Oct 18 08:09:11 iMac27.local sudo[4559]:     root : TTY=unknown ; PWD=/ ; USER=pperroud ; COMMAND=/opt/local/bin/mongod --dbpath /opt/local/var/db/mongodb --logpath /opt/local/var/log/mongodb/mongodb.log --logappend
Oct 18 08:09:11 iMac27 com.apple.xpc.launchd[1] (org.macports.mongodb): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

Attachments (1)

prefix.mtree.in.diff (347 bytes) - added by ryandesign (Ryan Carsten Schmidt) 9 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by p.perroud@…

I was able to address the issue by editing the org.macports.mongodb.plist file — changing -u param to root as _mongo is not a sudoer...

comment:2 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: changed from macports-tickets@… to ryandesign@…

comment:3 Changed 9 years ago by knightcode (Dylan)

I also edited org.macports.mongodb.plist, but I changed it just to use the --config option and refer to settings in /opt/local/etc/mongo/mongod.conf.

I also chown'ed the data directory to _mongo:wheel (I use a custom location) as an alternative

comment:4 Changed 9 years ago by moderndeveloperllc (Mark Garrett)

On a contrary note, I am not having any issues. I uninstalled mongodb along with the other ports. Reinstalled my Macports binary from the dmg, and made sure I had Xcode 6.1 command line tools installed. I actually did a port install and installed all my requested ports (port echo requested | cut -d ' ' -f 1 > requested.txt) instead of all the installed ports.

I even restarted. I can connect fine from the command line and from the PHP driver on my install. Have y'all followed all the steps on wiki:Migration? Doing sudo port -f uninstall installed does not remove any data, but the binaries and libraries and it's a requirement. Another issue might have been using Xcode before 6.1. That was causing many issues with various ports.The reason I bring this up is that after I first upgraded to Yosemite - but before I did all the uninstall/reinstall work, I had the same issue you describe.

Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:5 Changed 9 years ago by p.perroud@…

In my case it was a new install on a new mac therefore it was not a migration. I was using XCode 6.0.1 because 6.1 was not released yet. Most importantly you said you had uninstalled then re-installed with new port app - etc. Which seems to confirm my initial statement: the issue in my case was the _mongo user that was not created with sudo right set. The only change I've made to make it works - replacing _mongo by root user in the plist file - proves something in my opinion...

Last edited 9 years ago by p.perroud@… (previous) (diff)

comment:6 Changed 9 years ago by moderndeveloperllc (Mark Garrett)

I think I found the issue. It's not in the mongo port - it's somewhere else I think. The problem is that /opt/local/var/log is getting created by some port with a 0744 permission as opposed to the proper 0755. This means that the _mongo user can't get down to the /opt/local/var/log/mongodb directory to store it's logs. This means that mongod does not launch.

As soon as I did

sudo chmod 755 /opt/local/var/log/

the mongod instance started and I was able to connect.

Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:7 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Component: portsbase
Owner: changed from ryandesign@… to macports-tickets@…
Port: mongodb removed
Summary: mongodb refuses to connect on yosemitebase should create var/log, var/run and other common directories
Type: defectenhancement

Seems like MacPorts itself should take on the responsibility of creating common directories like ${prefix}/var/log and ${prefix}/var/run. As it is now, prefix.mtree.in only creates ${prefix}/var, not anything inside it.

Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: prefix.mtree.in.diff added

comment:8 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

Attached patch proposes adding cache, db, log, run, and spool directories to the var directory, based on directories I found on my system from my installed ports.

comment:9 Changed 9 years ago by neverpanic (Clemens Lang)

+1 by me.

comment:10 in reply to:  7 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Milestone: MacPorts Future

Replying to ryandesign@…:

Seems like MacPorts itself should take on the responsibility of creating common directories like ${prefix}/var/log and ${prefix}/var/run.

r135998

Still don't know which port created it with 744 permissions on your system...

comment:11 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

I'll call this good enough, because if the problem did indeed come from a port, then the problem will resolve itself once a new version of MacPorts containing r135998 is released and the affected port is rebuilt.

comment:12 Changed 7 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.3.5
Note: See TracTickets for help on using tickets.