postgres failed to start from services manager on windows 2008 r2

Started by PHANIKUMAR Gover 9 years ago7 messagesgeneral
Jump to latest
#1PHANIKUMAR G
phanikumar.gm@gmail.com

hi,

We are able to start the postgres from command line without any issue,
if postgres is registered as windows service and tried to start it, we are
facing an issue .

*Problem:*

We have registered postgres(version 9.3.4) as windows service on windows
2008 R2 and registration got succeeded.

we are performing below 2 commands to register postgres as windows service

*<fullpath>pg_ctl.exe register -N "prostgresService" -D
"fullpath_to_data_directory" -W*

*>sc description prostgresService "prostgresService Applicatio*
*n Server Database Service"*

when we try to start the service from services manager(services.msc) it is
failing and popping up below message

*"The prostgres service on Local Computer started and then stopped. Some
services stop automatically if they are not in use by other services or
programs "*

postgres does not even create log and its directory pg_log in pgsql\data
directory.

windows event log has a message

*The description for Event ID 0 from source PostgreSQL cannot be found.
Either the component that raises this event is not installed on your local
computer or the installation is corrupted. You can install or repair the
component on the local computer.*

*If the event originated on another computer, the display information had
to be saved with the event.*

*The following information was included with the event: *

*Timed out waiting for server startup*

could you please help us how to start, we are clueless since postgres is
not creating log except windows event log.

thanks in advance
Phani Kumar

#2Michael Paquier
michael@paquier.xyz
In reply to: PHANIKUMAR G (#1)
Re: postgres failed to start from services manager on windows 2008 r2

On Mon, Sep 26, 2016 at 4:01 PM, PHANIKUMAR G <phanikumar.gm@gmail.com> wrote:

We have registered postgres(version 9.3.4) as windows service on windows
2008 R2 and registration got succeeded.

Just a random thought: do you have ASLR enabled in this build (from
where is this build)? You can check that easily using dumpbin /headers
and by looking for "Dynamic base". Also, you could redirect the logs
to pg_log by modifying manually postgresql.conf before starting it.
This would provide more information regarding why postgres is not
running.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3PHANIKUMAR G
phanikumar.gm@gmail.com
In reply to: PHANIKUMAR G (#1)
Re: postgres failed to start from services manager on windows 2008 r2

Hi,
Please help me on this issue, postgresql is failing to start from Windows
services manager.

Below is the scenario we performed.

Verified services manager that postgresql service was registered and failed
to start.

We tried to start the service manually and observed the following.

a. fail to start the postgresql service.

b. found that pg_log directory is not created under data directory.

c. found that "log on as" type as "Local System account"

We then tried to start the service with the following changes.

a. we changed the "Log on as" type to "This account"

b. changed the account name to ".\<local account with admin
privileges>"

c. And entered the password for this account and saved.

After that we are able to start the postgresql service successfully.

Found that the pg_log directory is created under data directory with
postgres-Sep.log

Why it is failing with local system account, the local system account is
part of administrators group. If we specifically provide credentials to the
service as explained above, service getting started. Please help me to
understand what is causing.

Best regards
Phani Kumar

On Sep 26, 2016 12:31 PM, "PHANIKUMAR G" <phanikumar.gm@gmail.com> wrote:

Show quoted text

hi,

We are able to start the postgres from command line without any issue,
if postgres is registered as windows service and tried to start it, we are
facing an issue .

*Problem:*

We have registered postgres(version 9.3.4) as windows service on windows
2008 R2 and registration got succeeded.

we are performing below 2 commands to register postgres as windows service

*<fullpath>pg_ctl.exe register -N "prostgresService" -D
"fullpath_to_data_directory" -W*

*>sc description prostgresService "prostgresService Applicatio*
*n Server Database Service"*

when we try to start the service from services manager(services.msc) it is
failing and popping up below message

*"The prostgres service on Local Computer started and then stopped. Some
services stop automatically if they are not in use by other services or
programs "*

postgres does not even create log and its directory pg_log in pgsql\data
directory.

windows event log has a message

*The description for Event ID 0 from source PostgreSQL cannot be found.
Either the component that raises this event is not installed on your local
computer or the installation is corrupted. You can install or repair the
component on the local computer.*

*If the event originated on another computer, the display information had
to be saved with the event.*

*The following information was included with the event: *

*Timed out waiting for server startup*

could you please help us how to start, we are clueless since postgres is
not creating log except windows event log.

thanks in advance
Phani Kumar

#4Thomas Kellerer
spam_eater@gmx.net
In reply to: PHANIKUMAR G (#3)
Re: postgres failed to start from services manager on windows 2008 r2

PHANIKUMAR G schrieb am 01.10.2016 um 17:30:

We then tried to start the service with the following changes.

a. we changed the "Log on as" type to "This account"
b. changed the account name to ".\<local account with admin privileges>"
c. And entered the password for this account and saved.

After that we are able to start the postgresql service successfully.

Found that the pg_log directory is created under data directory with postgres-Sep.log

Why it is failing with local system account, the local system account
is part of administrators group. If we specifically provide
credentials to the service as explained above, service getting
started. Please help me to understand what is causing.

Where is the data directory? And how did you create the data directory?

Check the privileges on the data directory.
This sounds as if the local system account does not have the privilege to write to the data directory.

The local system account (or "Administrator") don't have the privilege to read and write all files.
Those accounts only have the ability to give themselves these privileges.

Also: if I'm not mistaken, Postgres 9.3 creates the service with the "Local Network Service", not with "Local System Account"

So how did you create the initial service?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5PHANIKUMAR G
phanikumar.gm@gmail.com
In reply to: Thomas Kellerer (#4)
Re: postgres failed to start from services manager on windows 2008 r2

hi,
thanks for your reply. we use postgres zip, during install time of our
product, on target host this zip will be extracted. We are not creating
data directory, when service is started by default data directory will be
created.

we created/registered the service with below commands

*<fullpath>pg_ctl.exe register -N "prostgresService" -D
"fullpath_to_data_directory" -W*

*>sc description prostgresService "prostgresService Applicatio*
*n Server Database Service"*

On Sat, Oct 1, 2016 at 9:36 PM, Thomas Kellerer <spam_eater@gmx.net> wrote:

Show quoted text

PHANIKUMAR G schrieb am 01.10.2016 um 17:30:

We then tried to start the service with the following changes.

a. we changed the "Log on as" type to "This account"
b. changed the account name to ".\<local account with admin
privileges>"
c. And entered the password for this account and saved.

After that we are able to start the postgresql service successfully.

Found that the pg_log directory is created under data directory with
postgres-Sep.log

Why it is failing with local system account, the local system account
is part of administrators group. If we specifically provide
credentials to the service as explained above, service getting
started. Please help me to understand what is causing.

Where is the data directory? And how did you create the data directory?

Check the privileges on the data directory.
This sounds as if the local system account does not have the privilege to
write to the data directory.

The local system account (or "Administrator") don't have the privilege to
read and write all files.
Those accounts only have the ability to give themselves these privileges.

Also: if I'm not mistaken, Postgres 9.3 creates the service with the
"Local Network Service", not with "Local System Account"

So how did you create the initial service?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#6PHANIKUMAR G
phanikumar.gm@gmail.com
In reply to: PHANIKUMAR G (#5)
Re: postgres failed to start from services manager on windows 2008 r2

hi Thomas,

thanks for your reply. small correction for my previous reply, we use
postgresql zip and bundle with our products installer, during install time
of our product, on target host this zip will be extracted. Data directory
is under pgsql along with bin and other directories.

we created/registered the service with below commands. And could you
please tell me how to create postgres service with "Local Network Service"

*<fullpath>pg_ctl.exe register -N "prostgresService" -D
"fullpath_to_data_directory" -W*

*>sc description prostgresService "prostgresService Applicatio*
*n Server Database Service"*

On Wed, Oct 5, 2016 at 4:04 PM, PHANIKUMAR G <phanikumar.gm@gmail.com>
wrote:

Show quoted text

hi,
thanks for your reply. we use postgres zip, during install time of our
product, on target host this zip will be extracted. We are not creating
data directory, when service is started by default data directory will be
created.

we created/registered the service with below commands

*<fullpath>pg_ctl.exe register -N "prostgresService" -D
"fullpath_to_data_directory" -W*

*>sc description prostgresService "prostgresService Applicatio*
*n Server Database Service"*

On Sat, Oct 1, 2016 at 9:36 PM, Thomas Kellerer <spam_eater@gmx.net>
wrote:

PHANIKUMAR G schrieb am 01.10.2016 um 17:30:

We then tried to start the service with the following changes.

a. we changed the "Log on as" type to "This account"
b. changed the account name to ".\<local account with admin
privileges>"
c. And entered the password for this account and saved.

After that we are able to start the postgresql service successfully.

Found that the pg_log directory is created under data directory with
postgres-Sep.log

Why it is failing with local system account, the local system account
is part of administrators group. If we specifically provide
credentials to the service as explained above, service getting
started. Please help me to understand what is causing.

Where is the data directory? And how did you create the data directory?

Check the privileges on the data directory.
This sounds as if the local system account does not have the privilege to
write to the data directory.

The local system account (or "Administrator") don't have the privilege to
read and write all files.
Those accounts only have the ability to give themselves these privileges.

Also: if I'm not mistaken, Postgres 9.3 creates the service with the
"Local Network Service", not with "Local System Account"

So how did you create the initial service?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7PHANIKUMAR G
phanikumar.gm@gmail.com
In reply to: PHANIKUMAR G (#6)
Re: postgres failed to start from services manager on windows 2008 r2

Please let me know if any other details required, I'm still struck at same
place.

On Oct 6, 2016 12:07 PM, "PHANIKUMAR G" <phanikumar.gm@gmail.com> wrote:

Show quoted text

hi Thomas,

thanks for your reply. small correction for my previous reply, we use
postgresql zip and bundle with our products installer, during install time
of our product, on target host this zip will be extracted. Data directory
is under pgsql along with bin and other directories.

we created/registered the service with below commands. And could you
please tell me how to create postgres service with "Local Network Service"

*<fullpath>pg_ctl.exe register -N "prostgresService" -D
"fullpath_to_data_directory" -W*

*>sc description prostgresService "prostgresService Applicatio*
*n Server Database Service"*

On Wed, Oct 5, 2016 at 4:04 PM, PHANIKUMAR G <phanikumar.gm@gmail.com>
wrote:

hi,
thanks for your reply. we use postgres zip, during install time of our
product, on target host this zip will be extracted. We are not creating
data directory, when service is started by default data directory will be
created.

we created/registered the service with below commands

*<fullpath>pg_ctl.exe register -N "prostgresService" -D
"fullpath_to_data_directory" -W*

*>sc description prostgresService "prostgresService Applicatio*
*n Server Database Service"*

On Sat, Oct 1, 2016 at 9:36 PM, Thomas Kellerer <spam_eater@gmx.net>
wrote:

PHANIKUMAR G schrieb am 01.10.2016 um 17:30:

We then tried to start the service with the following changes.

a. we changed the "Log on as" type to "This account"
b. changed the account name to ".\<local account with admin
privileges>"
c. And entered the password for this account and saved.

After that we are able to start the postgresql service successfully.

Found that the pg_log directory is created under data directory with
postgres-Sep.log

Why it is failing with local system account, the local system account
is part of administrators group. If we specifically provide
credentials to the service as explained above, service getting
started. Please help me to understand what is causing.

Where is the data directory? And how did you create the data directory?

Check the privileges on the data directory.
This sounds as if the local system account does not have the privilege
to write to the data directory.

The local system account (or "Administrator") don't have the privilege
to read and write all files.
Those accounts only have the ability to give themselves these privileges.

Also: if I'm not mistaken, Postgres 9.3 creates the service with the
"Local Network Service", not with "Local System Account"

So how did you create the initial service?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general