Re: BUG #18671: Unable to Run PostgreSQL on EndeavourOS without Modifying visudo

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: rq_(at)tutanota(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18671: Unable to Run PostgreSQL on EndeavourOS without Modifying visudo
Date: 2024-10-24 15:31:54
Message-ID: CAKFQuwYTk0jSE1GdjE78jvDC0WUcpUMwDCX6iS_C4X04XBG1XQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 24, 2024 at 7:54 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18671
> Logged by: rqbin
> Email address: rq_(at)tutanota(dot)com
> PostgreSQL version: 16.3
> Operating system: EndeavourOS (Arch Distro)
> Description:
>
>
> 1. Installed PostgreSQL via `pacman`:
> ```bash
> sudo pacman -S postgresql
> ```
>
> 2. Tried to initialize the PostgreSQL database:
> ```bash
> sudo su - postgres
> initdb --locale=C.UTF-8 --encoding=UTF8 -D '/var/lib/postgres/data'
> ```
>

It does seem a bit odd that the packager wouldn't initialize an initial
cluster; most of them do. The need to initdb here is surprising. But, if
you do manually run initdb then either the directory you specify for PGDATA
must exist OR the parent directory (here, /var/lib/postgres) must exist and
the user you are running initdb as must be permitted to create directories
in that location. It is unclear what the case here may be but at the end
of the day the OS administrator is responsible for ensuring an appropriate
environment exists for initdb to successfully initialize a cluster in the
PGDATA (-D) directory. That likely will require sudo and running mkdir and
chown commands. Then the postgres user can run initdb using the newly
created directory owned by them for PGDATA.

> If this issue is specific to EndeavourOS or PostgreSQL on Arch-based
> systems, it would be helpful to identify and address the root cause to
> improve the experience for future users.
>

I suppose they may be looking here but the core project doesn't accept
responsibility for the products the various and sundry packagers that exist
produce.

In any case I cannot read what you've provided and conclude there is a bug
rather than a mis-application of necessary administrative tasks. I also do
not have access to the necessary environment in which to experiment.
Others here may, though again reporting this to the provider of the pacman
package directly is more likely to find someone able to experiment and, if
there really is a bug, fix things.

For certain, visudo is not the only way to make it so the postgres OS user
can run initdb. But if you want to put things in places only root can
write to then involving root will be necessary to establish areas within
its domain that postgres can administer, thus precluding the need to
empower postgres to operate within the root-restricted areas.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-10-24 18:35:12 BUG #18672: failing to link postgresql
Previous Message PG Bug reporting form 2024-10-24 14:30:35 BUG #18671: Unable to Run PostgreSQL on EndeavourOS without Modifying visudo