StamusNetworks / scirius

Scirius is a web application for Suricata ruleset management and threat hunting.
GNU General Public License v3.0
626 stars 150 forks source link

Migration error during update to 1.2.8-1 #133

Closed danragnar closed 6 years ago

danragnar commented 6 years ago

Hi.

I'm experiencing some issues when updating SELKS/Scirius related to database migration: /usr/share/python/scirius/local/lib/python2.7/site-packages/requests/init.py:80: RequestsDependencyWarning: urllib3 (1.16) or c hardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)

Traceback (most recent call last):
File "bin/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/core/management/init.py", line 354, in executefrom command_line
utility.execute()
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/core/management/init.py", line 346, in execute self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv self.execute(*args, *cmd_options)
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(
args, **options)
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in init self.loader = MigrationLoader(self.connection)
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in init
self.build_graph()
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 185, in build_graph
self.load_disk()
File "/usr/share/python/scirius/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 112, in load_disk
"Migration %s in app %s has no Migration class" % (migration_name, app_config.label)
django.db.migrations.loader.BadMigrationError: Migration 0003_auto_20171214_1103 in app accounts has no Migration class
dpkg: error processing package scirius (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (232-25+deb9u2) ...
Errors were encountered while processing:
scirius
E: Sub-process /usr/bin/dpkg returned an error code (1)

The upgrade were first done with a simple "apt-get update && apt-get upgrade", but then I saw there was a script to do the upgrade (selks-upgrade_stamus.sh), both generate the same result/problem. Not sure if I caused some problem when running the upgrade without the script. I have also tried to do the migration manually with "manage.py makemigrations", but that also shows the same problem.

Any ideas on how to get back on track?

BR, Dan

pevma commented 6 years ago

Usually it is best to do it as recommended on the wiki - https://github.com/StamusNetworks/SELKS/wiki/SELKS-upgrades

What was the original version of Scirius you are upgrading from?

danragnar commented 6 years ago

Yea, I realize that, I ran the upgrade script afterwards, but as I said, same output. I was running 1.2.6-2 before upgrading.

pevma commented 6 years ago

Can you try stopping Scirius if it is running then try again with the selks script ?

danragnar commented 6 years ago

I tried that, same result: "Migration %s in app %s has no Migration class" % (migration_name, app_config.label) django.db.migrations.loader.BadMigrationError: Migration 0003_auto_20171214_1103 in app accounts has no Migration class

What does the error indicate? That there's something missing in the migration of the database?

pevma commented 6 years ago

Is this a SELKS pkg install or were there any custom modifications on the codebase?

danragnar commented 6 years ago

The system is installed through the SELKS 4 ISO. I have made some minor changes in the logstash config to forward alerts to our central log system, but besides that it is bone stock.

regit commented 6 years ago

This migration is not supposed to be there (it may have been created by a locally done makemigrations). Remove it from filesystem and try again.

danragnar commented 6 years ago

That worked wonders! Thanks so much for the help.

BR, Dan