Thread: Regarding initdb & pg_ctl
Hello Folks,
So I have following problem as I logged in Windows 2003 with domain\user. I am basically trying to create installer for postgres. So I need to keep in mind that person who is going to install can be the one who is currently logged in.
So I tried to change permissions on data directory so that initdb will run fine. I changed creator owner privileges to be read and execute using XACLS then ran initdb. It populated directory correctly But when I used pg_ctl to start up service it failed saying
“FATAL: XX000: C:/Program Files/PostgreSQL/8.4/bin/postgres.exe: could not locate matching postgres executable
, .\src\backend\postmaster\postmaster.c:1070 …”
Please provide some inputs how to tackle with this permission issues. Thanks in advance
Thanks & Regards,
Vikram
On Sat, Sep 12, 2009 at 05:23, Vikram Patil <vpatil@actuate.com> wrote: > Hello Folks, > > > > So I have following problem as I logged in Windows 2003 with > domain\user. I am basically trying to create installer for postgres. So I > need to keep in mind that person who is going to install can be the one who > is currently logged in. > > > > So I tried to change permissions on data directory so that initdb will run > fine. I changed creator owner privileges to be read and execute using XACLS > then ran initdb. It populated directory correctly But when I used pg_ctl to > start up service it failed saying > > “FATAL: XX000: C:/Program Files/PostgreSQL/8.4/bin/postgres.exe: could not > locate matching postgres executable > > , .\src\backend\postmaster\postmaster.c:1070 …” > > > > Please provide some inputs how to tackle with this permission issues. Thanks > in advance When you run pg_ctl, it will drop any privileges that is acquired through administrator groups. Did you grant the permissions directly to the postgres user account, and not through something that chains up to Administrators or Domain Admins? Also, make sure this holds true for the whole path up there. If you did, then the next step is to run Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) during the startup and see exactly which operation it is that fails. It is probably trying to load a DLL somewhere it doesn't have permissions. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
Thanks Magnus for help. Is there any way to start pg_ctl without creating postgres user? I am trying to use same logged in user to run initdb andstart service. As per documentation it seems to be allowed after 8.3. We tried to use it the way I describe on WindowsXP and it worked without any problem. Our installer first copies compiled binaries and then try to run initdb as current user. If it worked then we register servicewith same user and password. Users are defined in Active directory on active directory server ,basically we are usingdomain\user format to log in and run installation. Once registration is finished, we need to start service. I tried to run initdb with data directory path outside Program Files .It works fine But when data directory path is locatedinside program files, initdb fails. As per your advice I tried process monitor, it shows that there are no failures. So we can assume it is a issue with permissions. Thanks & Regards Vikram -----Original Message----- From: Magnus Hagander [mailto:magnus@hagander.net] Sent: Monday, September 14, 2009 4:28 AM To: Vikram Patil Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Regarding initdb & pg_ctl On Sat, Sep 12, 2009 at 05:23, Vikram Patil <vpatil@actuate.com> wrote: > Hello Folks, > > > > So I have following problem as I logged in Windows 2003 with > domain\user. I am basically trying to create installer for postgres. So I > need to keep in mind that person who is going to install can be the one who > is currently logged in. > > > > So I tried to change permissions on data directory so that initdb will run > fine. I changed creator owner privileges to be read and execute using XACLS > then ran initdb. It populated directory correctly But when I used pg_ctl to > start up service it failed saying > > "FATAL: XX000: C:/Program Files/PostgreSQL/8.4/bin/postgres.exe: could not > locate matching postgres executable > > , .\src\backend\postmaster\postmaster.c:1070 ..." > > > > Please provide some inputs how to tackle with this permission issues. Thanks > in advance When you run pg_ctl, it will drop any privileges that is acquired through administrator groups. Did you grant the permissions directly to the postgres user account, and not through something that chains up to Administrators or Domain Admins? Also, make sure this holds true for the whole path up there. If you did, then the next step is to run Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) during the startup and see exactly which operation it is that fails. It is probably trying to load a DLL somewhere it doesn't have permissions. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
On Tue, Sep 15, 2009 at 03:55, Vikram Patil <vpatil@actuate.com> wrote: > Thanks Magnus for help. > > Is there any way to start pg_ctl without creating postgres user? I am trying to use same logged in user to run initdb andstart service. As per documentation it seems to be allowed after 8.3. We tried to use it the way I describe on WindowsXP and it worked without any problem. Certainly, that works fine. > Our installer first copies compiled binaries and then try to run initdb as current user. If it worked then we registerservice with same user and password. Users are defined in Active directory on active directory server ,basicallywe are using domain\user format to log in and run installation. > Once registration is finished, we need to start service. That's a pretty standard thing, it pretty much works. > I tried to run initdb with data directory path outside Program Files .It works fine But when data directory path is locatedinside program files, initdb fails. That should work. Another possibility is that it breaks because you have spaces in the path name, and are not quoting it properly. The quoting rules on Windows can be very strange :-) > As per your advice I tried process monitor, it shows that there are no failures. So we can assume it is a issue with permissions. Can you see it opening postgres.exe? Or do you get a not foud error somewhere? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
On Tue, Sep 15, 2009 at 03:55, Vikram Patil <vpatil@actuate.com> wrote: > Thanks Magnus for help. > > Is there any way to start pg_ctl without creating postgres user? I am > trying to use same logged in user to run initdb and start service. As per > documentation it seems to be allowed after 8.3. We tried to use it the way > I describe on Windows XP and it worked without any problem. This sounds very very interesting!. Is there any documentation I can read to use this in Our postgres Installation? Thanks in advance!!! -- View this message in context: http://www.nabble.com/Regarding-initdb---pg_ctl-tp25411280p25453717.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
Hey Magnus, I tried out your suggestion, we are providing quotes correctly. We tried out one thing we installed postgresql outside Program Files. When I say installed I want to mean that I copied compiled binaries. User installing is local user belonging to Administrators group. Then we ran initdb utility with data directory to be in same directory (Outside data directory) . So initdb created it correctly. Then we tried to register service using pg_ctl/register options. It worked too. Then we tried to start service so here it failed. But when we tried to ran same scenario with runas /user:local_user pg_ctl start -D <Data directory> on command prompt, postgres server started without any problem. So I am confused as theoretically both scenarios are same. Since service should be started by same user which is provided later to start postgres through command line. All of these problems are caused only on Windows 2003 Server Enterprise Edition with windows XP everything is fine. Can you provide some inputs on this? Thanks & Regards, Vikram -----Original Message----- From: Magnus Hagander [mailto:magnus@hagander.net] Sent: Tuesday, September 15, 2009 1:19 AM To: Vikram Patil Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Regarding initdb & pg_ctl On Tue, Sep 15, 2009 at 03:55, Vikram Patil <vpatil@actuate.com> wrote: > Thanks Magnus for help. > > Is there any way to start pg_ctl without creating postgres user? I am trying to use same logged in user to run initdb and start service. As per documentation it seems to be allowed after 8.3. We tried to use it the way I describe on Windows XP and it worked without any problem. Certainly, that works fine. > Our installer first copies compiled binaries and then try to run initdb as current user. If it worked then we register service with same user and password. Users are defined in Active directory on active directory server ,basically we are using domain\user format to log in and run installation. > Once registration is finished, we need to start service. That's a pretty standard thing, it pretty much works. > I tried to run initdb with data directory path outside Program Files .It works fine But when data directory path is located inside program files, initdb fails. That should work. Another possibility is that it breaks because you have spaces in the path name, and are not quoting it properly. The quoting rules on Windows can be very strange :-) > As per your advice I tried process monitor, it shows that there are no failures. So we can assume it is a issue with permissions. Can you see it opening postgres.exe? Or do you get a not foud error somewhere? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
We are having exactly the same problem. It happens ONLY on Windows Server 2003 (any edition) It works great on the following Windows: Windows 2000(any),XP(any),Vista(any), Windows Server 2008, Windows 7 As you can see from the list above, we did guite a lot of testing Any input is appretiated. Chris -- View this message in context: http://www.nabble.com/Regarding-initdb---pg_ctl-tp25411280p25519698.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
Hi Chirs. Thanks for your Answer. We've already tried this method with Xp, and Vista and worked correctly in both, but We did no try with all versions as you did, so your help is very very appreciated. Thanks :) I'm sorry I can not help you because we have not 2003 server, and We can not do any test :( Thanks again Chris! chris_watcher wrote: > > We are having exactly the same problem. It happens ONLY on Windows Server > 2003 (any edition) > > It works great on the following Windows: > Windows 2000(any),XP(any),Vista(any), Windows Server 2008, Windows 7 > > As you can see from the list above, we did guite a lot of testing > > Any input is appretiated. > Chris > -- View this message in context: http://www.nabble.com/Regarding-initdb---pg_ctl-tp25411280p25522510.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On windows 2003 make the "postgres" user Member of "Power Users" group and NOT "Administrators". This should solve the above problem and the problem of installing postgreSQL on Windows 2003. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Regarding-initdb-pg-ctl-tp1924375p3208199.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.