diff mbox series

[bug#41786,2/2] doc: Explain how to use psql with peer authentication.

Message ID 20200728115836.23440-2-mail@ambrevar.xyz
State Accepted
Headers show
Series [bug#41786,1/2] services: postgresql: Provide postgresql commands. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Pierre Neidhardt July 28, 2020, 11:58 a.m. UTC
* doc/guix.texi (Database Services): Add example of shell commands to use psql
as  system user.  Also add troubleshooting tip when service fails to start
because of incompatible cluster.
---
 doc/guix.texi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Oleg Pykhalov July 28, 2020, 6:02 p.m. UTC | #1
Hi,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

[…]

> +@example
> +sudo -u postgres -s /bin/sh
> +createuser --interface
                ^^^^^^^^^
Rather “interactive”.

Otherwise LGTH.

Thanks,
Oleg.
Pierre Neidhardt Aug. 1, 2020, 10:03 a.m. UTC | #2
Merged in 1f0a41e95505c12af17c416651d70f18ea7c6a07, thanks!
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 74c7417174..aba3f925b9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17260,6 +17260,24 @@  The PostgreSQL daemon loads its runtime configuration from @var{config-file},
 creates a database cluster with @var{locale} as the default
 locale, stored in @var{data-directory}.  It then listens on @var{port}.
 
+If the services fails to start, it may be due to an incompatible
+cluster already present in @var{data-directory}.  Adjust it (or, if you
+don't need the cluster anymore, delete @var{data-directory}), then
+restart the service.
+
+Peer authentication is used by default and the @code{postgres} user
+account has no shell, which prevents the direct execution of @code{psql}
+commands as this user.  To use @code{psql}, you can temporarily log in
+as @code{postgres} using a shell, create a PostgreSQL superuser with the
+same name as one of the system users and then create the associated
+database.
+
+@example
+sudo -u postgres -s /bin/sh
+createuser --interface
+createdb $MY_USER_LOGIN      # Replace appropriately.
+@end example
+
 @cindex postgresql extension-packages
 Additional extensions are loaded from packages listed in
 @var{extension-packages}.  Extensions are available at runtime.  For instance,