Hjfocs created this task.
Hjfocs added projects: MediaWiki-Vagrant, Wikidata, Wikidata-primary-sources.
Herald added a subscriber: Aklapper.

TASK DESCRIPTION

Use case: import a Wikidata dump into a MediaWiki Vagrant instance running on a #cloud-vps machine.

TL;DR: is there a workaround or an alternative import method to avoid doing this manually? :-)


Details

cd /srv/mediawiki-vagrant
vagrant import-dump wikidatawiki-latest-pages-articles19.xml-p19072452p19140743.bz2

returns

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Changing the /usr/bin/sudo bits in the Vagrant box, as suggested in:
https://stackoverflow.com/questions/16682297/getting-message-sudo-must-be-setuid-root-but-sudo-is-already-owned-by-root/19306929#19306929
https://askubuntu.com/questions/452860/usr-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set#471503

requires root privileges, of course, and I'm not sure it's a good workaround. Anyway, the default root password is not vagrant, as mentioned in:
https://www.mediawiki.org/wiki/MediaWiki-Vagrant#Basic_usage

Here is some digging that may be useful.

  • the actual BASH script run in the Vagrant box is /srv/mediawiki-vagrant/puppet/modules/mediawiki/files/import-mediawiki-dump;
  • the script calls mwscript:
/usr/local/bin/mwscript importDump.php --uploads -- "$FILE"
/usr/local/bin/mwscript rebuildrecentchanges.php
  • mwscript is the one calling sudo, see lines 4 and 5:
# Ensure that the script is run as the www-data user
[[ $(whoami) = www-data ]] || exec sudo --preserve-env -u www-data -n -- "$0" "$@"
  • directly calling /var/www/w/MWScript.php from inside the Vagrant box also fails:
vagrant ssh
php /var/www/w/MWScript.php importDump.php --uploads /vagrant/wikidatawiki-latest-pages-articles19.xml-p19072452p19140743.bz2

returns

Cannot run a MediaWiki script as a user in the group vagrant
Maintenance scripts should generally be run using sudo -u www-data which
is available to all wikidev users.  Running a maintenance script as a
privileged user risks compromise of the user account.

You should run this script as the www-data user:

 sudo -u www-data -- <command>

Related to T76041.


TASK DETAIL
https://phabricator.wikimedia.org/T183274

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Hjfocs
Cc: Aklapper, Hjfocs, Lahi, Gq86, GoranSMilovanovic, Kiailandi, QZanden, dachary, Luke081515, Wikidata-bugs, aude, Ricordisamoa, Sjoerddebruin, Tpt, Mbch331, jeremyb
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to