Problem with postgresql configuration on Fedora 18

Max Pyziur pyz at brama.com
Wed May 15 12:10:25 UTC 2013


On Wed, 15 May 2013, Roger wrote:

> I am hoping someone can talk me through a postgresql problem on my Fedora 18 
> box.
> Have a Rails 4 app working with sqlite and mysql but need to have it in 
> postgres so that I can use it with Heroku.
> Had postgres working in Fedora 16 several months ago for my first Heroku test 
> application.
>
> Am now using Fedora 18 for everything but having a problem with apache 
> mysteriously failing with Drupal,(written about some weeks ago) so am moving 
> to Ruby 2 and Rails 4 which uses WEBrick on dev and test.
>
> Has latest Fedora 18  updates, (PostgreSQL) 9.2.4 is installed and 
> accessible.
> Sudo -u postgres psql  accesses postgres  \du shows users:  admin, postgres 
> and home_user.
>
> In a user terminal  I enter psql and get psql: FATAL:  role "Home_user" does 
> not exist. psql -Uadmin gives: psql: FATAL:  Peer authentication failed for 
> user "admin".  psql postgres gives:psql: FATAL:  role "Home_user" does not 
> exist
>
> Why is psql attempting login as my Fedora username?

Unless you specify the name of the database, it will accept your user 
loginas the database.

>From a command-line prompt
psql -l
gives you a list of databases

psql SomeDatabaseName
gets you into the psql monitor providing you have privileges to access 
that particular database.

How did you move from your previous installation of postgresql? Did you do 
a pg_dumpall as the postgres user?

Did you restore as the postgres user?

Do you have all of the same users on your F18 machine as you did on your 
previous one?

Is "admin" a user on this machine?

When doing psql -U admin
and not specifying a database the default is to accept the specified user 
(admin here).

Those are some of my first questions.

Max Pyziur
pyz at brama.com


> There's also a strange error when I successfully log in as sudo -u postgres 
> psql: - could not change directory to "/home/Home_user"l.
>
> As root, my experimental /var/lib/pgsql/data/pg_hba.conf contains:
> # TYPE  DATABASE        USER            ADDRESS METHOD
> # "local" is for Unix domain socket connections only
> local   all             all trust
> # IPv4 local connections:
> host    all             all             127.0.0.1/32 trust
> # IPv6 local connections:
> host    all             all             ::1/128 trust
> # Allow replication connections from localhost, by a user with the 
> replication privilege.
> local   all             127.0.0.1/32 trust
> #host    replication     postgres        127.0.0.1/32            md5
> #host    replication     postgres        ::1/128                md5
>
> sudo systemctl start postgresql.service gives no notice that it has started 
> psql
> ps aux |grep psql shows Home_user   5734  0.0  0.0 109180   872 pts/0    S+ 
> 21:10   0:00 grep --color=auto psql it seems to be finding the fedors user 
> login.
>
> I have tried peer, trust, ident and md5.
> I see there is #host    replication     @default_username@ 127.0.0.1/32 
> @authmethodhost@ in the /usr/share/pgsql/pg_hba.conf. I don't know whether 
> psql uses both this and the above pg_hba.conf. Have tried switching off one 
> then the other and having both onn but psql still fails.
> I do not know which configuration makes it seek the default Fedora username 
> as a login.
>
>
> ps aux |grep postgres shows:
> postgres  1378  0.0  0.3 224528  7540 ?        S    17:29   0:00 
> /usr/bin/postgres -D /var/lib/pgsql/data -p 5432
> postgres  1492  0.0  0.0 190808   948 ?        Ss   17:29   0:00 postgres: 
> logger process
> postgres  1570  0.0  0.0 224628  1808 ?        Ss   17:29   0:00 postgres: 
> checkpointer process
> postgres  1571  0.0  0.0 224528  1328 ?        Ss   17:29   0:00 postgres: 
> writer process
> postgres  1572  0.0  0.0 224528  1096 ?        Ss   17:29   0:00 postgres: 
> wal writer process
> postgres  1573  0.0  0.1 225348  2404 ?        Ss   17:29   0:00 postgres: 
> autovacuum launcher process
> postgres  1574  0.0  0.0 193036  1216 ?        Ss   17:29   0:00 postgres: 
> stats collector process
> Home_user   5756  0.0  0.0 109184   880 pts/0    S+   21:12   0:00 grep 
> --color=auto postgres
>
> So it seems postgres is started but why the last line shows Home_user I'm at 
> a loss to understand.

ps picks that up because you're grepping for the word postgres

> I have rebooted, restarted apache and postgres and now have no clue where to 
> look next.
> I am wondering whether the possible fault I am experiencing in apache may be 
> causing the postgres problem because of the browser on 127.0.0.1.
> I have no problem browsing the web and watching tuts on RoR24
> Very puzzling and I'd love to understand what it is that I'm not seeing and 
> how the problem can be fixed.
>
> Thank you in advance
> Roger
>
>
>


More information about the users mailing list