LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Not able to run initdb with chroot (https://www.linuxquestions.org/questions/linux-server-73/not-able-to-run-initdb-with-chroot-917863/)

jogin4groups 12-09-2011 04:00 AM

Not able to run initdb with chroot
 
Hi,

I want to run new postgres version with chroot in old environment.

I have compiled postgres, took related stuff and tried to run it.

The command works fine as below :

[root@manage /root]# /usr/sbin/chroot /var/newrootpg usr/local/pgsql/bin/initdb --help
initdb initializes a PostgreSQL database cluster.

Usage:
initdb [OPTION]... [DATADIR]

Options:
-A, --auth=METHOD default authentication method for local connections
[-D, --pgdata=]DATADIR location for this database cluster
-E, --encoding=ENCODING set default encoding for new databases
--locale=LOCALE set default locale for new databases
--lc-collate=, --lc-ctype=, --lc-messages=LOCALE
--lc-monetary=, --lc-numeric=, --lc-time=LOCALE
set default locale in the respective category for
new databases (default taken from environment)
--no-locale equivalent to --locale=C
--pwfile=FILE read password for the new superuser from file
-T, --text-search-config=CFG
default text search configuration
-U, --username=NAME database superuser name
-W, --pwprompt prompt for a password for the new superuser
-X, --xlogdir=XLOGDIR location for the transaction log directory

Less commonly used options:
-d, --debug generate lots of debugging output
-L DIRECTORY where to find the input files
-n, --noclean do not clean up after errors
-s, --show show internal settings

Other options:
-?, --help show this help, then exit
-V, --version output version information, then exit

If the data directory is not specified, the environment variable PGDATA
is used.

Report bugs to <pgsql-bugs@postgresql.org>.


But it creates problem when I actually use it to create a database

[root@manage /root]# /usr/sbin/chroot /var/newrootpg /usr/local/pgsql/bin/initdb -D /var/pgsql/data2
fgets failure: No such file or directory
The program "postgres" is needed by initdb but was not found in the
same directory as "/usr/local/pgsql/bin/initdb".
Check your installation.

where as postgres already exists in that folder,

[root@manage /root]# /usr/sbin/chroot /var/newrootpg /usr/local/pgsql/bin/postgres --version
postgres (PostgreSQL) 9.1.1

So why its unable to find postgres ? Any solution for this ?

Thanks in Advance.


All times are GMT -5. The time now is 12:35 PM.