Upgrade from 6.2.13 to 6.3.2 (migrate_file_comment error) (Arch_Linux)

Hi there,

I’m having an error trying to execute the migrate_file_comment script.
Running seafile on Arch Linux.

Any ideas?
What can I check if the database is OK? I’m asking because when I first upgraded I saw a warning about a comment table (?) when starting seahub and I can’t see it anymore.

$ sudo systemctl status seahub

● seahub.service - Seahub server
   Loaded: loaded (/etc/systemd/system/seahub.service; enabled; vendor preset: disabled)
   Active: active (exited) since Fri 2018-08-03 21:10:40 WEST; 27s ago
  Process: 16005 ExecStart=/srv/seafile/cal/seafile-server-latest/seahub.sh start (code=exited, status=0/SUCCESS)
 Main PID: 16005 (code=exited, status=0/SUCCESS)
    Tasks: 6 (limit: 4915)
   Memory: 99.3M
   CGroup: /system.slice/seahub.service
           ├─16041 python2.7 /srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/gunicorn seahub.wsgi:application -c /srv/seafile/cal/conf/gunicorn.conf --preload
           ├─16597 python2.7 /srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/gunicorn seahub.wsgi:application -c /srv/seafile/cal/conf/gunicorn.conf --preload
           ├─16598 python2.7 /srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/gunicorn seahub.wsgi:application -c /srv/seafile/cal/conf/gunicorn.conf --preload
           ├─16599 python2.7 /srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/gunicorn seahub.wsgi:application -c /srv/seafile/cal/conf/gunicorn.conf --preload
           ├─16600 python2.7 /srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/gunicorn seahub.wsgi:application -c /srv/seafile/cal/conf/gunicorn.conf --preload
           └─16601 python2.7 /srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/gunicorn seahub.wsgi:application -c /srv/seafile/cal/conf/gunicorn.conf --preload

Aug 03 21:10:34 nuc systemd[1]: Starting Seahub server...
Aug 03 21:10:34 nuc seahub.sh[16005]: LC_ALL is not set in ENV, set to en_US.UTF-8
Aug 03 21:10:34 nuc seahub.sh[16005]: Starting seahub at port 8000 ...
Aug 03 21:10:40 nuc seahub.sh[16005]: Seahub is started
Aug 03 21:10:40 nuc seahub.sh[16005]: Done.
Aug 03 21:10:40 nuc systemd[1]: Started Seahub server.

$ sudo systemctl status seafile

● seafile.service - Seafile server
   Loaded: loaded (/etc/systemd/system/seafile.service; enabled; vendor preset: disabled)
   Active: active (exited) since Fri 2018-08-03 21:10:30 WEST; 1min 54s ago
  Process: 15878 ExecStart=/srv/seafile/cal/seafile-server-latest/seafile.sh start (code=exited, status=0/SUCCESS)
 Main PID: 15878 (code=exited, status=0/SUCCESS)
    Tasks: 70 (limit: 4915)
   Memory: 425.1M
   CGroup: /system.slice/seafile.service
           ├─15906 /srv/seafile/cal/seafile-pro-server-6.3.2/seafile/bin/seafile-controller -c /srv/seafile/cal/ccnet -d /srv/seafile/cal/seafile-data -F /srv/seafile/cal/conf
           ├─15909 ccnet-server -F /srv/seafile/cal/conf -c /srv/seafile/cal/ccnet -f /srv/seafile/cal/logs/ccnet.log -d -L /srv/seafile/cal -P /srv/seafile/cal/pids/ccnet.pid
           ├─15913 /usr/bin/python2.7 -m seafevents.main --config-file /srv/seafile/cal/conf/seafevents.conf --logfile /srv/seafile/cal/logs/seafevents.log -P /srv/seafile/cal/pids/seafevents.pid
           ├─15914 /bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.no>
           ├─15925 seaf-server -F /srv/seafile/cal/conf -c /srv/seafile/cal/ccnet -d /srv/seafile/cal/seafile-data -l /srv/seafile/cal/logs/seafile.log -P /srv/seafile/cal/pids/seaf-server.pid -L /srv/seafile/cal
           ├─15980 /usr/bin/python3 /srv/seafile/cal/seafile-pro-server-6.3.2/pro/python/seafevents/office_converter/unoconv.py -vvv --pipe seafilepipe -l
           └─15983 /usr/lib/libreoffice/program/soffice.bin --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore --accept=pipe,name=seafilepipe;urp;StarOffice.ComponentContext

Aug 03 21:10:26 nuc seafile-control[15899]: seafile-controller.c(1142): loading seafdav config from /srv/seafile/cal/conf/seafdav.conf
Aug 03 21:10:27 nuc seafile.sh[15878]: [08/03/18 21:10:27] ../common/session.c(139): using config file /srv/seafile/cal/conf/ccnet.conf
Aug 03 21:10:27 nuc seafile.sh[15878]: [08/03/18 21:10:27] ../common/license.c(406): Loading license file /srv/seafile/cal/seafile-license.txt ..
Aug 03 21:10:27 nuc seafile.sh[15878]: [08/03/18 21:10:27] ../common/license.c(409): License file /srv/seafile/cal/seafile-license.txt does not exist, allow at most 3 trial users
Aug 03 21:10:27 nuc seafile.sh[15878]: License file /srv/seafile/cal/seafile-license.txt does not exist, allow at most 3 trial users
Aug 03 21:10:27 nuc seafile.sh[15878]: Starting seafile server, please wait ...
Aug 03 21:10:27 nuc seafile-control[15905]: seafile-controller.c(1142): loading seafdav config from /srv/seafile/cal/conf/seafdav.conf
Aug 03 21:10:30 nuc seafile.sh[15878]: Seafile server started
Aug 03 21:10:30 nuc seafile.sh[15878]: Done.
Aug 03 21:10:30 nuc systemd[1]: Started Seafile server.

$ cd $HOME/cal/seafile-server-latest
$ ./seahub.sh python-env seahub/manage.py migrate_file_comment

LC_ALL is not set in ENV, set to en_US.UTF-8
Traceback (most recent call last):
  File "seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/django/core/management/__init__.py", line 308, in execute
    settings.INSTALLED_APPS
  File "/srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/srv/seafile/cal/seafile-pro-server-6.3.2/seahub/thirdpart/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/srv/seafile/cal/seafile-pro-server-6.3.2/seahub/seahub/__init__.py", line 2, in <module>
    from signals import repo_created, repo_deleted, clean_up_repo_trash
ModuleNotFoundError: No module named 'signals'
Done.

This looks wrong to me. Shouldn’t it use python 2.7?

Yes, that’s the typical Arch problem. If you just write “python”, it’ll be executed with python 3.6. You have to put in python2 for python 2.7, unlike all other distributions. That’s why I don’t use Arch for servers, even it’s the best OS for daily machine.

@paapereira: You have to modify the script on several parts, just change python -> python2. Then it will work.

1 Like

Yep :slight_smile: it worked.

For reference:

$ cd $HOME/cal/seafile-server-latest
$ vi seahub/manage.py

Replaced:
!/usr/bin/env python
With:
!/usr/bin/env python2

$ ./seahub.sh python-env seahub/manage.py migrate_file_comment

LC_ALL is not set in ENV, set to en_US.UTF-8

Warning: File comment has changed since version 6.3, while table `base_filecomment` is not migrated yet, please consider migrate it according to v6.3.0 release note, otherwise the file comment feature will not work correctly.
            
Start to update schema...
ALTER TABLE base_filecomment RENAME TO base_filecomment_backup_b58b3b

CREATE TABLE `base_filecomment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `author` varchar(255) NOT NULL,
  `comment` longtext NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `uuid_id` char(32) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `base_filecomment_uuid_id_c6abe8_fk_tags_fileuuidmap_uuid` (`uuid_id`),
  KEY `base_filecomment_author_edd150` (`author`),
  CONSTRAINT `base_filecomment_uuid_id_b18a34_fk_tags_fileuuidmap_uuid` FOREIGN KEY (`uuid_id`) REFERENCES `tags_fileuuidmap` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
            
Start to migate comments data...
Done
Done.