Обсуждение: initdb problem on Windows XP Home
Hi Again, I posted earlier about a problem installing 8.1.5 on Windows XP Home. THat message was delayed, so it likely will not show up. THe problem is occuring on execution of initdb. I skipped the cluster creation in the installation so that I could run it manually, but it made no difference. The contents of the temp file for the initdb is: 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 C:/Program Files/PostgreSQL/8.1/data ... ok creating subdirectories ... initdb: could not create directory "C:/Program Files": File exists initdb: removing contents of data directory "C:/Program Files/PostgreSQL/8.1/data" I tried specifying a folder that doesn't exist, and then I get a permissions error. Fine, I logged into the system under the restricted account and tried running initdb again. However, same results. I tried specifying a folder that doesn't already exist, but of course the restricted user does not have access to the C: drive directly. If I create a folder under C:, e.g. C:\postgres_db_cluster, and then try to run initdb -D C:\postgres_db_cluster I get the same results, except this time the log reads creating subdirectories ... initdb: could not create directory "C:/postgres_db_cluster": File exists initdb: removing contents of data directory "C:/postgres_db_cluster" Has anyone encountered this before? If so, how do I get past this? I really need to get the database going. Any help you can offer will be most appreciated. Thank you. Alex.
adurrant@cogeco.ca wrote: > Hi Again, > > I posted earlier about a problem installing 8.1.5 on Windows XP Home. > THat message was delayed, so it likely will not show up. > > THe problem is occuring on execution of initdb. I skipped the cluster > creation in the installation so that I could run it manually, but it > made no difference. > > The contents of the temp file for the initdb is: > > 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 C:/Program > Files/PostgreSQL/8.1/data ... ok creating subdirectories ... initdb: > could not create directory "C:/Program Files": File exists initdb: > removing contents of data directory "C:/Program > Files/PostgreSQL/8.1/data" > > I tried specifying a folder that doesn't exist, and then I get a > permissions error. Fine, I logged into the system under the > restricted account and tried running initdb again. OK. Stop. You've tried a bunch of different things without finding out where the initial problem is. You're running initdb manually, so you'll need to check the permissions are in place manually too. I'm assuming you have a user "postgres" that will own the files and run the processes. Make sure that user "postgres" has full permissions on "C:\Program Files\Postgresql\8.1" Log in as user "postgres" (or use runas to open a shell as that user) and then run: initd -D "C:\Program Files\Postgresql\8.1\data" ... Note the double quotes Let us know what happens then. PS - it might be simpler to run the uninstaller, make sure you've deleted the PostgreSQL directories and user and just run it again. -- Richard Huxton Archonet Ltd
Hi Richard, Thanks for getting back to me. Yes, I have a "postgres" limited account that will own the files. (This was the one created by the installer.) In order to ensure the this user has access/full control to "C:\Program Files\Postgresql\8.1", I used the "cacls" command to edit the access control list and add postgres:f. i.e. I ran cacls "C:\Program Files\PostgreSQL\8.1" /t /e /g postgres:f (I've discovered this morning that I can boot in safe mode to get the Security tab on folder properties in XP Home. I'll check that this evening to see if it looks correct.) However, to continue with your suggestion, after running the cacls statment above, I did log in as postgres and then ran: initd -D "C:\Program Files\Postgresql\8.1\data" ... Yes, I did include the double quotes (due to the space in "Program Files") but it was still the same result. "could not create directory "C:/Program Files": File exists". This looks to me like a problem in the folder processing. At first I thought that it wasn't handling the space in "Program Files" correctly, so I tried a folder that had no spaces, but this had no effect. The message suggests to me that it is always trying to create the folder regardless of whether it exists or not. Thank you very much for your reply. If I have overlooked something, or if I'm completely out to lunch with what I've done/tried, please let me know. Also, any further suggestions would be welcomed. Thanks again. Alex. > > OK. Stop. You've tried a bunch of different things without finding out > where the initial problem is. > > You're running initdb manually, so you'll need to check the permissions > are in place manually too. > > I'm assuming you have a user "postgres" that will own the files and run > the processes. Make sure that user "postgres" has full permissions on > "C:\Program Files\Postgresql\8.1" > > Log in as user "postgres" (or use runas to open a shell as that user) > and then run: > initd -D "C:\Program Files\Postgresql\8.1\data" ... > Note the double quotes > > Let us know what happens then. > > PS - it might be simpler to run the uninstaller, make sure you've > deleted the PostgreSQL directories and user and just run it again. > > -- > Richard Huxton > Archonet Ltd > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > > adurrant@cogeco.ca wrote: > > Hi Again, > > > > I posted earlier about a problem installing 8.1.5 on Windows XP Home. > > THat message was delayed, so it likely will not show up. > > > > THe problem is occuring on execution of initdb. I skipped the cluster > > creation in the installation so that I could run it manually, but it > > made no difference. > > > > The contents of the temp file for the initdb is: > > > > 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 C:/Program > > Files/PostgreSQL/8.1/data ... ok creating subdirectories ... initdb: > > could not create directory "C:/Program Files": File exists initdb: > > removing contents of data directory "C:/Program > > Files/PostgreSQL/8.1/data" > > > > I tried specifying a folder that doesn't exist, and then I get a > > permissions error. Fine, I logged into the system under the > > restricted account and tried running initdb again.
adurrant@cogeco.ca wrote: > Hi Richard, > > Thanks for getting back to me. > > Yes, I have a "postgres" limited account that will own the files. (This was the one created by the installer.) In > order to ensure the this user has access/full control to "C:\Program Files\Postgresql\8.1", I used the "cacls" command > to edit the access control list and add postgres:f. > i.e. I ran > cacls "C:\Program Files\PostgreSQL\8.1" /t /e /g postgres:f > > (I've discovered this morning that I can boot in safe mode to get the Security tab on folder properties in XP Home. > I'll check that this evening to see if it looks correct.) > > However, to continue with your suggestion, after running the cacls statment above, I did log in as postgres and then > ran: > initd -D "C:\Program Files\Postgresql\8.1\data" ... > Yes, I did include the double quotes (due to the space in "Program Files") but it was still the same result. "could not > create directory "C:/Program Files": File exists". Hmm. That doesn't make any sense to me. I'm guessing it's a different error code behind the scenes. I suppose you can issue cd "C:/Program Files" dir successfully as user postgres? If so, try forward slashes to match the output of the error message: "C:/Program Files/Postgresql/..." If that's still not working and none of the Windows guys pop up, I'll try and reproduce it on my XP-Pro laptop. -- Richard Huxton Archonet Ltd
adurrant@cogeco.ca wrote: > (I've discovered this morning that I can boot in safe mode to get the Security tab on folder properties in XP Home. > I'll check that this evening to see if it looks correct.) I haven't used XP home much so I'm not certain it is the same - but the security tab is hidden in XP Pro when simple filesharing is on. Open Folder Options and select the view tab and the last item in the advanced settings list is Use Simple File Sharing - having this turned on hides the security tab and simplifies the sharing tab. -- Shane Ambler pgSQL@007Marketing.com Get Sheeky @ http://Sheeky.Biz
Hi, I gave restricted permissions to the postgres user on the C: drive. After doing this, I could run initdb without issue. Something doesn't sit right with me with giving access to C: drive, but it works. If anyone has any insights on what this problem is/was and how I can get around it without granting access to C:, I would appreciate it. Thanks for all your help. Alex. > > adurrant@cogeco.ca wrote: > > Hi Richard, > > > > Thanks for getting back to me. > > > > Yes, I have a "postgres" limited account that will own the files. (This was the one created by the installer.) In > > order to ensure the this user has access/full control to "C:\Program Files\Postgresql\8.1", I used the "cacls" > > command to edit the access control list and add postgres:f. > > i.e. I ran > > cacls "C:\Program Files\PostgreSQL\8.1" /t /e /g postgres:f > > > > (I've discovered this morning that I can boot in safe mode to get the Security tab on folder properties in XP Home. > > I'll check that this evening to see if it looks correct.) > > > > However, to continue with your suggestion, after running the cacls statment above, I did log in as postgres and then > > ran: > > initd -D "C:\Program Files\Postgresql\8.1\data" ... > > Yes, I did include the double quotes (due to the space in "Program Files") but it was still the same result. "could > > not create directory "C:/Program Files": File exists". > > Hmm. That doesn't make any sense to me. I'm guessing it's a different > error code behind the scenes. I suppose you can issue > cd "C:/Program Files" > dir > successfully as user postgres? > > If so, try forward slashes to match the output of the error message: > "C:/Program Files/Postgresql/..." > > If that's still not working and none of the Windows guys pop up, I'll > try and reproduce it on my XP-Pro laptop. > -- > Richard Huxton > Archonet Ltd
Hi Shane, Thanks for the tip. I think be default XP Home has simple file sharing enabled, and there is no way to turn it off. The only way to access the security tab is to log in under Safe Mode. Thanks again. Alex. > > adurrant@cogeco.ca wrote: > > > (I've discovered this morning that I can boot in safe mode to get the Security tab on folder properties in XP Home. > > I'll check that this evening to see if it looks correct.) > > I haven't used XP home much so I'm not certain it is the same - but the > security tab is hidden in XP Pro when simple filesharing is on. > > Open Folder Options and select the view tab and the last item in the > advanced settings list is Use Simple File Sharing - having this turned > on hides the security tab and simplifies the sharing tab. > > > -- > > Shane Ambler > pgSQL@007Marketing.com > > Get Sheeky @ http://Sheeky.Biz
Hi Richard, Some more information tonight. I logged in under safe mode and checked the security settings for "C:\Program Files\PostgreSQL" and the user postgres had full control. However, I could not issue a cd "C:\Program Files\PostgreSQL". I looked at the security for Program Files, and postgres was not part included. I added the user postgres with Read only permissions. Still couldn't change to the PostgreSQL folder. Changed security permissions to Read and Execute to include list directory contents. Still couldn't change folders. I think now that initdb is trying to create the folders because as thev postgres user it can't see the folder so assumes it not to be there. Then tries to create it, which of course it already exists, so it fails with file exists. The million dollar question is why can't the postgres user access the folder when logged in and security settings show it should have access. Do I need to give permissions to postgres for the C: drive? Somehow that doesn't seem correct. Any ideas? Thanks for your help. Alex. > > adurrant@cogeco.ca wrote: > > Hi Richard, > > > > Thanks for getting back to me. > > > > Yes, I have a "postgres" limited account that will own the files. (This was the one created by the installer.) In > > order to ensure the this user has access/full control to "C:\Program Files\Postgresql\8.1", I used the "cacls" > > command to edit the access control list and add postgres:f. > > i.e. I ran > > cacls "C:\Program Files\PostgreSQL\8.1" /t /e /g postgres:f > > > > (I've discovered this morning that I can boot in safe mode to get the Security tab on folder properties in XP Home. > > I'll check that this evening to see if it looks correct.) > > > > However, to continue with your suggestion, after running the cacls statment above, I did log in as postgres and then > > ran: > > initd -D "C:\Program Files\Postgresql\8.1\data" ... > > Yes, I did include the double quotes (due to the space in "Program Files") but it was still the same result. "could > > not create directory "C:/Program Files": File exists". > > Hmm. That doesn't make any sense to me. I'm guessing it's a different > error code behind the scenes. I suppose you can issue > cd "C:/Program Files" > dir > successfully as user postgres? > > If so, try forward slashes to match the output of the error message: > "C:/Program Files/Postgresql/..." > > If that's still not working and none of the Windows guys pop up, I'll > try and reproduce it on my XP-Pro laptop. > -- > Richard Huxton > Archonet Ltd
adurrant@cogeco.ca wrote: > Hi, > > I gave restricted permissions to the postgres user on the C: drive. After doing this, I could run initdb without issue. > Something doesn't sit right with me with giving access to C: drive, but it works. If anyone has any insights on what > this problem is/was and how I can get around it without granting access to C:, I would appreciate it. > With the *nix install folder permissions can stop PostgreSQL running and I will assume the same applies for windows. As you can set permissions in the properties window I assume the drive is NTFS (I don't think the security tab shows on FAT32 drives but may be why it only shows in safe mode). PostgreSQL doesn't really support FAT32 (initdb can be manually run on a FAT32 volume). The installer will fail with initdb on a FAT32 drive and may be your problem. From the windows faq - http://pginstaller.projects.postgresql.org/faq/FAQ_windows.html which may have some extra info for you. <quote> 2.5) What filesystem permissions does PostgreSQL require? The PostgreSQL service account needs read permissions on all directories leading up to the service directory. It needs write permissions only on the data directory. Specifically, it should not be granted anything other than read permissions on the directories containing binary files. (All directories below the installation directory are set by the installer, so unless you change something, there should be no problem with this). PostgreSQL also needs read permissions on system DLL files like kernel32.dll and user32.dll (among others), which is normally granted by default, and on the CMD.EXE binary, which may in some scenarios be locked down and need opening. If you are running PostgreSQL on a multi-user system, you should remove the permissions from all non-administrative users from the PostgreSQL directories. No user ever needs permissions on the PostgreSQL files - all communication is done through the libpq connection. Direct access to data files can lead to information disclosure or system instability! </quote> I haven't used PostgreSQL on windows much but I have an XP Pro machine with it installed here and am reading the permission settings from this machine to give below. The "read permissions on all directories up to the service directory" (which includes C:\Program Files\PostgreSQL) would normally come from all user access (Users group) settings not a specific postgres entry. C:\Program Files\PostgreSQL\8.1\ has a postgres entry with read & execute List Folder Contents Read are ticked as allow write is ticked as deny all others are left blank. Other user entries are inherited from parent. Owner is Administrators group Apply these settings to all child objects C:\Program Files\PostgreSQL\8.1\data All standard user entries have no permissions ticked (except special permissions on some) postgres user has modify read & execute list folder contents read write are all ticked as allow full control is unticked These should be applied to all child folders of data. The owner is the account used to run the installer. These settings should be what is applied by the binary installer. -- Shane Ambler pgSQL@007Marketing.com Get Sheeky @ http://Sheeky.Biz
adurrant@cogeco.ca wrote: > Hi, > > I gave restricted permissions to the postgres user on the C: drive. After doing this, I could run initdb without issue. > Something doesn't sit right with me with giving access to C: drive, but it works. If anyone has any insights on what > this problem is/was and how I can get around it without granting access to C:, I would appreciate it. Well, read-only permissions on C: should be alright (so long as it doesn't imply read-only on the folders below). It might be possible to remove the permissions after installation, although I've never tried. If it really concerns you, you could repartition and install just PostgreSQL on drive D: (or whatever). -- Richard Huxton Archonet Ltd