Installing STACK on Ubuntu Linux 22.04 (LTS), no success

Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Visvanath Ratnaweera -
Number of replies: 11
Picture of Particularly helpful Moodlers Picture of Translators
Hi all

After a long break I'm coming back to STACK having had the pleasure of meeting a full delegation from the STACK Dept. at the MoodleMoot DACH two weeks ago.

The platform is Ubuntu Linux 22.04 (LTS), Nginx 1.18, PHP 8.1.2, MariaDB 10.6.12. Moodle version is 4.1.4+ (Build: 20230629). Freshly installed, empty except for a very few plug-ins including the Question behaviour Adaptive mode (multi-part questions) 4.3.8 for Moodle 3.9+ (2022092200).

Then I got the STACK plug-in cloned to question/type/stack via Git. It gave me the release 4.4.4 for Moodle 3.9+. When the installation routine started it brought:


I see that Moodle version 4.0 is missing. Still went ahead and cloned the two plug-ins, also via Git to question/behaviour/dfexplicitvaildate 4.2.2 for Moodle 3.9+ resp. dfcbmexplicitvaildate which gave me the green light:

Then the installation script ran successfully.

When I start the mysite/question/type/stack/adminui/healthcheck.php the Display-style equation looks good. There is also an automatically written Maxima configuration file.

But Uncaches CAS call brings, "CAS failed to return any evaluated expressions. Please check your connection with the CAS. CAS returned some data as expected, but there were errors."

Debug info, Context used below that says,

Platform: linux
Maxima shell command: maxima --use-version=5.40.0
Maxima initial command: load("/var/www/moodledata/stack/maximalocal.mac");

Maxima timeout: 10
Maxima command:
cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("CASresult",errcatch(diff(x^n,x))), print("1=[ error= ["), cte("STACKversion",errcatch(stackmaximaversion)), print("2=[ error= ["), cte("MAXIMAversion",errcatch(MAXIMA_VERSION_STR)), print("3=[ error= ["), cte("MAXIMAversionnum",errcatch(MAXIMA_VERSION_NUM)), print("4=[ error= ["), cte("externalformat",errcatch(adjust_external_format())), print("5=[ error= ["), cte("CAStime",errcatch(CAStime:"2023-07-03 01:45:19")), print("] ]"), return(true));

I have maxima installed in the server,

$ which maxima
/usr/bin/maxima
$ maxima -v
+ [ gcl = clisp ]
+ [ gcl = cmucl ]
+ [ gcl = scl ]
+ [ gcl = gcl ]
+ exec /usr/lib/maxima/5.45.1/binary-gcl/maxima -eval (cl-user::run) -f -- -v

Maxima 5.45.1 https://maxima.sourceforge.io
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.

What is missing?

Average of ratings: -
In reply to Visvanath Ratnaweera

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I'm sorry, but I think this is a bug with Ubuntu, not with the STACK plugin. It's been reported before, and I had a colleague last week with this problem on a virtual box. It's reported here

https://stackoverflow.com/questions/65056494/maxima-segmentation-fault-php-exec-on-ubuntu-20-04

Chris
In reply to Christopher Sangwin

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
I don't know if it is relevant, but it seems like your configured maxima is 5.40 (in Moodle) and your installed maxima (on Ubuntu) is 5.45
In reply to koen roggemans

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Koen

Good observation:

$ maxima --v

Maxima 5.45.1 https://maxima.sourceforge.io
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1)

Only problem, there's no maxima 5.40 in the list:



I set to default and continued. This is the health report now:

Uncached CAS call

This section always sends a genuine call to the CAS, regardless of the current cache settings. This is needed to ensure the connection to the CAS is really currently working.

You have chosen the "default" version of Maxima, so no Maxima version checking is being done. Your raw connection is actually using version "5.45.1" (45.1). CAS returned data as expected. You have a live connection to the CAS.

Debug info

Context used

Platform: linux
Maxima shell command: maxima
Maxima initial command: load("/var/www/data/perfdata/stack/maximalocal.mac");


Maxima timeout: 10
Maxima command
cab:block([],print("[STACKSTART Locals= [ 0=[ error= ["), cte("CASresult",errcatch(diff(x^n,x))), print("1=[ error= ["), cte("STACKversion",errcatch(stackmaximaversion)), print("2=[ error= ["), cte("MAXIMAversion",errcatch(MAXIMA_VERSION_STR)), print("3=[ error= ["), cte("MAXIMAversionnum",errcatch(MAXIMA_VERSION_NUM)), print("4=[ error= ["), cte("externalformat",errcatch(adjust_external_format())), print("5=[ error= ["), cte("CAStime",errcatch(CAStime:"2023-07-03 18:23:20")), print("] ]"), return(true));
CAS process return value: 0
Timings
Start: 1688388800.4381, End: 1688388803.7223, Taken = 3.2842018604279
CAS result
Maxima 5.45.1 https://maxima.sourceforge.io
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) warning: encountered undefined variable %_ce_rem in translation.
define: warning: redefining the built-in function intervalp
warning: variable simp (declared type boolean) assigned type any.
define: warning: redefining the built-in function texnumformat
warning: encountered undefined variable stackintfmt in translation.
[ STACK-Maxima started, library version 2023060500 ] 
(%o0) "/var/www/data/perfdata/stack/maximalocal.mac"
(%i1) 
[STACKSTART Locals= [ 0=[ error= [ 
(too long, I think it is good)
Unpacked result as
Array
(
    [0] => Array
        (
            [key] => CASresult
            [value] => n*x^(n-1)
            [dispvalue] => n*x^(n-1)
            [display] => n\,x^{n-1}
            [error] => 
        )

    [1] => Array
(again very long, think it is good)



Is it good now? How do I know?
In reply to Visvanath Ratnaweera

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Session timed out. Here's the final screen-shot:


In reply to Visvanath Ratnaweera

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The healthcheck looks good.

If you possibly can, I would use a supported version of Maxima. If you can't I wonder if you should select version 44.0, as being the closest to 45?

I don't understant why the heathcheck is working, but questions are not. The whole point of helthcheck is to verify that everything is working. It connects to maxima the same way as everthing else, at least it should.

Eventually, when you plant to deploy this for real use, I would recomment following the approach that Stuart Anderson talks about: goemaxima. That is what we use on our severs.
In reply to Tim Hunt

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Tim, thanks for chiming in! In fact I was doing the same, checking in a known platform. The one I had ready was a Raspberry Pi 4 B 4 G running Raspberry Pi OS Lite, Debian 11. With that I got the sample question running!

The only difference is, I ran this Create Maxima image in the HealthCheck task a 2-3 times. The cause of that could be the low power of the RPi.

Yes, the Rpi runs Maxima 5.44.0.

I came back to the Ubuntu to re-check, ran the Create Maxima image. Now I can close the question. But trying to preview it I get the error:

At max. debug level, I get this:

Stack trace:
  • line 1451 of /question/type/questiontypebase.php: TypeError thrown
  • line 149 of /question/type/stack/questiontype.php: call to question_type->import_or_save_files()
  • line 538 of /question/type/questiontypebase.php: call to qtype_stack->save_question_options()
  • line 85 of /question/type/stack/questiontype.php: call to question_type->save_question()
  • line 294 of /question/bank/editquestion/question.php: call to qtype_stack->save_question()
Not that I direly need this Ubuntu one, the RPi suits me better. But thought debugging the Ubuntu further would be useful for the "Ubuntu followers".

P.S. No idea what goemaxima is. Too steep a climb for a beginner. I'll try the RPi line first.
In reply to Visvanath Ratnaweera

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
I have Stack running on an Ubuntu 20.04, which doesn't run flawless either. But is it an option for you to install a 20.04 in 2023 with only 2 years of support left?

To summarise the problem on a 20.04: The shipped maxima requires libreadline.so.7 an Ubuntu 20.04 comes with libreadline.so.8. The problem is solved by simlinking libreadline.so.8 to libreadline.so.7. Maxima seems happy enough with that.
Average of ratings: Useful (2)
In reply to koen roggemans

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Koen

You are a hero!

The Ubuntu Linux 22.04 I was describing in my OP works now with the addition of this symlink:
# ls -l libreadline.so.7
lrwxrwxrwx 1 root root 16 Jul  4 21:55 libreadline.so.7 -> libreadline.so.8

Now I have two Moodle instances with STACK question type, one on Ubuntu Linux 22.04 in a very powerful VM and one on Raspberry Pi OS Debian 11 "bullseye" in a RPi 4 B 4G.

CONCLUDED AFAIC. The thread is open if anybody has a question.
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Stuart Anderson -
If it helps, attached is my own disaster recovery document for creating and deploying a geomaxima pooling solution.  It's written so one of my colleagues who doesn't manage the service can rebuild/upgrade the geomaxima setup and also so I can remember what I did in 12 months time.  It's increadibly easy, though something still could go wrong I guess.  The only info missing from the attached PDF is the software requirements:

Software setup

I'm NOT a server admin and a colleague built the Ubuntu VM for me and I just took care of the Docker image build.  Building the docker image took a little over 6 minutes to complete.  It all seems too easy and I'm waiting for the "gotcha" moment...

Definitely worth looking at if you have time.

Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
It is not over yet. I started with the ubiquitous "Differentiate \( (x+1)^3 \) w.r.t. \(x\)" and seeing TIMEDOUT.




Ironically, a web search takes me a full circle to my own thread: Major upgrade broke STACK, now getting "CASText failed validation. TIMEDOUT dumped"

I tried the litmus test suggested there:

$ cat /var/www/html/tmpIn.txt 
1+1;
$ exec( "maxima -b /var/www/html/tmpIn.txt > /var/www/html/tmpOut.txt" );
-bash: syntax error near unexpected token `"maxima -b /var/www/html/tmpIn.txt > /var/www/html/tmpOut.txt"'
$ touch /var/www/html/xxx
$ ls -l /var/www/html/xxx
-rw-r--r-- 1 me users 0 Jul  4 01:14 /var/www/html/xxx
 Where do I go from here? Is it after all the bug https://stackoverflow.com/questions/65056494/maxima-segmentation-fault-php-exec-on-ubuntu-20-04 Chris mentioned?
In reply to Christopher Sangwin

Re: Installing STACK on Ubuntu Linux 22.04 (LTS), no success

by Stuart Anderson -
Damn, just as I choose to move from CentOS to Ubuntu sad (as CentOS is out of support early next summer).

All I can contribute to this discussion is that whilst I have more testing to do, I appear to be fine running STACK with a Go and Docker install as part of the goemaxima setup which is running on an Ubuntu based VM, but with Debian 11 in the goemaxima container (as indicated in the goemaxima build script).

I need to create a docker image for STACK 4.4.4 which I'll hopefully do trouble free tomorrow.

I'll be keeping my CentOS setup around just so I have a means to create a backup Maximapool image and webservice as backup.