Wind River Support Network

HomeDefectsLIN8-7120
Fixed

LIN8-7120 : User authentication problem with postgres

Created: Jul 13, 2017    Updated: Dec 3, 2018
Resolved Date: Jul 21, 2017
Found In Version: 8.0.0.15
Fix Version: 8.0.0.20
Severity: Severe
Applicable for: Wind River Linux 8
Component/s: Userspace

Description

It is not possible to connect to a PostgreSQL database via unixODBC with the existing package version combination on WRL8.

Below combination with different version of postgres and psqlodbc packages were tried:
1. Postgres 9.3.6 with PSQLODBC 9.01.200 --> Success
2. Postgres 9.3.6 with PSQLODBC 9.03.400 --> Failure
3. Postgres 9.4.4 with PSQLODBC 9.01.200 --> Success
4. Postgres 9.4.4 with PSQLODBC 9.03.400 --> Failure

We found the below link in open forums stating the same problem:
https://www.postgresql.org/message-id/flat/55A917AB.3010802%40lurcher.org#55A917AB.3010802@lurcher.org

Steps to Reproduce

$ configure --enable-board=intel-x86-64 \
    --enable-kernel=standard --enable-rootfs=glibc_std \
    --with-package=postgresql,psqlodbc,gdb \
    --enable-jobs=1 --enable-parallel-pkgbuilds=8 \
    --enable-rm-work=yes --enable-rm-oldimgs=yes \
    --enable-checkout-all-layers=yes --enable-reconfig \
    --enable-ccache=no --with-ccache-dir=/path/to/ccache \
    --with-sstate-dir=/path/to/sstate \
    --with-rcpl-version=0015

$ make fs

$ make start-target

---

Wind River Linux 8.0.0.15 qemu0 ttyS0

qemu0 login: root
Password: 

root@qemu0:~# grep postgres /etc/passwd
postgres:x:28:28:PostgreSQL Server:/var/lib/postgresql:/bin/bash

root@qemu0:~# rpm -qa | grep postgres
postgresql-timezone-9.4.4-r0.0.0.corei7_64
postgresql-9.4.4-r0.0.0.corei7_64

root@qemu0:~# rpm -qa | grep psqlodbc
psqlodbc-09.03.0400-r0.0.corei7_64

root@qemu0:~# ls /var
backups  cache	lib  local  lock  log  run  spool  tmp	volatile

root@qemu0:~# mkdir /var/data
root@qemu0:~# chmod 700 /var/data
root@qemu0:~# chown postgres:postgres /var/data
root@qemu0:~# ls -l /var
total 24
drwxr-xr-x  2 root     root     4096 Jul 12 16:42 backups
drwxr-xr-x  6 root     root     4096 Jul 12 18:38 cache
drwx------  2 postgres postgres 4096 Jul 13 14:16 data
drwxr-xr-x 17 root     root     4096 Jul 13 14:14 lib
drwxr-xr-x  2 root     root     4096 Jul 12 16:42 local
lrwxrwxrwx  1 root     root       11 Jul 12 18:37 lock -> ../run/lock
lrwxrwxrwx  1 root     root       12 Jul 12 18:38 log -> volatile/log
lrwxrwxrwx  1 root     root        6 Jul 12 18:37 run -> ../run
drwxr-xr-x  8 root     root     4096 Jul 12 18:38 spool
lrwxrwxrwx  1 root     root       12 Jul 12 18:37 tmp -> volatile/tmp
drwxrwxrwt  4 root     root       80 Jul 13 14:14 volatile

root@qemu0:~# vi odbc.ini 
root@qemu0:~# cat odbc.ini 
[default]
Description         = Postgres
Driver              = pgodbc
Trace               = Yes
TraceFile           =
Servername          = localhost
Database            = postgres
UserName            = postgres
Port                = 5432
Protocol            = 9.4
ReadOnly            = No
RowVersioning       = No
ShowSystemTables    = No
ShowOidColumn       = No
FakeOidIndex        = No
ConnSettings        =
UnknownSizes        = 2
Parse               = Yes

root@qemu0:~# vi odbcinst.ini 
root@qemu0:~# cat odbcinst.ini 
[ODBC]
Trace       = No
TraceFile   = /var/log/odbc_trace.log
Pooling     = Yes

[pgodbc]
Description = PostgreSQL ODBC driver for Linux
Driver64    = psqlodbca.so
CPTimeout   = 0

root@qemu0:~# cp odbc* /etc
root@qemu0:~# chmod 766 /etc/odbc*
root@qemu0:~# su postgres

postgres@qemu0:/root$ vi env.sh 
postgres@qemu0:/root$ cat env.sh 
export PGUSER=postgres
export PGDATABASE=postgres
export PGDATA=/var/data
export ODBCSYSINI=/etc
export ODBCINI=/etc/odbc.ini

postgres@qemu0:/root$ . env.sh 
postgres@qemu0:/root$ /usr/bin/pg_ctl -D /var/data/ initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /var/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... sh: locale: command not found
ok
No usable system locales were found.
Use the option "--debug" to see details.
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/bin/postgres -D /var/data
or
    /usr/bin/pg_ctl -D /var/data -l logfile start

postgres@qemu0:/root$ /usr/bin/postgres -D /var/data &
[1] 616
postgres@qemu0:/root$ LOG:  database system was shut down at 2017-07-13 14:20:43 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

postgres@qemu0:/root$ isql -v -3 default postgres postgres
[HY000][unixODBC]The database does not exist on the server
or user authentication failed.
[ISQL]ERROR: Could not SQLConnect

Other Downloads


Live chat
Online