Open edX is a remarkably stable platform, but if you’re having problems with your instance then hopefully this troubleshooting guide will help. This is a collection of the configuration and maintenance related problems that I routinely encounter, along with the prescriptive measures with which I’ve had the most success.
Table of Contents
The cure-all: Restarting the platform
When your Open edX installation is misbehaving and you’re unsure of your next step, I always like to begin with a reboot. It can’t hurt, and occasionally you’re pleasantly surprised to find your instance in good health immediately afterwards. The commands are as follows:
- A cold boot (reboots the entire server)
sudo reboot
- A warm boot (restarts Open edX)
# These are the commands for restarting the LMS and CMS beginning with Gingko /edx/bin/supervisorctl restart lms /edx/bin/supervisorctl restart cms # If you're running a previous version of Open edX then use this command instead /edx/bin/supervisorctl restart edxapp: # This is the command to stop and restart the RabbitMQ Celery workers /edx/bin/supervisorctl restart edxapp_worker:
Forgot Open edX admin username or password
This is nothing more than a minor speed bump provided that you still have terminal access via SSH. Open edX relies on a single master user list that is stored in MySQL in the table “edxapp.auth_user”. You have a few options for how to regain administrative access to the LMS and CMS depending on your level of comfort with the different technologies.
- Review the row-level contents of the MySQL table edxapp.auth_user. You can login to MySQL from a Linux terminal window using the command line. By default the root password of the local instance of MySQL is left blank. If you’re unable to login as root then Open edX also creates a MySQL user named edxapp, the password of which you’ll find in the master password file that is (hopefully) saved in /home/ubuntu/my-passwords.yml.
– To login to MySQL from the command line:mysql -u root -p
– To view all users:select * from auth_user;
– To logout of MySQL:exit
Once you find your user name and email address you can use the LMS login screen to request a password reset.
- Create a new user with the Django Command Line Interface. If you’re more comfortable working with Django then you can create a completely new superuser account with the following command, substituting “mcdaniel” with your username and “lpm0073@gmail.com” with your email address:
sudo su edxapp -s /bin/bash cd /edx/bin/python.edxapp /edx/bin/manage.edxapp lms lmcdaniel staff lpm0073@gmail.com --staff --superuser --settings=aws
To change the password execute this line:
sudo -u www-data /edx/bin/python.edxapp /edx/app/edxapp/edx-platform/manage.py lms --settings aws changepassword mcdaniel
- Insert a new user record into the MySQL table “edxapp.auth_user”. If all else fails then you can force a new record into the user table. Take note however that password values are encrypted and thus you cannot simply insert a password value into this table. Instead you’ll need to either use the Django console command from option 2 above, or request a password reset from the LMS login screen. The insert statement will be of the form:
INSERT edxapp.auth_user (is_superuser, username, first_name, last_name, email, is_staff, is_active) VALUES(1, 'mcdaniel', 'Lawrence', 'McDaniel', 'lpm0073@gmail.com', 1, 1);
Open edX email is flagged as spam
If you recently installed Open edX and are just getting started setting up new users then you’ve probably seen that the “Account Activation” welcome emails that Open edX sends to newly registered users are almost always flagged as spam by users’ email management applications like MS Outlook and Mac Mail. In defense of the architects of Open edX, this is actually not a defect of the software but rather an indication that you still have more configuration and systems integration work to do.
To cure this problem you’ll need integrate your Open edX instance to an SMTP-compliant email server like MS Exchange or Gmail. I wrote a blog post, “Setup SMTP Email on Open edX“, that provides detailed step-by-step instructions.
Incidentally you might have also run into problems with the activation email itself providing a broken account activation link that points to “http://localhost”. This is a simpler problem which you can remedy by editing the configuration file /edx/app/edxapp/lms.env.json. Look for the following three parameter values:
"LMS_BASE": "localhost", "LMS_INTERNAL_ROOT_URL": "localhost", "LMS_ROOT_URL": "localhost",
and then replace the value “localhost” with your fully qualified domain name. These parameter values should be located contiguously beginning approximately on row 245 of this file.
Poor server performance
If your Open edX server seems sluggish, and …
- your Open edx instance is running in AWS or Azure or GCC, and
- you have not modified the program code of your Open edX instance, and
- your Open edX instance is intended to support fewer than a few hundred concurrent users (ie users simultaneously logged in to your server)
then the short story is that you probably need more computing infrastructure. Save yourself time and brain damage by not attempting to “tune” your Open edX instance. It is already optimized, and frankly, you’ll do more harm than good if you begin tinkering with operating system and subsystem configurations. Instead, you can use the Linux command “top” to view real-time vital statistics of your Ubuntu server instance to begin to get a better understanding where performance bottlenecks problems might exist.
If you do not see problems with CPU and Memory then your problems might lie elsewhere with your IT infrastructure, beginning with network bandwidth and latency on both the server and client sides.
HTTP firewall ports
Open edX uses lots of http ports, and many of these are non-standard. If your server appears to be functional but you’re having trouble getting LMS or CMS pages to render in your browser then your firewall ports are a good place to begin troubleshooting. As of this writing you should ensure that the following ports are opened in your firewall:
Port | Description |
---|---|
22 | SSH |
80 | HTTP |
443 | HTTPS |
18000-18999 | Other Django Applications (like Course Management Studio) |
8000-8999 | Internal subsystem interoperation |
Uh oh, we are having some server issues..
If your LMS returns the dreaded “Uh oh, we are having some server issues..” message then you most likely are suffering from configuration errors that are directly related to the parameter values stored in any of the four JSON files saved in /edx/app/edxapp/.
These errors generally fit into one of the following cases:
- a JSON Syntax error in the file. This file has to syntactically conform to JSON standards. If there are ANY syntax violations, no matter how minor they might seem, this will break your Open edX installation. I prefer to edit these files on my laptop using a code editor like Atom or Sublime. Both of these editors provide native syntax highlighting for JSON files, which will help you to quickly identify any structural problems in the files.
- An invalid parameter value that causes Python/Django to throw an application exception. For example, if one of these parameters expects an integer but you provided a decimal number or an alpha character then this will break your Open edX instance. Frustratingly, in most cases you will not find ant useful diagnostics information in the logs files (example: /edx/var/log/lms/edx.log). Therefore, you should be methodical in modifying parameter values, testing each change individually.
- An invalid URL / URI. Keep in mind that the syntax of URL’s is evaluated at application startup whereas other problems like http return errors are evaluated at run-time. Thus if you’re certain that a recently-modified URL’s are causing problems then at the very least you can use this as a guideline for refining the nature of your problem.
Alternatively, if you’ve successfully modified one of these files and the platform still works, but the change doesn’t seem to have taken effect then you probably need to restart the applications. I suggest that you download the following script and edit the commands as indicated in the description in the script header: https://github.com/lpm0073/edx.scripts/blob/master/edx.platform-restart.sh
Comprehensive theming problems
A common problem that you might encounter when you first begin to work with Open edX’s comprehensive theming system is that modifications to your theme are inconsistently rendered in the browser. Changes to Mako templates take effect immediately whereas changes to static assets like images, CSS and javascript might not appear, or at the very least these do not render as you’d intended.
Theme assets have to be “compiled”. That is, a set of subroutines on the server must first aggregate, pre-process and archive these files into a caching area on the server located at /edx/var/edxapp/staticfiles/. The following commands execute the static asset compilation process:
# update assets as edxapp user sudo -H -u edxapp bash << EOF source /edx/app/edxapp/edxapp_env cd /edx/app/edxapp/edx-platform paver update_assets lms --settings=aws paver update_assets cms --settings=aws EOF # restart edx instances sudo /edx/bin/supervisorctl restart lms sudo /edx/bin/supervisorctl restart cms #sudo /edx/bin/supervisorctl restart edxapp: #for versions prior to Ginkgo /edx/bin/supervisorctl restart edxapp_worker:
For more information you might want to read my blog article, “Open edX Custom Theming Tutorial“
MySQL database errors
There are a couple of situations which can leave you with an Open edX codebase that is out of synch with the underlying MySQL database schemas. If you’ve upgraded your edx-platform code base recently, or if you recently restored one or more of the MySQL databases from another instance then you might experience sporadic errors when trying to save certain information.
The LMS and CMS are both written in Python/Django, which relies on a process called “database migrations” whereby Django source code is analyzed to infer what database structures must exist in order to persist the data from the Django models. The following series of commands will execute database migrations for both the LMS and CMS.
sudo -H -u edxapp -s bash << EOF cd ~ source /edx/app/edxapp/edxapp_env python /edx/app/edxapp/edx-platform/manage.py lms makemigrations --settings=aws python /edx/app/edxapp/edx-platform/manage.py lms migrate --settings=aws python /edx/app/edxapp/edx-platform/manage.py cms makemigrations --settings=aws python /edx/app/edxapp/edx-platform/manage.py cms migrate --settings=aws EOF
Linux file permissions
Like all Linux software, file ownership and permissions play an integral role in the Open edX architecture. Modifying files permissions, broadly speaking, is a terrible idea. But, if you find yourself wishing that you’d read this post sooner then here are a couple of general suggestions for getting your Open edX instance back to “factory” settings.
- Re-install the edx-platform software code. You should definitely snapshot your instance before heading down this path. But this is otherwise a simpler procedure that it may seem. Ansible does everything for you. The commands are as follows:
sudo rm -r /edx/app/edxapp/edx-platform/ nohup wget https://raw.githubusercontent.com/edx/configuration/master/util/install/sandbox.sh -O - | bash > install.out &
The installation will run as a background process which you can process by using the “tail” command on the the install.out output file. You can also use “top” to monitor the activity and progress real-time.
- Trying the following:
sudo chown -R edxapp /edx/app/edxapp/edx-platform/ sudo chgrp -R edxapp /edx/app/edxapp/edx-platform/ sudo chmod 2755 /edx/app/edxapp/edx-platform/ find /edx/app/edxapp/edx-platform -type d -exec sudo chmod 2755 {} \;
As best I can tell, all file permissions appear to be 755 and the owner and group are both assigned to edxapp. This code snippet will set all files in the edx-platform codebase to these exact settings. While this APPEARS to be correct, I have no way to verify that this is unequivocally the case throughout the entire codebase.
Internal server authentication problems
During your original native build installation process you executed a really cool piece of code — https://github.com/edx/configuration/blob/master/util/install/generate-passwords.sh — that generates strong, randomized passwords for the couple of dozen system accounts that support your Open edX installation. The native build ansible installation scripts refer to the resulting file, /home/ubuntu/my-passwords.yml, to assign passwords for all of these system accounts.
If you deleted the file my-passwords.yml from your home directory then it might be game over for you. The only cure to not having these passwords available is the following:
- individually export your courses
- create a dump of the MySQL databases (assuming that the root password is still blank)
- build a new Open edX instance, import your courses, and restore the MySQL data
- run database migrations
- compile static assets
Nginx web server configuration problems
If you suspect that you’re having problems with Nginx then please note that I’ve never needed to modify the stock configurations created by Ansible other than to add SSL certificates, in which case I use the procedure described in my blog post, “Add SSL Encryption to Open edX“. That is, if I haven’t previously modified the Nginx configuration to add SSL then it definitely has never been a problem.
If you remain skeptical then you might try the following, which will restart the Nginx service and then provide a status report:
sudo systemctl restart nginx sudo systemctl status nginx
Celery configuration problems
Celery — also known as RabbitMQ — is a low-level subsystem that brokers tasks and messages between the LMS and CMS applications and the many underlying subsystems. On an aside, once I wrapped my head around what RabbitMQ does I was completely blown away by the elegance of it all. It’s a work horse, and for the most part its a trouble-free cornerstone of your platform. Occasionally however, you’ll do something like say, migrate your Open edX instance to a larger server, that unexpectedly causes Celery to break.
This topic is important enough that it got it’s own dedicated blog post, “Troubleshooting Celery & RabbitMQ For Open edX“.
Django configuration
If you’re not a Python Django developer and you haven’t previously supported a Django app then you’d have no reason to be aware that Django apps have their own back end that’s somewhat similar the WordPress admin console. From your web browser, open your LMS, login, and then navigate to /admin/.
I suggest that you spend some time to get acquainted with the parameters that are available to modify in the console. How and what parameters make their way onto the Django console screen are the stuff of books on learning to code in Django — and I shan’t steal their thunder here in my humble blog.
I hope you found this helpful. Please help me improve this article by leaving a comment below. Thank you!
I Have created admin account but when i came to login in LMS it says “We couldn’t sign you in”
Hello thank you for all the helpful information on your blog. I would like to ask how can I change the template of a Course certificate and the badge icon?
I use tutor. I’ve found some guides, I’ve changed it but nothing happened at the end.
Thank you in advance
Badges-Certificates
Default images are supplied in Open edX for course completion badges.
Be sure to replace these default badge images with your organization’s own badge images before any badges are issued.
When the first badge is issued for a given course, badge images are uploaded to Badgr Server.
All badges issued in future for this course will use this uploaded original badge image, even if you subsequently change badge images in the Django Administration badge image configuration.
Access the Django Administration website for your instance of Open edX.
To do this, go to https://dev.mooc.edu.gr/admin 1.
Select Site Administration > Badges > Course complete image configurations, and then define a course complete image configuration for each course mode on your platform for which you want to issue badges upon course completion.
Examples of course modes are “professional” or “advanced” or “basic”.
For each course complete badge image configuration, set these parameters.
• Mode: The course mode for which the badge image should be used.
• Icon: The badge image to use for the specified course mode.
Important
Be sure to replace the default badge images with your organization’s own badge images before any badges are issued!!!
Optionally, you can define a badge image that will be used as the default badge image for any course modes that do not have an explicitly specified badge image.
To do so, in the course complete image configuration that references the image you want to use as a default, select the Default checkbox. After you save the configuration, this badge image is used for any course completion badge configurations that do not have a badge image explicitly specified.
Note
You can specify only one default badge image.
Save each configuration parameter and exit the Django Administration website.
Create Course Event Badges for Your Open edX Instance
Open edX provides several customizable course event badges that can be awarded when any of the following events occur.
A learner enrolls in a certain number of courses.
A learner receives a completion certificate for a certain number of courses.
A learner receives a completion certificate for every course in a specified list of courses.
Before course event badges can be awarded, you must customize them with your parameters and badge images. To customize any of the course event badges, follow these steps.
Access the Django Administration website for your instance of Open edX.
To do this, go to https://dev.mooc.edu.gr/admin 1.
2.1 Select Site Administration Course Mode
Admin panel: Course modes -> Add course mode
fill in course ID: course-v1:dsfds+sfdds+dsd
select “honor” mode
fill in display name
fill in “0” under Price
fill in “usd” under Currency
rest stays empty
2.2 Select Site Administration > Badges > Badge Classes.
Add badge class (fill in slug from server, fill in display name, fill in course ID, fill in description, fill in criteria or link to course landing page, select “honor” mode, upload badge image)
Developer needs to award certificate to a test account (to get the slug from the server)
Also important for certificates: activating honor mode
To be done BEFORE anyone enrols on the cours
Add a badge class for each course event for which you want to issue badges.
Examples of course events might be enrolling in five courses, or completing three required courses.
For each badge class, set the following parameters.
Slug: A unique identifier that you choose to identify the badge class. This identifier can contain only numbers, lowercase letters, underscores, or hyphens. The slug, combined with the Issuing Component value, uniquely identifies a badge.
Issuing Component: Identifies the part of the platform that is issuing the badge. This identifier can contain only numbers, lowercase letters, underscores, or hyphens. For the three customizable course event badges that are included in the Open edX platform, the value for Issuing Component must be openedx__course (with two underscores). For course completion badges that are included in the Open edX platform, the issuing component value should be empty.
For new badge types that you create, specify an Issuing Component value that identifies the software component responsible for issuing the badge. For example, if badges are issued by the course management component, you might define Issuing Component as platform__course; if badges are issued based on activity in course discussions, you might define Issuing Component as platform__discussions.
Display name: The human readable badge name that is used when badges are shown to learners, for example, in the Accomplishments view of learners’ profiles.
Course ID: This value should be blank for course event type badges, as they are not associated with a single course.
Description: A description of this badge.
Criteria: A description of the criteria for awarding this badge.
Mode: The course mode for the course associated with this badge, if applicable.
Image: The badge image to use for this badge. Badge images should be square .png files less than 250KB in size.
An example of a badge class configuration might have the following values.
slug: enrolled_three
issuing_component: openedx__course
display_name: Enroll in Three Courses
description: Enrolled in three courses
criteria: A learner must enroll in three courses to receive this badge
image: triple_enrollment_badge_image.png
When you have finished defining the badge class, select Save.
Next, you create a new course event badge configuration that defines all of the course event badges that you want to issue.
Select Site Administration > Badges > Course event badges configurations > Add course event badges configuration.
Important
You can create more than one course event badge configuration, but you can only mark one configuration as Enabled. Only the most recently activated course event badge configuration is used.
Within the new course event badge configuration, set the following parameters.
Courses completed: Define badges to be awarded for completing a certain number of courses, or completion of specific courses. Define one badge per line. On each line, enter the number of courses that must be completed, followed by a comma and then the slug of the badge class to associate with this badge.
For example, to configure two badges, one that is awarded when a learner completes 3 courses, and another that is awarded when a learner completes 8 courses, you add two lines to the Courses completed field.
3,completed_three 8,completed_eight
where completed_three and completed_eight are badge slugs that you previously defined in badge classes.
Courses enrolled: Define badges to be awarded for enrolling in a certain number of courses, or enrolling in specific courses. Define one badge per line. On each line, enter the number of courses that must be enrolled in, followed by a comma and then the slug of the badge class to associate with this badge.
For example, to configure a badge that is awarded when a learner enrolls in 5 courses, you add this definition.
5,enrolled_five
where enrolled_five is a badge slug that you previously defined in a badge class.
Course groups: Define badges to be awarded for completing a list of specific courses. Define one badge per line. On each line, enter the slug of the badge class, a comma, then the list of course keys.
For example, to configure a badge that is awarded when a learner completes the 3 prerequisite courses in a series, you add this definition.
prereq_computerscience_badge_slug,course1_identifier,course2_identifier,course_3_identifier
where prereq_computerscience_badge_slug is a badge slug that you previously defined in a badge class, and course1_identifier, course2_identifier, and course3_identifier are the Course IDs for the three courses that must be completed for this badge.
When you have finished defining badges in the configuration, select Save.
To activate this configuration, select Enabled at the top of the configuration page.
Important
You can create more than one course event badge configuration, but you can only mark one configuration as Enabled. Only the most recently activated course event badge configuration is used.
Admin panel: Link course -> Add link course (fill in course ID, select Organization, “Active” should be ticked)
Admin panel: Certificate templates (fill in name, fill in template, select organization ID, fill in course key (ID), choose “honor” mode, tick “Active”, select “All languages”)
Admin panel: Organizations -> Add organization (fill in Name and Short Name, “Active” should be ticked)
To activate certificates
Px TeachUPTU4_Creative_EL
https://studio.dev.mooc.edu.gr/course/course-v1:dsfds+sfdds+dsd
Studio: Settings -> Certificates -> fill in fields and upload signatures (Mode -> honor, “Active” should be ticked)
Studio: Settings -> Advanced Settings -> Certificates Display Behavior: early_with_info
Studio: Settings -> Advanced Settings -> Issue Open Badges: true
To automatically award certificate, in LMS: Instructor -> Certificates -> Student-generated certificate
Configuring Open edX Certificates in Studio |
https://www.youtube.com/watch?v=IJvMjou8e64
Hi Lawrence,
I got a system error in Django admin in some particular courses from the course overview tab.
Hi I’m getting an error as “Connection Refused” but studio is working fine on the port 18010. Why this could have happened ?
Hi Lawrence,
Actually, I want to change my HTML in the LMS(admin) section. But not able to find the HTML file for that. Can you please help me in finding the file for it.
Thank you
Satyam
here’s documentation on how to customize the styling of the django admin console: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates
Hey, Lawrence!
First, excuse me for my bad english 🙂
My problem – when I want to restart my open edx platform with this commands:
/edx/bin/supervisorctl restart lms
/edx/bin/supervisorctl restart cms
I have error: unix:///edx/var/supervisor/supervisor.sock no such file
My OS Ubuntu 16.04 x64 located on the VMBox within Windows 10 x64. It’s my local computer, not on server.
My steps to restart:
cd edx/devstack
make dev.up
make discovery-shell
sudo /edx/bin/supervisorctl restart lms
Is it right steps? I installed open edx with this tutorial: https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/installation/install_devstack.html
I hope, that You’ll answer me 🙂
Hi Lawrence, we have some issues in discussion forum. It was working fine few days back, but now we are not able to post, delete, comment on posts, it gives ERROR “Your request could not be processed. Refresh the page and try again.”
The log says:
File “/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/requests/adapters.py”, line 449, in send
raise ReadTimeout(e, request=request)
ReadTimeout: HTTPConnectionPool(host=’localhost’, port=18080): Read timed out. (read timeout=5.0)
Kindly provide some help of yours in this regard.
Thanking you!
I am unable to access my Open Edx site remotely via http: – I am getting the following error on the webpage:
504 Gateway Time-out
nginx
How can I fix this?
500-level error indicate a server-side configuration error like for example, a syntax error in your edx/app/edxapp/ json files, or any python run-time error. errors of this nature will appear in the application log along with a complete stack trace. the log entries are ugly, but highly informative. if you see a 500 error on the open edx LMS home page then use the following command to view the most recent contents of the LMS log: tail -n 50 /edx/var/log/lms/edx.log
I checked the actual setting affects URL in activation/password reset email is SITE_NAME, not specified settings in this post.
Thanks a ton!!