0

I'm trying to install PostgreSQL 9.0.1 on Windows Server 2008, but every time, there will be such error message

"Problem running post-install step. Installation may not complete correctly. Failed to start the database server"

in the installation log, it is due to a failure in initdb.exe, error is

"The program postgres is needed by initdb, but was not found in the same directory as D:\PostgreSQL\9.0\bin\initdb.exe, Check your installation."

I searched such error in internet and tried the solution in this page "Installing PostgreSQL on Windows Server 2008", but no help.

After reading code of initdb, I know it is caused by the window api CreateProcess in the function pipe_read_line. the calling of CreateProcess returned -5 (access denied). it is because initdb was executed in a subprocess invoked in the functiion CreateRestrictedProcess. I know it is due to privilege setting, I ran gpedit.msc to add users group (even everyone) into almost all privilege policy, but the error was still there.

I also assigned full control rights of the install target folder to everyone, no help!

I also tried postgresql 9.6.2, the error was still there :-)

from the code, I know if there is the environment variable PG_RESTRICT_EXEC with value 1, initdb will not executed in a restricted process. so before run initdb.exe, I set an environment PG_RESTRICT_EXEC=1 in command prompt, then run initdb.exe. this time such error was gone!!

So I wonder how to change the os settings to allow the installation running without error!

ljfzhq
  • 1
  • 2
  • Probably unrelated, but: why are you installing and outdated and un-supported Postgres version? Very often installation problems in Windows are caused by the Anti-Virus. Try disabling it during installation and exclude the postgres binaries and the data directory from scanning it. Also do **not** put the data directory into `c:\Program Files` that could very well be the reason for the "access denied" –  Feb 14 '17 at 08:57
  • the server is from one customer using an old version server. – ljfzhq Feb 14 '17 at 10:24
  • the server is from one customer using an old version server. even I try 9.6.2, the problem is still there. I changed the install target folder to D:\postgres, and the data folder is not under programFiles folder either. Today, I also tried the solution in https://technet.microsoft.com/en-us/library/ee791868(v=ws.10).aspx, the problem is still there. I use command "runas /user:postgres cmd.exe" to open the console, when try to execute any exe file, there will be error "access denied". but I have assigned full rights of the folder to this user. I am almost mad :-( – ljfzhq Feb 14 '17 at 10:31

0 Answers0