Project:Support desk

About this board

Welcome to the MediaWiki Support desk, where you can ask MediaWiki questions!

(Read this message in a different language)

See also

Before you post

Post a new question

  1. To help us answer your questions, please indicate which versions you are using, as found on your wiki's Special:Version page:
    • MediaWiki version
    • PHP version
    • Database type and version
  2. Please include the web address (URL) to your wiki if possible. It's often easier for us to identify the source of the problem if we can see the error directly.
  3. To start a new thread, click "Start a new topic".

"Error creating thumbnail: Error code: 2"

17 (talkcontribs)


I recently moved my MediaWiki from one server to another. Everything seems to work well except thumbnail generation: I receive "Error creating thumbnail: Error code: 2"

I have reviewed and tried the various documented online solutions without success. My LocalSettings.php is

$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

I can confirm that ImageMagick is installed (version 6.7.7-10) and the convert command path works when I try it from the Mediawiki directory prompt. . MediaWiki is looking into the right place for images (full images upload and display fine). I temporarily changed permissions to 777 on /images and on /images/temp just to see if that solved a problem. It didn't. I tried specifying

$wgMaxShellMemory = 512 000; 
$wgMaxShellFileSize = unlimited;

But that didn't solve the problem. I tried specifying the /images/temp directory with $wgTmpDirectory = "$IP/images/temp"; but that didn't solve the problem either. For kicks I tried using /etc/alternatives/convert but that didn't work either. I logged out of the wiki after each change and 'hard' refreshed my browser just to make sure that I was looking at the new settings effects. My MediaWiki is in /var/www/html/wikiname. It is version 1.23.2.

Convinced that imagemagick isn't being called or exiting properly I followed the links and got:

me@star:/usr/bin$ ls -l /usr/bin/convert
lrwxrwxrwx 1 root root 25 Nov  3 17:39 /usr/bin/convert -> /etc/alternatives/convert
me@star:/usr/bin$ ls -l /etc/alternatives/convert
lrwxrwxrwx 1 root root 20 Nov  3 17:39 /etc/alternatives/convert -> /usr/bin/convert.im6
me@star:/usr/bin$ ls -l /usr/bin/convert.im6
-rwxr-xr-x 1 root root 6320 Mar  6  2014 /usr/bin/convert.im6
me@star:/usr/bin$ dpkg -S /usr/bin/convert.im6
imagemagick: /usr/bin/convert.im6

I tried changing the LocalSettings command path to /usr/bin/convert/im6 but it didn't help. I'm out of troubleshooting ideas. Any suggestions?

Ciencia Al Poder (talkcontribs)

You say you have this:

$wgMaxShellMemory = 512 000; 
$wgMaxShellFileSize = unlimited;

But Manual:$wgMaxShellFileSize doesn't mention "unlimited" as a valid value, and also I think "512 000" is not a valid number in PHP. It should generate a parse error. Could you please verify that? (talkcontribs)

G'day, I was following ( suggestion and similar posts elsewhere reporting that this solved their similar problem even when no memory limitation was expected. I did not receive a parser error in MediWiki responses, looking in ~/apache2/error I don't see one, but I also commented out this trial after it did not resolve the problem.

This, that and the other (talkcontribs)

The fact that you didn't get a parser error with that invalid code suggests that your LocalSettings.php file is being ignored altogether... (talkcontribs)

Thanks, but not true. Chances are good that I'm not looking in the right place for a parser error that doesn't report in the MediaWiki. LocalSettings.php is the effective configuration file because if I set #wgEnableUploads = false; then my MediaWiki doesn't allow uploads. I've sequentially tried these fixes, but either it's a 'more than one variable problem' or something else is causing an abnormal exit from ImageMagick. From the active LocalSettings.php

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
#$wgSVGConverterPath = "/usr/bin";
#$wgImageMagickTempDir = "IP$/images/temp";
#$wgMaxShellMemory = 300000;
#$wgMaxShellFileSize = 300000;
#$wgMaxShellTime = 220;
#$wgTmpDirectory = "/var/www/html/wikiname/images/temp";
#$wgUseImageReseize = true;
#$wgGenerateThumbnailOnParse = true;
##$wgSVGConverterPath = "/usr/bin";
#$wgTmpDirectory = "$IP/images/temp"; (talkcontribs)

I should have mentioned:

  • MediaWiki 1.23.2
  • PHP 5.5.9-1ubuntu4.5 (apache2handler)
  • MySQL 5.5.40-0ubuntu0.14.04.1
This, that and the other (talkcontribs)

From reading the MW source code (includes/media/Bitmap.php, line 180 or thereabouts, if you're interested), it seems that your invocation of ImageMagick is returning the error code "2".

You could try enabling the debug log: Manual:How_to_debug#Setting_up_a_debug_log_file

The log will contain lines like "transformImageMagick: running ImageMagick: " followed by the exact command line being issued by MediaWiki. You should try running this command manually (at a shell on your server) and see what happens.

In the debug log you may also see lines containing "thumbnail failed on", which may point you closer to the source of the problem. (talkcontribs)

Thank you, that was a helpful suggestion. I made the log file and this is the relevant portion of the log:

File::transform: Doing stat for mwstore://local-backend/local-thumb/9/93/How_Did_you_Hear_About_2014.png/120px-How_Did_you_Hear_About_2014.png FileBackendStore::getFileStat: File mwstore://local-backend/local-thumb/9/93/How_Did_you_Hear_About_2014.png/120px-How_Did_you_Hear_About_2014.png does not exist. BitmapHandler::doTransform: creating 120x68 thumbnail at /tmp/transform_79944211ec2f-1.png using scaler im BitmapHandler::doTransform: called wfMkdirParents(/tmp) BitmapHandler::transformImageMagick: running ImageMagick: '/usr/bin/convert' '-quality' '95' '-background' 'white' '/var/www/html/wikiname/images/9/93/How_Did_you_Hear_About_2014.png' '-thumbnail' '120x68!' '-set' 'comment' 'File source: http://intentionallyremoved/wikiname//index.php/File:How_Did_you_Hear_About_2014.png' '-depth' '8' '-rotate' '-0' '/tmp/transform_79944211ec2f-1.png' wfShellExec: /bin/bash '/var/www/html/wikiname/includes/' 'OMP_NUM_THREADS='\''1'\'' '\''/usr/bin/convert'\'' '\''-quality'\'' '\''95'\'' '\''-background'\'' '\''white'\'' '\''/var/www/html/wikiname/images/9/93/How_Did_you_Hear_About_2014.png'\'' '\''-thumbnail'\'' '\''120x68!'\'' '\''-set'\'' '\''comment'\'' '\''File source: http:// intentionallyremoved /wikiname//index.php/File:How_Did_you_Hear_About_2014.png'\'' '\''-depth'\'' '\''8'\'' '\''-rotate'\'' '\''-0'\'' '\''/tmp/transform_79944211ec2f-1.png'\''' 'MW_INCLUDE_STDERR=1;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes'[thumbnail] thumbnail failed on star: error 2 "" from "'/usr/bin/convert' '-quality' '95' '-background' 'white' '/var/www/html/wikiname/images/9/93/How_Did_you_Hear_About_2014.png' '-thumbnail' '120x68!' '-set' 'comment' 'File source: http:// intentionallyremoved /wikiname//index.php/File:How_Did_you_Hear_About_2014.png' '-depth' '8' '-rotate' '-0' '/tmp/transform_79944211ec2f-1.png'" [thumbnail] Removing bad 0-byte thumbnail "/tmp/transform_79944211ec2f-1.png". unlink() succeeded User::getBlockedStatus: checking... ForeignAPIRepo: HTTP GET: LoadBalancer::reuseConnection: this connection was not opened as a foreign connection [runJobs] Running 1 job(s) via '/wikiname//index.php?title=Special%3ARunJobs&tasks=jobs&maxjobs=1&sigexpiry=1416866196&signature=e8ce801451b14a3d680b953c8d298293fdffbfeb'

I then tried to run the command as you suggested:

me@place:/var/www/html/wikiname/images$ /usr/bin/convert -quality 95 /var/www/html/wikiname/images/9/93/How_Did_you_Hear_About_2014.png -thumbnail 120x68! /var/www/html/wikiname/images/9/93/bpthumb.png convert: unable to open image `/var/www/html/wikiname/images/9/93/bpthumb.png': Permission denied @ error/blob.c/OpenBlob/2638. convert: WriteBlob Failed `/var/www/html/wikiname/images/9/93/bpthumb.png' @ error/png.c/MagickPNGErrorHandler/1728. me@place:/var/www/html/wikiname/images$

Helpful! So I then changed the permsions of ~/images and all subdirectories so that then MediaWiki user www-data has drwxr-xr-x I was then able to execute the code without an error and thumbnail file was correctly built as I can see when I downloaded it via ftp, but the MediaWiki still give me the same error code 2 and doesn't' produce thumbnails for the images (in say new files special page). I simplified the MediaWiki command to:

/usr/bin/convert -quality 95 -background white /var/www/html/wikiname/images/9/93/How_Did_you_Hear_About_2014.png -thumbnail 120x68! -depth 8 -rotate -0 /var/www/html/wikiname/images/9/93/transform_bp4.png

And I got:

convert: unable to open image `/var/www/html/wikiname/images/9/93/transform_bp4.png': Permission denied @ error/blob.c/OpenBlob/2638. convert: WriteBlob Failed `/var/www/html/wikiname/images/9/93/transform_bp4.png' @ error/png.c/MagickPNGErrorHandler/1728.

So I suspect a permissions error, but I get the same error even when I set the ~/images/9 and ~/9/93 to drwxrwxr-x

This, that and the other (talkcontribs)

Note that the original ImageMagick command seems to be trying to write to your /tmp directory. Try checking the permissions on that directory! Or try running the original ImageMagick command exactly, complete with the output filename in /tmp, and see what messages you get. (talkcontribs)

Thanks. the /tmp directory is drwxrwxrwt. I think it should be open. By setting permissions to 777 I was able to execute the imagemagick line manually. I'm beginning to suspect that the problem is ownership or group membership or something? Most of my directions in ~/wikiname are like

drwxr-xr-x 8 me UNIVERSITY\domain^users 4096 Nov 11 16:17 extensions

but images is

drwxr-xr-x 22 me www-data 4096 Nov 11 16:17 images

because I changed ownership as advised here ( All the subdirectories under images are

drwxr-xr-x 16 me www-data 4096 Nov 24 12:54 9

Is this a problematic permissions configuration maybe?

This, that and the other (talkcontribs)

Unfortunately I know very little about Unix permissions, being a Windows person myself. At least in Windows you get a nice user interface to manage permissions! On Linux-based boxes it seems very confusing.

My only suggestion would be to carefully check what user the server or PHP processes are running under, and make sure they have the correct permissions. Or if you try setting the relevant directories' permissions to 777 (temporarily of course), and everything then works, it is evidently a problem of certain users not having the right permissions on the right directories. Keep checking the MediaWiki debug log for information.

Ciencia Al Poder (talkcontribs)

Confusing? unix permissions are very simple ;)

Try what TTO suggested (777 permissions), and if that also fails, the problem might be that you have some sort of security program blocking "unexpected" file creations. The most common problem is SELinux. Try disabling it.

Ciencia Al Poder (talkcontribs)

Note that every line starting with a "#" character in LocalSettings.php is ignored, since it's a PHP comment.

Note that $wgImageMagickTempDir = "IP$/images/temp"; should be $wgImageMagickTempDir = "$IP/images/temp"; instead. And the value of $wgSVGConverterPath doesn't make sense. Still, all of those configuration variables are commented out, so they aren't being used in your installation. (talkcontribs)

Yes, thank you. I understand the commenting syntax. I was just illustrating my history of trying one fix at a time.

Sergezolotukhin (talkcontribs)

In my case, I had bash error '\r': command not found when running includes/ (this script is using for running convert). So it's easy to fix it with removing trailing \r character that causes this error:

sed -i 's/\r$//' includes/

.digamma (talkcontribs)

Just upgraded to 1.33.0 and this (sed command on my includes/shell/ ^^^ fixed it for me.

Awailable (talkcontribs)

@Sergezolotukhin Can you explain this error more? I'm sure i have that same problem...

Reply to ""Error creating thumbnail: Error code: 2""

Error creating thumbnail: Error code: 2

Awailable (talkcontribs)

Error creating thumbnail:


line 4: $'\r': command not found


line 6: syntax error near unexpected token `$'{\r''


line 6: `cleanup() {

Error code: 2

Any ideas how fix that?

Reply to "Error creating thumbnail: Error code: 2"

How to allow bureaucrats to create (local) rights dynamically?

The last available username (talkcontribs)

Like how stewards can create (global) rights without modifying LocalSettings.php, how can I make bureaucrats do the same?

The last available username (talkcontribs)

. (to get more attention)

Bawolff (talkcontribs)

You need an extension. The one stewards use is extension:CentralAuth but it is oriented more to having multiple wikis.

The last available username (talkcontribs)

@Bawolff: I already have that extension installed, is there any way I can modify it to also allow dynamic (local) groups that can be modified by bureaucrats? The last available username (talk) 08:09, 8 February 2023 (UTC)

The last available username (talkcontribs)

Re-commenting since this thread is getting buried.

Reply to "How to allow bureaucrats to create (local) rights dynamically?"

Server error?

Summary by

74240475 (talkcontribs)

Ongoing fetch errors, last 8 hours. Always cp4039. Request from via cp4039 cp4039, Varnish XID 967763452 Error: 503, Backend fetch failed at Sun, 05 Feb 2023 20:07:54 GMT

Malyacko (talkcontribs)

You need to contact the website that you refer to.

Reply to "Server error?"

after an upgrade to the latetest version no data is displayed

2 (talkcontribs)


After an upgrade to the latest version no data is displayed

There is currently no text in this page. You can ....

If I migrate to a different host with an older version, it works fine.

How to procede,

Regards, Johan

Malyacko (talkcontribs)

Hi, please see "Post a new question" in the sidebar (what "older version"? what "latest version"?) and Manual:How_to_debug - thanks!

Reply to "after an upgrade to the latetest version no data is displayed"

Problem with login and user data

Khk2 (talkcontribs)

I use MediaWiki for a private single user purpose in a cPanel managed commercial host, and used its upgrade mechanism to upgrade from 1.37.6 to 1.39.1. Before upgrade and after upgrade I was able to log into MW. However, there was a problem with one page, and I decided to revert to the complete backup of 1.37.6 cPanel had made for me to see if it worked there.

After this, I was not able to log in any more. I tried also to create a new user, and it succeeded partly - a new user was created, but the username I gave was not registered in the mySQL database, while my full name was, and after I logged out, there was no way to log back in.

Also, cPanel sets the wiki admin user name and password, and these did not work either anymore, and setting it again and saving through cPanel has no effect on the MW. I tried to upgrade to 1.39.1 again, and the same situation continues.

I am able to browse the mySQL with cPanel, and I see e.g. the user I created in mw_user as "Unknown user", but with my name as the "Full name". This unknown user is the only row in the mw_user table. My former two users (admin and normal) are visible in the mw_actor table.

Any ideas?

This post was hidden by Khk2 (history)
Reply to "Problem with login and user data"

Issue after Domainchange

2 (talkcontribs)


i moved the files and DB to the new Domain and in LocalSettings.php i changed the $wgserver to new domain.

but i just get the following error now :

[Y@CsDGEvTkV-NWAv74m3pgAAAA0] / Error: Class 'MediaWiki\ResourceLoader\MessageBlobStore' not found


from /var/www/vhosts/

#0 /var/www/vhosts/ Wikimedia\Services\ServiceContainer::{closure}()

#1 /var/www/vhosts/ LocalisationCache->recache()

#2 /var/www/vhosts/ LocalisationCache->initLanguage()

#3 /var/www/vhosts/ LocalisationCache->loadItem()

#4 /var/www/vhosts/ LocalisationCache->getItem()

#5 /var/www/vhosts/ MediaWiki\Languages\LanguageFallback->getAll()

#6 /var/www/vhosts/ MediaWiki\Languages\LanguageFactory->newFromCode()

#7 /var/www/vhosts/ MediaWiki\Languages\LanguageFactory->MediaWiki\Languages\{closure}()

#8 /var/www/vhosts/ MapCacheLRU->getWithSetCallback()

#9 /var/www/vhosts/ MediaWiki\Languages\LanguageFactory->getRawLanguage()

#10 /var/www/vhosts/ MediaWiki\Languages\LanguageFactory->getLanguage()

#11 /var/www/vhosts/ Wikimedia\Services\ServiceContainer::{closure}()

#12 /var/www/vhosts/ Wikimedia\Services\ServiceContainer->createService()

#13 /var/www/vhosts/ Wikimedia\Services\ServiceContainer->getService()

#14 /var/www/vhosts/ MediaWiki\MediaWikiServices->getService()

#15 /var/www/vhosts/ MediaWiki\MediaWikiServices->getContentLanguage()

#16 /var/www/vhosts/ Wikimedia\Services\ServiceContainer::{closure}()

#17 /var/www/vhosts/ Wikimedia\Services\ServiceContainer->createService()

#18 /var/www/vhosts/ Wikimedia\Services\ServiceContainer->getService()

#19 /var/www/vhosts/ MediaWiki\MediaWikiServices->getService()

#20 /var/www/vhosts/ MediaWiki\MediaWikiServices->getUserNameUtils()

#21 /var/www/vhosts/ MediaWiki\Session\SessionManager->__construct()

#22 /var/www/vhosts/ MediaWiki\Session\SessionManager::singleton()

#23 /var/www/vhosts/ require_once(string)

the MessageBlobStore is located at same paths and are available as in "old" Domain..

Bawolff (talkcontribs)

It seems most likely that some of your mediawiki files are corrupt or didn't transfer properly. Try redownloading mediawiki.

Reply to "Issue after Domainchange"

wiki shows old version for unregistered users

Subbass1 (talkcontribs)

MediaWiki 1.34.1 PHP 7.3.33-4+0~20220627.98+debian10~1.gbp40b3e4 (fpm-fcgi) MySQL 5.7.36-39-log ICU 65.1

Hello, the wiki regularly shoes an older version for unregistered users, no clue why. And yes, I know there should have been a SW update long ago (we suffer from various bugs), but I'm not an admin and can't do anything here unfortunately.

If one is registered and logged in all is fine and actual. Any hints for this? Thanks

Reply to "wiki shows old version for unregistered users"

File:FileName generates incorrect URL (file://filename)

4 (talkcontribs)

I've migrated and upgraded an old mediawiki to 1.35.8 and am now fixing up the configuration. The content loads but file links aren't working properly (they are working on the old wiki). For example, [[File:Monitor_Code_Block.jpg]], does not show the file and instead creates a url file://Monitor_Code_Block.jpg, instead of the correct URL. I've tried running php maintenance\rebuildall.php but that didn't help. The files were copied to the upgraded wiki in the images folder. $wgScriptPath, $wgUploadPath and $wgServer seem to be set correctly. (talkcontribs)

To expand on what I do see, the image replaced with a citation looking like "[[3]], where the inner [3] is a URL pointing to "file:dcom_.png" in this example (not even a valid file URL in fact). I've tried running php maintenance\refreshImageMetadata.php, but that didn't help either.

Bawolff (talkcontribs)

Do you have $wgUrlProtocols set to something other than its default in LocalSettings.php? If so, what is it set to? (talkcontribs)

Thanks, that was the problem! It included 'file:'. Changing that to 'file://' fixed my problem as per the bug description in your link.

Reply to "File:FileName generates incorrect URL (file://filename)"

Unable to reset password

2A02:8071:683:5F00:CB3D:E7A2:8CA9:A063 (talkcontribs)


when trying to create new account for HermannSW, I get told that I have one:


But I am unable to reset password with "forgot your password" for that.

Can you please help me to get password reset to registered email address for that account?



Ciencia Al Poder (talkcontribs)

Unfortunately, if you haven't set an email and/or it hasn't been confirmed, there's no way to recover your account, because you can't demonstrate you own that account.

You'll have to create a new one.

Reply to "Unable to reset password"