PREP 2015 System Administration

Problems with OPL-update

Problems with OPL-update

by Jim Fischer -
Number of replies: 5
I posted this in the OPL maintenance subforum, but not sure if that was a good place. Anyway, I am having issues with running OPL-update.

I get an error that state WEBWORK_ROOT is undefined. After looking thru the wiki, I saw that I should have some export commands in the .bashrc file.

I went ahead and added these three export lines. Including one for WEBWORK_ROOT. Im still getting the same error. Here are those export lines I added to the end of the .bashrc files for both root and my user.

export PATH=$PATH:/opt/webwork/webwork2/bin
export WEBWORK_ROOT=/opt/webwork/webwork2
export PG_ROOT=/opt/webwork/pg

I'm no longer getting the WEBWORK_ROOT error. However, we have new errors.

When I type ./OPL-update, I get an error now that the file does not exist. If I type $ sudo OPL-update, I get file not found error.However, If I type OPL-update (without sudo) I get the following:

fischerj@OTK-MATHDEV-01:/opt/webwork/libraries$ OPL-update
Library version is 2.5; using OPLtables!
Mysql database reinitialized.
Reading in textbook data from Textbooks in the library /opt/webwork/libraries/webwork-open-problem-library/OpenProblemLibrary.
Reading in OPL taxonomy from Taxonomy2 in the library /opt/webwork/libraries/webwork-open-problem-library/OpenProblemLibrary.
Cannot open /opt/webwork/webwork2/htdocs/DATA/tagging-taxonomy.json at /opt/webwork/webwork2/bin/OPL-update line 516.




What are the appropriate commands to use to get my OPL-update to work so that I can get the latest set of library problems? We were able to get this to work during the web conference, but has not worked since.





In reply to Jim Fischer

Re: Problems with OPL-update

by Jim Fischer -
Okay, I made some progress.

I changed to root, sudo su

Then I ran OPL-update. And the problems are now loading. Still not exactly sure what I am doing. It would be great to get those few command lines that are appropriate for updating the OPL.


In reply to Jim Fischer

Re: Problems with OPL-update

by Arnold Pizer -
Hi Jim,

You can look at
 http://webwork.maa.org/wiki/Installation_Manual_for_2.10_on_Ubuntu_14.04
specifically 
http://webwork.maa.org/wiki/Installation_Manual_for_2.10_on_Ubuntu_14.04#Updating_the_OPL

Note that you might have to do some preliminary stuff, e.g. 
http://webwork.maa.org/wiki/Installation_Manual_for_2.10_on_Ubuntu_14.04#Configuring_the_Shell
which you found.  Also note that file permissions, etc are set up so that the user "wwadmin" can do things.  If you had to be root to run OPL-update, then probably you didn't set things up so that the user you logged in as has permission to do things.

Arnie
In reply to Jim Fischer

Re: Problems with OPL-update

by Michael Gage -
As you notice you need the WEBWORK_ROOT variable in your environment.  You also need to permission to write to various directories, including htdocs/DATA.

If you use sudo, you are temporarily using the "root" .bashrc which probably doesn't have the WEBWORK_ROOT variable initialized.  One way around this is to use 

sudo -E ./OPL-update

The -E flag means use your own .bashrc file to initialize variables and aliases but also allows you root privileges for that command which means you have access to directories that you normally would not have access to.

Hope this helps.

-- Mike

In reply to Michael Gage

Re: Problems with OPL-update

by Danny Glin -
A couple of corrections to Mike's post:

When you sudo a command, by default (on most systems) very few environment variables are passed to the command.  This is to increase security.  This means that sudo doesn't know of any custom environment variables such as WEBWORK_ROOT, regardless of whose .bashrc file they are stored in.

There are two fixes to the problem that you describe:  one is to make sure that the user running OPL-update has permission to write to all of the relevant directories.  In most WeBWorK installations, this means making sure that your user is in the same group as the web server, and that these directories are owned and writeable by that group.

The second solution is as Mike describes, which is to use sudo -E.  One detail is that the -E flag doesn't read the .bashrc file, but simply uses the current environment when running the command (i.e. all of the variables that are set for the current user).  This means that if you were to run

export WEBWORK_ROOT=/opt/webwork/webwork2

followed by

sudo -E ./OPL-update

it should work even if WEBWORK_ROOT is not set in your .bashrc file.

One last comment: the .bashrc file is typically only read when a new session is started, so if you add things to .bashrc, you will typically have to log out and log back in before they take effect.

Danny
In reply to Danny Glin

Re: Problems with OPL-update

by Jim Fischer -
Thanks, I believe I have the permissions figured out and am now able to run the OPL-update.

I have a new problem after upgrading a different server from 2.9 to 2.10. Ill make a new post for that.