Last modified: 2014-08-31 03:10:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 70225 - Freshly installed wiki fails with "Permission denied" on PostgreSQL socket
Freshly installed wiki fails with "Permission denied" on PostgreSQL socket
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: postgres 69281
  Show dependency treegraph
Reported: 2014-08-31 00:59 UTC by Marcin Cieślak
Modified: 2014-08-31 03:10 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Marcin Cieślak 2014-08-31 00:59:54 UTC
After running:

php -c "${HOME}/php.ini"  maintenance/install.php --dbtype="postgres" --dbname=${db} \
	--dbuser=wikiuser --dbpass=${pass} \
	--installdbuser=*someuser* --installdbpass=*somepassword* \
	--server --scriptpath "${script}" \
	--showexceptions=true --pass test postgrestest WikiAdmin

a wiki installs fine, but the first invocation of /w/index.php gives:

(Cannot contact the database server: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running locally and accepting connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?)


#0 w/includes/db/Database.php(822): DatabasePostgres->open('', 'wikiuser', '*pass*', '*database*')
#1 w/includes/db/Database.php(919): DatabaseBase->__construct(Array)
#2 w/includes/db/LoadBalancer.php(717): DatabaseBase::factory('postgres', Array)
#3 w/includes/db/LoadBalancer.php(591): LoadBalancer->reallyOpenConnection(Array, false)
#4 w/includes/db/LoadBalancer.php(471): LoadBalancer->openConnection(0, false)
#5 w/includes/GlobalFunctions.php(3618): LoadBalancer->getConnection(-1, Array, false)
#6 w/includes/page/WikiPage.php(379): wfGetDB(-1)
#7 w/includes/page/WikiPage.php(462): WikiPage->loadPageData()
#8 w/includes/page/WikiPage.php(515): WikiPage->exists()
#9 w/includes/page/WikiPage.php(222): WikiPage->getContentModel()
#10 w/includes/page/WikiPage.php(208): WikiPage->getContentHandler()
#11 w/includes/actions/Action.php(96): WikiPage->getActionOverrides()
#12 w/includes/actions/Action.php(149): Action::factory('view', Object(WikiPage), Object(RequestContext))
#13 w/includes/MediaWiki.php(164): Action::getActionName(Object(RequestContext))
#14 w/includes/MediaWiki.php(533): MediaWiki->getAction()
#15 w/includes/MediaWiki.php(460): MediaWiki->main()
#16 w/index.php(46): MediaWiki->run()
#17 {main}

LocalSettings.php include:

 $wgDBtype = "postgres";
 $wgDBserver = "";
 $wgDBname = "*dbname*";

Running the installer with explicit --dbserver=localhost

php -c "${HOME}/php.ini"  maintenance/install.php --dbtype="postgres" --dbname=${db} \
	--dbuser=wikiuser --dbpass=${pass} \
	--dbserver=localhost \
	--installdbuser=*user* --installdbpass=*pass* \
	--server --scriptpath "${script}" \
	--showexceptions=true --pass test postgrestest WikiAdmin

Seems to create LocalSettings.php with

Now LocalSettings.php include:

 $wgDBtype = "postgres";
 $wgDBserver = "localhost";
 $wgDBname = "*dbname*";

which indicates this is probably another intstance of bug 69291
Comment 1 Marcin Cieślak 2014-08-31 01:25:39 UTC
... I mean "another instance of bug 69281"
Comment 2 Jeff Janes 2014-08-31 02:17:56 UTC
I agree that bugs 69281 and 70233 are relevant here.

Based on the error message, it is trying to connect to postgres through a local unix socket rather than a TCP socket, which is certainly to do possible.  But web servers are often prevented from doing that by selinux, private Temp Files, or some other security feature.

Rather than trying to fight those invisible train wrecks, I just don't even attempt to use local unix sockets.   (Which you weren't attempting to do, but only did accidentally through lack of defaults.)

To clarify, once you filled in "localhost", it then worked, right?
Comment 3 Marcin Cieślak 2014-08-31 02:25:35 UTC
Yes, it worked but... I am not using selinux (only FreeBSD) and socket-only connection works from the commandline.

I just reconfigured PostgreSQL to listen only on the socket connection and see how it works.
Comment 4 Marcin Cieślak 2014-08-31 02:35:43 UTC
So, with I61d5f262e60722bc08201b40b61a298d8af42223 (patch for bug 70030) and I0ded13f9f7a2ab93a070224e7448cda34ac83df1 (patch for bug 70223) the CLI installer runs just fine with empty value for the database servers and finishes its work generating LocalSettings.php with $wgDBserver = "";

WebInstaller fails with an error, however:

DB connection error: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running locally and accepting connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"
Comment 5 Marcin Cieślak 2014-08-31 03:10:48 UTC
Ah, nevermind... this was because webserver could not access the socket (directory permissions). I have changed the permissions and now everything works fine.

Note You need to log in before you can comment on or make changes to this bug.