Re: could not create lock file postmaster.pid: No such file or directory, but file does exist

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Rob Goethals / SNP *EXTERN*" <Rob(dot)Goethals(at)snp(dot)nl>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: could not create lock file postmaster.pid: No such file or directory, but file does exist
Date: 2014-02-17 11:42:24
Message-ID: A737B7A37273E048B164557ADEF4A58B17CA7E02@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Rob Goethals wrote:
> This is my first post to this list, so I hope I am posting it to the correct lists. But I am really
> stuck and getting pretty desperate at the moment.

You should not post to more than one list.

> This weekend my database crashed while importing some Openstreetmapdata and I can’t get it back to
> work again. It happened before and normally I would reset the WAL-dir with the pg_resetxlog command. I
> would loose some data but that would be all.

That is not a good idea. PostgreSQL should recover from a crash automatically.
If you run pg_resetxlog your database cluster is damaged, and all you should
do is pg_dump all the data you can, run initdb and import the data.

> This time it is somehow different because he doesn’t recognize any of the important files anymore. For
> example when I try to start Postgresql again with the command:
>
> /usr/lib/postgresql/9.1/bin/pg_ctl -D OSM/ start
>
> I get the following error:
>
> FATAL: could not create lock file "postmaster.pid": No such file or directory
>
> But when I do a ls –l on the directory I can see the file exists.
[...]
> -rwxr-xr-x 0 postgres postgres 88 Feb 17 08:58 postmaster.pid
>
> I cannot perform any action on the postmaster.pid file. I tried cp, mv and rm, but nothing works. Is
> there anything I can do to make the system recognize this file again? And get my database up and
> running? Or is all hopelessly lost?
>
> I have Postgresql 9.1 installed on Ubuntu 12.04.

What is the error message you get for cp, mv or rm?

Can you describe the crash of your machine in greater detail?
What was the cause?

One wild guess: could it be that the OS automatically remounted the file system
read-only because it encountered a problem? Check your /var/log/messages (I hope
the location is the same on Ubuntu and on RHEL).
In that case unmount, fsck and remount should solve the problem.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Rob Goethals / SNP 2014-02-17 13:42:17 Re: could not create lock file postmaster.pid: No such file or directory, but file does exist
Previous Message Rob Goethals / SNP 2014-02-17 11:07:01 could not create lock file postmaster.pid: No such file or directory, but file does exist

Browse pgsql-general by date

  From Date Subject
Next Message Jürgen Fuchsberger 2014-02-17 13:32:40 File system level backup of shut down standby does not work?
Previous Message Rob Goethals / SNP 2014-02-17 11:07:01 could not create lock file postmaster.pid: No such file or directory, but file does exist