Problem with roles in openwisp installation

691 views
Skip to first unread message

William Shi

unread,
Dec 19, 2017, 8:48:58 PM12/19/17
to OpenWISP
Hi I seem to be having trouble with the roles in installing openwisp2 like this post from earlier https://groups.google.com/forum/#!topic/openwisp/kiJfX9lD1gM, however I double checked and I did have the role installed already and even reinstalled and am still having the issue.(I am running virtual box on a windows 10 one instance of Ubuntu which is acting as my controller and one instance of Ubuntu server)


When running the ansible-playbook -i hosts playbook.yml -u <user> -k --become -K I get

                                                          

My playbook.yml looks like this




Federico Capoano

unread,
Dec 20, 2017, 4:01:23 AM12/20/17
to OpenWISP
Try removing the role and reinstalling without using "sudo". Something in the recent versions of ansible changed, before ansible-galaxy installed roles in /etc/ansible/roles (which require root privileges), now it installs them in the home directory of the user running ansible-galaxy so there's need to issue sudo anymore. The docs need to be updated, we are working on it: https://github.com/openwisp/ansible-openwisp2/issues/59

Federico

William Shi

unread,
Dec 20, 2017, 8:52:49 PM12/20/17
to OpenWISP

The issue was resolved but now I'm getting a new one error, it seems to might be a issue with my ssh connection but i can ssh into my server just fine

Federico Capoano

unread,
Dec 21, 2017, 3:05:41 AM12/21/17
to open...@googlegroups.com
Please paste the text instead of uploading images.
I have never encountered that issue, try rebooting, try again and if the problem persists look on google.

Federico

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

William Shi

unread,
Dec 23, 2017, 6:37:11 PM12/23/17
to OpenWISP
I was able to resolve the problem, it seems ansible works with python2 and by default ubuntu server has python3 rather than 2. Now I am getting a new error which looks like this.
TASK [openwisp.openwisp2 : migrate] *****************************************************************************************************************************
fatal: [ubuntu]: FAILED! => {"changed": false, "cmd": "./manage.py migrate --noinput", "msg": "\n:stderr: Traceback (most recent call last):\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", line 60, in get_new_connection\n    cur.execute(\"SELECT load_extension(%s)\", (self.spatialite_lib,))\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py\", line 328, in execute\n    return Database.Cursor.execute(self, query, params)\nsqlite3.OperationalError: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined symbol: sqlite3_spatialite_init\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"./manage.py\", line 10, in <module>\n    execute_from_command_line(sys.argv)\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/__init__.py\", line 364, in execute_from_command_line\n    utility.execute()\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/__init__.py\", line 356, in execute\n    self.fetch_command(subcommand).run_from_argv(self.argv)\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/base.py\", line 283, in run_from_argv\n    self.execute(*args, **cmd_options)\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/base.py\", line 330, in execute\n    output = self.handle(*args, **options)\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/commands/migrate.py\", line 81, in handle\n    connection.prepare_database()\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", line 72, in prepare_database\n    with self.cursor() as cursor:\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", line 254, in cursor\n    return self._cursor()\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", line 229, in _cursor\n    self.ensure_connection()\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", line 213, in ensure_connection\n    self.connect()\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", line 189, in connect\n    self.connection = self.get_new_connection(conn_params)\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", line 65, in get_new_connection\n    six.reraise(ImproperlyConfigured, ImproperlyConfigured(new_msg), sys.exc_info()[2])\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/six.py\", line 685, in reraise\n    raise value.with_traceback(tb)\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", line 60, in get_new_connection\n    cur.execute(\"SELECT load_extension(%s)\", (self.spatialite_lib,))\n  File \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py\", line 328, in execute\n    return Database.Cursor.execute(self, query, params)\ndjango.core.exceptions.ImproperlyConfigured: Unable to load the SpatiaLite library extension \"libspatialite.so.7\" because: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined symbol: sqlite3_spatialite_init\n", "path": "/opt/openwisp2/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin", "state": "absent", "syspath": ["/tmp/ansible_qw4W0_", "/tmp/ansible_qw4W0_/ansible_modlib.zip", "/tmp/ansible_qw4W0_/ansible_modlib.zip", "/usr/lib/python2.7", "/usr/lib/python2.7/plat-x86_64-linux-gnu", "/usr/lib/python2.7/lib-tk", "/usr/lib/python2.7/lib-old", "/usr/lib/python2.7/lib-dynload", "/usr/local/lib/python2.7/dist-packages", "/usr/lib/python2.7/dist-packages"]}
    to retry, use: --limit @/home/william/openwisp2-ansible-playbook/playbook.retry

PLAY RECAP ******************************************************************************************************************************************************
ubuntu                     : ok=39   changed=0    unreachable=0    failed=1   

The issue seems to be specifically regarding openwisp migration and the only post I could find similiar to this issue was this one https://groups.google.com/forum/#!topic/openwisp/B2rdQJ8TSM4 but after comparing the error messages I think it is not the same issue. Have any suggestions?


On Tuesday, December 19, 2017 at 7:48:58 PM UTC-6, William Shi wrote:

Federico Capoano

unread,
Dec 24, 2017, 4:43:06 AM12/24/17
to open...@googlegroups.com
what OS are you using for your VM?

William Shi

unread,
Dec 24, 2017, 8:27:41 PM12/24/17
to OpenWISP
ubuntu 16.04.3 desktop for controller and unbuntu 16.04.3 server as the server

Federico Capoano

unread,
Dec 25, 2017, 6:21:47 AM12/25/17
to OpenWISP
What happens if you destroy the VM, recreate it and start again from scratch, do you get the same error?

Federico

William Shi

unread,
Dec 25, 2017, 3:55:44 PM12/25/17
to OpenWISP
I still get the same error

Federico Capoano

unread,
Dec 27, 2017, 5:20:50 AM12/27/17
to OpenWISP
It has to do with this issue:

Are you able to try to apply the fix manually and run:

cd /opt/openwisp2
source env/bin/activate
./manage.py migrate

And let me know if it works?

Federico
Message has been deleted

William Shi

unread,
Dec 27, 2017, 11:11:53 PM12/27/17
to OpenWISP
Hi, thanks for the response! Just to make sure the manual fix is done in my desktop controller and the set of commands you listed is done on the server yes. If so I am currently stuck on the last step ./manage.py migrate I am getting an error that says
(env) william@ubuntu:/opt/openwisp2$ sudo ./manage.py migrate
Traceback (most recent call last):
    File "./manage.py", line 8, in <module>
           from django.core.management import execute_from_command_line
importError: No module named django.core.management

I am currently troubleshooting the issue.

William Shi

unread,
Dec 28, 2017, 12:00:03 AM12/28/17
to OpenWISP
When I run python -c "import django; print(django.get_version())"  in the virtualenv I get 1.11.8, however when I run python it says 3.5.2 as its default, but I remember that earlier I had an issue that wouldn't be resolved until I installed python2. Do you think a conflict of python versions is causing my issue? If so would I just follow this guide http://barkas.com/2016/change-python-version-in-virtualenvwrapper/?

Federico Capoano

unread,
Dec 28, 2017, 2:20:43 AM12/28/17
to open...@googlegroups.com
That error means the virtualenv is not activated (django is installed in the python virtualenv).
You are doing this for the Google Code-In right?
If yes, I suggest you to temporarily drop this task and perform other tasks which will teach you some more basics which then will make this task look much easier.
For example you can do:
  • prepare your development environment
  • get started with linux
  • learn python and django by creating your blog
  • learn to build a REST API with django
  • learn DevOps practices with ansible
After these tasks you'll eat this one easily.

Federico

Federico Capoano

unread,
Dec 29, 2017, 1:40:44 PM12/29/17
to OpenWISP

William Shi

unread,
Jan 1, 2018, 11:57:53 PM1/1/18
to OpenWISP
I'm still getting the same error with my old set of vms and a fresh set of vms. In addition I'm still getting the same error when trying the old fix I was getting before when trying to do the sudo ./manage.py migrate. The source env/bin/activate should activate the virtual enviroment yes? I also have the  (Env) tag in front of the commands I'm running so I know the python virtual enviroment is activated.

p.s Happy New Years!

Federico Capoano

unread,
Jan 3, 2018, 3:50:54 AM1/3/18
to OpenWISP
I'm sorry, It's a bug with the new release that manifests on some systems: https://github.com/openwisp/ansible-openwisp2/issues/68

We are working on it.

Federico

William Shi

unread,
Jan 10, 2018, 1:02:00 AM1/10/18
to OpenWISP
New changes worked. Thank you so much for your time and help! Have a great day!


On Tuesday, December 19, 2017 at 7:48:58 PM UTC-6, William Shi wrote:

Federico Capoano

unread,
Jan 10, 2018, 4:11:42 AM1/10/18
to open...@googlegroups.com
Thx for reporting, I'll publish the latest role version now.

Reply all
Reply to author
Forward
0 new messages