Thread: Trouble running PostgreSQL server / Server must be started under certain locale.

Trouble running PostgreSQL server / Server must be started under certain locale.

From
"Geoff Ellingwood"
Date:
I'm in the process of getting Subversion and Trac running on my development machine.  So far, the installation process has gone fairly smoothly, until I had to install the Subversion bindings for Python.  Because I run Ubuntu, and Ubuntu did not have the latest bindings in its repositories, I had to get it from the Debian archives instead.  Well, after doing this, the PostgreSQL server is now refusing to start.

The following error message is given:
neppyman@loki:~$ sudo /etc/init.d/postgresql-8.1 start
 * Starting PostgreSQL 8.1 database server
 * Error: The server must be started under the locale en_US.UTF-8 which does not exist any more.

Checking my locales tels me...

neppyman@loki:~$ locale -a
(snip)
en_US.utf8

Obviously there's a mismatch there, but I'm still learning Linux, so I don't really know how to fix it.  I've tried uninstalling and reinstalling the locales package, but that didn't help.

Any help would be appreciated; I have quite a bit of data in my 8.1 cluster (active phpBB, etc.), and while I could upgrade to 8.2 or even the 8.3 beta, I don't know how I would be able to migrate a database if the postmaster process is unable to start.

-- Geoff

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
Richard Huxton
Date:
Geoff Ellingwood wrote:
> I'm in the process of getting Subversion and Trac running on my development
> machine.  So far, the installation process has gone fairly smoothly, until I
> had to install the Subversion bindings for Python.  Because I run Ubuntu,
> and Ubuntu did not have the latest bindings in its repositories, I had to
> get it from the Debian archives instead.  Well, after doing this, the
> PostgreSQL server is now refusing to start.

If you're not familiar with your system, you really are better off
staying with the packages your distribution supports.

> The following error message is given:
> neppyman@loki:~$ sudo /etc/init.d/postgresql-8.1 start
>  * Starting PostgreSQL 8.1 database server
>  * Error: The server must be started under the locale en_US.UTF-8 which does
> not exist any more.
>
> Checking my locales tels me...
>
> neppyman@loki:~$ locale -a
> (snip)
> en_US.utf8
>
> Obviously there's a mismatch there, but I'm still learning Linux, so I don't
> really know how to fix it.  I've tried uninstalling and reinstalling the
> locales package, but that didn't help.

Presumably it's getting the locale details from the wrong repository
(Debian unstable, I guess you're using). Did you agree to install a
whole bunch of other packages when you were trying to sort out this
Python thing?

> Any help would be appreciated; I have quite a bit of data in my 8.1 cluster
> (active phpBB, etc.), and while I could upgrade to 8.2 or even the 8.3 beta,
> I don't know how I would be able to migrate a database if the postmaster
> process is unable to start.

Step 1 is to make sure you have a backup of your database directory.
That's *everything* in .../pgsql/data (or wherever). You're going to
have to get the database running again and dump it.

Step 2 will be to revert the locale packages (at least). I'd actually
recommend going back to a completely "clean" system and staring again
unless you're clear what's gone wrong.

You'll need to read this and figure out exactly what changes you've made
first.
   http://www.debian.org/doc/manuals/apt-howto/
Sections 3.8/9/10 are probably the most important, but read the lot
before doing anything.

Best bet for help then is an ubuntu/debian list, but as long as you've
got backups you'll be OK.

--
   Richard Huxton
   Archonet Ltd

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
"Geoff Ellingwood"
Date:
On Dec 19, 2007 7:40 AM, Richard Huxton <dev@archonet.com> wrote:
Geoff Ellingwood wrote:
> Any help would be appreciated; I have quite a bit of data in my 8.1 cluster
> (active phpBB, etc.), and while I could upgrade to 8.2 or even the 8.3 beta,
> I don't know how I would be able to migrate a database if the postmaster
> process is unable to start.

Step 1 is to make sure you have a backup of your database directory.
That's *everything* in .../pgsql/data (or wherever). You're going to
have to get the database running again and dump it.

Step 2 will be to revert the locale packages (at least). I'd actually
recommend going back to a completely "clean" system and staring again
unless you're clear what's gone wrong.

You'll need to read this and figure out exactly what changes you've made
first.
  http://www.debian.org/doc/manuals/apt-howto/
Sections 3.8/9/10 are probably the most important, but read the lot
before doing anything.

Best bet for help then is an ubuntu/debian list, but as long as you've
got backups you'll be OK.

I think my best bet is going to be to nuke my 8.1 installation from orbit (after making a backup of the cluster directory) and let Ubuntu configure it correctly with whatever locale managed to squeeze itself into my system.  When I was fiddling with it last night, I did manage to get a copy of 8.2 up and running, but I knew that I couldn't just copy 8.1's data directory over top of 8.2's.

So, what are tips for completely removing 8.1 after I've made my backups?  Will "apt-get remove -purge" be sufficient, or am I going to need to track down individual binaries and config files as well?

-- Geoff

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
Richard Huxton
Date:
Geoff Ellingwood wrote:
>
> I think my best bet is going to be to nuke my 8.1 installation from orbit
> (after making a backup of the cluster directory) and let Ubuntu configure it
> correctly with whatever locale managed to squeeze itself into my system.

That's not the problem, the problem is that the locale for all your data
has changed. You need to get the original locale back *then* get PG
running and pg_dump your databases. Once you have dumps you can do what
you like with the locales and restore your dumps.

The problem is that any sorting (e.g. all your indexes) are only valid
for a given locale and its sorting rules. You no longer have the locale
for the database installed. You probably have an identical one with a
slightly different name, but there's no way the system will know that.

Get your system back to "pure" Ubuntu and work forward from there.

Alternatively, you might be able to do something with a live-cd, but
that'll be fiddly and if you can't immediately see how that might be
made to work, I'd concentrate on reversing the non-Ubuntu packages out
of your system.

--
   Richard Huxton
   Archonet Ltd

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
Olmec Sinclair
Date:
Richard, did you ever get this issue sorted?

I have encountered a similar situation that came about when I upgraded to postgres 8.3. Now it won't start stating that:

The server must be started under the locale : which does not exist any more

(it looks like the locale is set to {blank} ???)

Not sure what I should do here. Removing mostprest to an older version might be the way to go?

--

Olmec Sinclair

Director Innovation and Communication

021 586 664
0508 50 51 50

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
"Andrej Ricnik-Bay"
Date:
On 27/02/2008, Olmec Sinclair <olmec@cleanweb.co.nz> wrote:
Hi Olmec,

>  I have encountered a similar situation that came about when I
> upgraded to postgres 8.3. Now it won't start stating that:

>  The server must be started under the locale : which does not
> exist any more
>
>  (it looks like the locale is set to {blank} ???)
>
>  Not sure what I should do here. Removing mostprest to an older version
> might be the way to go?
That was Richards suggestion for Geoff who had the
problem.  What OS are you running PostgreSQL on?


> Olmec Sinclair
Cheers,
Andrej


--
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
"Andrej Ricnik-Bay"
Date:
On 28/02/2008, Olmec Sinclair <olmec@cleanweb.co.nz> wrote:
Hello again!

And please remember to hit reply-to-all so everyone on the
list sees what you're saying.  Also please note that top-posting
is frowned upon here. :)

>  I am running postgres on Ubuntu 7.10 (recent convert from windows) and I
> think my previous version of postgresql was 8.2

>  Last night I un installed 8.3 and reinstalled 8.2 but now I can't get that
> to start.... so I'm not making much progress. The problem is I don't really
> know what I am doing :)
By which means did you do the installation/un-install of both versions?
What data-directory is/was which version using?



>  I am learning slowly though.
>
>  Olmec
Cheers from sunny Wellington,
Andrej

--
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
Olmec Sinclair
Date:
Andrej,

Thanks for the tips (should I post this in a different way?)

Anyway, I uninstalled and installed using the ubuntu package manager. I tried again this morning - removing 8.2 and then reinstalling 8.2 again... still won't start.

I'm sure I can work through this (I seem to remember having a starting issue before) but the data locale thing is a worry.

Cheers (from Christchurch)

Olmec

Andrej Ricnik-Bay wrote:
On 28/02/2008, Olmec Sinclair <olmec@cleanweb.co.nz> wrote:
Hello again!

And please remember to hit reply-to-all so everyone on the
list sees what you're saying.  Also please note that top-posting
is frowned upon here. :)
 
 I am running postgres on Ubuntu 7.10 (recent convert from windows) and I
think my previous version of postgresql was 8.2   
 
 Last night I un installed 8.3 and reinstalled 8.2 but now I can't get that
to start.... so I'm not making much progress. The problem is I don't really
know what I am doing :)   
By which means did you do the installation/un-install of both versions?
What data-directory is/was which version using?


 
 I am learning slowly though.
Olmec   
Cheers from sunny Wellington,
Andrej
 

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
"Andrej Ricnik-Bay"
Date:
On 28/02/2008, Olmec Sinclair <olmec@cleanweb.co.nz> wrote:
>  Anyway, I uninstalled and installed using the ubuntu package manager. I
> tried again this morning - removing 8.2 and then reinstalling 8.2 again...
> still won't start.
Are you seeing any error messages?  W/o more detail it's impossible
to even start trying to support you.
What does /var/log/postgresql/postgresql-8.2-main.log say?

>  I'm sure I can work through this (I seem to remember having a starting
> issue before) but the data locale thing is a worry.
That, too, is indeed.  Now ... gutsy doesn't have 8.3 officially yet
(I don't think).  What other repositories did you tie in with your apt?


>  Cheers (from Christchurch)
>
>  Olmec
Cheers,
Andrej

Re: Trouble running PostgreSQL server / Server must be started under certain locale.

From
cgastrell@gmail.com
Date:
Have you guys tried this? Solved a lot of problems for me running
ubuntu... may be not permanent, but enough to get it running and get a
dump... just maybe

http://blog.andrewbeacock.com/2007/01/how-to-change-your-default-locale-on.html