Re: [BUGS] BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
On 14 July 2012 05:56, Craig Ringer wrote: > On 07/14/2012 12:18 AM, Petros Tsialiamanis wrote: >> >> Thank you very much for your reply. > > Thanks for coming back and re-testing with a modern PostgreSQL. > > PostgreSQL 9.1 isn't compatible with databases from 8.3, so you can't > actually run Pg 9.1 directly against a datadir from 8.3; that's why I > suggested the latest 8.3 point release. > > However, your startup should be failing with a message telling you this, not > with a permissions error then (more importantly) a crash. > Sorry for the misunderstanding. When I said that I reproduced the error in 9.1 version, I mean that I created the PGDATA with 9.1 postgresql server as 'local system' user and after that I tried to start the postgresql server as 'pss-svc' user and I took the error message which I sent with my previous mail. So there isn't any incompatibility problem with PGDATA. > Is there any antivirus software on this computer? If so, what is it? Does > excluding the PostgreSQL data directory, PostgreSQL executable directory, > and (if the AV supports it) adding process exclusions for "postmaster.exe" > and "postgres.exe" have any effect? > There isn't any antivirus software on my computer. >> The 'pss-svc' user is member of the administrators group and has full >> permissions for PostgreSQL data directory. > > It clearly doesn't, because PostgreSQL is getting "permission denied" from > the OS when accessing global/pg_control. Maybe you need to apply permissions > recursively? As 'pss-svc' user I can open, read and write to the pg_control file ( I took backup of this file first ). I have exactly the same problem when I try to start progresql server as Administrator instead of 'pss-svc' user > > Remember that on Win7, membership of the Administrators group doesn't grant > the ability to perform file operations as administrator directly. It grants > the ability to create privileged processes that can then perform those > operations using implicit or explicit "run as administrator" functionality. > > I can't off the top of my head think of a safe way on Windows to test if a > file is writable as a given user without potentially changing its contents. > On Linux I'd say "run touch /path/name" but there's no touch command on > Windows. global\pg_control is a binary file so you can't just open it and > save it in notepad (DO NOT DO THIS) as it'll corrupt it hopelessly, and > Windows doesn't come with a binary-safe editor. > >> I reproduced the crash with PostgreSQL version 9.1.4.12152 with the >> following output : > > [snip] > >> LOCATION: _dosmaperr, .\src\port\win32error.c:186 >> PANIC: 42501: could not open control file "global/pg_control": >> Permission denied >> LOCATION: ReadControlFile, .\src\backend\access\transam\xlog.c:4687 >> >> This application has requested the Runtime to terminate it in an unusual >> way. >> Please contact the application's support team for more information. >> ** > > > OK, that's not very nice behaviour - it should be doing a clean exit after > it fails to read global/pg_control . Hmm. I'm not sure off the top of my > head how to tackle tracking that down without a debugger. I don't really > have time at the moment to set up a test environment under Windows and see > if I can reproduce it. > > Ideas anyone? Can someone with a Windows box use pg_ctl to try to start a > new Pg instance against a datadir with an unwritable pg_control ? > > -- > Craig Ringer -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
On 07/16/2012 07:54 PM, Petros Tsialiamanis wrote: Sorry for the misunderstanding. When I said that I reproduced the error in 9.1 version, I mean that I created the PGDATA with 9.1 postgresql server as 'local system' user and after that I tried to start the postgresql server as 'pss-svc' user and I took the error message which I sent with my previous mail. So there isn't any incompatibility problem with PGDATA. OK, that helps explain that. Thanks for following up with a current version, then. I have a Windows VM on this machine so I'll see if I can reproduce that issue. I need a bit more information to do so. Specifically I need to know how the user 'pss-svc' was created, what its group memberships are and what its rights are ("can interact with desktop", "login as service", etc). As 'pss-svc' user I can open, read and write to the pg_control file ( I took backup of this file first ). Open, read and write using what command(s) or programs? Is there a UAC prompt? Did you run the CACLS command you were given by John? I have exactly the same problem when I try to start progresql server as Administrator instead of 'pss-svc' user If 'pss-svc' user is a member of Administrators or Local Admins, remove the user from those groups. Pg is quite insistent about not being run as admin. That shouldn't be the cause of these issues, as it's quite explicit about it when that's the case, but it's a good idea anyway. Personally I think Pg should let this up to the user, but that's the way it is for now. -- Craig Ringer -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
Craig Ringer writes: > PostgreSQL 9.1 isn't compatible with databases from 8.3, so you can't > actually run Pg 9.1 directly against a datadir from 8.3; that's why I > suggested the latest 8.3 point release. > However, your startup should be failing with a message telling you this, > not with a permissions error then (more importantly) a crash. Well, the reason that's a PANIC is that ReadControlFile is coded that way: fd = BasicOpenFile(XLOG_CONTROL_FILE, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR); if (fd < 0) ereport(PANIC, (errcode_for_file_access(), errmsg("could not open control file \"%s\": %m", XLOG_CONTROL_FILE))); Perhaps it should be only FATAL instead, but that seems like a quibble. If it can't read pg_control, the server ain't starting. It is curious though that the OP gets this far, because the server would previously have tried to read PG_VERSION and postgresql.conf, which if it were a simple wrong-account problem should likewise have been unreadable. Your thought about AV software may be the right explanation. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
On 07/13/12 6:00 AM, tsial...@gmail.com wrote: PANIC: 42501: could not open control file "global/pg_control": Permission denied start a CMD prompt ('dos') via 'run as admin'. from this privileged command window, CACLS \path\to\pg\data /T /E /G pss-svc:(OI)(CI)F then try restarting postgres. LOCAL_SYSTEM created the files, and owns them. Oh, the pss-svc user should not be a member of Administrators. -- john r pierceN 37, W 122 santa cruz ca mid-left coast -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
On 07/14/2012 12:18 AM, Petros Tsialiamanis wrote: Thank you very much for your reply. Thanks for coming back and re-testing with a modern PostgreSQL. PostgreSQL 9.1 isn't compatible with databases from 8.3, so you can't actually run Pg 9.1 directly against a datadir from 8.3; that's why I suggested the latest 8.3 point release. However, your startup should be failing with a message telling you this, not with a permissions error then (more importantly) a crash. Is there any antivirus software on this computer? If so, what is it? Does excluding the PostgreSQL data directory, PostgreSQL executable directory, and (if the AV supports it) adding process exclusions for "postmaster.exe" and "postgres.exe" have any effect? The 'pss-svc' user is member of the administrators group and has full permissions for PostgreSQL data directory. It clearly doesn't, because PostgreSQL is getting "permission denied" from the OS when accessing global/pg_control. Maybe you need to apply permissions recursively? Remember that on Win7, membership of the Administrators group doesn't grant the ability to perform file operations as administrator directly. It grants the ability to create privileged processes that can then perform those operations using implicit or explicit "run as administrator" functionality. I can't off the top of my head think of a safe way on Windows to test if a file is writable as a given user without potentially changing its contents. On Linux I'd say "run touch /path/name" but there's no touch command on Windows. global\pg_control is a binary file so you can't just open it and save it in notepad (DO NOT DO THIS) as it'll corrupt it hopelessly, and Windows doesn't come with a binary-safe editor. I reproduced the crash with PostgreSQL version 9.1.4.12152 with the following output : [snip] LOCATION: _dosmaperr, .\src\port\win32error.c:186 PANIC: 42501: could not open control file "global/pg_control": Permission denied LOCATION: ReadControlFile, .\src\backend\access\transam\xlog.c:4687 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ** OK, that's not very nice behaviour - it should be doing a clean exit after it fails to read global/pg_control . Hmm. I'm not sure off the top of my head how to tackle tracking that down without a debugger. I don't really have time at the moment to set up a test environment under Windows and see if I can reproduce it. Ideas anyone? Can someone with a Windows box use pg_ctl to try to start a new Pg instance against a datadir with an unwritable pg_control ? -- Craig Ringer -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied
On 07/13/2012 09:00 PM, tsial...@gmail.com wrote: The following bug has been logged on the website: Bug reference: 6735 Logged by: Petros Tsialiamanis Email address: tsial...@gmail.com PostgreSQL version: 8.3.5 Operating system: WinXP Pro SP3 Description: Hi, The first time I started the postgresql server as 'Local System' user and I created the PGDATA. Now I am trying to start the postgresql server again as 'pss-svc' user which is member of Administrators group and I take the following error message (I've changed the debug log level) The server shouldn't crash at the end, but otherwise this is all misconfiguration of your system. If you change the service account, you need to change the permissions on the PostgreSQL data directory to match the new service account credentials. DEBUG: 0: mapped win32 error code 5 to 13 LOCATION: _dosmaperr, .\src\port\win32error.c:182 PANIC: 42501: could not open control file "global/pg_control": Permission denied LOCATION: ReadControlFile, .\src\backend\access\transam\xlog.c:3904 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. server starting I'm not sure why it's crashing here, but you're running such an ancient version that it's hard to care. If you can reproduce the crash with the latest 8.3 point release it might be worth a look. -- Craig Ringer -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs