Jump to content

Topic on Project:Support desk

[RESOLVED] File Upload Error

11
Summary by Ciencia Al Poder

If file permissions in folders are not the problem, check out if SELinux is blocking apache from creating the file

71.31.165.106 (talkcontribs)

Good morning. I seem to be having some issues. I get the following when trying to upload a file: Internal Error [3a9c03ba] 2015-02-15 15:37:53: Fatal exception of type MWException

Any help would be appreciated.

Florianschmidtwelzow (talkcontribs)
71.31.165.106 (talkcontribs)

I just got that enabled: [94bbdfd6] /index.php/Special:Upload Exception from line 1871 of /var/www/html/includes/filerepo/file/LocalFile.php: Could not acquire lock for 'Doink.png.'

Backtrace:

  1. 0 /var/www/html/includes/filerepo/file/LocalFile.php(1174): LocalFile->lock()
  2. 1 /var/www/html/includes/upload/UploadBase.php(738): LocalFile->upload(string, string, string, integer, array, boolean, User)
  3. 2 /var/www/html/includes/specials/SpecialUpload.php(467): UploadBase->performUpload(string, string, boolean, User)
  4. 3 /var/www/html/includes/specials/SpecialUpload.php(186): SpecialUpload->processUpload()
  5. 4 /var/www/html/includes/specialpage/SpecialPage.php(363): SpecialUpload->execute(NULL)
  6. 5 /var/www/html/includes/specialpage/SpecialPageFactory.php(584): SpecialPage->run(NULL)
  7. 6 /var/www/html/includes/MediaWiki.php(275): SpecialPageFactory::executePath(Title, RequestContext)
  8. 7 /var/www/html/includes/MediaWiki.php(584): MediaWiki->performRequest()
  9. 8 /var/www/html/includes/MediaWiki.php(435): MediaWiki->main()
  10. 9 /var/www/html/index.php(46): MediaWiki->run()
  11. 10 {main}
Ciencia Al Poder (talkcontribs)
2601:7:1C00:911:5824:F046:6C6D:DDE1 (talkcontribs)

This is happening to me also on a fresh install on Centos 7 (3.10.0-123.el7.x86_64)

MediaWiki 1.24.1 PHP 5.4.37 (apache2handler) MySQL 5.6.23

I set these debug options in LocalSettings.php:

# DEBUG
error_reporting( -1 );
ini_set( 'display_errors', 1 );

$wgShowSQLErrors = true;
$wgDebugDumpSql  = true;
$wgShowExceptionDetails = true;
$wgShowDBErrorBacktrace = true;

Backtrace:

#0 /var/www/html/mediawiki-1.24.1/includes/filerepo/file/LocalFile.php(1174): LocalFile->lock()
#1 /var/www/html/mediawiki-1.24.1/includes/upload/UploadBase.php(738): LocalFile->upload(string, string, string, integer, array, boolean, User)
#2 /var/www/html/mediawiki-1.24.1/includes/specials/SpecialUpload.php(467): UploadBase->performUpload(string, string, boolean, User)
#3 /var/www/html/mediawiki-1.24.1/includes/specials/SpecialUpload.php(186): SpecialUpload->processUpload()
#4 /var/www/html/mediawiki-1.24.1/includes/specialpage/SpecialPage.php(363): SpecialUpload->execute(NULL)
#5 /var/www/html/mediawiki-1.24.1/includes/specialpage/SpecialPageFactory.php(584): SpecialPage->run(NULL)
#6 /var/www/html/mediawiki-1.24.1/includes/MediaWiki.php(275): SpecialPageFactory::executePath(Title, RequestContext)
#7 /var/www/html/mediawiki-1.24.1/includes/MediaWiki.php(584): MediaWiki->performRequest()
#8 /var/www/html/mediawiki-1.24.1/includes/MediaWiki.php(435): MediaWiki->main()
#9 /var/www/html/mediawiki-1.24.1/index.php(46): MediaWiki->run()
#10 {main}

Also, this error appears on-screen after the failed upload (with the above debugging options on):

Warning: fopen(/var/www/html/mediawiki-1.24.1/images/lockdir/dmzfox3ljn7ipsdr0zlw44nwle1qlbp.lock): failed to open stream: No such file or directory in /var/www/html/mediawiki-1.24.1/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582] in /var/www/html/mediawiki-1.24.1/includes/debug/MWDebug.php on line 302

If you set a debug.log up, this seems to be the relevant tidbit:

[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[warning] failed to mkdir "/var/www/html/mediawiki-1.24.1/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/www/html/mediawiki-1.24.1/includes/GlobalFunctions.php at line 2582]
[exception] [2c79a15b] /index.php/Special:Upload   Exception from line 1871 of /var/www/html/mediawiki-1.24.1/includes/filerepo/file/LocalFile.php: Could not acquire lock for 'Images_(18).jpg.'

So, I think it's a permissions thing in general and maybe an SELinux thing in particular? But I can't figure it out. I've set the images dir chmod -R 777. Any idea what's up here?

Ciencia Al Poder (talkcontribs)

If you think it's a SELinux problem, try disabling it and see if upload works.

2601:7:1C00:911:5824:F046:6C6D:DDE1 (talkcontribs)

So, here is what finally fixed it for me:

sudo mkdir /var/www/html/mediawiki-1.24.1/images/temp
chmod -R 777 /var/www/html/mediawiki-1.24.1/images
sudo setsebool -P httpd_unified 1

The last command was suggested by the log dumped to screen when you run

audit2allow -a -w

So I guess it's SELinux. I will try to see if it stick after a reboot. I hope this helps somebody.

64.60.199.231 (talkcontribs)

This worked for me, thanks!

66.219.240.170 (talkcontribs)

This also worked for me. I was convince the problem was related to the $wgScriptPath.

Thanks for the tip.

189.40.44.111 (talkcontribs)

worked for me! tranks

167.58.6.127 (talkcontribs)

Worked for me too, many thanks!!!