Re: weird initdb output

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Geoffrey <lists(at)serioustechnology(dot)com>
Cc: PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: weird initdb output
Date: 2010-06-28 18:54:04
Message-ID: 1873.1277751244@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Geoffrey <lists(at)serioustechnology(dot)com> writes:
> I wrote a script that creates a new database from an existing backup.
> Works great on my machine. Another user tries to use it and sees the
> following output from initdb:

> could not change directory to "/root"
> The files belonging to this database system will be owned by user
> "postgres".
> This user must also own the server process.
> .
> .

> Why is it trying to change directory to /root???

IIRC, part of the startup process involves chdir'ing to where the initdb
executable is and then chdir'ing back to whatever directory had been
current when you called initdb. I speculate the other guy was root and
did "su postgres" not "su - postgres", so his cwd was still root's home
directory.

This might be harmless as long as you gave an absolute path for PGDATA
to initdb, but I'd still recommend using su - not just su.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message GEORGE KEVIN 2010-06-28 19:01:45 Vamos fazer esta operação
Previous Message John R Pierce 2010-06-28 18:51:15 Re: weird initdb output