20

I tried to install postgresql 8.4 in my windows 7 (64 bit). But it fails with following messages in log

Initialising the database cluster (this may take a few minutes)...
Executing cscript //NoLogo "C:\PostgreSQL\8.4/installer/server/initcluster.vbs" "postgres" "postgres" "****" "C:\PostgreSQL\8.4" "C:\PostgreSQL\data" 5432 "DEFAULT"
Script exit code: 1

Script output:
 CScript Error: Can't find script engine "VBScript" for script "C:\PostgreSQL\8.4\installer\server\initcluster.vbs".

Script stderr:
 Program ended with an error exit code

Error running cscript //NoLogo "C:\PostgreSQL\8.4/installer/server/initcluster.vbs" "postgres" "postgres" "****" "C:\PostgreSQL\8.4" "C:\PostgreSQL\data" 5432 "DEFAULT" : Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
 The database cluster initialisation failed.
Creating Uninstaller
Creating uninstaller 25%
Creating uninstaller 50%
Creating uninstaller 75%

I have googled about this and run the command 'regsvr32 vbscript.dll' and it shows the message 'DllRegisterServer in vbscript.dll is succeeded', but it haven't solved my issue.

Also I set the default value for {B54F3741-5B07-11cf-A4B0-00AA004A55E8} in registry to the file path of vbscript.dll, but it also haven't solved my issue.

How to fix this issue?

shin
  • 1,675
  • 4
  • 22
  • 46
  • 1
    Can you manually run .vbs scripts from the commandline? And why are you installing a version that is soon to be outdated? The current version is 9.1 with 9.2 on the doorstep –  Jul 25 '12 at 21:34
  • 8.4.*what* by the way? There have been a series of improvements to the installers. [8.4.12](http://www.enterprisedb.com/products-services-training/pgdownload#windows) is the latest, is that's what you're using? The newer versions should check for a working VBScript environment before running any scripts. Also: Is the log above from *after* you re-registered vbscript? If not, check the log again, you could be encountering a different issue. – Craig Ringer Jul 26 '12 at 04:28
  • I have tried with 9.1 also, but the same result. This is the latest log after register the vbscript. – shin Jul 26 '12 at 04:30
  • @shinod Gah, another weird system-specific piece of Windows brokenness then. Have you tried after disabling your antivirus scanner? If you don't have any luck here soon ask on pgsql-general and I'll poke Dave or one of the other EnterpriseDB installer guys. – Craig Ringer Jul 26 '12 at 08:27
  • @CraigRinger I had avast antivirus, but I completely removed it, but I am not lucky. Any other solutions? – shin Jul 26 '12 at 17:56
  • @shinod Sorry, I'm about out. It'd be appreciated if you could collect your info up - with as much detail as possible and link to this page - and post it to http://archives.postgresql.org/pgsql-bugs/ . Include the *full* installer log. – Craig Ringer Jul 27 '12 at 00:19
  • @CraigRinger I got solution from following link.....Thanks for your help. http://www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/ – shin Aug 03 '12 at 17:21
  • @shinod Very interesting. Thankyou for following up. One quick question for you: what language is your Windows install in? What is the name of your Program Files directory? – Craig Ringer Aug 04 '12 at 01:32
  • Also: was it 8.4 or 9.1 that you eventually installed? I'm confused about how, if it was a permissions problem, the CSCript errors magically went away. Did you look at the log from the failed 9.1 install to see if the problem was still CSCript errors, or if it was complaining about something else when 9.1 failed to install? (Sorry for all the questions, it's just that finding these things out can help make the installer better). – Craig Ringer Aug 04 '12 at 01:35

21 Answers21

27

Following link solve my issue

http://www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/

The article text:

I’ll keep this one short and sweet. For those of you that have tried to install PostgreSQL (mine was 8.3.7-1) on Windows Vista and got the error Database Cluster Initialisation Failed error at the end of the install, read this.

The problem is that Vista has some safety features associated with setting permissions on the Program Files folder. Basically, even if you are an admin, you can’t change permissions on some folders like Program Files and Windows folder itself. This causes initdb to be unable to create some folders and the database cluster. What this means for you is that you need to install PostgreSQL in another folder that is not inside Program Files.

By the way, if you have forgotten your Postgres account password while installing the first time, just open a Command Prompt in Vista (If you don’t know how, Google for it). Then type the command “net user”. You will see a list of users on your computer. Find Postgre’s account. It’s usually “postgres“. Then you need to change its password by typing “net user postgres new_password” where new_password is… well, a new password for the account. You will be needing that postgres account during install. You will need admin privileges to do this change however.

Firstly, uninstall any failed installations. Use the Control Panel or the PostgreSQL installer in the install folder.

During the install, you will be prompted to choose where you want to install the program. Just select a location in another place. Like “C:\PostgreSQL” or something similar. It may even be on your desktop. But not inside Program Files. Not inside Windows folder. However, it’s not as easy. Bear with me.

After the install, you will still see that darned error message (or something like non-fatal error occured). Do not despair! (For Windows Power Users, we are just assigning Full Control permission to Postgres account on the new PostgreSQL install folder). For other users, read on if you don’t know how to do it.

Go to where you just installed PostgreSQL. In this case, the C: drive. There, right-click on the folder (usually called PostgreSQL), and go to Properties – Security tab. Click on the Edit button. You will now see some usernames and other stuff. Click on the Add button. In the “Enter the object names to select” box, enter “postgres” and press Check. Postgres’ user account should appear there. Click on Ok.

Now from the “Group or Usernames” box, select the Postgres account. In the window below, with lots of checkboxes, assign permission “Full Control” in the Allow Column to it. Note, if you don’t want to allow full control, just give it read/write. But I just went ahead and gave it Full Control. (I was tired and annoyed. The “World’s most advanced open source database” had failed to install!). Click on Ok and wait a bit for permissions to be applied.

Then, just do a re-install. Do not uninstall anything. Just run the setup again. It’ll say that a PostgreSQL install folder already exists and other stuff. Just click on Next until the install finishes. If you see “file cannot be copied” errors, click on the “ignore” button when needed.

That’s it. PostgreSQL should be up and running on Vista now. Hope it works for you too as it did for me, and that my guide is helpful to anybody. If it works, or if you have other solutions, let us know. Thanks for reading! :)

crthompson
  • 15,653
  • 6
  • 58
  • 80
shin
  • 1,675
  • 4
  • 22
  • 46
9

I got the same result installing "postgresql-9.2.3-1-windows-x64.exe" on Windows 7 Enterprise and the problem get solved when I change the installation path.

Try to install into "c:\postgresql" instead of "c:\program files\Postgresql"

Good luck

Ankur Ghelani
  • 659
  • 4
  • 16
Susana Gb
  • 91
  • 1
  • 2
8

For me the problem was that PATH variable did not have C:\Windows\system32 and so it did not find ICACLS command to change folder permissions. So the solution is to add C:\Windows\system32 to system PATH variable (if it does not contain it already):

  1. Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables
  2. Under "System variable" find and select "Path"
  3. Click "Edit..."
  4. Now if value does not contain path to system32 append string ;C:\Windows\system32 (or wherever your windows path is)
Muhammad Waheed
  • 1,048
  • 1
  • 13
  • 30
  • 2
    I've been trying to install version 10.0.1 for the last two days and I'm pretty sure this did the trick. Even though `C:\WINDOWS\system32` was in my Path, once I added `C:\Windows\System32` above it the installer ran without the initialization error. Note: I also created a postgres user to run the installer from, as well as set full control rights on the folder after the first install and then reran the installer. – pheeper Nov 02 '17 at 18:33
  • 1
    Worked for me Using a fresh windows 10 pc and PostgreSQL 10.5. How fresh? %PATH% was empty, that's how fresh. – ssimm Sep 05 '18 at 09:32
4

I've pulled shin's link from the google cache:

Original link: http://www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/

Cached link: http://webcache.googleusercontent.com/search?q=cache:RXu-5-ZzfcgJ:www.geekscribes.net/blog/2009/04/22/postgresql-database-cluster-initialisation-failed-solution/+&cd=3&hl=ro&ct=clnk


PostgreSQL Database Cluster Initialisation Failed Solution

I’ll keep this one short and sweet. For those of you that have tried to install PostgreSQL (mine was 8.3.7-1) on Windows Vista and got the error Database Cluster Initialisation Failed error at the end of the install, read this.

The problem is that Vista has some safety features associated with setting permissions on the Program Files folder. Basically, even if you are an admin, you can’t change permissions on some folders like Program Files and Windows folder itself. This causes initdb to be unable to create some folders and the database cluster. What this means for you is that you need to install PostgreSQL in another folder that is not inside Program Files.

By the way, if you have forgotten your Postgres account password while installing the first time, just open a Command Prompt in Vista (If you don’t know how, Google for it). Then type the command “net user”. You will see a list of users on your computer. Find Postgre’s account. It’s usually “postgres“. Then you need to change its password by typing “net user postgres new_password” where new_password is… well, a new password for the account. You will be needing that postgres account during install. You will need admin privileges to do this change however.

Firstly, uninstall any failed installations. Use the Control Panel or the PostgreSQL installer in the install folder.

During the install, you will be prompted to choose where you want to install the program. Just select a location in another place. Like “C:\PostgreSQL” or something similar. It may even be on your desktop. But not inside Program Files. Not inside Windows folder. However, it’s not as easy. Bear with me.

After the install, you will still see that darned error message (or something like non-fatal error occured). Do not despair! (For Windows Power Users, we are just assigning Full Control permission to Postgres account on the new PostgreSQL install folder). For other users, read on if you don’t know how to do it.

Go to where you just installed PostgreSQL. In this case, the C: drive. There, right-click on the folder (usually called PostgreSQL), and go to Properties – Security tab. Click on the Edit button. You will now see some usernames and other stuff. Click on the Add button. In the “Enter the object names to select” box, enter “postgres” and press Check. Postgres’ user account should appear there. Click on Ok.

Now from the “Group or Usernames” box, select the Postgres account. In the window below, with lots of checkboxes, assign permission “Full Control” in the Allow Column to it. Note, if you don’t want to allow full control, just give it read/write. But I just went ahead and gave it Full Control. (I was tired and annoyed. The “World’s most advanced open source database” had failed to install!). Click on Ok and wait a bit for permissions to be applied.

Then, just do a re-install. Do not uninstall anything. Just run the setup again. It’ll say that a PostgreSQL install folder already exists and other stuff. Just click on Next until the install finishes. If you see “file cannot be copied” errors, click on the “ignore” button when needed.

That’s it. PostgreSQL should be up and running on Vista now. Hope it works for you too as it did for me, and that my guide is helpful to anybody. If it works, or if you have other solutions, let us know. Thanks for reading!

CosminB
  • 173
  • 8
4

Solution:

• Uninstall PostgreSQL

• Run command: net user postgres /delete

• Click: Control Panel -> User Accounts -> Configure advanced user profile properties -> delete all “Unknown User” instances that seem to be left from PostgreSQL installation.

• Run: compmgmt.msc -> Click Local Users and Groups -> Users -> New User… -> User name: postgres, Password: postgrespass -> Create

• Run: compmgmt.msc -> Click Local Users and Groups -> Users -> postgres ->Member of -> Add… -> Administrators -> OK

• copy the PostgreSQL installer postgresql-8.4.9-1-windows.exe to C:\

• Run: runas /user:postgres cmd.exe -> cd \ -> postgresql-8.4.9-1-windows.exe -> installed successfully without errors. Checked data folder and confirmed files created successfully.

• Run: compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Administrators -> Remove

• Run: compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add… -> Power Users -> OK

Rakesh
  • 2,732
  • 29
  • 28
  • With an up-to-date Postgres version (9.x) the extra Windows user `postgres` is no longer needed. –  Apr 16 '14 at 16:05
  • Deleting the "postgres" user may break 3rd party extras on the system (pgagent, etc) so be prepared to reinstall other things too. – Craig Ringer May 14 '14 at 05:02
2

Your Windows install is a little borked, and you will need to re-register the VBScript engine to get the installer to run.

Edit: I'm blind, the post author had already tried this.

See:

http://wiki.postgresql.org/wiki/Running_%26_Installing_PostgreSQL_On_Native_Windows#The_installer_exits_with_a_runtime_installation_error.3F

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
2

I had the same problem when trying to install PostgreSQL 9.3.5-3 on a Windows 7 x64 machine (not joined to a domain) in a folder, created on the root, with full access to everybody. The problem was solved by not using ä in my password, so avoid using non-English characters in your password.

1

This message still occurs in Postgres v9.3.1.1.

For me, the problem was running the installer under the "Administrator" account. This doesn't work. Run it under an administrator account, avoiding the built-in "Administrator" account.

I don't really know what it's usually called, but it's the one that already exists on a fresh install; the one that cannot be changed to a Standard User; the one whose profile is stored in C:\Users\Administrator. Turns out it was a bad idea using this account; learned it the hard way.

(Windows Server 2008 R2 64-bit)

Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
  • The *installer* should run under any Administrator account, unless you have some funky group policy set up. The server its self doesn't want to run under any account with admin rights for security reasons. – Craig Ringer May 14 '14 at 05:02
  • @CraigRinger yeah, but it didn't for some reason. The box was more or less vanilla 2008 R2, not domain-joined, no funky group policies. – Roman Starkov May 14 '14 at 14:28
1

Hey guys the answer is very simple just install postgresql on another folder outside program files. it prompts a non fatal error and proceeds to with the installation...

  • hello.. I tried everything but still giving this error "unable to write inside TEMP environment variable path". while runing .exe in other than C drive, it generates tmp file. help me out, please. – Bharti Mohane Sep 08 '18 at 11:02
1

I have solved the same problem on Windows Server 2003 and postgres 9.2.9-3 by creating directory for installation beforehand, and giving full access on it to group "Users".

user3132194
  • 2,381
  • 23
  • 17
1

The answer is very simple, move the downloaded .exe file to some other folder . for ex: c:\postgres and try to install it.

your issue is due to some admin privilege issues

Manoj Kalluri
  • 1,384
  • 2
  • 14
  • 27
1

There seem to be many reasons cause the installation fail.

In my case, I'm using Windows 10 home edition, which has no advance user group control, so a lot of solutions above doesn't work for me. And I guess this is why the installation fails.

What I do is just using BigSQL's installer instead of EnterpriceDB's installer,

Choose the second installer in posgresql download center

Or visit BigSQL directly.

lzszone
  • 65
  • 1
  • 8
1

After some struggle I came across this post. I struggled some more time and I think I finally figured it out with the help of all the invaluable input from my predecessors in this post.

My case

  • It's November 2018.
  • PostgreSQL 11.1 Winodws-x64 from EnterpriseDB as suggested by postgresql.org
  • Tried to install on Windows 10 (both Home and Professional)

I tried several constellations and boiled down the process to this:

Pre-installation

  • Uninstall any failed installations.
  • Add a local user "postgres" (lowercase worked for me) to your computer, assign a SIMPLE password and administrative rights. Do avoid special characters at all expenses, stick with english letters (upper and lowercase) and numbers only.
  • Add a folder on your computer OUTSIDE the "C:\Program Files" or Windows folder. I chose C:\PostgreSQL
  • Assign full control over the above folder to the postgres account.

Installation

  • Run the installer (postgresql-11.1-1-windows-x64.exe in my case)
  • use the above password and folder when prompted (not the default folder)

Post-installation

  • For security reasons you should now assign a proper password to the windows-user "postgres" and remove administrative rights from the account.
  • Test your installation by running pgAdmin and connecting to your server. However, the password for the postgres user you need to connect to the server will still be the simple one you used earlier. You may change it within pgAdmin by selecting the postgres database left, choose Tools -> Query Tool and type ALTER USER postgres WITH PASSWORD '4wligzo748o$%&'; or whatever. Execute with the flash symbol or F5.

But maybe this is wrong altogether and you should rather run a linux vm with postgreSQL server.

Wolfgang Jacques
  • 769
  • 6
  • 15
1

Struggling with this problem for days. Finally got help from the EDB team My problem got solved by doing the following steps :

1) Open the command prompt and go to the following directory:

cd "C:\Program Files\PostgreSQL\10\bin"

2) Once you are inside this "C:\Program Files\PostgreSQL\10\bin" directory execute the following command:

.\initdb.exe -D "C:\Program Files\PostgreSQL\10\data"

3) At the end of this command you will be promoted to execute a pg_ctl command to start the Postgres cluster. Please execute the command and once you get a message as the server started you are all set to use the Postgres database.

Note: Instead of 10 user whatever version you have installed. If the pg_ctl command in the third step gives an error after running it in \bin directory, then try running it in \data directory. After the above process re-run the installer.

Alessio
  • 3,404
  • 19
  • 35
  • 48
0

I know it is not the the solution but installing 32 bit of Postgres, worked for me

0

I had the same problem when trying to install PostgreSQL 9.6.2 on a Windows 7 32 bit machine,but i got solution,first just uninstall the installed postgres,then delete the postgres folder from 'c' drive,delete the entry from temp file which resides in "C:\Users\AppData\Local\Temp".Then again installed postgres 9.6.2 that installed successfully.

Seema Barate
  • 97
  • 14
0

Had this same problem trying to install on my company computer (PC running Windows 7). If you are not admin on your computer, you need to install it within your personal "User" folder (not in the "Program Files" folder(s) at the root).

If you still can't access Postgres:

Once you'd installed it under your "User" folder, use the 'Run' program and type in "services.msc" and hit enter. In the window that pops up, go down to your postgres installation, right-click and go to "properties". In the "Log On" tab, select "Local System account" then go back to the "General" tab and click "Start". It should boot after that.

After this, I was able to run "pgAdmin" and access the database (after entering the password I used during installation).

HaulinOats
  • 3,628
  • 4
  • 21
  • 24
0

I had the same problem today when installing postgres 9.6.19 on windows 10. Solution: Neither the installation path nor the windows path variable may contain a blank! Near to the end of the installer log file (found in wondows %temp% dir with a name like bitrock_installer_16156.log) i found:

Script stderr: "\UnxUtils\usr\local\wbin\";"C:\Program" kann syntaktisch an dieser Stelle nicht verarbeitet werden.

where the installation directory i set as well as my windows %PATH% variable contained

C:\Program Files\

Workaround: open a command prompt as administrator and type:

set path=C:\WINDOWS\system32
PostgreSQL-9.6.10-1-win64-bigsql.exe

And then of course choose a path not containing a blank. That did it for me.

RED SOFT ADAIR
  • 12,032
  • 10
  • 54
  • 92
0

I encountered an issue where a username with a space in it on windows fails the postgres installation.

To test:

  • Reinstalled windows 10 home (restored)
  • Made a user account without the space
  • Postgres installed successfully

Very frustrating...

demonllama
  • 101
  • 1
  • 3
0
  1. check the services: if any folder there postgres related stop it, and change to disable mode.
  2. check regedit: HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER -> software -> remove postgres folder if exists.
  3. In system environment variable: TEMP path location, remove the TEMP folder for both user and system. and Rename the TEMP to TEMP1 or something..
  4. In system environment variable: remove path for postgres if it exists.
  5. Now change the location of postgres.exe file to another drive.
  6. Restart the system
  7. Then Run postgres.exe
  8. create a new installation directory for postgres and put /data outside.
Savin Sabu
  • 11
  • 2
0

the easiest way i solve this was:

1.- uninstall if you have already installed

2.- delete all files with failed instalations

3.- start windows in secure mode

4.- run installer in secure mode (it pops a warning but ignore) and restart

and that's it when restarted the service was running ok and everything works fine