# Problem with starting Postgresql90-server



## z0ran (May 6, 2011)

After I installed postgresql90-server, I tried to start it with 

```
#/usr/local/etc/rc.d/postgersql initdb
```

It was asking me for a "password"; I never set up any passwd, I tried user and root passwd but id didn't work. I also set in my /etc/rc.conf

```
postgresql_enable="YES"
```
 and reboot the system, and while it was booting up, it asked me again for password. Anyway, I have no idea what kind of password it is asking for. Any idea please, how can I start postgersql?

This is my /var/log/auth.log:


```
May  6 14:45:32 agni su: BAD SU agni to pgsql on /dev/pts/8
May  6 14:59:09 agni su: BAD SU root to pgsql on /dev/pts/2
```

I'm using FreeBSD-8.2-RELEASE amd64


----------



## SirDice (May 6, 2011)

Make sure the account "pgsql" exists. Also make sure you are root when you're starting postgresql.


----------



## z0ran (May 6, 2011)

SirDice said:
			
		

> Make sure the account "pgsql" exists. Also make sure you are root when you're starting postgresql.



This is in my /etc/passwd:

```
pgsql:*:70:70:PostgreSQL Daemon:/usr/local/pgsql:/bin/sh
```

and, after I type as root:


```
agni# /usr/local/etc/rc.d/postgresql start
Password:
```
or

```
agni# /usr/local/etc/rc.d/postgresql initdb
Password:
```

this is what I get, same thing happened if I do as user.


----------



## SirDice (May 6, 2011)

As root what happens if you do
`# su pgsql`

It should switch to the pgsql user without asking for a password. 
If it does ask for a password there's something wrong with the way su(1) is set up.


----------



## z0ran (May 6, 2011)

SirDice said:
			
		

> As root what happens if you do
> `# su pgsql`



Same thiong, it's asking for password.


```
su pgsql
Password:
```

I reinstalled also, but, same thing. Weird, I never did anything to change su.


----------



## SirDice (May 6, 2011)

Can you post the content of /etc/pam.d/su?


----------



## z0ran (May 6, 2011)

SirDice said:
			
		

> Can you post the content of /etc/pam.d/su?


 `# more /etc/pam.d/su`

```
# $FreeBSD: src/etc/pam.d/su,v 1.16.32.1.6.1 2010/12/21 17:09:25 kensmith Exp $
#
# PAM configuration for the "su" service
#

# auth
#auth           sufficient      pam_rootok.so           
#auth           sufficient      pam_self.so             
auth            requisite       pam_group.so            
auth            include         system

# account
account         include         system

# session
session         required        pam_permit.so
```


----------



## SirDice (May 6, 2011)

Hmm.. That looks distinctly different then mine:

```
#
# $FreeBSD: src/etc/pam.d/su,v 1.16.32.1 2009/08/03 08:13:06 kensmith Exp $
#
# PAM configuration for the "su" service
#

# auth
auth            sufficient      pam_rootok.so           no_warn
auth            sufficient      pam_self.so             no_warn
auth            requisite       pam_group.so            no_warn group=wheel root_only fail_safe
auth            include         system

# account
account         include         system

# session
session         required        pam_permit.so
```

Note the two remarks for pam_rootok.so and pam_self.so on yours.


----------



## z0ran (May 6, 2011)

Now, I'm going to change it, How that could happened? Anyway, thank you SirDice, I'm really grateful for your time.

After I changed /etc/pam.d/su everything is ok, it works!
Thanks again SirDice!


----------



## SirDice (May 7, 2011)

No idea how it could have happened. Perhaps a botched mergemaster run.

It was the missing pam_rootok(8) that caused the password question.


----------

