Last modified: 2014-09-11 00:22:38 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T72314, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70314 - Enabling role mobilefrontend causes puppet run failures
Enabling role mobilefrontend causes puppet run failures
Status: RESOLVED FIXED
Product: MediaWiki-Vagrant
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: High normal
: ---
Assigned To: Bryan Davis
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-03 00:02 UTC by Yuri Astrakhan
Modified: 2014-09-11 00:22 UTC (History)
3 users (show)

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


Attachments

Description Yuri Astrakhan 2014-09-03 00:02:19 UTC
Windows 8.1, af0c7963d12dcfb6c4a9cffb198d8ce5685c3617

http://pastebin.com/peUi27SE

Stderr from the command:

stdin: is not a tty
Error: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]: Failed to call refresh: /usr/local/bin/multiversion
-install mobilewiki admin --dbname mobilewiki --dbpass vagrant --dbuser root --pass vagrant --scriptpath /w --server http://mobile.wiki.loca
l.wmftest.net:8080 --confpath /vagrant/settings.d/wikis/mobilewiki
 returned 1 instead of one of [0]
Error: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]: /usr/local/bin/multiversion-install mobilewiki admi
n --dbname mobilewiki --dbpass vagrant --dbuser root --pass vagrant --scriptpath /w --server http://mobile.wiki.local.wmftest.net:8080 --con
fpath /vagrant/settings.d/wikis/mobilewiki
 returned 1 instead of one of [0]
Error: ruby2.0 -- /usr/local/bin/bundle install --path '.gem' returned 5 instead of one of [0]
Error: /Stage[main]/Role::Mobilefrontend/Mediawiki::Extension[MobileFrontend]/Browsertests::Bundle[MobileFrontend_browsertests_bundle]/Ruby:
:Bundle[MobileFrontend_browsertests_bundle]/Exec[bundle_install_MobileFrontend_browsertests_bundle]/returns: change from notrun to 0 failed:
 ruby2.0 -- /usr/local/bin/bundle install --path '.gem' returned 5 instead of one of [0]
Comment 1 Bryan Davis 2014-09-03 00:15:12 UTC
From your paste it looks like you have some bad MW database setup code from somewhere: 

==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns: A database query error has occurred.
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns: Query: INSERT INTO `updatelog`
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns:  SELECT 'filearchive-fa_major_mime-patch-fa_major_mime-chemical.sql' AS ul_key, null as ul_value
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns:  UNION SELECT 'image-img_major_mime-patch-img_major_mime-chemical.sql', null
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns:  UNION SELECT 'oldimage-oi_major_mime-patch-oi_major_mime-chemical.sql', null
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns:  UNION SELECT 'user_groups-ug_group-patch-ug_group-length-increase-255.sql', null
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns:  UNION SELECT 'user_former_groups-ufg_group-patch-ufg_group-length-increase-255.sql', null
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns:  UNION SELECT 'user_properties-up_property-patch-up_property.sql', null
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns:
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns: Function: DatabaseBase::sourceFile( /vagrant/mediawiki/maintenance/update-keys.sql )
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns: Error: 1062 Duplicate entry 'filearchive-fa_major_mime-patch-fa_major_mime-chemical.sql' for key 'PRIMARY' ()
Comment 2 Yuri Astrakhan 2014-09-09 05:20:32 UTC
http://pastebin.com/g47qTxAT

Fresh machine rebuild - still fails. I listed all the enabled roles at the end.
Comment 3 Yuri Astrakhan 2014-09-09 08:28:24 UTC
Tried disabling vector skin just in case - http://pastebin.com/2RmrnnC2
Comment 4 Bryan Davis 2014-09-09 15:00:37 UTC
(In reply to Yuri Astrakhan from comment #2)
> http://pastebin.com/g47qTxAT
> 
> Fresh machine rebuild - still fails. I listed all the enabled roles at the
> end.

Your latest error output paste still has the errors from Exec[mobilewiki_setup] failing. I had a very similar problem recently on updating an existing VM and it turned out to be caused by a LocalSettings.php file from settings.d/wikis/*/ (in my case "wiki", in your case "mobile") having been deleted at some point. For me the cause for this was bug 50912. I had updated my mediawiki clone and not noticed that there was a merge conflict before I ran `vagrant provision`.

There are 3 ways to fix this:
* `vagrant destroy -f; vagrant up` to rebuild everything from scratch
* Drop the mobile database in the vm so that it is recreated cleanly.
* Copy the LocalSettings.php file from any other wiki into your settings.d/wikis/mobile directory. It turns out that the per-wiki LocalSettings.php file is not actually used for anything except controlling whether or not puppet tries to run the setup scripts to create the wiki or not. The LocalSettings.php file in your mediawiki checkout is the only one that is sourced at runtime and should be a copy of settings.d/wikis/wiki/LocalSettings.php.
Comment 5 Bryan Davis 2014-09-09 22:40:29 UTC
Steps to reproduce:

* vagrant destroy -f
* vagrant reset-roles
* vagrant git-update
* vagrant up
* vagrant enable-role mobilefrontend
* vagrant provision

Failure is from the mobilewiki install itself. The installer fails claiming that the database already exists.
Comment 6 Bryan Davis 2014-09-09 22:45:10 UTC
Immediately following puppet run that show creating the wiki as failing:

$ mysql -e 'show databases;'
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mobilewiki         |
| mysql              |
| performance_schema |
| wiki               |
+--------------------+

/vagrant/settings.d/wikis/mobilewiki/LocalSettings.php also exists and http://mobile.wiki.local.wmftest.net:8080/wiki/Special:Version responds with expected mobile skin content.

Is puppet failure a false negative somehow? Investigating further.
Comment 7 Bryan Davis 2014-09-09 22:58:31 UTC
(In reply to Bryan Davis from comment #6)
> 
> Is puppet failure a false negative somehow? Investigating further.

Additional `vagrant provision` calls seem to complete with no errors and no failures for me. I'm going to redo my steps to reproduce with verbose vagrant and puppet logging to see if I can figure out what's happening on the initial provisioning attempt.
Comment 8 Bryan Davis 2014-09-10 02:54:13 UTC
It looks to me like puppet is doing this:

* Run Exec['mobilewiki_check_settings'] which fails to connect to db and notifies Exec['mobile_setup']
* Run Exec['mobile_setup'] because the LocalSettings.php file in it's creates clause is missing
* Run Exec['mobile_setup'} again (wtfbbq?) and crash because of a db error for duplicate keys on an insert.

Log excerpts from `vagrant enable-role mobilefrontend && PUPPET_DEBUG=1 vagrant provision`:

# Check for existing db runs
==> default: Debug: Exec[mobilewiki_check_settings](provider=posix): Executing check 'mwscript sql.php --wikidb=mobilewiki </dev/null'
==> default: Debug: Executing 'mwscript sql.php --wikidb=mobilewiki </dev/null'
==> default: Debug: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_check_settings]/unless: DB connection error: Unknown database 'mobilewiki' ()
==> default: Debug: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_check_settings]/unless: Backtrace:
{...snip...}

# Check failed, so remove mobilewiki/LocalSettings.php
==> default: Debug: Exec[mobilewiki_check_settings](provider=posix): Executing 'rm -f /vagrant/settings.d/wikis/mobilewiki/LocalSettings.php'
{...snip...}

# Tell Exec[mobilewiki_setup] that it needs to run
==> default: Info: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_check_settings]: Scheduling refresh of Exec[mobilewiki_setup]
==> default: Debug: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_check_settings]: The container Mediawiki::Wiki[mobile] will propagate my refresh event

# Run Exec[mobilewiki_setup]
==> default: Debug: Exec[mobilewiki_setup](provider=posix): Executing '/usr/local/bin/multiversion-install mobilewiki admin --dbname mobilewiki --dbpass vagrant --dbuser root --pass vagrant --scriptpath /w --server http://mobile.wiki.local.wmftest.net:8888 --confpath /vagrant/settings.d/wikis/mobilewiki
{...snip...}

# Install worked, mobilewiki/LocalSettings.php and database created
==> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns: executed successfully
{...snip...}

# Here's the WTF. Puppet decides to run Exec[mobilewiki_setup] a second time
==> default: Debug: Exec[mobilewiki_setup](provider=posix): Executing '/usr/local/bin/multiversion-install mobilewiki admin --dbname mobilewiki --dbpass vagrant --dbuser root --pass vagrant --scriptpath /w --server http://mobile.wiki.local.wmftest.net:8888 --confpath /vagrant/settings.d/wikis/mobilewiki
{...snip...}
=> default: Notice: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]/returns: A database query error has occurred.
{...snip...}
==> default: Error: /Stage[main]/Role::Mobilefrontend/Mediawiki::Wiki[mobile]/Exec[mobilewiki_setup]: Failed to call refresh: /usr/local/bin/multiversion-install mobilewiki admin --dbname mobilewiki --dbpass vagrant --dbuser root --pass vagrant --scriptpath /w --server http://mobile.wiki.local.wmftest.net:8888 --confpath /vagrant/settings.d/wikis/mobilewiki
==> default:  returned 1 instead of one of [0]
Comment 9 Bryan Davis 2014-09-10 03:15:32 UTC
Dan has a pending patch at Ia2ff2ab53966ade7bbacd705dc43369345d1b0e0 that will probably fix this as an unintended but happy side effect. I'll test that patch and see if I can get it merged.
Comment 10 Gerrit Notification Bot 2014-09-10 04:25:58 UTC
Change 159217 had a related patch set uploaded by BryanDavis:
Wiki installer now conditional on existence of database

https://gerrit.wikimedia.org/r/159217
Comment 11 Gerrit Notification Bot 2014-09-10 04:27:06 UTC
Change 159217 merged by jenkins-bot:
Wiki installer now conditional on existence of database

https://gerrit.wikimedia.org/r/159217
Comment 12 Bryan Davis 2014-09-10 04:45:17 UTC
The merged patch fixed the problem for me, but I'd like Yuri to confirm before closing.

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


Navigation
Links