Обсуждение: BUG #6140: PostgreSQL Server Service Not Starting

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

BUG #6140: PostgreSQL Server Service Not Starting

От
"Steve Boyd"
Дата:
The following bug has been logged online:

Bug reference:      6140
Logged by:          Steve Boyd
Email address:      sboyd67@yahoo.com
PostgreSQL version: 8.3.12
Operating system:   Windows Server 2003 R2 SP2
Description:        PostgreSQL Server Service Not Starting
Details:

Good morning!

I've searched through the bug archives but can't seem to find an answer to
this issue.  We have version 8.3.12 installed and the PostgreSQL server
service is trying to start but doesn't. I receive the following message when
I click on the service:

"The PostgreSQL Server 8.3 service on Local Computer started then stopped.
Some services stop automatically if they have no work to do, for example,
the Performance Logs and Alerts service."

I've checked the PostgreSQL logs and there is nothing there.  The last log
entry was in May.  I've checked the windows event viewer and get the
following error message:

"could not open process token:  error code 5"

The service account is in the local administrators group and has full
control over the data directory.  Not sure what has changed.  I even
re-entered the password to confirm that the "logon as a service right" was
granted.

 I was going to try to upgrade to 8.3.15 but since pgdumpall won't work if
the service is not running, that's not an option.

Not sure where else to look.  Any help is appreciated.

Best regards,

Steve

Re: BUG #6140: PostgreSQL Server Service Not Starting

От
Craig Ringer
Дата:
On 2/08/2011 8:01 PM, Steve Boyd wrote:

> "could not open process token:  error code 5"
>
> The service account is in the local administrators group and has full
> control over the data directory.

AFAIK PostgreSQL service account should *NOT* be part of the local
administrators group.

That said, the fact that it fails so ungracefully is definitely a bug
that bears investigation.

> Not sure what has changed.  I even
> re-entered the password to confirm that the "logon as a service right" was
> granted.

The service account won't have been created as a local admin originally,
so something has been changed.

>   I was going to try to upgrade to 8.3.15 but since pgdumpall won't work if
> the service is not running, that's not an option.

If you can't get it working normally, one option you have is to copy the
datadir to a normal user account (or change its permissions), then run
an instance of PostgreSQL against it manually under that user account
using pg_ctl - rather than launching it as a service under the service
account.

That'll at least get you a running instance to dump.

Given the state of the system, be sure to delete the postgres service
account after uninstalling 8.3 and before updating.

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088     Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

Re: BUG #6140: PostgreSQL Server Service Not Starting

От
Craig Ringer
Дата:
On 3/08/2011 9:23 PM, Steven Boyd wrote:
> Craig,
> Good morning!
> Working in IT, I understand how hard it is to troubleshoot an issue
> with an incomplete picture.  I wanted to tell you that your suggestion
> worked!  I removed the postgres account from the local administrators
> group, restarted the VM and the service started (I had to re-enter the
> service account password so the account could be given the "logon as a
> service" right).  So we'll see where things go from there.  I really
> appreciate your suggestion and it might be something that you can put
> in the manuals.
>

Glad to hear it worked.

It's not so much something that should be documented, as something that
should give a useful error message when it happens, or should handle the
error and start correctly.

Adding additional rights should *NOT* cause the Pg service to fail. If
it's decided that it should for security reasons, a conf flag should be
available to allow those who genuinely feel they need the added privs to
enable them. A useful error should be emitted.

That said, I find developing on Windows to be a lot like a dentist visit
without anesthetic, so I'm not going to be stepping up to implement it
;-) .

>


POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088     Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

Re: BUG #6140: PostgreSQL Server Service Not Starting

От
Craig Ringer
Дата:
On 3/08/2011 7:20 AM, Craig Ringer wrote:
> On 2/08/2011 8:01 PM, Steve Boyd wrote:
>
>> "could not open process token: error code 5"
>>
>> The service account is in the local administrators group and has full
>> control over the data directory.
>
> AFAIK PostgreSQL service account should *NOT* be part of the local
> administrators group.
>
> That said, the fact that it fails so ungracefully is definitely a bug
> that bears investigation.

An on-list follow-up:

Removing the Pg service account from local admins resolved Steve's problem.

Pg should really fail more gracefully and informatively - or not fail to
launch at all - in this case. It involves Win32 API programming, though....

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088     Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/