[Solved] Internal Error when trying to view a document via web browser

First, I am still a beginner to Linux.

I am on CentOS 7 Minimal (64-Bit) with SeaFile Pro 6.0.4. Whenever I connect to my server via a web browser, such as firefox, and open a document, such as the “seafile-tutorial.doc” included on install, I get an Internal Error. The only option is to download the file and view externally. How do I fix this?

Thanks,
Jeff Savage ~ BetaLeaf


Here are my server logs. Logs.zip

Have you checked the FAQ section for online preview? https://manual.seafile.com/deploy_pro/faq_for_seafile_pro_server.html#faq-about-libreoffice-based-office-documents-preview

Yes I have. Nothing in there pertains to my issue. I set this server up with the script found at https://github.com/seafile/seafile-server-installer if that matters.

I checked my seahub.log and found this log a few times.

[ERROR] root:1088 prepare_converted_html failed to add_office_convert_task:
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-6.0.4/seahub/seahub/utils/__init__.py", line 1086, in prepare_converted_html
    add_office_convert_task(obj_id, doctype, raw_path)
  File "/opt/seafile/seafile-pro-server-6.0.4/seahub/seahub/utils/__init__.py", line 1000, in real_func
    return func(*args)
  File "/opt/seafile/seafile-pro-server-6.0.4/seahub/seahub/utils/__init__.py", line 1059, in add_office_convert_task
    d = rpc.add_task(file_id, doctype, raw_path)
  File "/opt/seafile/seafile-pro-server-6.0.4/seafile/lib64/python2.6/site-packages/pysearpc/client.py", line 110, in newfunc
    ret_str = self.call_remote_func_sync(fcall_str)
  File "/opt/seafile/seafile-pro-server-6.0.4/seafile/lib64/python2.6/site-packages/ccnet/rpc.py", line 92, in call_remote_func_sync
    req_id = self._start_service(client)
  File "/opt/seafile/seafile-pro-server-6.0.4/seafile/lib64/python2.6/site-packages/ccnet/rpc.py", line 36, in _start_service
    raise SearpcError("Error received: %s %s (In _start_service)" % (rsp.code, rsp.code_msg))
SearpcError: Error received: 511 Unknown service (In _start_service)
[12/13/16 22:21:12] seafile-controller.c(600): seafevents need restart...
[12/13/16 22:21:22] seafile-controller.c(600): seafevents need restart...

The logs shows that the background service (seafevents) which is responsible for online preview is failing to start repeatedly. Seems it’s throwing some exception.

For now there seems no good way to debug this, but here is a hackish way to debug: edit the script seafile.sh, locate this line around line 171:

    if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" -F "${central_config_dir}"; then

Add --foreground before the “; then” part, i.e. change the line to:

    if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" -F "${central_config_dir}" --foreground; then.

Then run ./seafile.sh restart. It would stop the current running seafile server, and restart it in foreground.

Wait for a while and you should see the errors printed on your console.

After the debugging you can remove the --foreground flag from that line to use seafile normally.

Ok, I have done what you have requested. Here are the debug logs you needed.

Using username "root".
root@192.168.0.3's password:
Last login: Tue Dec 13 23:40:28 2016
[root@SeaFile ~]# su - seafile -s /bin/bash
Last login: Wed Dec 14 00:24:58 EST 2016
-bash-4.2$ cd seafile-latest-server
-bash: cd: seafile-latest-server: No such file or directory
-bash-4.2$ ls
aio_seafile-server.log  logs          seafile-pro-server-6.0.4
ccnet                   pids          seafile-server-latest
conf                    pro-data      seahub-data
installed               seafile-data
-bash-4.2$ cd seafile-server-latest
-bash-4.2$ bash seafile.sh restart

Stopping seafile server ...
** Message: seafile-controller.c(1084): loading seafdav config from /opt/seafile/conf/seafdav.conf

License file /opt/seafile/seafile-license.txt does not exist, allow at most 3 trial users
[12/14/16 00:26:50] ../common/session.c(139): using config file /opt/seafile/conf/ccnet.conf
Starting seafile server, please wait ...
** Message: seafile-controller.c(1084): loading seafdav config from /opt/seafile/conf/seafdav.conf

License file /opt/seafile/seafile-license.txt does not exist, allow at most 3 trial users
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 280, in <module>
    main()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 274, in main
    app.serve_forever()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 139, in serve_forever
    self._bg_tasks.start(self._evbase)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 219, in start
    self._office_converter.start()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/__init__.py", line 73, in start
    max_pages=self._max_pages)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 279, in init
    self._set_pdf_dir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 287, in _set_pdf_dir
    _checkdir_with_mkdir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 23, in _checkdir_with_mkdir
    raise RuntimeError("Access to %s denied" % dname)
RuntimeError: Access to /tmp/seafile-office-output/pdf denied
[2016-12-14 00:26:52,631][INFO ][node                     ] [Phantom Blonde] version[1.4.0], pid[2863], build[bc94bd8/2014-11-05T14:26:12Z]
[2016-12-14 00:26:52,631][INFO ][node                     ] [Phantom Blonde] initializing ...
[2016-12-14 00:26:52,658][INFO ][plugins                  ] [Phantom Blonde] loaded [transport-thrift, analysis-ik], sites []
[2016-12-14 00:26:55,751][INFO ][node                     ] [Phantom Blonde] initialized
[2016-12-14 00:26:55,752][INFO ][node                     ] [Phantom Blonde] starting ...
[2016-12-14 00:26:55,777][INFO ][thrift                   ] [Phantom Blonde] bound on port [9500]
[2016-12-14 00:26:55,789][INFO ][transport                ] [Phantom Blonde] bound_address {local[1]}, publish_address {local[1]}
[2016-12-14 00:26:55,805][INFO ][discovery                ] [Phantom Blonde] elasticsearch/Bz-E_wejT9ii7snXoPgSfA
[2016-12-14 00:26:55,807][INFO ][cluster.service          ] [Phantom Blonde] master {new [Phantom Blonde][Bz-E_wejT9ii7snXoPgSfA][SeaFile][local[1]]{local=true}}, removed {[Phantom Blonde][N0cP9v0XTgGIKzZ0TtreMg][SeaFile][local[1]]{local=true},}, reason: local-disco-initial_connect(master)
[2016-12-14 00:26:55,950][INFO ][gateway                  ] [Phantom Blonde] recovered [0] indices into cluster_state
[2016-12-14 00:26:55,991][INFO ][http                     ] [Phantom Blonde] bound_address {inet[/127.0.0.1:9200]}, publish_address {inet[/127.0.0.1:9200]}
[2016-12-14 00:26:55,992][INFO ][node                     ] [Phantom Blonde] started
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 280, in <module>
    main()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 274, in main
    app.serve_forever()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 139, in serve_forever
    self._bg_tasks.start(self._evbase)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 219, in start
    self._office_converter.start()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/__init__.py", line 73, in start
    max_pages=self._max_pages)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 279, in init
    self._set_pdf_dir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 287, in _set_pdf_dir
    _checkdir_with_mkdir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 23, in _checkdir_with_mkdir
    raise RuntimeError("Access to %s denied" % dname)
RuntimeError: Access to /tmp/seafile-office-output/pdf denied
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 280, in <module>
    main()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 274, in main
    app.serve_forever()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 139, in serve_forever
    self._bg_tasks.start(self._evbase)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 219, in start
    self._office_converter.start()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/__init__.py", line 73, in start
    max_pages=self._max_pages)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 279, in init
    self._set_pdf_dir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 287, in _set_pdf_dir
    _checkdir_with_mkdir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 23, in _checkdir_with_mkdir
    raise RuntimeError("Access to %s denied" % dname)
RuntimeError: Access to /tmp/seafile-office-output/pdf denied
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 280, in <module>
    main()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 274, in main
    app.serve_forever()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 139, in serve_forever
    self._bg_tasks.start(self._evbase)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 219, in start
    self._office_converter.start()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/__init__.py", line 73, in start
    max_pages=self._max_pages)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 279, in init
    self._set_pdf_dir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 287, in _set_pdf_dir
    _checkdir_with_mkdir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 23, in _checkdir_with_mkdir
    raise RuntimeError("Access to %s denied" % dname)
RuntimeError: Access to /tmp/seafile-office-output/pdf denied
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 280, in <module>
    main()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 274, in main
    app.serve_forever()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 139, in serve_forever
    self._bg_tasks.start(self._evbase)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 219, in start
    self._office_converter.start()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/__init__.py", line 73, in start
    max_pages=self._max_pages)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 279, in init
    self._set_pdf_dir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 287, in _set_pdf_dir
    _checkdir_with_mkdir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 23, in _checkdir_with_mkdir
    raise RuntimeError("Access to %s denied" % dname)
RuntimeError: Access to /tmp/seafile-office-output/pdf denied
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 280, in <module>
    main()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 274, in main
    app.serve_forever()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 139, in serve_forever
    self._bg_tasks.start(self._evbase)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/main.py", line 219, in start
    self._office_converter.start()
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/__init__.py", line 73, in start
    max_pages=self._max_pages)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 279, in init
    self._set_pdf_dir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 287, in _set_pdf_dir
    _checkdir_with_mkdir(pdf_dir)
  File "/opt/seafile/seafile-pro-server-6.0.4/pro/python/seafevents/office_converter/task_manager.py", line 23, in _checkdir_with_mkdir
    raise RuntimeError("Access to %s denied" % dname)
RuntimeError: Access to /tmp/seafile-office-output/pdf denied

So that’s the culprit.

Seems you have been running seafile with different users. Which user are you running seafile with? If you’re using the “seafile” user, try sudo chown -R seafile:seafile /tmp/seafile-office-output.

1 Like

I am running SeaFile by using su - seafile -s /bin/bash as documented here. Running the command you gave me fixed the issue. I also have another issue but I’ll make a new topic for that. It would be greatly appreciated if you could help with that one too. Thanks.