Common Issues and Solutions

alembic.util.exc.CommandError: Can’t locate revision identified by

Spotipo uses ‘alembic’ for migrating database structure. However in case there is something went wrong with the installation it might be possible that migration record and stored database version are out of sync.

Such case will cause the above error.

To fix this, follow below steps. Remember to take a database backup just in case.

  • Delete the table called alembic_version from database.
mysql -u root -p -e 'use spotipo; drop table alembic_version' 

  • Delete the migrations folder. Its kept in /usr/share/nginx/spotipo
rm -rf /usr/share/nginx/spotipo/migrations/
Error while getting sitelist. Please check Controller settings

As you have guesses, Spotipo needs a Unifi controller to function. If you haven’t installed it please install it from UBNT website.

This error is caused by Spotipo not being able to reach Unifi controller. Please make sure that you have configured hostname and login details of the controller correctly in Manage-> Settings

Too many redirects in Facebook login

There could be two reasons for this error.

  • Facebook IPs are not white listed. Check the facebook tutorial for knowing which IPs to white list.
  • Check-in is enabled, however Facebook APP is not approved for “publish_actions”. See this tutorial for understanding how to enable this.
SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform.

Check the version of your current python

python --version

If its less than 2.7.11 you will need to upgrade your python version. Please follow this tutorial

After up-gradation you will have to completely remove spotipo and re-install it.

sudo rm -rf /usr/share/nginx/spotipo

Delete the created database, provide your MySQL password when asked.

mysql -u root -p -e 'drop database spotipo'

Now install spotipo again using the standard command

dpkg -i spotipo_XXXXX.deb 
Recover MySQL password for spotipo

To recover the MySQL credentials used during installation, please open the config.py located in /usr/share/nginx/spotipo/instance

Look for a line that says

SQLALCHEMY_DATABASE_URI = mysql://<username>:<pass>@localhost/<dbname>'

For example

cat /usr/share/nginx/spotipo/instance/config.py
Reset a user account password

To reset a client/admin account’s password. One option is to use the Forgot password link available in login screen. However it will work only if you have configured a mail server.

Another option will be to reset using command line. Login to your server via ssh and execute below commands

sudo su
cd /usr/share/nginx/spotipo
source .env/bin/activate
python manage.py  reset_pass

This will show a list of available users, select the one you want to reset password for and follow the instructions.

OperationalError: (_mysql_exceptions.OperationalError) (xxxx, “Access denied for user ‘root’@‘localhost’”)

Sometimes after a fresh installation, login to spotipo may return a 500 error and you will see “Access denied for user ‘root’@‘localhost’” error in spotipo.log. To start with, please check for the mysql root password in config.py located in /usr/share/nginx/spotipo/instance and see if you are able to connect fine using it. You can connect to mysql by running the below command

mysql -u root -p
Enter password:

provide the root password at prompt. If the root password is correct, you will connect fine to mysql. Secondly make sure no special characters are set for mysql root password as this is not allowed.

But in most cases, the issue happens when root password is not set properly during installation. What happens here is if we don’t provide a password to the root user, it will use the auth_socket plugin. That plugin doesn’t care and doesn’t need a password. It just checks if the user is connecting using a UNIX socket and then compares the username. If we want to configure a password, we need to change the plugin and set the password at the same time, in the same command. To resolve the issue try running the below command in mysql prompt

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypasswordhere';

replace mypasswordhere with the root password you need to set for mysql. Make sure this new password is updated correctly in config.pylocated in /usr/share/nginx/spotipo/instance.

SIGPIPE: writing to a closed pipe/socket/fd and uwsgi_response_writev_headers_and_body_do(): Broken pipe

If you receive the above errors in spotipo, its due to configured read/send timeout being low in Nginx. To resolve the error please follow the steps below

First create a backup of the original nginx.conf file:

cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf_old

Open the file /etc/nginx/nginx.conf in any text editor and add the following directives inside the http {} section:

uwsgi_read_timeout 1200s;
uwsgi_send_timeout 1200s;

Restart the nginx service by issuing the below command:

service nginx restart

Once done, you should be able to download guest data from Spotipo without any errors.


How did we do?