Re: [mongodb-user] cannot start mongodb 2.2.0 on Fedora 17

1,414 views
Skip to first unread message

मैं एक भारतीय बेवकूफ हूँ

unread,
Oct 6, 2012, 2:20:50 AM10/6/12
to mongod...@googlegroups.com


Edouard Perov wrote:
> permissions are ok for mongod user
>
> drwxr-xr-x. 2 mongod mongod 4096 Oct 5 12:41 /var/log/mongo
> rw-r----. 1 mongod mongod 0 Aug 28 22:42 mongod.log

No, it's not. The 'x' is missing the user.


Edouard Perov

unread,
Oct 6, 2012, 2:38:30 AM10/6/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
'x' means executable, there is no any reason why 'x' is needed for the log file.
It is a unix basis.

Edouard Perov

unread,
Oct 6, 2012, 2:50:05 AM10/6/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
Another reason for absolutely irrelevant answer
I uninstalled 2.2.0 and installed2.0.7 where everything is working

the log file also does not have 'x'.
-rw-r--r--. 1 mongodb mongodb 986 Oct  5 23:43 mongodb.log
So, it is some 2.2.0 bug.
Where do you get that the log file needs 'x'?

Edouard Perov

unread,
Oct 6, 2012, 3:09:38 AM10/6/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
I do not know what happened with my original description and why the topic starts with "Re:", I am posting the problem here
=========================

Hello,
I cannot start mongodb 2.2.0 on Fedora 17
got the error
Oct 05 12:59:50 Evkalipt runuser[1787]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Oct 05 12:59:50 Evkalipt mongod[1783]: Starting mongod: can't open [/var/log/mongo/mongod.log] for log file: errno:13 Permission denied
Oct 05 12:59:50 Evkalipt runuser[1787]: pam_unix(runuser:session): session closed for user mongod

permissions are ok for mongod user

drwxr-xr-x. 2 mongod mongod 4096 Oct 5 12:41 /var/log/mongo
rw-r----. 1 mongod mongod 0 Aug 28 22:42 mongod.log

I de-installed 2.2.0 (from mongodb.org/downloads) and installed 2.0.7 using Fedora/updates and everything is ok.

Thanks

=========================

Edouard Perov

unread,
Oct 6, 2012, 11:14:30 AM10/6/12
to mongod...@googlegroups.com, iamanind...@googlemail.com

The "very smart guy" that "knows unix very well" replied

=======================================


मैं एक भारतीय बेवकूफ हूँ
2:02 AM (6 hours ago)

to me
Only idiots repost the same question twice within an hour. Moron!
==================================
You better learn unix.
"x" for the log file - if you do not know do not tell, or at least check your system if you have brain.

Sam Millman

unread,
Oct 6, 2012, 11:52:33 AM10/6/12
to mongod...@googlegroups.com
The log should never be executable as such there should never be an x on it.

Log files should only be accessible by root, many programs suffice this by starting in root but then downgrading to the right user, i.e. apache downgrades to www-data.

I think this is most likely to the problem, the user itself does not have access. I reckon if you were to add sudo to your command it would work, I am unsure what the best way is to run MongoDB on fedora but from a startup (/etc/init.d or whatever) script it normally runs with the ability to touch the log directory due to running effectively in sudo mode.

How are you running this? You haven't included the command.

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Sam Millman

unread,
Oct 6, 2012, 11:54:37 AM10/6/12
to mongod...@googlegroups.com
can you also include a ls -la on the mongodb log directory for 2.0.7?

Sam Millman

unread,
Oct 6, 2012, 12:02:38 PM10/6/12
to mongod...@googlegroups.com
Also are you sure you are the mongo user when you try and start? Basically what is the command you use?

Edouard Perov

unread,
Oct 6, 2012, 1:01:13 PM10/6/12
to mongod...@googlegroups.com
1. mongodb user cannot login
since its shell is /sbin/nologin
cat /etc/passwd
mongodb:x:995:992:MongoDB Database Server:/var/lib/mongodb:/sbin/nologin

Also when I try "su" to "mongodb" from "root" I got
[root@Evkalipt ~]# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[root@Evkalipt ~]# su - mongodb
This account is currently not available.
[root@Evkalipt ~]#

2. So, because of the (1) I start mongodb as per MangoDB official page as "root"
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-redhat-centos-or-fedora-linux/
Exerpt:
Start the mongod process by issuing the following command (as root, or with sudo):
UNIX> service mongod start

3. This is the 2.0.7 log directory you asked

[root@Evkalipt log]# pwd
/var/log

[root@Evkalipt log]# ls -ld mongo*
drwxr-xr-x. 2 mongodb root 4096 Oct  5 21:33 mongodb

[root@Evkalipt log]# ls -la mongodb
drwxr-xr-x.  2 mongodb root    4096 Oct  5 21:33 .
drwxr-xr-x. 12 root    root    4096 Oct  6 09:46 ..
-rw-r--r--.  1 mongodb mongodb 2197 Oct  5 23:59 mongodb.log

Edouard Perov

unread,
Oct 6, 2012, 1:40:55 PM10/6/12
to mongod...@googlegroups.com, iamanind...@googlemail.com

Installed 2.2.0 back and providing snapshots to show that I start it as root

1. List of installed mongodb RPMs
[root@Evkalipt ~]# rpm -qa|grep mongo
mongo-10gen-server-2.2.0-mongodb_1.x86_64
mongo-10gen-2.2.0-mongodb_1.x86_64

2. Current user - root


[root@Evkalipt ~]# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

3. Start server
root@Evkalipt ~]# service mongod start
Starting mongod (via systemctl): Job failed. See system journal and 'systemctl status' for details.
[FAILED]
4. Error stack
[root@Evkalipt ~]# systemctl status mongod.service
mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod)
Active: failed (Result: exit-code) since Sat, 06 Oct 2012 10:23:10 -0700; 6min ago
Process: 2094 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/mongod.service

Oct 06 10:23:10 Evkalipt runuser[2098]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Oct 06 10:23:10 Evkalipt mongod[2094]: Starting mongod: can't open [/var/log/mongo/mongod.log] for log file: errno:13 Permission denied
Oct 06 10:23:10 Evkalipt runuser[2098]: pam_unix(runuser:session): session closed for user mongod
Oct 06 10:23:10 Evkalipt mongod[2094]: [FAILED]

5. List/owners/permissions of the directories

[root@Evkalipt ~]# ls -al /var/*/mong*
/var/lib/mongo:
total 8
drwxr-xr-x. 2 mongod mongod 4096 Aug 28 22:42 .
drwxr-xr-x. 40 root root 4096 Oct 6 10:20 ..

/var/log/mongo:
total 8
drwxr-xr-x. 2 mongod mongod 4096 Oct 6 10:20 .
drwxr-xr-x. 12 root root 4096 Oct 6 10:20 ..

Sam Millman

unread,
Oct 6, 2012, 2:35:19 PM10/6/12
to mongod...@googlegroups.com
gotta admit with su I am confused that should have overwritten any errors that you may have got from setting the rights on the file itself.

--

Edouard Perov

unread,
Oct 6, 2012, 2:52:02 PM10/6/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
I did not change anything manually, did not change file permissions, nothing.
I installed 2.2.0 from the mongodb/download and started it as recommended.
It does not work "out of box"
From my perspective I do not see any problem.
The log file belongs to "mongod" user and has "rw" - read/write permissions,
the log directory also belongs to the user.
So the user can write and read the file,and even if the process runs as "root" user, root has access for any file in the system.

I submitted this issue to MongoDB team yesterday , they have not replied so far with anything useful:
SERVER-7285 -Cannot start mongodb


Raxit Sheth

unread,
Oct 6, 2012, 9:50:05 PM10/6/12
to mongod...@googlegroups.com
Ensure file permission, directory permission, ownership (uid/gid both)
and with id you are starting mongod all are in sync.

Looks more like unix admin related confusion!

Raxit

Edouard Perov

unread,
Oct 6, 2012, 11:10:20 PM10/6/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
I am starting as root.
All permissions are provided in this thread.
What is wrong with them?

Octavian Covalschi

unread,
Oct 7, 2012, 1:03:08 AM10/7/12
to mongod...@googlegroups.com
Perhaps you should install it one more time... i'm using fedora 17 64b and have 2.2.0 installed... it works fine if I'm starting it mongod -f /path/to/conf

Edouard Perov

unread,
Oct 7, 2012, 2:37:22 AM10/7/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
mongod -f /path/to/conf seems working.
Have you tried
service mongod start?

It does not work in 2.2.0 for me but was ok in 2.0.7

Octavian Covalschi

unread,
Oct 7, 2012, 12:47:20 PM10/7/12
to mongod...@googlegroups.com
Yes, I have issues with service mongod too.. but those were different than you described, although I haven't read all posts. It basically due to systemctl (system will redirect to systemctl) and init files that are installed (it will halt the script)... eventually I gave up and just using an alias for mongod -f conf.file...

I don't remember if it was working with 2.0.x..  

Edouard Perov

unread,
Oct 8, 2012, 9:35:22 AM10/8/12
to mongod...@googlegroups.com
Thank you very much.
I am new to MongoDB, we use Oracle for decades and
now thinking if we can replace some applications that do not require "heavy weight" databases.
The choice is between Oracle NoSQL MongoDB, some others might be.
This example shows that MongoDB does not work "out of box",
to make it working requires "dances with drums" around it,
MongoDB team has not provided any help after several days, which is critical for our customers' 24x7 systems.

Might be it is acceptable for home playing, student projects, non-critical applications, ...
but for us the good, fast, and reliable support from all third party software vendors is mandatory otherwise we loose customers and might be even sued for damage.
Probably, some kind of commercial license with MongoDB is available, I am not quite familiar with that, but in this case would it be cheaper for us and customers than Oracle?
Most people prefer to use well known brands despite of the price: Mercedes, BMW, Buick, ... vs Dacia, Great Wall, Lada ...
i.e. quality and reliability vs price.

Sam Millman

unread,
Oct 8, 2012, 10:51:02 AM10/8/12
to mongod...@googlegroups.com
If you need something that critical I have no doubt that you hold some kind of commerical licence with Oracle correct?

Not doing so would be asking for trouble.

Octavian Covalschi

unread,
Oct 8, 2012, 1:31:51 PM10/8/12
to mongod...@googlegroups.com
Is Fedora used in productions servers? I thought CentOS is more appropriate since it has a longer life support.


Edouard Perov

unread,
Oct 8, 2012, 5:34:52 PM10/8/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
Yes, of course, we have a commercial Oracle license and we are Oracle partners.
I can contact to Oracle Support 24x7, talk to their management anytime if the problem is important.
If it is critical Oracle may provide a dedicated support person or even team until resolution, I had such experience a couple of times.

Fedora I am using at home only and wanted just to play with MongoDb to see how it looks like and whether it may fit with our needs.
For business we use Red Hat Enterprise different versions (including several clusters for Oracle RAC), and AIX, Solaris, HP-UX, HP-UX Itanium (all versions available and released during last decade).
Tens Oracle databases from 8.1.7 to 11.2.0.3.

Thomas Rueckstiess

unread,
Oct 9, 2012, 1:08:42 AM10/9/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
Hi Edouard,

I'd like to point out that 10gen (the MongoDB company) also offers commercial support for MongoDB: http://www.10gen.com/subscription

We offer training, consulting, on-boarding and health checks, as well as different levels of subscribed commercial support (including 24x7) and MMS, our free cloud-based monitoring service.
You will find information on the different support levels and pricing on the website above as well.

This Google group is part of 10gen's free community support, and 10gen endeavours to provide answers for all MongoDB questions in a reasonable time frame. However, your problem looks like it is more related to incorrectly set user permissions, since other users report that 2.2 is working on Fedora for them. Maybe double-check these settings and compare them to your 2.0.7 permissions. You could also try to start mongod not as a service but from the command line, with "mongod" and the config parameters for log files etc and see if that makes a difference.

If you have any more questions please let us know.

Best Regards,
Thomas

--
Thomas Rueckstiess
10gen Technical Support

Robert Stewart

unread,
Oct 9, 2012, 1:18:09 AM10/9/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
Edouard,

At work I run MongoDB 2.2.0 successfully on my Linux Desktop running Fedora 17 and on a couple of our QA and production servers running RHEL 6. I use the same config for both Fedora and RHEL.

I have a fairly standard mongodb.conf file in /etc/mongodb/ (on some servers I need to run multiple instances, so I prefer to group all of their conf files into a single directory). I always install MongoDB from a tarball rather than an rpm. Personal preference.

I created a mongodb user and group under which I run mongod. I then have a custom init script for starting, stopping repairing, checking status, etc. I store logs in /var/log/mongodb/ (again, a directory for the log file for each instance).

I created the init file a year or two ago, based off someone else's script in a gist. It's probably not that different than the one that comes with the rpm, but this one is mine and it works well for me.

I run the init script directly to start, stop, etc. Typing service instead of /etc/init.d/ isn't a huge win for me. Have you tried that instead of service mongod start?

Some of your posts show lines like with the user and file name as mongodb:


-rw-r--r--. 1 mongodb mongodb 986 Oct  5 23:43 mongodb.log

and others with mongod:


rw-r----. 1 mongod mongod 0 Aug 28 22:42 mongod.log

Maybe check the init script to see which user account it is trying to use? I run my init script via sudo, but in the script I run mongod as the mongodb user. Also, in the start section of my init script, I first ensure the /var/log/mongodb/mongod.log file is there and properly owned via touch and chown.

Robert

Edouard Perov

unread,
Oct 9, 2012, 2:35:05 PM10/9/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
Hi Stuart,
The user is different because of different versions, which means RPMs were packaged differently.

2.0.7

-rw-r--r--.  1 mongodb mongodb 2197 Oct  5 23:59 mongodb.log

2.2.0

rw-r----. 1 mongod mongod 0 Aug 28 22:42 mongod.log

What is the "normal/standard" username?

Just to recap:
v 2.2.0 downloaded from momgodb.org/downloads - does not start as a service, starting "mongod -f <comf_file>" is ok
v 2.0.7 from Fedora/updates - strating via service is ok

Thanks



Edouard Perov

unread,
Oct 9, 2012, 4:15:38 PM10/9/12
to mongod...@googlegroups.com, iamanind...@googlemail.com

Thanks Thomas!

This is what we need – fast and reliable support from the software vendor.

I understand that every software may have problems.

I have a ticket open and a MongoDB support person is trying to help me out.

Thanks

Robert Stewart

unread,
Oct 12, 2012, 12:23:07 AM10/12/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
The standard username is mongod if you install from an RPM, at least according to the spec file at

https://github.com/mongodb/mongo/blob/master/rpm/mongo.spec

which includes:

%pre server
if ! /usr/bin/id -g mongod &>/dev/null; then
    /usr/sbin/groupadd -r mongod
fi
if ! /usr/bin/id mongod &>/dev/null; then
    /usr/sbin/useradd -M -r -g mongod -d /var/lib/mongo -s /bin/false -c mongod mongod > /dev/null 2>&1
fi

It appears to want to put the log file at /var/log/mongo/mongod.log

mkdir -p $RPM_BUILD_ROOT/var/log/mongo
touch $RPM_BUILD_ROOT/var/log/mongo/mongod.log

Robert

Edouard Perov

unread,
Oct 12, 2012, 3:48:14 PM10/12/12
to mongod...@googlegroups.com, iamanind...@googlemail.com
MongoDB Support confirmed that the bug "starting mdb via service" really exists since Fedora 15.

If you are interested take a look
https://jira.mongodb.org/browse/SERVER-7285

Octavian Covalschi

unread,
Oct 12, 2012, 5:05:55 PM10/12/12
to mongod...@googlegroups.com
Voted up.

Even though it's not a problem to start it manually, the biggest annoyance here is that if you install it and enable auto start (chkonfig mongod on), on reboot it will hang... 

PS: I'm pretty sure it was happening with 2.0.x too... so it's the systemd.

Reply all
Reply to author
Forward
0 new messages