Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql failed to install correcty

Tags:

postgresql

I have been trying to install PostgreSQL 9.2 for the last couple of days. I guess I tried everything that I could find online but the service still will not start. I am currently running Windows 7 SP1. I used to have PostgreSQL 8.3 installed and working fine but a couple of weeks ago I decided to uninstall it. I thoroughly uninstalled it (delete the postgres user and the data file) and now every time I try to install any version I get this non-fatal error at the end of the setup when the loading of the database modules takes place. I managed to see that the postgresql service does not start or as windows puts it starts then stops. This is the relevant part of the log file of the installation:

Successfully processed 771 files; Failed processing 0 files

initcluster.vbs ran to completion

Script stderr:

Configuring database server startup...
Executing cscript //NoLogo "C:\Program Files (x86)\PostgreSQL\9.2\installer\server\startupcfg.vbs" 9.2 "NT AUTHORITY\NetworkService" "****" "C:\Program Files (x86)\PostgreSQL\9.2" "C:\Program Files (x86)\PostgreSQL\9.2\data" "postgresql-9.2"
Script exit code: 0

Script output:
 startupcfg.vbs ran to completion

Script stderr:

Creating menu shortcuts...
Executing cscript //NoLogo "C:\Program Files (x86)\PostgreSQL\9.2\installer\server\createshortcuts.vbs" 9.2 "postgres" 5432 "PostgreSQL 9.2 (x86)" "C:\Program Files (x86)\PostgreSQL\9.2" "C:\Program Files (x86)\PostgreSQL\9.2\data" "postgresql-9.2"
Script exit code: 0

Script output:
 Start FixupFile(C:\Program Files (x86)\PostgreSQL\9.2\scripts\serverctl.vbs)...
   Opening file for reading...
   Closing file (reading)...
   Replacing placeholders...
   Opening file for writing...
   Closing file...
  End FixupFile()...
Start FixupFile(C:\Program Files (x86)\PostgreSQL\9.2\scripts\runpsql.bat)...
   Opening file for reading...
   Closing file (reading)...
   Replacing placeholders...
   Opening file for writing...
   Closing file...
  End FixupFile()...
createshortcuts.vbs ran to completion

Script stderr:


Starting the database server...
Executing cscript //NoLogo "C:\Program Files (x86)\PostgreSQL\9.2\installer\server\startserver.vbs" postgresql-9.2
Script exit code: 0

Script output:
 Starting postgresql-9.2
Service postgresql-9.2 started successfully
startserver.vbs ran to completion

Script stderr:


Loading additional SQL modules...
Executing cscript //NoLogo "C:\Program Files (x86)\PostgreSQL\9.2\installer\server\loadmodules.vbs" "postgres" "****" "C:\Program Files (x86)\PostgreSQL\9.2" "C:\Program Files (x86)\PostgreSQL\9.2\data" 5432
Script exit code: 2

Script output:
 Installing the adminpack module in the postgres database...
    Executing 'C:\Users\George\AppData\Local\Temp\radA5996.bat'...
psql: server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

Failed to install the 'adminpack' module in the 'postgres' database
loadmodules.vbs ran to completion

Script stderr:
 Program ended with an error exit code

Error running cscript //NoLogo "C:\Program Files (x86)\PostgreSQL\9.2\installer\server\loadmodules.vbs" "postgres" "****" "C:\Program Files (x86)\PostgreSQL\9.2" "C:\Program Files (x86)\PostgreSQL\9.2\data" 5432 : Program ended with an error exit code

[10:34:28] Write the data directory to the ini file...
[10:34:28] Write the port number, service ID, locale and superuser to the ini file...
[10:34:28] Write ServiceID(postgresql-9.2) to registry/ini...
[10:34:28] Write Superuser to ini file and windows registry...
[10:34:28] Write Service Account to ini file and windows registry...
[10:34:28] Write the server description to the ini file...
[10:34:28] Write the server branding to the ini file...
[10:34:28] Write the 'whether stack-builder is disabled or not' to the ini file...
[10:34:29] Finished running post-installation/upgrade tasks.

Creating Uninstaller
Creating uninstaller 25%
Creating uninstaller 50%
Creating uninstaller 75%
Creating uninstaller 100%
Installation completed
like image 608
user1903442 Avatar asked Dec 14 '12 08:12

user1903442


People also ask

Why PostgreSQL is not installing?

If you encounter an error about being unable to create the postgres service user, turn off any antivirus programs and re-run the installer. >\database directory and manually set the permissions for the \data subdirectory. If the subdirectory \data does not exist, create. Then uninstall PostgreSQL and re-install.

Why my PostgreSQL is not working?

To be sure that PostgreSQL is running, you can also restart it with systemctl restart postgresql. If this does not fix the problem, the most likely cause of this error is that PostgreSQL is not configured to allow TCP/IP connections. To correct this, edit your posgresql. conf file.


3 Answers

I had the same problem. At one point it needs to get a package via internet connection. This is not right because the install package s/b able to install without a connection but that's how it is. Your firewall is blocking the install. Here's what you need to do:

Shut Down Windows Firewall (Control Panel\All Control Panel Items\Windows Firewall\Customize Settings)

If you use this great program shut down Firewall Control (Exit from task bar or Use Task Mgr to kill UI & Service - 2 items)

For downloading Selected Packages: Shut Down Key Protection Services: Shut Down Base Filtering (Leaves you unprotected! - Dependencies will.restart when BFE is restarted) Base Filtering Engine IKE and AuthIP IPsec Keying Modules IPsec Policy Agent ICS ...

Don't forget to restart all protections.

like image 189
Beathoven Avatar answered Oct 14 '22 06:10

Beathoven


I faced similar issues of Pg 9.2.4 installer on Win7 x64. It turned out that 'adminpack' module did not load due to stopped postgres service. It starts and then terminates almost immediately. You may check this running Pg service manually to see if it can load. If it cant this may be from missing config files from "data" directory. initdb command cant create valid cluster and copy corresponding *.conf files. I tried to dig into details and the installer has complicated checks of user permissions which could fail in your (and my) case.

Just try installing Pg from zip binaries. It took only the following commands (less than 20 minutes). Original article.

1) Create "postgres" windows user (with no admin rights) and granted it full privileges on your Pg folder and "data" folder. To do this from command line run "cmd" as administrator (press Ctrl-Shift-Enter instead of Enter to run "cmd") and issue: "net user postgres /add". Then right click on your Pg folder (and "data" folder if it is outside) and grant all permissions to "postgres".

2) Install Microsoft Visual C++ 20xx Redistributable Package which comes with one click Pg installer (vcredist_x64.exe from Users\"your user"\AppData\Local\Temp\postgresql_installer_**** - folder created by one click Pg installer on first run).

3) Unzip Pg binaries to your Pg folder and "cmd" as administrator to its bin directory.

4) Run to init cluster: initdb -U postgres -A password -E utf8 -W -D "path to your Pg folder"\data

5) Run to install windows service: pg_ctl register -N "postgresql" -U ".\postgres" -D "path to your Pg folder/data" -w

6) Open windows services list and open "postgresql" service properties. Then set password for windows user postgres there. Try starting your new Pg service. If it starts then everything should be ok.

7) Open bin\pgAdmin3, connect to local server and open postgres database and its metadata. You should see a complaint about missing admin services and a propose to correct this. Just press Ok - 'adminpack' should be installed.

like image 2
ritz14 Avatar answered Oct 14 '22 06:10

ritz14


Install postgres only from windows account written in english. For example installation from user "Аня" always fail.

like image 2
Anton Sirotinkin Avatar answered Oct 14 '22 06:10

Anton Sirotinkin