initdb must have write access to /tmp

Started by Rich Bodoover 24 years ago3 messagesbugs
Jump to latest
#1Rich Bodo
rsb@ostel.com

Hi,

I was just installing postgres 7.1.2 on my linux mandrake 7.2
system and the build and install went fine up to the point I
had to run:

initdb -D /usr/local/pgsql/data

which segfaulted. I changed the permissions on /tmp to 777
and all was well. I think initdb could use an if statement to
check the permissions on /tmp and report a descriptive bug.

-Rich

Rich Bodo | rsb@ostel.com | 650-964-4678

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rich Bodo (#1)
Re: initdb must have write access to /tmp

Rich Bodo <rsb@ostel.com> writes:

I was just installing postgres 7.1.2 on my linux mandrake 7.2
system and the build and install went fine up to the point I
had to run:
initdb -D /usr/local/pgsql/data
which segfaulted. I changed the permissions on /tmp to 777
and all was well. I think initdb could use an if statement to
check the permissions on /tmp and report a descriptive bug.

I cannot replicate this in current sources; I get

creating directory /home/postgres/testversion/data... ok
creating directory /home/postgres/testversion/data/base... ok
creating directory /home/postgres/testversion/data/global... ok
creating directory /home/postgres/testversion/data/pg_xlog... ok
creating directory /home/postgres/testversion/data/pg_clog... ok
creating template1 database in /home/postgres/testversion/data/base/1... ok
creating configuration files... ok
initializing pg_shadow... /home/postgres/testversion/bin/initdb[505]: /tmp/sh4843.13: Cannot find or open the file.

initdb failed.
Removing /home/postgres/testversion/data.

which seems like reasonable behavior to me. On another machine I get
something about "Cannot create temp file for here document: Permission
denied".

My guess is that the core dump you are seeing is actually your shell's
fault, not Postgres'; probably the shell is not expecting a create of
its temp file to fail. If so, it would be inappropriate for us to put
in a test for /tmp writability, since that would be making an
unsupported assumption about where the local shell puts its internal
temp files.

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Rich Bodo (#1)
Re: initdb must have write access to /tmp

Hi,

I was just installing postgres 7.1.2 on my linux mandrake 7.2
system and the build and install went fine up to the point I
had to run:

initdb -D /usr/local/pgsql/data

which segfaulted. I changed the permissions on /tmp to 777
and all was well. I think initdb could use an if statement to
check the permissions on /tmp and report a descriptive bug.

I think this will be fixed in 7.2. I don't see initdb referencing /tmp
at all and postmaster/postgres have some fixes when they fail to write
to /tmp. In fact, I just initdb'ed with temp unwritable so it seems
this is certainly fixed.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026