postgresql-service error checking wtf

  • Done
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • Ludovic Courtès
  • Glenn Morris
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal
D
D
Danny Milosavljevic wrote on 10 Feb 2016 20:01
(address . submit@debbugs.gnu.org)
20160210200143.4a9f95c2@scratchpost.org
Package: postgresql

When I first configure operating-system with postgresql-service with default config file, then run

guix system reconfigure config.scm,

then configure operating-system with postgresql-service with custom config file, then run

guix system reconfigure config.scm,

I get:

---
initdb: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".
making '/gnu/store/byn534fg4agm0vv9szl5kkfl19n080b2-system' the current system...
Installation finished. No error reported.
----

Postgresql doesn't run and the error message still references the default config file.
G
G
Glenn Morris wrote on 11 Feb 2016 00:11
control message for bug 22619
(address . control@debbugs.gnu.org)
E1aTdv5-0003YK-6I@fencepost.gnu.org
reassign 22619 guix
G
G
Glenn Morris wrote on 11 Feb 2016 00:12
Re: bug#22619: postgresql-service error checking wtf
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 22619@debbugs.gnu.org)
uioabob1o8.fsf@fencepost.gnu.org
Danny Milosavljevic wrote:

Toggle quote (2 lines)
> Package: postgresql

There's no postgresql package on debbugs.gnu.org, so your report
went to the help-debbugs mailing list.

From the rest of your report, I'm guessing this should have been
assigned to guix, so I did that.

Toggle quote (24 lines)
> When I first configure operating-system with postgresql-service with
> default config file, then run
>
> guix system reconfigure config.scm,
>
> then configure operating-system with postgresql-service with custom
> config file, then run
>
> guix system reconfigure config.scm,
>
> I get:
>
> ---
> initdb: directory "/var/lib/postgresql/data" exists but is not empty
> If you want to create a new database system, either remove or empty
> the directory "/var/lib/postgresql/data" or run initdb
> with an argument other than "/var/lib/postgresql/data".
> making '/gnu/store/byn534fg4agm0vv9szl5kkfl19n080b2-system' the
> current system...
> Installation finished. No error reported.
> ----
>
> Postgresql doesn't run and the error message still references the
> default config file.
L
L
Ludovic Courtès wrote on 12 Feb 2016 15:14
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 22619@debbugs.gnu.org)
8760xu10e3.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (10 lines)
> initdb: directory "/var/lib/postgresql/data" exists but is not empty
> If you want to create a new database system, either remove or empty
> the directory "/var/lib/postgresql/data" or run initdb
> with an argument other than "/var/lib/postgresql/data".
> making '/gnu/store/byn534fg4agm0vv9szl5kkfl19n080b2-system' the current system...
> Installation finished. No error reported.
> ----
>
> Postgresql doesn't run

I’m not familiar with PostgreSQL, but perhaps you just need to do what
the message above says?

I’ve tested ‘postgresql-service’ in a pristine system with ‘guix system
vm’ and it starts without any such message. So I guess there’s stale
data in /var/lib/postgresql/data on your system?

Toggle quote (2 lines)
> and the error message still references the default config file.

I don’t see any references to a config file in what you pasted.

HTH,
Ludo’.
L
L
Ludovic Courtès wrote on 12 Feb 2016 15:14
(name . Glenn Morris)(address . rgm@gnu.org)
871t8i10d8.fsf@gnu.org
Glenn Morris <rgm@gnu.org> skribis:

Toggle quote (6 lines)
> There's no postgresql package on debbugs.gnu.org, so your report
> went to the help-debbugs mailing list.
>
>>From the rest of your report, I'm guessing this should have been
> assigned to guix, so I did that.

Indeed, thanks Glenn!

Ludo’.
L
L
Ludovic Courtès wrote on 12 Feb 2016 15:15
control message for bug #22619
(address . control@debbugs.gnu.org)
87ziv6ypzl.fsf@gnu.org
tags 22619 moreinfo
D
D
Danny Milosavljevic wrote on 12 Feb 2016 20:48
Re: bug#22619: postgresql-service error checking wtf
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 22619@debbugs.gnu.org)
20160212204858.56275e93@scratchpost.org
Hi,

I've found out some more details. The message
Toggle quote (5 lines)
> > initdb: directory "/var/lib/postgresql/data" exists but is not empty
> > If you want to create a new database system, either remove or empty
> > the directory "/var/lib/postgresql/data" or run initdb
> > with an argument other than "/var/lib/postgresql/data".

is not an error for the entire service. It's initdb refusing to clobber the existing database (which has been created by the postgresql-service instance with no #:config-file argument) and helpful in preventing data loss.

The actual problem only arises because guix reconfigure doesn't deem a change in service arguments as reason to restart (or reconfigure) a service.

I.e. before, my config was:

(postgresql-service )

Then I did guix reconfigure ...

Afterwards, I changed the config to:

(postgresql-service #:config-file ...)

Then I did giux reconfigure # this erroneously doesn't reload the postgres service!!

Toggle quote (4 lines)
> > and the error message still references the default config file.
>
> I don’t see any references to a config file in what you pasted.

In the postgres-service definition in guix/gnu/services/databases.scm , there's a %default-postgres-config . That's what I meant.
At all times, the default config file was printed in the log - which was because the postgres service never actually was reconfigured.

Toggle quote (2 lines)
>I’ve tested ‘postgresql-service’ in a pristine system with ‘guix system vm’ and it starts without any such message. So I guess there’s stale data in /var/lib/postgresql/data on your system?

It was left over from the first unsuccessful launch because bug# 22618 hadn't been fixed at the time.

Thanks,
Danny
L
L
Ludovic Courtès wrote on 21 Feb 2016 12:38
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 22619-done@debbugs.gnu.org)
87wppyxpic.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (14 lines)
> The actual problem only arises because guix reconfigure doesn't deem a change in service arguments as reason to restart (or reconfigure) a service.
>
> I.e. before, my config was:
>
> (postgresql-service )
>
> Then I did guix reconfigure ...
>
> Afterwards, I changed the config to:
>
> (postgresql-service #:config-file ...)
>
> Then I did giux reconfigure # this erroneously doesn't reload the postgres service!!

Yes, this is a known limitation: http://bugs.gnu.org/22039.

Currently, for services that are safe to be restarted, the solution is
to explicitly stop them beforehand, in which case the new service gets
started by ‘guix system reconfigure’:

# herd stop postgresql
# guix system reconfigure new-config.scm

I’m closing this bug. Let me know if anything else is amiss.

Thanks,
Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 22619@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 22619
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch