Обсуждение: Initdb on Windows 2003

Поиск
Список
Период
Сортировка

Initdb on Windows 2003

От
Дата:
Hello all,

Below is an email thread regarding a possible bug in PostgreSQL on
Windows 2003. Any help or advice anyone can give on this would be much
appreciated.

All the best,
James Hughes

--- EMAIL THREAD FOLLOWS ---

James_Hughes@McAfee.com wrote:
> Hi Bruce,
>
> We are now seeing this issue on three machines, all of which are
> running Windows 2003. After some looking at the code and putting some
> extra debug output (very little) all we have determined is that
> initdb.exe opens postgres.exe via pipes, and at some point within
> postgres.exe this error is generated.
>
> If we knock out the check for the user being not being admin and run
> initdb.exe as an administrator all works as expected. Adding the user
> to the 'Power Users' group also causes the "Access Denined" error! I
> don't believe that the access denined is anything to do with file
> access or memory (shared) access as I ran some tools to see what
> postgres.exe is trying to access.
>
> Is there an easy way on Windows to step-through the PostgreSQL code as

> it runs? Is there any other information I can provide which will help
> you with this defect?
>
> Any help getting to the root of this problem is much appericated.
>
> All the best
> James Hughes
>
> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: 24 February 2006 18:54
> To: Hughes, James
> Cc: pgsql-bugs@postgresql.org
> Subject: Re: [BUGS] BUG #2268: initdb fails to initialize database
> cluster with error "Access is denied"
>
>
> Strange.  It isn't a typical error we see, and the fact you see it on
> two machines is even stranger.  My guess is that somehow the
> configuration on those two machines is the same and is causing the
> failure.
>
> ----------------------------------------------------------------------
> --
> ---
>
> James Hughes wrote:
> >
> > The following bug has been logged online:
> >
> > Bug reference:      2268
> > Logged by:          James Hughes
> > Email address:      james_hughes@mcafee.com
> > PostgreSQL version: 8.1.3
> > Operating system:   Windows 2003 (Server)
> > Description:        initdb fails to initialize database cluster with
> error
> > "Access is denied"
> > Details:
> >
> > When we try and initialize a database cluster using initdb.exe we
> > are getting the following output.
> >
> > -- OUTPUT from dbinit.exe --
> > The files belonging to this database system will be owned by user
> "user1".
> > This user must also own the server process.
> >
> > The database cluster will be initialized with locale English_United
> > Kingdom.1252.
> >
> > creating directory c:/dataa ... ok
> > creating directory c:/dataa/global ... ok creating directory
> > c:/dataa/pg_xlog ... ok creating directory
> > c:/dataa/pg_xlog/archive_status ... ok creating directory
> > c:/dataa/pg_clog ... ok creating directory c:/dataa/pg_subtrans ...
> > ok
>
> > creating directory c:/dataa/pg_twophase ... ok creating directory
> > c:/dataa/pg_multixact/members ... ok creating directory
> > c:/dataa/pg_multixact/offsets ... ok creating directory
> > c:/dataa/base ... ok creating directory c:/dataa/base/1 ... ok
> > creating directory c:/dataa/pg_tblspc ... ok selecting default
> > max_connections ... Access
>
> > is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > 10
> > selecting default shared_buffers ... Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > Access is denied.
> > 50
> > creating configuration files ... ok
> > creating template1 database in c:/dataa/base/1 ... ok initializing
> > pg_authid ... Access is denied.
> > child process was terminated by signal 1
> > initdb: removing data directory "c:/dataa"
> >
> > -- end: OUTPUT from dbinit.exe --
> >
> > user1 is a user without administrative rights. I have checked all
> > the directories and the user has permissons to write to the data
> > directory, and read other files it requires.
> >
> > I also tried the Windows installer (MSI) from pgFoundry. This too is

> > having the same problem.
> >
> > We have two machines which this problem occurs on, one of which
> > originally the initialization would work on. I have checked all the
> > user rights asssignments, and even given the postgres user (user1 in

> > the above output from dbinit.exe) all user rights.
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 2: Don't 'kill -9' the postmaster
> >
>
> --
>   Bruce Momjian   http://candle.pha.pa.us
>   SRA OSS, Inc.   http://www.sraoss.com
>
>   + If your life is a hard drive, Christ can be your backup. +
>

--  Bruce Momjian   http://candle.pha.pa.us SRA OSS, Inc.   http://www.sraoss.com
 + If your life is a hard drive, Christ can be your backup. +






James Hughes



Re: Initdb on Windows 2003

От
"Andrew Dunstan"
Дата:

1. please show the EXACT initdb command line used.

2. Which Windows user was actually running initdb?

cheers

andrew

> Hello all,
>
> Below is an email thread regarding a possible bug in PostgreSQL on
> Windows 2003. Any help or advice anyone can give on this would be much
> appreciated.
>
> All the best,
> James Hughes
>
> --- EMAIL THREAD FOLLOWS ---
>
> James_Hughes@McAfee.com wrote:
>> Hi Bruce,
>>
>> We are now seeing this issue on three machines, all of which are
>> running Windows 2003. After some looking at the code and putting some
>> extra debug output (very little) all we have determined is that
>> initdb.exe opens postgres.exe via pipes, and at some point within
>> postgres.exe this error is generated.
>>
>> If we knock out the check for the user being not being admin and run
>> initdb.exe as an administrator all works as expected. Adding the user
>> to the 'Power Users' group also causes the "Access Denined" error! I
>> don't believe that the access denined is anything to do with file
>> access or memory (shared) access as I ran some tools to see what
>> postgres.exe is trying to access.
>>
>> Is there an easy way on Windows to step-through the PostgreSQL code as
>
>> it runs? Is there any other information I can provide which will help
>> you with this defect?
>>
>> Any help getting to the root of this problem is much appericated.
>>
>> All the best
>> James Hughes
>>
>> -----Original Message-----
>> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>> Sent: 24 February 2006 18:54
>> To: Hughes, James
>> Cc: pgsql-bugs@postgresql.org
>> Subject: Re: [BUGS] BUG #2268: initdb fails to initialize database
>> cluster with error "Access is denied"
>>
>>
>> Strange.  It isn't a typical error we see, and the fact you see it on
>> two machines is even stranger.  My guess is that somehow the
>> configuration on those two machines is the same and is causing the
>> failure.
>>
>> ----------------------------------------------------------------------
>> --
>> ---
>>
>> James Hughes wrote:
>> >
>> > The following bug has been logged online:
>> >
>> > Bug reference:      2268
>> > Logged by:          James Hughes
>> > Email address:      james_hughes@mcafee.com
>> > PostgreSQL version: 8.1.3
>> > Operating system:   Windows 2003 (Server)
>> > Description:        initdb fails to initialize database cluster with
>> error
>> > "Access is denied"
>> > Details:
>> >
>> > When we try and initialize a database cluster using initdb.exe we
>> > are getting the following output.
>> >
>> > -- OUTPUT from dbinit.exe --
>> > The files belonging to this database system will be owned by user
>> "user1".
>> > This user must also own the server process.
>> >
>> > The database cluster will be initialized with locale English_United
>> > Kingdom.1252.
>> >
>> > creating directory c:/dataa ... ok
>> > creating directory c:/dataa/global ... ok creating directory
>> > c:/dataa/pg_xlog ... ok creating directory
>> > c:/dataa/pg_xlog/archive_status ... ok creating directory
>> > c:/dataa/pg_clog ... ok creating directory c:/dataa/pg_subtrans ...
>> > ok
>>
>> > creating directory c:/dataa/pg_twophase ... ok creating directory
>> > c:/dataa/pg_multixact/members ... ok creating directory
>> > c:/dataa/pg_multixact/offsets ... ok creating directory
>> > c:/dataa/base ... ok creating directory c:/dataa/base/1 ... ok
>> > creating directory c:/dataa/pg_tblspc ... ok selecting default
>> > max_connections ... Access
>>
>> > is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > 10
>> > selecting default shared_buffers ... Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > 50
>> > creating configuration files ... ok
>> > creating template1 database in c:/dataa/base/1 ... ok initializing
>> > pg_authid ... Access is denied.
>> > child process was terminated by signal 1
>> > initdb: removing data directory "c:/dataa"
>> >
>> > -- end: OUTPUT from dbinit.exe --
>> >
>> > user1 is a user without administrative rights. I have checked all
>> > the directories and the user has permissons to write to the data
>> > directory, and read other files it requires.
>> >
>> > I also tried the Windows installer (MSI) from pgFoundry. This too is
>
>> > having the same problem.
>> >
>> > We have two machines which this problem occurs on, one of which
>> > originally the initialization would work on. I have checked all the
>> > user rights asssignments, and even given the postgres user (user1 in
>
>> > the above output from dbinit.exe) all user rights.
>> >
>> > ---------------------------(end of
>> > broadcast)---------------------------
>> > TIP 2: Don't 'kill -9' the postmaster
>> >
>>
>> --
>>   Bruce Momjian   http://candle.pha.pa.us
>>   SRA OSS, Inc.   http://www.sraoss.com
>>
>>   + If your life is a hard drive, Christ can be your backup. +
>>
>
> --
>  Bruce Momjian   http://candle.pha.pa.us
>  SRA OSS, Inc.   http://www.sraoss.com
>
>  + If your life is a hard drive, Christ can be your backup. +
>
>
>
>
>
>
> James Hughes
>
>
> ---------------------------(end of
> broadcast)--------------------------- TIP 6: explain analyze is your
> friend





Re: Initdb on Windows 2003

От
Дата:
Hi,

1. The command line passed is -D "c:\data" --user=McAfeePostgresUser
2. McAfeePostgresUser which is a local machine user with limited
privileges. Though this problem occurs with any user account you create
with non-administrator privileges.

Thanks
James

-----Original Message-----
From: Andrew Dunstan [mailto:andrew@dunslane.net]
Sent: 01 March 2006 13:27
To: Hughes, James
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Initdb on Windows 2003



1. please show the EXACT initdb command line used.

2. Which Windows user was actually running initdb?

cheers

andrew

> Hello all,
>
> Below is an email thread regarding a possible bug in PostgreSQL on
> Windows 2003. Any help or advice anyone can give on this would be much

> appreciated.
>
> All the best,
> James Hughes
>
> --- EMAIL THREAD FOLLOWS ---
>
> James_Hughes@McAfee.com wrote:
>> Hi Bruce,
>>
>> We are now seeing this issue on three machines, all of which are
>> running Windows 2003. After some looking at the code and putting some

>> extra debug output (very little) all we have determined is that
>> initdb.exe opens postgres.exe via pipes, and at some point within
>> postgres.exe this error is generated.
>>
>> If we knock out the check for the user being not being admin and run
>> initdb.exe as an administrator all works as expected. Adding the user

>> to the 'Power Users' group also causes the "Access Denined" error! I
>> don't believe that the access denined is anything to do with file
>> access or memory (shared) access as I ran some tools to see what
>> postgres.exe is trying to access.
>>
>> Is there an easy way on Windows to step-through the PostgreSQL code
>> as
>
>> it runs? Is there any other information I can provide which will help

>> you with this defect?
>>
>> Any help getting to the root of this problem is much appericated.
>>
>> All the best
>> James Hughes
>>
>> -----Original Message-----
>> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>> Sent: 24 February 2006 18:54
>> To: Hughes, James
>> Cc: pgsql-bugs@postgresql.org
>> Subject: Re: [BUGS] BUG #2268: initdb fails to initialize database
>> cluster with error "Access is denied"
>>
>>
>> Strange.  It isn't a typical error we see, and the fact you see it on

>> two machines is even stranger.  My guess is that somehow the
>> configuration on those two machines is the same and is causing the
>> failure.
>>
>> ---------------------------------------------------------------------
>> -
>> --
>> ---
>>
>> James Hughes wrote:
>> >
>> > The following bug has been logged online:
>> >
>> > Bug reference:      2268
>> > Logged by:          James Hughes
>> > Email address:      james_hughes@mcafee.com
>> > PostgreSQL version: 8.1.3
>> > Operating system:   Windows 2003 (Server)
>> > Description:        initdb fails to initialize database cluster
with
>> error
>> > "Access is denied"
>> > Details:
>> >
>> > When we try and initialize a database cluster using initdb.exe we
>> > are getting the following output.
>> >
>> > -- OUTPUT from dbinit.exe --
>> > The files belonging to this database system will be owned by user
>> "user1".
>> > This user must also own the server process.
>> >
>> > The database cluster will be initialized with locale English_United

>> > Kingdom.1252.
>> >
>> > creating directory c:/dataa ... ok
>> > creating directory c:/dataa/global ... ok creating directory
>> > c:/dataa/pg_xlog ... ok creating directory
>> > c:/dataa/pg_xlog/archive_status ... ok creating directory
>> > c:/dataa/pg_clog ... ok creating directory c:/dataa/pg_subtrans ...
>> > ok
>>
>> > creating directory c:/dataa/pg_twophase ... ok creating directory
>> > c:/dataa/pg_multixact/members ... ok creating directory
>> > c:/dataa/pg_multixact/offsets ... ok creating directory
>> > c:/dataa/base ... ok creating directory c:/dataa/base/1 ... ok
>> > creating directory c:/dataa/pg_tblspc ... ok selecting default
>> > max_connections ... Access
>>
>> > is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > 10
>> > selecting default shared_buffers ... Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > Access is denied.
>> > 50
>> > creating configuration files ... ok creating template1 database in
>> > c:/dataa/base/1 ... ok initializing pg_authid ... Access is denied.
>> > child process was terminated by signal 1
>> > initdb: removing data directory "c:/dataa"
>> >
>> > -- end: OUTPUT from dbinit.exe --
>> >
>> > user1 is a user without administrative rights. I have checked all
>> > the directories and the user has permissons to write to the data
>> > directory, and read other files it requires.
>> >
>> > I also tried the Windows installer (MSI) from pgFoundry. This too
>> > is
>
>> > having the same problem.
>> >
>> > We have two machines which this problem occurs on, one of which
>> > originally the initialization would work on. I have checked all the

>> > user rights asssignments, and even given the postgres user (user1
>> > in
>
>> > the above output from dbinit.exe) all user rights.
>> >
>> > ---------------------------(end of
>> > broadcast)---------------------------
>> > TIP 2: Don't 'kill -9' the postmaster
>> >
>>
>> --
>>   Bruce Momjian   http://candle.pha.pa.us
>>   SRA OSS, Inc.   http://www.sraoss.com
>>
>>   + If your life is a hard drive, Christ can be your backup. +
>>
>
> --
>  Bruce Momjian   http://candle.pha.pa.us
>  SRA OSS, Inc.   http://www.sraoss.com
>
>  + If your life is a hard drive, Christ can be your backup. +
>
>
>
>
>
>
> James Hughes
>
>
> ---------------------------(end of
> broadcast)--------------------------- TIP 6: explain analyze is your
> friend





Re: Initdb on Windows 2003

От
Tom Lane
Дата:
<James_Hughes@McAfee.com> writes:
> Below is an email thread regarding a possible bug in PostgreSQL on
> Windows 2003. Any help or advice anyone can give on this would be much
> appreciated.

"Access is denied." is not a string that appears anywhere in the
Postgres source code.  My bet is some overenthusiastic anti-virus
code is interfering with the install.
        regards, tom lane


Re: Initdb on Windows 2003

От
Andrew Dunstan
Дата:
(private email says leaving off --user=foo doesn't fix it ;-( )

Since you have apparently compiled your own, could you please try with 
the latest stable initdb.c code for your release? That is version 
1.99.2.2 for release 8.1 or 1.73.4.3 for release 8.0. They are 
downloadable here: 
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/initdb/initdb.c

Maybe there's something odd about your setup - we have a WS2k3 machine 
happily building and running on buildfarm: see
http://www.pgbuildfarm.org/cgi-bin/show_history.pl?nm=snake&br=REL8_1_STABLE

If it still doesn't work, you might get some useful info from initdb --debug

Thanks

andrew


James_Hughes@McAfee.com wrote:

>Hi,
>
>1. The command line passed is -D "c:\data" --user=McAfeePostgresUser
>2. McAfeePostgresUser which is a local machine user with limited
>privileges. Though this problem occurs with any user account you create
>with non-administrator privileges.
>
>Thanks
>James 
>
>-----Original Message-----
>From: Andrew Dunstan [mailto:andrew@dunslane.net] 
>Sent: 01 March 2006 13:27
>To: Hughes, James
>Cc: pgsql-hackers@postgresql.org
>Subject: Re: [HACKERS] Initdb on Windows 2003
>
>
>
>1. please show the EXACT initdb command line used.
>
>2. Which Windows user was actually running initdb?
>
>cheers
>
>andrew
>
>  
>
>>Hello all,
>>
>>Below is an email thread regarding a possible bug in PostgreSQL on 
>>Windows 2003. Any help or advice anyone can give on this would be much
>>    
>>
>
>  
>
>>appreciated.
>>
>>All the best,
>>James Hughes
>>
>>--- EMAIL THREAD FOLLOWS ---
>>
>>James_Hughes@McAfee.com wrote:
>>    
>>
>>>Hi Bruce,
>>>
>>>We are now seeing this issue on three machines, all of which are 
>>>running Windows 2003. After some looking at the code and putting some
>>>      
>>>
>
>  
>
>>>extra debug output (very little) all we have determined is that 
>>>initdb.exe opens postgres.exe via pipes, and at some point within 
>>>postgres.exe this error is generated.
>>>
>>>If we knock out the check for the user being not being admin and run 
>>>initdb.exe as an administrator all works as expected. Adding the user
>>>      
>>>
>
>  
>
>>>to the 'Power Users' group also causes the "Access Denined" error! I 
>>>don't believe that the access denined is anything to do with file 
>>>access or memory (shared) access as I ran some tools to see what 
>>>postgres.exe is trying to access.
>>>
>>>Is there an easy way on Windows to step-through the PostgreSQL code 
>>>as
>>>      
>>>
>>>it runs? Is there any other information I can provide which will help
>>>      
>>>
>
>  
>
>>>you with this defect?
>>>
>>>Any help getting to the root of this problem is much appericated.
>>>
>>>All the best
>>>James Hughes
>>>
>>>-----Original Message-----
>>>From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>>>Sent: 24 February 2006 18:54
>>>To: Hughes, James
>>>Cc: pgsql-bugs@postgresql.org
>>>Subject: Re: [BUGS] BUG #2268: initdb fails to initialize database 
>>>cluster with error "Access is denied"
>>>
>>>
>>>Strange.  It isn't a typical error we see, and the fact you see it on
>>>      
>>>
>
>  
>
>>>two machines is even stranger.  My guess is that somehow the 
>>>configuration on those two machines is the same and is causing the 
>>>failure.
>>>
>>>---------------------------------------------------------------------
>>>-
>>>--
>>>---
>>>
>>>James Hughes wrote:
>>>      
>>>
>>>>The following bug has been logged online:
>>>>
>>>>Bug reference:      2268
>>>>Logged by:          James Hughes
>>>>Email address:      james_hughes@mcafee.com
>>>>PostgreSQL version: 8.1.3
>>>>Operating system:   Windows 2003 (Server)
>>>>Description:        initdb fails to initialize database cluster
>>>>        
>>>>
>with
>  
>
>>>error
>>>      
>>>
>>>>"Access is denied"
>>>>Details:
>>>>
>>>>When we try and initialize a database cluster using initdb.exe we 
>>>>are getting the following output.
>>>>
>>>>-- OUTPUT from dbinit.exe --
>>>>The files belonging to this database system will be owned by user
>>>>        
>>>>
>>>"user1".
>>>      
>>>
>>>>This user must also own the server process.
>>>>
>>>>The database cluster will be initialized with locale English_United
>>>>        
>>>>
>
>  
>
>>>>Kingdom.1252.
>>>>
>>>>creating directory c:/dataa ... ok
>>>>creating directory c:/dataa/global ... ok creating directory 
>>>>c:/dataa/pg_xlog ... ok creating directory 
>>>>c:/dataa/pg_xlog/archive_status ... ok creating directory 
>>>>c:/dataa/pg_clog ... ok creating directory c:/dataa/pg_subtrans ...
>>>>ok
>>>>        
>>>>
>>>>creating directory c:/dataa/pg_twophase ... ok creating directory 
>>>>c:/dataa/pg_multixact/members ... ok creating directory 
>>>>c:/dataa/pg_multixact/offsets ... ok creating directory 
>>>>c:/dataa/base ... ok creating directory c:/dataa/base/1 ... ok 
>>>>creating directory c:/dataa/pg_tblspc ... ok selecting default 
>>>>max_connections ... Access
>>>>        
>>>>
>>>>is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>10
>>>>selecting default shared_buffers ... Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>50
>>>>creating configuration files ... ok creating template1 database in 
>>>>c:/dataa/base/1 ... ok initializing pg_authid ... Access is denied.
>>>>child process was terminated by signal 1
>>>>initdb: removing data directory "c:/dataa"
>>>>
>>>>-- end: OUTPUT from dbinit.exe --
>>>>
>>>>user1 is a user without administrative rights. I have checked all 
>>>>the directories and the user has permissons to write to the data 
>>>>directory, and read other files it requires.
>>>>
>>>>I also tried the Windows installer (MSI) from pgFoundry. This too 
>>>>is
>>>>        
>>>>
>>>>having the same problem.
>>>>
>>>>We have two machines which this problem occurs on, one of which 
>>>>originally the initialization would work on. I have checked all the
>>>>        
>>>>
>
>  
>
>>>>user rights asssignments, and even given the postgres user (user1 
>>>>in
>>>>        
>>>>
>>>>the above output from dbinit.exe) all user rights.
>>>>
>>>>---------------------------(end of
>>>>broadcast)---------------------------
>>>>TIP 2: Don't 'kill -9' the postmaster
>>>>
>>>>        
>>>>
>>>--
>>>  Bruce Momjian   http://candle.pha.pa.us
>>>  SRA OSS, Inc.   http://www.sraoss.com
>>>
>>>  + If your life is a hard drive, Christ can be your backup. +
>>>
>>>      
>>>
>>--
>> Bruce Momjian   http://candle.pha.pa.us
>> SRA OSS, Inc.   http://www.sraoss.com
>>
>> + If your life is a hard drive, Christ can be your backup. +
>>
>>
>>
>>
>>
>>
>>James Hughes
>>
>>
>>---------------------------(end of
>>broadcast)--------------------------- TIP 6: explain analyze is your 
>>friend
>>    
>>
>
>
>
>  
>



Re: Initdb on Windows 2003

От
Дата:
Thanks for the info, I shall indeed try this.

One thing to mention is that I don't think the error occurs within
initdb, it seams to be postgres.exe that dbinit starts.

Regards
James

-----Original Message-----
From: Andrew Dunstan [mailto:andrew@dunslane.net]
Sent: 01 March 2006 16:26
To: Hughes, James
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Initdb on Windows 2003


(private email says leaving off --user=foo doesn't fix it ;-( )

Since you have apparently compiled your own, could you please try with
the latest stable initdb.c code for your release? That is version
1.99.2.2 for release 8.1 or 1.73.4.3 for release 8.0. They are
downloadable here:
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/initdb/initdb.c

Maybe there's something odd about your setup - we have a WS2k3 machine
happily building and running on buildfarm: see
http://www.pgbuildfarm.org/cgi-bin/show_history.pl?nm=snake&br=REL8_1_ST
ABLE

If it still doesn't work, you might get some useful info from initdb
--debug

Thanks

andrew


James_Hughes@McAfee.com wrote:

>Hi,
>
>1. The command line passed is -D "c:\data" --user=McAfeePostgresUser 2.

>McAfeePostgresUser which is a local machine user with limited
>privileges. Though this problem occurs with any user account you create

>with non-administrator privileges.
>
>Thanks
>James
>
>-----Original Message-----
>From: Andrew Dunstan [mailto:andrew@dunslane.net]
>Sent: 01 March 2006 13:27
>To: Hughes, James
>Cc: pgsql-hackers@postgresql.org
>Subject: Re: [HACKERS] Initdb on Windows 2003
>
>
>
>1. please show the EXACT initdb command line used.
>
>2. Which Windows user was actually running initdb?
>
>cheers
>
>andrew
>
>
>
>>Hello all,
>>
>>Below is an email thread regarding a possible bug in PostgreSQL on
>>Windows 2003. Any help or advice anyone can give on this would be much
>>
>>
>
>
>
>>appreciated.
>>
>>All the best,
>>James Hughes
>>
>>--- EMAIL THREAD FOLLOWS ---
>>
>>James_Hughes@McAfee.com wrote:
>>
>>
>>>Hi Bruce,
>>>
>>>We are now seeing this issue on three machines, all of which are
>>>running Windows 2003. After some looking at the code and putting some
>>>
>>>
>
>
>
>>>extra debug output (very little) all we have determined is that
>>>initdb.exe opens postgres.exe via pipes, and at some point within
>>>postgres.exe this error is generated.
>>>
>>>If we knock out the check for the user being not being admin and run
>>>initdb.exe as an administrator all works as expected. Adding the user
>>>
>>>
>
>
>
>>>to the 'Power Users' group also causes the "Access Denined" error! I
>>>don't believe that the access denined is anything to do with file
>>>access or memory (shared) access as I ran some tools to see what
>>>postgres.exe is trying to access.
>>>
>>>Is there an easy way on Windows to step-through the PostgreSQL code
>>>as
>>>
>>>
>>>it runs? Is there any other information I can provide which will help
>>>
>>>
>
>
>
>>>you with this defect?
>>>
>>>Any help getting to the root of this problem is much appericated.
>>>
>>>All the best
>>>James Hughes
>>>
>>>-----Original Message-----
>>>From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>>>Sent: 24 February 2006 18:54
>>>To: Hughes, James
>>>Cc: pgsql-bugs@postgresql.org
>>>Subject: Re: [BUGS] BUG #2268: initdb fails to initialize database
>>>cluster with error "Access is denied"
>>>
>>>
>>>Strange.  It isn't a typical error we see, and the fact you see it on
>>>
>>>
>
>
>
>>>two machines is even stranger.  My guess is that somehow the
>>>configuration on those two machines is the same and is causing the
>>>failure.
>>>
>>>---------------------------------------------------------------------
>>>-
>>>--
>>>---
>>>
>>>James Hughes wrote:
>>>
>>>
>>>>The following bug has been logged online:
>>>>
>>>>Bug reference:      2268
>>>>Logged by:          James Hughes
>>>>Email address:      james_hughes@mcafee.com
>>>>PostgreSQL version: 8.1.3
>>>>Operating system:   Windows 2003 (Server)
>>>>Description:        initdb fails to initialize database cluster
>>>>
>>>>
>with
>
>
>>>error
>>>
>>>
>>>>"Access is denied"
>>>>Details:
>>>>
>>>>When we try and initialize a database cluster using initdb.exe we
>>>>are getting the following output.
>>>>
>>>>-- OUTPUT from dbinit.exe --
>>>>The files belonging to this database system will be owned by user
>>>>
>>>>
>>>"user1".
>>>
>>>
>>>>This user must also own the server process.
>>>>
>>>>The database cluster will be initialized with locale English_United
>>>>
>>>>
>
>
>
>>>>Kingdom.1252.
>>>>
>>>>creating directory c:/dataa ... ok
>>>>creating directory c:/dataa/global ... ok creating directory
>>>>c:/dataa/pg_xlog ... ok creating directory
>>>>c:/dataa/pg_xlog/archive_status ... ok creating directory
>>>>c:/dataa/pg_clog ... ok creating directory c:/dataa/pg_subtrans ...
>>>>ok
>>>>
>>>>
>>>>creating directory c:/dataa/pg_twophase ... ok creating directory
>>>>c:/dataa/pg_multixact/members ... ok creating directory
>>>>c:/dataa/pg_multixact/offsets ... ok creating directory
>>>>c:/dataa/base ... ok creating directory c:/dataa/base/1 ... ok
>>>>creating directory c:/dataa/pg_tblspc ... ok selecting default
>>>>max_connections ... Access
>>>>
>>>>
>>>>is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>10
>>>>selecting default shared_buffers ... Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>50
>>>>creating configuration files ... ok creating template1 database in
>>>>c:/dataa/base/1 ... ok initializing pg_authid ... Access is denied.
>>>>child process was terminated by signal 1
>>>>initdb: removing data directory "c:/dataa"
>>>>
>>>>-- end: OUTPUT from dbinit.exe --
>>>>
>>>>user1 is a user without administrative rights. I have checked all
>>>>the directories and the user has permissons to write to the data
>>>>directory, and read other files it requires.
>>>>
>>>>I also tried the Windows installer (MSI) from pgFoundry. This too is
>>>>
>>>>
>>>>having the same problem.
>>>>
>>>>We have two machines which this problem occurs on, one of which
>>>>originally the initialization would work on. I have checked all the
>>>>
>>>>
>
>
>
>>>>user rights asssignments, and even given the postgres user (user1
>>>>in
>>>>
>>>>
>>>>the above output from dbinit.exe) all user rights.
>>>>
>>>>---------------------------(end of
>>>>broadcast)---------------------------
>>>>TIP 2: Don't 'kill -9' the postmaster
>>>>
>>>>
>>>>
>>>--
>>>  Bruce Momjian   http://candle.pha.pa.us
>>>  SRA OSS, Inc.   http://www.sraoss.com
>>>
>>>  + If your life is a hard drive, Christ can be your backup. +
>>>
>>>
>>>
>>--
>> Bruce Momjian   http://candle.pha.pa.us
>> SRA OSS, Inc.   http://www.sraoss.com
>>
>> + If your life is a hard drive, Christ can be your backup. +
>>
>>
>>
>>
>>
>>
>>James Hughes
>>
>>
>>---------------------------(end of
>>broadcast)--------------------------- TIP 6: explain analyze is your
>>friend
>>
>>
>
>
>
>
>



Re: Initdb on Windows 2003

От
Дата:
All

I have determined what is causing the failure. It appears that the
stdout & stderr redirection to nul produces the "Access is Denied."
message. This is happening even if I type "dir >nul" at the command
prompt! I assume that this re-direction in PostgreSQL is done when
starting postgres.exe as to allow the communction between the two
processes?

I know this is not the correct place to ask my next question but maybe
there is a Windows expert out there :o) Does anyone have any idea how
Windows controls access to devices such as nul,comN, lpt1, etc? Or what
security setting governs this?

Thanks all for your help.

Regards
James

-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Hughes, James
Sent: 02 March 2006 07:51
To: andrew@dunslane.net
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Initdb on Windows 2003

Thanks for the info, I shall indeed try this.

One thing to mention is that I don't think the error occurs within
initdb, it seams to be postgres.exe that dbinit starts.

Regards
James

-----Original Message-----
From: Andrew Dunstan [mailto:andrew@dunslane.net]
Sent: 01 March 2006 16:26
To: Hughes, James
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Initdb on Windows 2003


(private email says leaving off --user=foo doesn't fix it ;-( )

Since you have apparently compiled your own, could you please try with
the latest stable initdb.c code for your release? That is version
1.99.2.2 for release 8.1 or 1.73.4.3 for release 8.0. They are
downloadable here:
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/initdb/initdb.c

Maybe there's something odd about your setup - we have a WS2k3 machine
happily building and running on buildfarm: see
http://www.pgbuildfarm.org/cgi-bin/show_history.pl?nm=snake&br=REL8_1_ST
ABLE

If it still doesn't work, you might get some useful info from initdb
--debug

Thanks

andrew


James_Hughes@McAfee.com wrote:

>Hi,
>
>1. The command line passed is -D "c:\data" --user=McAfeePostgresUser 2.

>McAfeePostgresUser which is a local machine user with limited
>privileges. Though this problem occurs with any user account you create

>with non-administrator privileges.
>
>Thanks
>James
>
>-----Original Message-----
>From: Andrew Dunstan [mailto:andrew@dunslane.net]
>Sent: 01 March 2006 13:27
>To: Hughes, James
>Cc: pgsql-hackers@postgresql.org
>Subject: Re: [HACKERS] Initdb on Windows 2003
>
>
>
>1. please show the EXACT initdb command line used.
>
>2. Which Windows user was actually running initdb?
>
>cheers
>
>andrew
>
>
>
>>Hello all,
>>
>>Below is an email thread regarding a possible bug in PostgreSQL on
>>Windows 2003. Any help or advice anyone can give on this would be much
>>
>>
>
>
>
>>appreciated.
>>
>>All the best,
>>James Hughes
>>
>>--- EMAIL THREAD FOLLOWS ---
>>
>>James_Hughes@McAfee.com wrote:
>>
>>
>>>Hi Bruce,
>>>
>>>We are now seeing this issue on three machines, all of which are
>>>running Windows 2003. After some looking at the code and putting some
>>>
>>>
>
>
>
>>>extra debug output (very little) all we have determined is that
>>>initdb.exe opens postgres.exe via pipes, and at some point within
>>>postgres.exe this error is generated.
>>>
>>>If we knock out the check for the user being not being admin and run
>>>initdb.exe as an administrator all works as expected. Adding the user
>>>
>>>
>
>
>
>>>to the 'Power Users' group also causes the "Access Denined" error! I
>>>don't believe that the access denined is anything to do with file
>>>access or memory (shared) access as I ran some tools to see what
>>>postgres.exe is trying to access.
>>>
>>>Is there an easy way on Windows to step-through the PostgreSQL code
>>>as
>>>
>>>
>>>it runs? Is there any other information I can provide which will help
>>>
>>>
>
>
>
>>>you with this defect?
>>>
>>>Any help getting to the root of this problem is much appericated.
>>>
>>>All the best
>>>James Hughes
>>>
>>>-----Original Message-----
>>>From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>>>Sent: 24 February 2006 18:54
>>>To: Hughes, James
>>>Cc: pgsql-bugs@postgresql.org
>>>Subject: Re: [BUGS] BUG #2268: initdb fails to initialize database
>>>cluster with error "Access is denied"
>>>
>>>
>>>Strange.  It isn't a typical error we see, and the fact you see it on
>>>
>>>
>
>
>
>>>two machines is even stranger.  My guess is that somehow the
>>>configuration on those two machines is the same and is causing the
>>>failure.
>>>
>>>---------------------------------------------------------------------
>>>-
>>>--
>>>---
>>>
>>>James Hughes wrote:
>>>
>>>
>>>>The following bug has been logged online:
>>>>
>>>>Bug reference:      2268
>>>>Logged by:          James Hughes
>>>>Email address:      james_hughes@mcafee.com
>>>>PostgreSQL version: 8.1.3
>>>>Operating system:   Windows 2003 (Server)
>>>>Description:        initdb fails to initialize database cluster
>>>>
>>>>
>with
>
>
>>>error
>>>
>>>
>>>>"Access is denied"
>>>>Details:
>>>>
>>>>When we try and initialize a database cluster using initdb.exe we
>>>>are getting the following output.
>>>>
>>>>-- OUTPUT from dbinit.exe --
>>>>The files belonging to this database system will be owned by user
>>>>
>>>>
>>>"user1".
>>>
>>>
>>>>This user must also own the server process.
>>>>
>>>>The database cluster will be initialized with locale English_United
>>>>
>>>>
>
>
>
>>>>Kingdom.1252.
>>>>
>>>>creating directory c:/dataa ... ok
>>>>creating directory c:/dataa/global ... ok creating directory
>>>>c:/dataa/pg_xlog ... ok creating directory
>>>>c:/dataa/pg_xlog/archive_status ... ok creating directory
>>>>c:/dataa/pg_clog ... ok creating directory c:/dataa/pg_subtrans ...
>>>>ok
>>>>
>>>>
>>>>creating directory c:/dataa/pg_twophase ... ok creating directory
>>>>c:/dataa/pg_multixact/members ... ok creating directory
>>>>c:/dataa/pg_multixact/offsets ... ok creating directory
>>>>c:/dataa/base ... ok creating directory c:/dataa/base/1 ... ok
>>>>creating directory c:/dataa/pg_tblspc ... ok selecting default
>>>>max_connections ... Access
>>>>
>>>>
>>>>is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>10
>>>>selecting default shared_buffers ... Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>Access is denied.
>>>>50
>>>>creating configuration files ... ok creating template1 database in
>>>>c:/dataa/base/1 ... ok initializing pg_authid ... Access is denied.
>>>>child process was terminated by signal 1
>>>>initdb: removing data directory "c:/dataa"
>>>>
>>>>-- end: OUTPUT from dbinit.exe --
>>>>
>>>>user1 is a user without administrative rights. I have checked all
>>>>the directories and the user has permissons to write to the data
>>>>directory, and read other files it requires.
>>>>
>>>>I also tried the Windows installer (MSI) from pgFoundry. This too is
>>>>
>>>>
>>>>having the same problem.
>>>>
>>>>We have two machines which this problem occurs on, one of which
>>>>originally the initialization would work on. I have checked all the
>>>>
>>>>
>
>
>
>>>>user rights asssignments, and even given the postgres user (user1
>>>>in
>>>>
>>>>
>>>>the above output from dbinit.exe) all user rights.
>>>>
>>>>---------------------------(end of
>>>>broadcast)---------------------------
>>>>TIP 2: Don't 'kill -9' the postmaster
>>>>
>>>>
>>>>
>>>--
>>>  Bruce Momjian   http://candle.pha.pa.us
>>>  SRA OSS, Inc.   http://www.sraoss.com
>>>
>>>  + If your life is a hard drive, Christ can be your backup. +
>>>
>>>
>>>
>>--
>> Bruce Momjian   http://candle.pha.pa.us
>> SRA OSS, Inc.   http://www.sraoss.com
>>
>> + If your life is a hard drive, Christ can be your backup. +
>>
>>
>>
>>
>>
>>
>>James Hughes
>>
>>
>>---------------------------(end of
>>broadcast)--------------------------- TIP 6: explain analyze is your
>>friend
>>
>>
>
>
>
>
>


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Re: Initdb on Windows 2003

От
"Magnus Hagander"
Дата:
> All
>
> I have determined what is causing the failure. It appears
> that the stdout & stderr redirection to nul produces the
> "Access is Denied."
> message. This is happening even if I type "dir >nul" at the
> command prompt! I assume that this re-direction in PostgreSQL
> is done when starting postgres.exe as to allow the
> communction between the two processes?
>
> I know this is not the correct place to ask my next question
> but maybe there is a Windows expert out there :o) Does anyone
> have any idea how Windows controls access to devices such as
> nul,comN, lpt1, etc? Or what security setting governs this?
>
> Thanks all for your help.

Wow, that's really interesting. Never heard of that one before.

Can you run filemon and/or regmon from sysinternals.com, and see exactly
what object it gets access denied on?

Oh, and did you try this without antivirus/antispyware/personalfirewall
as I beleive someone suggested? Same result, or different but still
broken?

//Magnus


Re: Initdb on Windows 2003

От
Дата:
I did run filemon but did not get anything from it :( Yes I disabled all
anti-virus software, no difference made.

Have raised a helpdesk ticket with Microsoft, see if they can shed any
light on the problem.

James

-----Original Message-----
From: Magnus Hagander [mailto:mha@sollentuna.net]
Sent: 03 March 2006 14:14
To: Hughes, James; andrew@dunslane.net
Cc: pgsql-hackers@postgresql.org
Subject: RE: [HACKERS] Initdb on Windows 2003

> All
>
> I have determined what is causing the failure. It appears that the
> stdout & stderr redirection to nul produces the "Access is Denied."
> message. This is happening even if I type "dir >nul" at the command
> prompt! I assume that this re-direction in PostgreSQL is done when
> starting postgres.exe as to allow the communction between the two
> processes?
>
> I know this is not the correct place to ask my next question but maybe

> there is a Windows expert out there :o) Does anyone have any idea how
> Windows controls access to devices such as nul,comN, lpt1, etc? Or
> what security setting governs this?
>
> Thanks all for your help.

Wow, that's really interesting. Never heard of that one before.

Can you run filemon and/or regmon from sysinternals.com, and see exactly
what object it gets access denied on?

Oh, and did you try this without antivirus/antispyware/personalfirewall
as I beleive someone suggested? Same result, or different but still
broken?

//Magnus


Re: Initdb on Windows 2003

От
"Magnus Hagander"
Дата:
> I did run filemon but did not get anything from it :( Yes I
> disabled all anti-virus software, no difference made.

Even more interesting. Do you have any other filter drivers that you
know of? SOme kind of quota stuff or so perhaps?

Oh, and if the bug is in the AV filter driver it's often not enough to
disable the AV - it has to be completely uninstalled. I've seen this
with several products wrt LSPs, and at least once with filterdrivers. So
that's also worth a try.


> Have raised a helpdesk ticket with Microsoft, see if they can
> shed any light on the problem.

Sounds good - since you can reproduce it with a simple commandline, they
should at least accept touching the case ;-)

//Magnus


Re: Initdb on Windows 2003

От
Andrew Dunstan
Дата:
Magnus Hagander wrote:

>
>  
>
>>Have raised a helpdesk ticket with Microsoft, see if they can 
>>shed any light on the problem.
>>    
>>
>
>Sounds good - since you can reproduce it with a simple commandline, they
>should at least accept touching the case ;-)
>
>  
>

In any case, since dir > nul fails, I think we can probably say it's Not 
Our Problem (tm).

We've used nul on Windows ever since initdb was written in C.

cheers

andrew


Re: Initdb on Windows 2003

От
Дата:
I think we can safely say that it is not :-)


-----Original Message-----
From: Andrew Dunstan [mailto:andrew@dunslane.net]
Sent: 03 March 2006 15:41
To: Magnus Hagander
Cc: Hughes, James; pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Initdb on Windows 2003

Magnus Hagander wrote:

>
>
>
>>Have raised a helpdesk ticket with Microsoft, see if they can shed any

>>light on the problem.
>>
>>
>
>Sounds good - since you can reproduce it with a simple commandline,
>they should at least accept touching the case ;-)
>
>
>

In any case, since dir > nul fails, I think we can probably say it's Not
Our Problem (tm).

We've used nul on Windows ever since initdb was written in C.

cheers

andrew


Re: Initdb on Windows 2003

От
Дата:
Just to let you guys know, I spoke to Microsoft and they confirmed that
they have restricted access to the 'nul' device in a security update (to
admin users). Not quite sure of the extact update! This is hardcoded in
the Windows source, so no way to change somthing via code :(

- James

-----Original Message-----
From: Magnus Hagander [mailto:mha@sollentuna.net]
Sent: 03 March 2006 15:18
To: Hughes, James; andrew@dunslane.net
Cc: pgsql-hackers@postgresql.org
Subject: RE: [HACKERS] Initdb on Windows 2003

> I did run filemon but did not get anything from it :( Yes I disabled
> all anti-virus software, no difference made.

Even more interesting. Do you have any other filter drivers that you
know of? SOme kind of quota stuff or so perhaps?

Oh, and if the bug is in the AV filter driver it's often not enough to
disable the AV - it has to be completely uninstalled. I've seen this
with several products wrt LSPs, and at least once with filterdrivers. So
that's also worth a try.


> Have raised a helpdesk ticket with Microsoft, see if they can shed any

> light on the problem.

Sounds good - since you can reproduce it with a simple commandline, they
should at least accept touching the case ;-)

//Magnus


Re: Initdb on Windows 2003

От
"Magnus Hagander"
Дата:
> Just to let you guys know, I spoke to Microsoft and they
> confirmed that they have restricted access to the 'nul'
> device in a security update (to admin users). Not quite sure
> of the extact update! This is hardcoded in
> the Windows source, so no way to change somthing via code :(

:-O

Do you have a reference to a Q article, or to which security update it
was changed in?

//Magnus



Re: Initdb on Windows 2003

От
Дата:
Not yet, have asked for that very information.

-James

-----Original Message-----
From: Magnus Hagander [mailto:mha@sollentuna.net]
Sent: 30 March 2006 09:27
To: Hughes, James; andrew@dunslane.net
Cc: pgsql-hackers@postgresql.org
Subject: RE: [HACKERS] Initdb on Windows 2003

> Just to let you guys know, I spoke to Microsoft and they confirmed
> that they have restricted access to the 'nul'
> device in a security update (to admin users). Not quite sure of the
> extact update! This is hardcoded in
> the Windows source, so no way to change somthing via code :(

:-O

Do you have a reference to a Q article, or to which security update it
was changed in?

//Magnus