Extension talk:Scribunto

Jump to: navigation, search

About this board

error when loading luasandbox.so

Summary by Tessus

The Lua library has to be compiled with -fPIC and the Lua library has to be explicitly put in LUA_LIBS for the sandbox.

Tessus (talkcontribs)

I've compiled the PHP module as follows:

LUA_CFLAGS="-I/usr/local/lua-5.1.5/include" LUA_LIBS="-L/usr/local/lua-5.1.5/lib" ./configure
make install

The module is created successfully, but when I start php-fpm, I get the following error message:

luasandbox.so: undefined symbol: luaopen_debug in Unknown on line 0

I'd appreciate any help with this.

Anomie (talkcontribs)

You seem to have forgotten the '-l' to actually link against the Lua library. Try LUA_LIBS="-L/usr/local/lua-5.1.5/lib -llua5.1", assuming the actual library is /usr/local/lua-5.1.5/lib/liblua5.1.so.

Tessus (talkcontribs)

Thanks for the reply.

The Lua 5.1.5 source code does not generate a shared object, but only a static library. There are no options in the Lua Makefile to generate a dynamic lib.

Usually it should not be necessary to add the lib to the X_LIBS var, since configure is supposed to do that. These env vars should only show the locations of the include and library files (and necessary 3rd party libs - not the lib itself!!!).

Anyway, adding the lib to LUA_LIBS made it worse. The module did not even compile anymore.

cc -shared  .libs/alloc.o .libs/data_conversion.o .libs/library.o .libs/luasandbox.o .libs/timer.o .libs/luasandbox_lstrlib.o  -L/usr/local/lua-5.1.5/lib -lrt -llua  -Wl,-rpath -Wl,/usr/local/lua-5.1.5/lib -Wl,-soname -Wl,luasandbox.so -o .libs/luasandbox.so
/bin/ld: /usr/local/lua-5.1.5/lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a shared object; recompile with -fPIC
/usr/local/lua-5.1.5/lib/liblua.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [luasandbox.la] Error 1
Tessus (talkcontribs)

Wow, ok, the build system of Lua 5.1.5 sucks. It still does not give you a dynamic lib, but adding -fPIC to the CFLAGS in src/Makefile did the trick.

The following works to compile the sandbox:

LUA_CFLAGS="-I/usr/local/lua-5.1.5/include" LUA_LIBS="-L/usr/local/lua-5.1.5/lib -llua" ./configure
make install

Summary: The Lua library has to be compiled with -fPIC and the Lua library has to be explicitly stated in LUA_LIBS for the sandbox.

Lua error: Cannot create process: proc_open(/dev/null): failed to open stream:

Adrianevs (talkcontribs)

Hello Everyone,

I hard trying to setup correctly Scribunto but I get the following error:

Lua error: Cannot create process: proc_open(/dev/null): failed to open stream: Operation not permittedScript error: No such module "Check for unknown parameters". Script error: No such module "documentation".

And php debug:

Warning: proc_open(): open_basedir restriction in effect. File(/dev/null) is not within the allowed path(s): (/var/sentora/hostdata/zadmin/public_html/mydomain_com:/var/sentora/temp/) in /var/sentora/hostdata/zadmin/public_html/mydomain_com/extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php on line 267

Any idea how to fix that ?

Thanks in advance.

Legoktm (talkcontribs)

The problem itself is in the warning message: "open_basedir restriction in effect". You'll need to disable that. You'll need to talk to your hosting provider, it might be an option in the configuration panel.

Adrianevs (talkcontribs)

@Legoktm I run the mediawiki on a dedicated server. Any advice ?

Legoktm (talkcontribs)

You should edit your PHP configuration (php.ini) and disable the open_basedir restriction.

Reply to "Lua error: Cannot create process: proc_open(/dev/null): failed to open stream:"
Tessus (talkcontribs)

I was in the process of trying to install the luasandbox Apache module, but the LUA 5.1 requirement is truly a problem, unless I'm compiling LUA myself. Even on my rather ancient server OS (a few years old), the LUA that comes with it is LUA 5.2. The latest LUA version is 5.3.4. I doubt someone will ever find a LUA 5.1 package on a current distro.

Thus my question: Is there a plan to support newer LUA versions in the future?

Mr. Stradivarius (talkcontribs)

That's task T178146 in Phabricator, but I don't know if there is a timetable for implementing it. The motivation isn't really there for WMF wikis, as all the modules on the wikis have been written for Lua 5.1.

Tessus (talkcontribs)

Thanks for the info. That pretty much explains it. See, I didn't know that LUA code is not backwards compatible.

Mr. Stradivarius (talkcontribs)

I think the modules on the wikis should be able to run on Lua 5.2 and 5.3, as Scribunto restricts or disables the features (like getfenv and setfenv) that would break on moving from Lua 5.1. It's just the Scribunto extension code itself that needs updating (although that is by no means a small job, especially when you factor in the security review).

Tessus (talkcontribs)

Ok, that explains it even more. I have never looked into the extension code (e.g. I don't know if it was written in C or in Lua, but I always assumed backwards compatibility to a certain point.) I mean I can still compile C code from the 70s. Even APIs are mostly compatible and are phased out via deprecation (e.g. Objective C classes and methods). Therefore I would have never thought that this would be such a challenge. Well, I guess I learned something new.

Thanks again for the explanation.

Reply to "Why the LUA 5.1 requirement?"
2600:1003:B45D:D34B:D4EB:D72B:9F2:C36E (talkcontribs)

I installed this extension so I would be able to install modules, but I can't figure out how to install them.

I followed the instructions on this page and the extension is working, but if I wanted to install something like the String module, do I just copy the script, save it as something.extension and upload it to my extensions/Scribunto/modules/ directory?

Even the "hello world" Bananas module doesn't say where or how to save it.

Mr. Stradivarius (talkcontribs)

You save them as pages on the wiki itself. To "install" the string module, copy it, edit the page "Module:String" on your wiki, paste the contents, and save the page. If the modules you install depend on any other modules, you will need to install those as well, or you may get errors. I'm not aware of any way to automatically find module dependencies like that - I usually just eyeball them for "require" statements.

2600:1003:B45D:D34B:D4EB:D72B:9F2:C36E (talkcontribs)

Thank you very much!

Reply to "Installing Modules"

Cannot create process: proc_open: failed to open stream: Permission denied

Summary last edited by Jamal22066 02:12, 20 September 2017 2 months ago

The parent directory needs write permissions.

If you do not want to give the entire parent directory write permissions for security reasons, change the errorlog file path to /tmp/errorfile.log. It should look like this:

$wgScribuntoEngineConf['luastandalone']['errorFile'] = "C:/tmp/errorFile";
Stromoxpage (talkcontribs)

I'm trying to use Scribunto for Template:Navbox

The error I'm getting:

Lua error: Cannot create process: proc_open(/usr/share/webapps/mediawiki/extensions/Scribunto/errorFile): failed to open stream: Permission denied

The LocalSettings.php lines:

require_once "$IP/extensions/Scribunto/Scribunto.php";

$wgScribuntoDefaultEngine = 'luastandalone';

$wgScribuntoEngineConf['luastandalone']['errorFile'] = "$IP/extensions/Scribunto/errorFile";

And the permissions:

$ ls -l extensions/Scribunto/

total 96

-rw-r--r-- 1 root root 19917 Nov 18 19:15 COPYING

-rw-r--r-- 1 root root   609 Nov 18 19:15 Gruntfile.js

-rw-r--r-- 1 root root  2793 Nov 18 19:15 Scribunto.magic.php

-rw-r--r-- 1 root root  8111 Nov 18 19:15 Scribunto.namespaces.php

-rw-r--r-- 1 root root  9437 Nov 18 19:15 Scribunto.php

drwxr-xr-x 2 root root  4096 Nov 18 19:15 common

-rw-r--r-- 1 root root   702 Nov 18 19:15 composer.json

-rw-r--r-- 1 root root  3945 Nov 18 19:15 composer.lock

drwxr-xr-x 5 root root  4096 Jan  9  2016 engines

-rwxrwxrwx 1 root root     0 Feb 26 23:44 errorFile

-rw-r--r-- 1 root root   278 Nov 18 19:15 gitinfo.json

drwxr-xr-x 2 root root  4096 Nov 18 19:15 i18n

drwxr-xr-x 2 root root  4096 Nov 18 19:15 modules

-rw-r--r-- 1 root root   276 Nov 18 19:15 package.json

-rw-r--r-- 1 root root   505 Nov 18 19:15 phpcs.xml

drwxr-xr-x 3 root root  4096 Jan  9  2016 tests

drwxr-xr-x 3 root root  4096 Nov 18 19:15 vendor

-rw-r--r-- 1 root root    48 Nov 18 19:15 version

Do you know what's wrong?

Stromoxpage (talkcontribs)

Setting the parent directory permissions to 777 will work. Maybe moving the log to a directory owned by the web server's process owner also?

Reply to "Cannot create process: proc_open: failed to open stream: Permission denied"
2002:43F4:3186:1234:4D53:5039:7DA7:BDF7 (talkcontribs)

I am trying to update from LuaSandbox 2.0.14-alpha to 2.0.15-alpha. I updated the code using git and than ran

phpize && ./configure && make && sudo make install

but it still shows that I'm on 2.0.14-alpha. How can I fix this? I did restart apache.

Legoktm (talkcontribs)

How did you install LuaSandbox originally? Did you put the newly generated luasandbox.so file in the right place? (talkcontribs)

I followed the instructions on this page.

Alex Mashin (talkcontribs)

Check, if PHP loads the extension from the directory, where it was compiled to.

MacFan4000 (talkcontribs)

It seems to be loaded correctly. Any other ideas?

Reply to "LuaSandbox Update"

How to nominate a module for speedy deletion?

Liuxinyu970226 (talkcontribs)

I doubt just inserting {{delete}} in "the header of" codes shall be helpful...

Maybe I should create its /doc subpage with that?!

Mr. Stradivarius (talkcontribs)

You're right - leaving the template on the module itself won't add the module page to the relevant category, so doing that won't help. Instead you could put it on the /doc page or the talk page, and explain that it is the module itself that you want deleted. Or you could leave a request on the relevant admin noticeboard. As far as I'm aware, those are the best solutions available at the moment.

Reply to "How to nominate a module for speedy deletion?"
Negative24 (talkcontribs)

So I'm getting the very common error "The lua binary (/home/u249147388/public_html/testing/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua) is not executable" but I did mark the executable as executable (with chmod code 755). For some reason the error still keeps coming up when the executable does have the executable flag. Any ideas? Could it be an annoying noexec flag somewhere? I'm running MediaWiki version 1.22.7 and Scribunto for MW 1.22. Thanks.

Wmat (talkcontribs)

What does

ls -l 

say for that file?

Negative24 (talkcontribs)

ls -l output:

-rwxr-xr-x 1 u249147388 u249147388 195476 Jun  4 17:18 lua
Anomie (talkcontribs)
Could it be an annoying noexec flag somewhere?

That would be my guess.

Negative24 (talkcontribs)

I guess it is. I'll be switching to a new hosting company anyways because this one also doesn't support proc_open which is needed for many scripts.

Elia1995 (talkcontribs)

I got the same error, although I even set "executable" to the whole extensions folder and subfolders.

Alex Mashin (talkcontribs)

Try to run your /home/u249147388/public_html/testing/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua from command line.

Also, check if the partition where this file is situated is mounted with noexec option (/etc/fsab).

Reply to "Lua not executable"

Anyone could help me out with Scribunto? (Windows 10)

Justgabs (talkcontribs)

Hello. I am completely new to this, and do not have much experience on this matter, I know you are required to install Scribunto in order to implement infoboxes such as personality, country, organization etc.

I believe that someone who has already used Scribunto could help me out with the installation much better than the already given guideline.

Everything I have set up for now is the Wiki itself, added the CSS and the JS to their respective pages. Nothing more.


PS: I have installed and added the extension to the extensions folder, and have added the code at the end of LocalSettings.

require_once "$IP/extensions/Scribunto/Scribunto.php"; $wgScribuntoDefaultEngine = 'luastandalone';

Anything else must be done?

Justgabs (talkcontribs)

So after doing this, I have downloaded the Template:infobox and tried to import it through Special:Import.

It wouldn't load it and it showed me this error.

Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\mediawiki\extensions\Scribunto\engines\LuaStandalone\LuaStandaloneEngine.php on line 510

Why so? (talkcontribs)


I am having the same issue. May I know how did you solve the issue?

Many thanks. (talkcontribs)

Same issue here, but I am running Windows Server 2012 with Apache 2.4 (talkcontribs)

I'm having a similar problem as well on server 2008R2 running IIS. Unfortunately, it looks like nobody knows the answer. :(

Alex Mashin (talkcontribs)

Is Lua installed at all? Also, is $wgScribuntoEngineConf['luastandalone']['luaPath'] equal to the path to your Lua binary? And does that binary run when started manually?

Also, you could try to compile and use luasandbox.

Reply to "Anyone could help me out with Scribunto? (Windows 10)"

Importazione non riuscita: The lua binary (/membri/themagotuxwiki/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua) is not executable with all permissions set as "executable"

Elia1995 (talkcontribs)

Hello, today I created my brand new wiki and everything went fine until I created my first character page.

I looked on Google on how to import templates and I tried to import the Template:Infobox from wikipedia, but it gave me an error asking me for some scrubunto extension, so I looked on Google and found a guide here on how to install it, I downloaded the one for my version, wich is 1.29, I then extracted it with 7zip and uploaded on altervista with Filezilla.

I then set up the LocalSetting.php file to make it load up and when I tried to import the template again I got this error:

"Importazione non riuscita: The lua binary (/membri/themagotuxwiki/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua) is not executable."

at that point I went on my Filezilla and I changed the permissions of the whole folder structure of "Extensions" to enable execute, at that point I thought "well, since now the permissions are ok, it must work, right ?" No, wrong, when I tried to import the template again, I got that same error again !!!

I checked the permissions of the extensions folder and everything, "read", "write" and "execute" are checked as well as "recursive" and "all files and subfolders".

I created my wiki on the host Altervista, on which I've been making sites for a lot of years now (but I never created a wiki there until today).

I basically want the template:infobox to work so I can make the characters pages with the character's name, role and all other stuff on the right as well as the picture with the description, you know, that rectangular thing with all the character's info that is on every wikipedia page of any character.

Elia1995 (talkcontribs)

[http://themagotuxwiki.altervista.org/index.php?title=TheMagoTux|This is the page], as you can see it says "Missing module "infobox" in the beginning.

EDIT: now the page just gives away the error directly.

Here's a screenshot of the permissions of that lua file in particular: https://image.prntscr.com/image/Esib92WcTISvhNt2aTOiyQ.png

DHillBCA (talkcontribs)

It sounds like you need to add something like the following to your wiki: https://en.wikipedia.org/wiki/Module:Infobox

Elia1995 (talkcontribs)

That's exactly what I'm trying to import: Template:Infobox and the module:infobox, but when I try to import them, I get that lua execution error nonetheless I have the "execute" permissions on that file.

Here's a screenshot: https://image.prntscr.com/image/ZDHA_4ZgQzSF0WJ9WMxIjQ.png

Jackmcbarn (talkcontribs)

Check that exact file. Don't count on the folder to propagate the settings down. If you check that and it's executable too, make sure you're not on a noexec filesystem or under SELinux restrictions.

Elia1995 (talkcontribs)

The actual exact file is set as "executable".

How do I check if the host uses a noexec filesystem ?

Alex Mashin (talkcontribs)

Check mount options in /etc/fstab.

Reply to "Importazione non riuscita: The lua binary (/membri/themagotuxwiki/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua) is not executable with all permissions set as "executable""