FS#23858 - Postgresql rc.d script is broken

Attached to Project: Arch Linux
Opened by Jonathan (ThatJon) - Wednesday, 20 April 2011, 15:25 GMT
Last edited by Dan McGee (toofishes) - Saturday, 23 April 2011, 18:41 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Paul Mattal (paul)
Dan McGee (toofishes)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 6
Private No

Details

Description:
When postgresql is freshly installed, the postgres user account is set to have a shell of /sbin/nologin:
postgres:x:88:88:PostgreSQL user:/var/lib/postgres:/sbin/nologin
However, the script /etc/rc.d/postgresql tries to run the line
su - postgres -c "/usr/bin/initdb $INITOPTS -D $PGROOT/data"
This fails, with the error "This account is currently not available."

Additional info:
* Version: postgresql 9.0.4-1
* Broken in both i686 and x86_64

Steps to reproduce:

sudo pacman -S postgresql
sudo /etc/rc.d/postgresql start
This task depends upon

Closed by  Dan McGee (toofishes)
Saturday, 23 April 2011, 18:41 GMT
Reason for closing:  Fixed
Additional comments about closing:  postgresql-9.0.4-2
Comment by Joo Kia (Jookia) - Wednesday, 20 April 2011, 20:26 GMT
I can confirm this bug along with when removing it, it gives a "error: command failed to execute correctly" message.
Comment by Van Nguyen (kaizoku) - Thursday, 21 April 2011, 01:55 GMT
This is happening to me too, tried deleting /var/lib/postgres/
removing everything to do with postgres, reinstalling; it just won't work.
Comment by Haroldo Stenger (harovali) - Thursday, 21 April 2011, 06:20 GMT
This hit me by surprise too.
Hope its easy to solve and workaroud in the meanwhile.
Comment by Dan McGee (toofishes) - Thursday, 21 April 2011, 12:00 GMT
Whoops- I'll take a look at this and get a fix, sorry guys.
Comment by Dan McGee (toofishes) - Thursday, 21 April 2011, 13:25 GMT
Can someone check if changing the shell to "/bin/false" fixes the issue?
Comment by Haroldo Stenger (harovali) - Thursday, 21 April 2011, 13:50 GMT
--
Comment by Haroldo Stenger (harovali) - Thursday, 21 April 2011, 13:52 GMT
Dan, at least changing it to /bin/bash (which I've found convinient) , solves the issue, postgresql now starts fine.
Comment by pafa (pafa) - Friday, 22 April 2011, 00:27 GMT
Haroldo
oh, it not worked to me with "pg_ctl: could not start server
Examine the log output."
and "/bin/false" not worked too -__-
Comment by Haroldo Stenger (harovali) - Friday, 22 April 2011, 02:53 GMT
pafa, which postgresql version got installed in your system ? 9.0.3 or 9.0.4 ?
I think I saw the same error a while ago in a 9.0.3 postgresql .
I now did a pacman -Sy and a pacman -S extra/postgresql in another system of mine , and just by changing the shell of the postgres user , the database could start fine.
Try upgrading , or uninstalling and installing again, and tell me, please.

regards.
Comment by Imobach González Sosa (osoh) - Friday, 22 April 2011, 09:05 GMT
Hi

Changing the postgres' shell to /bin/bash worked for me. So it seems to be a problem with 'su' invocation, because if I changed the shell that way or if I add "-s /bin/sh" to all "su" invocations at /etc/rc.d/postgresql, it seems to work just fine.

Also, if I try something like: "su - postgres -c pwd" nothing happens, but it works if I do "su - postgres -c pwd -s /bin/sh".

I hope it helps.

Thank you!
Comment by Imobach González Sosa (osoh) - Friday, 22 April 2011, 09:08 GMT
Oh, I almost forgot: I've some Debian boxes and the postgres shell is just /bin/bash.

Regards.
Comment by pafa (pafa) - Friday, 22 April 2011, 10:10 GMT
Haroldo
I tried to start postgresql-9.0.4 after update all system
And yeah - i reinstalling DBMS a few times and it not helping :/
I think, in my case trouble in another thing... But where?
Comment by Greg (dolby) - Friday, 22 April 2011, 10:43 GMT
@pafa: If you have a problem configuring the application you can ask help from users in the forum or the mailing list. This bug tracker is not the place to chat about it.
Comment by pafa (pafa) - Friday, 22 April 2011, 12:51 GMT
Greg
Unfortunately, I can't configure the application until it started. I'm just trying to figure out how to solve this problem
Comment by Imobach González Sosa (osoh) - Friday, 22 April 2011, 17:38 GMT
@pafa: changing postgres' shell to '/bin/bash' doesn't work for you?
Comment by pafa (pafa) - Friday, 22 April 2011, 17:48 GMT
Imobach
Yes.
When i tried to start without change shell, i have:
"This account is currently not available."
But then, when i change it from "/sbin/nologin" to "/bin/bash", start failing with:
"pg_ctl: could not start server
Examine the log output."
I can't understand what i doing wrong
Comment by Imobach González Sosa (osoh) - Friday, 22 April 2011, 17:58 GMT
Ok, I suppose that you don't have any data yet, no? So, maybe you need to remove /var/lib/postgres/data directory (surely it's empty), because if this directory exists the script won't initialize de database.
After that, change the shell and try again.

If /var/lib/postgres/data doesn't exist and the shell is /bin/bash, it should work (at least, it works for me).

CAUTION: don't do that if you have some data on your PostgreSQL databases.

Good luck!
Comment by pafa (pafa) - Friday, 22 April 2011, 18:15 GMT
oh, thank you so much! ^_^
really, now server starting successfully!

thank for all for help :3
Comment by Dan McGee (toofishes) - Saturday, 23 April 2011, 18:17 GMT
For all affected by this bug, you will want to run the following:
sudo chsh -s /bin/bash postgres

Or wait for the new package to arrive, which will run this automatically if necessary.

Loading...