librelist archives

« back to archive

mongrel2 says he can't read the PID file

mongrel2 says he can't read the PID file

From:
fokenrute
Date:
2010-09-01 @ 16:35
Hi everybody,
    I just installed mongrel2 on Ubuntu 10.04 and followed the documentation
for installing and creating a first config file.
Here is the content of the config file:

from mongrel2.config import *

main = Server(
uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
access_log="/log/access.log",
error_log="/log/error.log",
chroot="/var/www/mongrel2/",
default_host="localhost",
name="test",
pid_file="/run/mongrel2.pid",
port=37777,
hosts= [
Host(name="localhost", routes={
r'/tests/': Dir(base='tests/', index_file='index.html',
default_ctype='text/plain')
})
]
)

commit([main])


And when I do: m2sh start -db config.sqlite -h localhost, i get the
following message:


DEBUG src/config/db.c:65: [SQL] SELECT id, send_spec, send_ident, recv_spec,
recv_ident FROM handler
DEBUG src/config/db.c:65: [SQL] SELECT id, addr, port FROM proxy
DEBUG src/config/db.c:65: [SQL] SELECT id, uuid, default_host, port, chroot,
access_log, error_log, pid_file FROM server WHERE default_host='localhost'
OR name='localhost'
DEBUG src/config/db.c:65: [SQL] SELECT id, name, matching FROM host WHERE
server_id = 1
INFO (src/host.c:67) MAX limits.url_path=256, limits.host_name=256
DEBUG src/config/db.c:65: [SQL] SELECT id, path, target_id, target_type FROM
route WHERE host_id=1
DEBUG src/config/db.c:65: [SQL] SELECT directory.id as id, base, route.path
as prefix, index_file, default_ctype FROM route, directory WHERE
directory.id = target_id AND target_type='dir' AND target_id=1 AND route.id
=1
INFO (src/dir.c:177) MAX limits.dir_send_buffer=16384,
limits.dir_max_path=256
INFO (src/config/config.c:129) Created dir 1 with base=tests/ prefix=/tests/
index=index.html def_ctype=text/plain
DEBUG src/routing.c:88: ADDING prefix: /tests/, pattern: /tests/
INFO (src/config/config.c:211) Adding host 1:localhost to server at pattern
localhost
DEBUG src/routing.c:88: ADDING prefix: tsohlacol, pattern: localhost
INFO (src/config/config.c:242) Loaded server
1:f400bf85-4538-4f7a-8908-67e313d515c2 on port 37777 with default host
localhost
DEBUG src/config/db.c:65: [SQL] SELECT id, extension, mimetype FROM mimetype
INFO (src/mime.c:49) MAX limits.mime_ext_len=128
DEBUG src/config/db.c:65: [SQL] SELECT id, key, value FROM setting
DEBUG src/superpoll.c:240: Attempting to force NOFILE limit to 10240
INFO (src/superpoll.c:255) MAX open file descriptors is 10240 now.
ERROR (src/unixy.c:99: errno: No such file or directory) Failed to open PID
file /var/www/mongrel2//run/mongrel2.pid for reading.
INFO (src/unixy.c:138) No previous Mongrel2 running, continuing on.
INFO (src/mongrel2.c:166) All loaded up, time to turn into a server.
ERROR (src/mongrel2.c:168: errno: No such file or directory) logs directory
doesn't exist in /var/www/mongrel2/ or isn't owned right.
ERROR (src/mongrel2.c:281: errno: Success) Major failure in chroot/droppriv,
aborting.
ERROR (src/mongrel2.c:310: errno: Success) Exiting due to error.

Yet, I chmod everything under /var/www/mongrel2/ to 777.
Please help fixing this little administration issue to allow me to start
enjoying mongrel2 hacking.

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
Zed A. Shaw
Date:
2010-09-01 @ 20:27
On Wed, Sep 01, 2010 at 06:35:30PM +0200, fokenrute wrote:
> Hi everybody,
>     I just installed mongrel2 on Ubuntu 10.04 and followed the documentation
> for installing and creating a first config file.
> Here is the content of the config file:

Alright, that's all fixed, I alos checked the code to reload and it
accepts thos parameters, so you are probably a version or so behind.  Go
ahead and grab:

http://mongrel2.org/home#download

To get the latest.  Then for now just make your logs directory /logs/ so
that you'll work with what we got until I release 1.0 tonight.

Let me know if you run into any other snags.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
Zed A. Shaw
Date:
2010-09-01 @ 20:16
On Wed, Sep 01, 2010 at 06:35:30PM +0200, fokenrute wrote:
> Hi everybody,
>     I just installed mongrel2 on Ubuntu 10.04 and followed the documentation
> for installing and creating a first config file.
> Here is the content of the config file:
> 
> from mongrel2.config import *
> 
> main = Server(
> uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
> access_log="/log/access.log",
> error_log="/log/error.log",

AHA! See how you have /log/ ?

> ERROR (src/unixy.c:99: errno: No such file or directory) Failed to open PID
> file /var/www/mongrel2//run/mongrel2.pid for reading.
> INFO (src/unixy.c:138) No previous Mongrel2 running, continuing on.
> INFO (src/mongrel2.c:166) All loaded up, time to turn into a server.

This is all irrelevant, but this isn't:

> ERROR (src/mongrel2.c:168: errno: No such file or directory) logs directory
> doesn't exist in /var/www/mongrel2/ or isn't owned right.

See how that says "logs directory doesn't exist"?  Looks like we got a
bug that we expect "/logs/" explicitly.  Change your config to
/logs/access.log and /logs/error.log also do the stuff I mentioned in
the other email and you'll be set.  I'll fix this up too so that you can
actually use the config to do something different.


-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
Carlo Pires
Date:
2010-09-01 @ 17:03
Logs and run directory must be under /var/www/mongrel2

2010/9/1 fokenrute <fokenrute@gmail.com>:
> Hi everybody,
>     I just installed mongrel2 on Ubuntu 10.04 and followed the documentation
> for installing and creating a first config file.
> Here is the content of the config file:
> from mongrel2.config import *
> main = Server(
> uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
> access_log="/log/access.log",
> error_log="/log/error.log",
> chroot="/var/www/mongrel2/",
> default_host="localhost",
> name="test",
> pid_file="/run/mongrel2.pid",
> port=37777,
> hosts= [
> Host(name="localhost", routes={
> r'/tests/': Dir(base='tests/', index_file='index.html',
> default_ctype='text/plain')
> })
> ]
> )
> commit([main])
>
> And when I do: m2sh start -db config.sqlite -h localhost, i get the
> following message:
>
> DEBUG src/config/db.c:65: [SQL] SELECT id, send_spec, send_ident, recv_spec,
> recv_ident FROM handler
> DEBUG src/config/db.c:65: [SQL] SELECT id, addr, port FROM proxy
> DEBUG src/config/db.c:65: [SQL] SELECT id, uuid, default_host, port, chroot,
> access_log, error_log, pid_file FROM server WHERE default_host='localhost'
> OR name='localhost'
> DEBUG src/config/db.c:65: [SQL] SELECT id, name, matching FROM host WHERE
> server_id = 1
> INFO (src/host.c:67) MAX limits.url_path=256, limits.host_name=256
> DEBUG src/config/db.c:65: [SQL] SELECT id, path, target_id, target_type FROM
> route WHERE host_id=1
> DEBUG src/config/db.c:65: [SQL] SELECT directory.id as id, base, route.path
> as prefix, index_file, default_ctype FROM route, directory
> WHERE directory.id = target_id AND target_type='dir' AND target_id=1
> AND route.id=1
> INFO (src/dir.c:177) MAX limits.dir_send_buffer=16384,
> limits.dir_max_path=256
> INFO (src/config/config.c:129) Created dir 1 with base=tests/ prefix=/tests/
> index=index.html def_ctype=text/plain
> DEBUG src/routing.c:88: ADDING prefix: /tests/, pattern: /tests/
> INFO (src/config/config.c:211) Adding host 1:localhost to server at pattern
> localhost
> DEBUG src/routing.c:88: ADDING prefix: tsohlacol, pattern: localhost
> INFO (src/config/config.c:242) Loaded server
> 1:f400bf85-4538-4f7a-8908-67e313d515c2 on port 37777 with default host
> localhost
> DEBUG src/config/db.c:65: [SQL] SELECT id, extension, mimetype FROM mimetype
> INFO (src/mime.c:49) MAX limits.mime_ext_len=128
> DEBUG src/config/db.c:65: [SQL] SELECT id, key, value FROM setting
> DEBUG src/superpoll.c:240: Attempting to force NOFILE limit to 10240
> INFO (src/superpoll.c:255) MAX open file descriptors is 10240 now.
> ERROR (src/unixy.c:99: errno: No such file or directory) Failed to open PID
> file /var/www/mongrel2//run/mongrel2.pid for reading.
> INFO (src/unixy.c:138) No previous Mongrel2 running, continuing on.
> INFO (src/mongrel2.c:166) All loaded up, time to turn into a server.
> ERROR (src/mongrel2.c:168: errno: No such file or directory) logs directory
> doesn't exist in /var/www/mongrel2/ or isn't owned right.
> ERROR (src/mongrel2.c:281: errno: Success) Major failure in chroot/droppriv,
> aborting.
> ERROR (src/mongrel2.c:310: errno: Success) Exiting due to error.
> Yet, I chmod everything under /var/www/mongrel2/ to 777.
> Please help fixing this little administration issue to allow me to start
> enjoying mongrel2 hacking.
>

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
fokenrute
Date:
2010-09-01 @ 17:30
They are both under /var/www/mongrel2

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
Alex Gartrell
Date:
2010-09-01 @ 17:45
Are the owners of all of the directories consistent?  (is /var/www/mongrel2
owned by the same user as logs and run?)

On Wed, Sep 1, 2010 at 1:30 PM, fokenrute <fokenrute@gmail.com> wrote:

> They are both under /var/www/mongrel2

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
fokenrute
Date:
2010-09-01 @ 17:59
They're all owned bu root, with rights 777

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
Zed A. Shaw
Date:
2010-09-01 @ 20:12
On Wed, Sep 01, 2010 at 07:59:53PM +0200, fokenrute wrote:
> They're all owned bu root, with rights 777

That's most likely wrong then.  Try this:

ls -ld /var/www/mongrel2

When I do that, my /var/www/mongrel2 is owned by the user mongrel2, not
root.

Ok, now do:

ls -l /var/www/mongrel2

When I do that, all the file inside are owned by mongrel2, not root.

You could also use nobody instead of mongrel2, but I like different
users for different services.  So try this:

mkdir -p /var/www/mongrel2/run
mkdir -p /var/www/mongrel2/logs
mkdir -p /var/www/mongrel2/tmp
chown -R mongrel2.users /var/www/mongrel2

Once you do that, mongrel2 will start up, chroot to /var/www/mongrel2,
become the user/group mongrel2/users, and it should work.

If not, do this:

cd /var/www/mongrel2

m2sh start -db config.sqlite -every

It'll run and then die, when it does, send a dpaste.de link with the
output of the log and I'll help figure out the cause.

One more thing, mongrel2.org and a few other services of mine basically
run this way and it works, so you should be looking at the logs and
trying to figure out you've done wrong.  Specifically look at the ERROR
log lines as they tell you lots of useful information for how to fix it.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
Sebastian Otaegui
Date:
2010-09-01 @ 19:15
Just thought worth mentioning that since the owner is root you should only
need the permissions to be 700

On Wed, Sep 1, 2010 at 12:59 PM, fokenrute <fokenrute@gmail.com> wrote:

> They're all owned bu root, with rights 777




-- 
Those who do not understand Unix are condemned to reinvent it, poorly.
Any sufficiently recent Microsoft OS contains an ad hoc,
informally-specified, bug-ridden, slow implementation of half of Unix.

Re: [mongrel2] mongrel2 says he can't read the PID file

From:
Alex Gartrell
Date:
2010-09-01 @ 16:37
DId you make the logs and run directories?


On Wed, Sep 1, 2010 at 12:35 PM, fokenrute <fokenrute@gmail.com> wrote:

> Hi everybody,
>     I just installed mongrel2 on Ubuntu 10.04 and followed the
> documentation for installing and creating a first config file.
> Here is the content of the config file:
>
> from mongrel2.config import *
>
> main = Server(
> uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
>  access_log="/log/access.log",
> error_log="/log/error.log",
> chroot="/var/www/mongrel2/",
>  default_host="localhost",
> name="test",
> pid_file="/run/mongrel2.pid",
>  port=37777,
> hosts= [
> Host(name="localhost", routes={
>  r'/tests/': Dir(base='tests/', index_file='index.html',
> default_ctype='text/plain')
>  })
> ]
> )
>
> commit([main])
>
>
> And when I do: m2sh start -db config.sqlite -h localhost, i get the
> following message:
>
>
> DEBUG src/config/db.c:65: [SQL] SELECT id, send_spec, send_ident,
> recv_spec, recv_ident FROM handler
> DEBUG src/config/db.c:65: [SQL] SELECT id, addr, port FROM proxy
> DEBUG src/config/db.c:65: [SQL] SELECT id, uuid, default_host, port,
> chroot, access_log, error_log, pid_file FROM server WHERE
> default_host='localhost' OR name='localhost'
> DEBUG src/config/db.c:65: [SQL] SELECT id, name, matching FROM host WHERE
> server_id = 1
> INFO (src/host.c:67) MAX limits.url_path=256, limits.host_name=256
> DEBUG src/config/db.c:65: [SQL] SELECT id, path, target_id, target_type
> FROM route WHERE host_id=1
> DEBUG src/config/db.c:65: [SQL] SELECT directory.id as id, base,
> route.path as prefix, index_file, default_ctype FROM route, directory WHERE
> directory.id = target_id AND target_type='dir' AND target_id=1 AND
> route.id=1
> INFO (src/dir.c:177) MAX limits.dir_send_buffer=16384,
> limits.dir_max_path=256
> INFO (src/config/config.c:129) Created dir 1 with base=tests/
> prefix=/tests/ index=index.html def_ctype=text/plain
> DEBUG src/routing.c:88: ADDING prefix: /tests/, pattern: /tests/
> INFO (src/config/config.c:211) Adding host 1:localhost to server at pattern
> localhost
> DEBUG src/routing.c:88: ADDING prefix: tsohlacol, pattern: localhost
> INFO (src/config/config.c:242) Loaded server
> 1:f400bf85-4538-4f7a-8908-67e313d515c2 on port 37777 with default host
> localhost
> DEBUG src/config/db.c:65: [SQL] SELECT id, extension, mimetype FROM
> mimetype
> INFO (src/mime.c:49) MAX limits.mime_ext_len=128
> DEBUG src/config/db.c:65: [SQL] SELECT id, key, value FROM setting
> DEBUG src/superpoll.c:240: Attempting to force NOFILE limit to 10240
> INFO (src/superpoll.c:255) MAX open file descriptors is 10240 now.
> ERROR (src/unixy.c:99: errno: No such file or directory) Failed to open PID
> file /var/www/mongrel2//run/mongrel2.pid for reading.
> INFO (src/unixy.c:138) No previous Mongrel2 running, continuing on.
> INFO (src/mongrel2.c:166) All loaded up, time to turn into a server.
> ERROR (src/mongrel2.c:168: errno: No such file or directory) logs directory
> doesn't exist in /var/www/mongrel2/ or isn't owned right.
> ERROR (src/mongrel2.c:281: errno: Success) Major failure in
> chroot/droppriv, aborting.
> ERROR (src/mongrel2.c:310: errno: Success) Exiting due to error.
>
> Yet, I chmod everything under /var/www/mongrel2/ to 777.
> Please help fixing this little administration issue to allow me to start
> enjoying mongrel2 hacking.
>
>