Thread: Bug #466: Unable to remove /root/tmp/initdb:xxxx.xxx

Bug #466: Unable to remove /root/tmp/initdb:xxxx.xxx

From
pgsql-bugs@postgresql.org
Date:
Vladimir Georgiev (vladimirg@rambler.bg) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Unable to remove /root/tmp/initdb:xxxx.xxx

Long Description
I've tried to follow the detailed description in INSTALL as for fresh install as long as it was possible.

0)My Linux box: Mandrake 8.0 for i586. Any RPMS concerning any RDBMSs were intentionally NOT installed during the
Mandrakeinstallation. PostgreSQL 7.1.3 source unpacked into /usr/src/postgresql-7.1.3. The root user enters this
directory.Then: 

1)
root# ./configure --with-perl --enable-odbc --enable-syslog
Result: Worked fine

2)
root# gmake
Result: Worked fine

3)
root# gmake install
Result: Worked fine

4)
root# adduser -r -d /dyn/pgsql/home postgres
Result: Failed. User postgres already exists.

5)
root# chown -R postgres.postgres *
Result: Worked fine

6)
user root edits /etc/ld.so.conf adding the line:
/usr/local/pgsql
Save the file and close it.

7)
root# ldconfig
Result: Worked fine

8)
user root edits /etc/profile adding
PATH=$PATH:/usr/local/pgsql/bin
export $PATH
MANPATH=$MANPATH:/usr/local/pgsql/man
export $MANPATH

9)
logout/login
Result: System variables set fine

10)
root# mkdir /dyn/pgsql
root# mkdir /dyn/pgsql/data
root# mkdir /dyn/pgsql/home
root# chown -R postgres.postgres /dyn/pgsql
Result: Worked fine

11)
root# usermod -d /dyn/pgsql/home
Result: Worked fine

12)
root# su postgres
Result: Worked fine

13)
postgres$ /usr/local/pgsql/bin/initdb -D /dyn/pgsql/data
Result: most of the script runs ok. At some point it said:
....... unable to remove /root/tmp/initdb:xxx.xxx
where "xxx.xxx" are some numbers
Result:Failed
Observation: There are files created in /dyn/pgsql/data

14)
postgres$ /usr/local/pgsql/bin/pg_ctl -D /dyn/pgsql/data -l /dyn/pgsql/home/server.log start
Result: Failed. It said: Unable to remove /root/tmp/.....
The server did not started.

======================================
How did I workarounded the problem
======================================

1) I've opened /dyn/pgsql/data/postgresql.conf
2) I've Uncommented the line
#unix_socket_directory=''
so it became this:
unix_socket_directory='/tmp'
3) I've saved the so edited postgresql.conf.
4)
postgres$ /usr/local/pgsql/bin/pg_ctl -D /dyn/pgsql/data -l /dyn/pgsql/home/server.log start

RESULT: NOW IT WORKS FINE :-)

=========================================
WHY do I think it's a bug
=========================================
Because I've followed the commands order recommended by the INSTALL file as long as it was possible.
I've installed already about 4 prior versions of PostgreSQL, every time working this same way and never had this
problem,every time working on some Mandrake distribution. 

Sample Code


No file was uploaded with this report

Re: Bug #466: Unable to remove /root/tmp/initdb:xxxx.xxx

From
Peter Eisentraut
Date:
> Vladimir Georgiev (vladimirg@rambler.bg) reports a bug with a severity of 3

> postgres$ /usr/local/pgsql/bin/initdb -D /dyn/pgsql/data
> Result: most of the script runs ok. At some point it said:
> ....... unable to remove /root/tmp/initdb:xxx.xxx
> where "xxx.xxx" are some numbers
> Result:Failed
> Observation: There are files created in /dyn/pgsql/data

Initdb doesn't produce that kind of output.  Please post the exact output
you got.  And what do you have set for $TMPDIR?

> postgres$ /usr/local/pgsql/bin/pg_ctl -D /dyn/pgsql/data -l /dyn/pgsql/home/server.log start
> Result: Failed. It said: Unable to remove /root/tmp/.....

pg_ctl doesn't produce that kind of output.  Please post the exact output
you got.

> 1) I've opened /dyn/pgsql/data/postgresql.conf
> 2) I've Uncommented the line
> #unix_socket_directory=''
> so it became this:
> unix_socket_directory='/tmp'
> 3) I've saved the so edited postgresql.conf.
> 4)
> postgres$ /usr/local/pgsql/bin/pg_ctl -D /dyn/pgsql/data -l /dyn/pgsql/home/server.log start
>
> RESULT: NOW IT WORKS FINE :-)

That is a completely incomprehensible workaround, but since you didn't
post the exact outputs above I cannot guess what actually happened here.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

Re: Bug #466: Unable to remove /root/tmp/initdb:xxxx.xxx

From
Justin Clift
Date:
Hi Vladimir,

pgsql-bugs@postgresql.org wrote:
>
> Vladimir Georgiev (vladimirg@rambler.bg) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> Unable to remove /root/tmp/initdb:xxxx.xxx

This definitely sounds like a permissions problem.

> Long Description
> I've tried to follow the detailed description in INSTALL as for fresh install as long as it was possible.
>
> 0)My Linux box: Mandrake 8.0 for i586. Any RPMS concerning any RDBMSs were intentionally NOT installed during the
Mandrakeinstallation. PostgreSQL 7.1.3 source unpacked into /usr/src/postgresql-7.1.3. The root user enters this
directory.Then: 

It sounds like you're trying to say you are certain you don't have
PostgreSQL installed for the rest of this procedure.  One thing I'll
point out is that in point 4) below, you show it won't add the user
"postgres" because that user exists already.  In my experience with
Mandrake, if you have PostgreSQL (can't remember which RPM) already
installed then the "postgres" user is automatically added (by whichever
RPM it is), and also removed when the RPM version of PostgreSQL is
removed.

> 1)
> root# ./configure --with-perl --enable-odbc --enable-syslog
> Result: Worked fine
>
> 2)
> root# gmake
> Result: Worked fine
>
> 3)
> root# gmake install
> Result: Worked fine
>
> 4)
> root# adduser -r -d /dyn/pgsql/home postgres
> Result: Failed. User postgres already exists.

If you haven't ever manually created the "postgres" user, then I
strongly feel you have some kind of PostgreSQL RPM already present on
the system.

> 5)
> root# chown -R postgres.postgres *
> Result: Worked fine
>
> 6)
> user root edits /etc/ld.so.conf adding the line:
> /usr/local/pgsql
> Save the file and close it.
>
> 7)
> root# ldconfig
> Result: Worked fine
>
> 8)
> user root edits /etc/profile adding
> PATH=$PATH:/usr/local/pgsql/bin
> export $PATH
> MANPATH=$MANPATH:/usr/local/pgsql/man
> export $MANPATH
>
> 9)
> logout/login
> Result: System variables set fine
>
> 10)
> root# mkdir /dyn/pgsql
> root# mkdir /dyn/pgsql/data
> root# mkdir /dyn/pgsql/home
> root# chown -R postgres.postgres /dyn/pgsql
> Result: Worked fine
>
> 11)
> root# usermod -d /dyn/pgsql/home
> Result: Worked fine
>
> 12)
> root# su postgres
> Result: Worked fine
>
> 13)
> postgres$ /usr/local/pgsql/bin/initdb -D /dyn/pgsql/data
> Result: most of the script runs ok. At some point it said:
> ....... unable to remove /root/tmp/initdb:xxx.xxx
> where "xxx.xxx" are some numbers
> Result:Failed
> Observation: There are files created in /dyn/pgsql/data
>
> 14)
> postgres$ /usr/local/pgsql/bin/pg_ctl -D /dyn/pgsql/data -l /dyn/pgsql/home/server.log start
> Result: Failed. It said: Unable to remove /root/tmp/.....
> The server did not started.
>
> ======================================
> How did I workarounded the problem
> ======================================
>
> 1) I've opened /dyn/pgsql/data/postgresql.conf
> 2) I've Uncommented the line
> #unix_socket_directory=''
> so it became this:
> unix_socket_directory='/tmp'
> 3) I've saved the so edited postgresql.conf.
> 4)
> postgres$ /usr/local/pgsql/bin/pg_ctl -D /dyn/pgsql/data -l /dyn/pgsql/home/server.log start
>
> RESULT: NOW IT WORKS FINE :-)

From reading this, it looks like something is causing PostgreSQL to run
as the "postgres" user, but trying to install it's Unix Socket file in
the /root/tmp directory (where it doesn't have permission to put it).
That's why the error occurs.

> =========================================
> WHY do I think it's a bug
> =========================================
> Because I've followed the commands order recommended by the INSTALL file as long as it was possible.
> I've installed already about 4 prior versions of PostgreSQL, every time working this same way and never had this
problem,every time working on some Mandrake distribution. 

I strongly feel you already had/have some kind of PostgreSQL
installation on your system, and I would point the finger at that as
having caused or contributed to your problem.

Can you run :

rpm -q -a | grep post

and look for occurances of postgresql-xxxxx  (or any other indications
of PostgreSQL), just to make sure?

:-)

Regards and best wishes,

Justin Clift

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi