Opened 11 years ago

Last modified 10 years ago

#40364 new defect

mongodb can't install into userdir

Reported by: posita (Matt Bogosian) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc:
Port: mongodb

Description (last modified by mf2k (Frank Schima))

Much like ticket:40360, mongodb Staging mongodb fails on attempt to set group in non-root install. main.log is attached. Relevant part:

:debug:destroot Executing proc-post-org.macports.destroot-destroot-0
:info:destroot xinstall: chdir([__MACPORTS_ROOT__]/var/macports/build/[__MACPORTS_ROOT__]_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_mongodb/mongodb/work/mongodb-src-r2.4.6)
:info:destroot xinstall: mongobridge -> [__MACPORTS_ROOT__]/var/macports/build/[__MACPORTS_ROOT__]_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_mongodb/mongodb/work/destroot[__MACPORTS_ROOT__]/bin/mongobridge
:error:destroot org.macports.destroot for port mongodb returned: xinstall: Unknown group _mongo
:debug:destroot Error code: NONE
:debug:destroot Backtrace: xinstall: Unknown group _mongo
    while executing
"$post $targetname"

The Portfile does not appear to offer a +no_root variant. The following work-around seems to get it built and installed:

--- [__MACPORTS_ROOT__]/var/macports/sources/rsync.macports.org/release/tarballs/ports/databases/mongodb/Portfile.orig    2013-08-29 16:01:28.000000000 -0700
+++ [__MACPORTS_ROOT__]/var/macports/sources/rsync.macports.org/release/tarballs/ports/databases/mongodb/Portfile 2013-09-03 08:41:20.000000000 -0700
@@ -84,8 +84,8 @@

 set dbdir           ${prefix}/var/db/mongodb
 set logdir          ${prefix}/var/log/mongodb
-set mongouser       _mongo
-add_users           ${mongouser} group=${mongouser} realname=MongoDB\ Server
+set mongouser       [__USER__]
+#add_users           ${mongouser} group=${mongouser} realname=MongoDB\ Server

 post-destroot {
     if {[variant_isset universal]} {
@@ -102,7 +102,7 @@
 }

 startupitem.create      yes
-startupitem.executable  sudo -u ${mongouser} ${prefix}/bin/mongod --dbpath ${dbdir} --logpath ${logdir}/mongodb.log --logappend
+startupitem.executable  ${prefix}/bin/mongod --dbpath ${dbdir} --logpath ${logdir}/mongodb.log --logappend

 if {${os.platform} eq "darwin" && ${os.major} < 10} {
     depends_build

(Where "[__USER__]" is the installer's username. See .../devel/dbus/Portfile as a decent example of supporting +no_root with LaunchDaemons.)

Attachments (1)

main.log (5.0 MB) - added by posita (Matt Bogosian) 11 years ago.
var/macports/logs/.../mongodb/main.log

Change History (9)

Changed 11 years ago by posita (Matt Bogosian)

Attachment: main.log added

var/macports/logs/.../mongodb/main.log

comment:1 Changed 11 years ago by mf2k (Frank Schima)

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

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

Thanks for the report but see comment:ticket:40360:5 for why I would want to fix this in a different way than adding a no_root variant.

comment:3 Changed 11 years ago by posita (Matt Bogosian)

I did not mean to be unclear. I am not trying to suggest a particular fix. I only meant to point out that this port did not support +no_root, and (if it was desirable) .../dbus/Portfile provided an example of support for such a variant. If the problem can be addressed using another approach, then I am not in a position to discourage it.

Even if I were encouraging a particular approach, my suggestions should be given very little (if any) weight. I am not a maintainer of any ports, I have never written a Portfile, and I do not have the breadth of knowledge regular maintainers do about the direction of MacPorts and changes to strategy, conventions, etc.

Last edited 11 years ago by posita (Matt Bogosian) (previous) (diff)

comment:4 in reply to:  3 ; Changed 11 years ago by larryv (Lawrence Velázquez)

Replying to mtb19@…:

Even if I were encouraging a particular approach, my suggestions should be given very little (if any) weight. I am not a maintainer of any ports, I have never written a Portfile, and I do not have the breadth of knowledge regular maintainers do about the direction of MacPorts and changes to strategy, conventions, etc.

We value contributions from persons with a wide range of experience. Everyone has to start somewhere :)

comment:5 in reply to:  4 ; Changed 11 years ago by posita (Matt Bogosian)

Replying to larryv@…:

We value contributions from persons with a wide range of experience. Everyone has to start somewhere :)

Thanks! :o)

By the way, if +no_root is a deprecated hack, can anyone speak to what is the preferred (or at least idiomatic) way to address these types of non-root install issues?

I know that MacPorts' own configure supports options like:

--with-no-root-privileges
--with-install-user=...
--with-install-group=...
--with-applications-dir=...
--with-frameworks-dir=...
--with-directory-mode=...
...
[no --with-startupitems-dir=... though]

Many packages provide a [pkg]-config executable for others to discover aspects about how they were configured (where they were installed, etc.) Is there an equivalent for MacPorts itself (port-config?) that could signal to the build process what users to use and where to stick stuff, perhaps by parsing .../etc/macports/macports.conf? macports.conf doesn't appear to capture all configure options...maybe it doesn't need to?

comment:6 in reply to:  5 Changed 11 years ago by larryv (Lawrence Velázquez)

Replying to mtb19@…:

By the way, if +no_root is a deprecated hack, can anyone speak to what is the preferred (or at least idiomatic) way to address these types of non-root install issues?

If a Portfile must behave differently based on user, it should check the values of install.user and install.group and automatically do the right thing. (See the portfile(7) man page.)

comment:7 Changed 10 years ago by posita (Matt Bogosian)

FYI, I thought I'd add this still happens with 2.3.0. I'd also point out that it *builds* fine. It's in the install phase that it fails (apparently from the add_users/sudo bits).

comment:8 in reply to:  7 Changed 10 years ago by posita (Matt Bogosian)

Replying to mtb19@…:

FYI, I thought I'd add this still happens with 2.3.0. I'd also point out that it *builds* fine. It's in the install phase that it fails (apparently from the add_users/sudo bits).

FYI, the same still applies to 2.6.0.

Note: See TracTickets for help on using tickets.