Re: could not create lock file postmaster.pid: No such file or directory, but file does exist - Mailing list pgsql-general

From Albe Laurenz
Subject Re: could not create lock file postmaster.pid: No such file or directory, but file does exist
Date
Msg-id A737B7A37273E048B164557ADEF4A58B17CA7E02@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to could not create lock file postmaster.pid: No such file or directory, but file does exist  (Rob Goethals / SNP <Rob.Goethals@snp.nl>)
List 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

pgsql-general by date:

Previous
From: Rob Goethals / SNP
Date:
Subject: could not create lock file postmaster.pid: No such file or directory, but file does exist
Next
From: Jürgen Fuchsberger
Date:
Subject: File system level backup of shut down standby does not work?