Upgraded to 8.0.1: Initdb troubles

From: Mike <1100100(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Upgraded to 8.0.1: Initdb troubles
Date: 2005-02-03 21:26:44
Message-ID: 8ca422820502031326539ce620@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi Group:

I do apologize ahead of time.
I have been reading through many gentoo posts addressing initdb
problems with postgresql, but I cannot seem to figure out the problem
on my own following along with the documentation and forum posts. I'm
going around in circles uninstalling/re-installing.

I removed Postgresql 7.4.6 and installed Postgresql ver. 8.0.1
I am using Gentoo Linux.

1. /etc/conf.d/postgresql says --

PGDATA=/var/lib/postgresql/data
PGLOG=/var/lib/postgresql/data/postgresql.log
PGUSER=postgres

2. I checked to make sure that /var/lib/postgresql/data is owned by
postgres, and it is ---

Under /var/lib, ls -al shows:
drwxr-xr-x 3 postgres postgres 136 Jan 30 23:14 postgresql

3. I su postgres from root and set the PGDATA variable, but it all
goes wrong from there. Here's the feedback I get when I try to
complete the post-installation configuration:

bash-2.05b# su postgres
bash-2.05b$ export PGDATA=/var/lib/postgresql/data
bash-2.05b$ echo $PGDATA
/var/lib/postgresql/data
bash-2.05b$ initdb
could not change directory to "/home/floog"
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.

initdb: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".
bash-2.05b$ whoami
postgres
bash-2.05b$

I cannot figure out why Postgresql wants to change to the /home/floog
directory, and I do not understand why Postgresql needs an empty
directory. I have tried in the past to create an empty directory in
/usr/local/postgres , but then when I do initdb there, Postgres
automatically creates the same files that were in
/var/lib/postgresql/data , and then simply complains again that the
directory I've specified is not empty.

In a last-ditch effort I tried doing the ebuild config again --

bash-2.05b# ebuild
/var/db/pkg/dev-db/postgresql-8.0.1/postgresql-8.0.1.ebuild config
* Creating the data directory ...
* Initializing the database ...
* Postgres 8.0.1 cannot upgrade your existing databases.
* You must remove your entire database directory to continue.
* (database directory = /var/lib/postgresql).
- - - - - - - - - - -- - - - - -- -

I figure, I'll do as Gentoo tells me --

bash-2.05b# rm -rf /var/lib/postgresql

Now try the ebuild config again --

bash-2.05b# ebuild
/var/db/pkg/dev-db/postgresql-8.0.1/postgresql-8.0.1.ebuild config
* Creating the data directory ...
* Initializing the database ...
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating directory /var/lib/postgresql/data/global ... ok
creating directory /var/lib/postgresql/data/pg_xlog ... ok
creating directory /var/lib/postgresql/data/pg_xlog/archive_status ... ok
creating directory /var/lib/postgresql/data/pg_clog ... ok
creating directory /var/lib/postgresql/data/pg_subtrans ... ok
creating directory /var/lib/postgresql/data/base ... ok
creating directory /var/lib/postgresql/data/base/1 ... ok
creating directory /var/lib/postgresql/data/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/data/base/1 ... ok
initializing pg_shadow ... ok
enabling unlimited row size for system tables ... ok
initializing pg_depend ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

/etc/init.d/postgresql start

bash-2.05b# /etc/init.d/postgresql start
* WARNING: "postgresql" has already been started.
bash-2.05b# /etc/init.d/postgresql restart
* Restarting PostgreSQL...
pg_ctl: PID file "/var/lib/postgresql/data/postmaster.pid" does not exist
Is postmaster running?
starting postmaster anyway [ ok ]
bash-2.05b#

So after restarting postgresql, it complains about this missing .pid
file and I've seen that problem before. But what the hell I try to do
initdb again and it's still a mess --

bash-2.05b$ initdb
could not change directory to "/home/floog"
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.

initdb: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".

Well things can't get any worse, so I figured I'd try to see if I
could make a database --

bash-2.05b$ createdb mytestdb
could not change directory to "/home/floog"
CREATE DATABASE
bash-2.05b$

Supposedly the test database was created but Postgres still wants to
use my /home/floog directory for some reason.

As Charlie Brown would say --- Ugghh.

I'm hoping someone can see what I'm doing wrong.
Thankyou for reading such a long post.

Mike

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message T- Bone 2005-02-03 23:31:39 Need help creating a stored procedure
Previous Message Bruce Rowe 2005-02-03 20:42:24 Installation tool