haiwen / seafile-rpi

Seafile server package for Raspberry Pi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

seahub problems with ubuntu 21.04.

lyq1996 opened this issue · comments

I installed seafile-server-8.0.7-buster-arm64v8.tar.gz from the github release in my raspberry pi 4 (4GB, running the official ubuntu-server 21.04), and I followed this guide (https:// manual.seafile. com/deploy/using_mysql/) to configure seafile-server, but I encountered two problems.

  1. when I try to start seahub with ./seahub.sh start command, failed.
Starting seahub at port 8000 ...

----------------------------------------
It's the first time you start the seafile server. Now let's create the admin account
----------------------------------------

What is the email for the admin account?
[ admin email ] ***********

What is the password for the admin account?
[ admin password ] 

Enter the password again:
[ admin password again ] 

Error happened during creating seafile admin.

Error:Seahub failed to start.

Then I set daemon = False at gunicorn.conf.py, it says

Error happened during creating seafile admin.

Traceback (most recent call last):
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/MySQLdb/__init__.py", line 18, in <module>
    from . import _mysql
ImportError: cannot import name '_mysql' from partially initialized module 'MySQLdb' (most likely due to a circular import) (/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/MySQLdb/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/bin/gunicorn", line 8, in <module>
    sys.exit(run())
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/wsgiapp.py", line 67, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/base.py", line 231, in run
    super().run()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/arbiter.py", line 58, in __init__
    self.setup(app)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/arbiter.py", line 118, in setup
    self.app.wsgi()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/seahub/wsgi.py", line 25, in <module>
    application = get_wsgi_application()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/contrib/sessions/models.py", line 1, in <module>
    from django.contrib.sessions.base_session import (
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/contrib/sessions/base_session.py", line 26, in <module>
    class AbstractBaseSession(models.Model):
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/db/models/base.py", line 117, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/db/models/base.py", line 321, in add_to_class
    value.contribute_to_class(cls, name)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/db/models/options.py", line 204, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/db/__init__.py", line 28, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/db/utils.py", line 201, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/db/utils.py", line 110, in load_backend
    return import_module('%s.base' % backend_name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/db/backends/mysql/base.py", line 15, in <module>
    import MySQLdb as Database
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/MySQLdb/__init__.py", line 24, in <module>
    version_info, _mysql.version_info, _mysql.__file__
NameError: name '_mysql' is not defined

Error:Seahub failed to start.

And I saw this isuse, and I add

import pymysql
pymysql.install_as_MySQLdb()

into seahub/seahub/__init__.py, and the isuse gone.

  1. After fix problem 1, the seahub still start failed.
Error happened during creating seafile admin.

Traceback (most recent call last):
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/seahub/avatar/models.py", line 23, in <module>
    from PIL import Image
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/PIL/Image.py", line 114, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/PIL/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/bin/gunicorn", line 8, in <module>
    sys.exit(run())
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/wsgiapp.py", line 67, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/base.py", line 231, in run
    super().run()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/arbiter.py", line 58, in __init__
    self.setup(app)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/arbiter.py", line 118, in setup
    self.app.wsgi()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/seahub/wsgi.py", line 25, in <module>
    application = get_wsgi_application()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/thirdpart/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/ubuntu/seafile/seafile-server-8.0.7/seahub/seahub/avatar/models.py", line 26, in <module>
    import Image
ModuleNotFoundError: No module named 'Image'
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again

Then I saw this post , then I rm -rf seahub/thirdpart/PIL/, now that seahub works.

Finally, I'm a little busy for work, so I hope someone can solve problems above for rpi4 that running ubuntu.

@lyq1996 thanks for reporting. These are not exclusively related to a device, like rpi4, moreover to the Distro. These are related to the fact that you use ubuntu 21.04 and you chosed the Buster Distro, since there is actually no Hirsuite release fo arm64. That's the issue with python modules regarding version python 3.8 vs. 3.9 and specific compilation for modules like PIL / Pillow.

Solution? Yes, to build for Ubuntu 21.04 (Hirsuite) as well.

If that's the case, to use an ubuntu release may be sufficient, to work with hirsute (?):
seafile-server-8.0.7-focal-arm64v8.tar.gz

I don't think so, since focal brings just python3.8. He will still suffer from PIL/Pillow Problems. We should build for Ubuntu 21.04 too.

@Gustl22 and me improved the build pipeline for consideing latest distros. @lyq1996 Hirsuite is available to download for v9.0.2