Webinterface broken after upgrading from 6.1 to 6.2


#1

Hi guys, after upgrading Seafile server from 6.1 to 6.2.2 I am experiencing an an issue with my media directory.

I am running Seafile behind an Apache web server (2.4.10) and use memcached (1.4.21) for caching.
When opening the web interface, the contents of the media directory cannot be accessed (404) so CSS files, JS files, images etc. are not loaded and the web interface looks completely broken.

I know I am not the first one to experience this problem, but the documented solutions did not work for me.

My media directory is /etc/seafile/seafile-server-latest/seahub/media.

File permissions --> media directory owner is set to www-data (which is the user that runs the apache2 process) and permissions are set to 755 :white_check_mark:
Cache --> reset memcached manually and by restarting the memcached service :white_check_mark:
Apache configuration:

Alias /media /etc/seafile/seafile-server-latest/seahub/media
<Location /media>
    Require all granted
</Location>

should be ok :white_check_mark:

Seahub configuration (which I did not touch):

MEDIA_URL = '/media/'

Here’s an example line from the Apache error log:

my_source_ip - - [27/Oct/2017:14:35:35 +0200] "GET /media/img/seafile-logo.png HTTP/1.1" 404 8866 "https://seafile.mydomain.tld/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36"

And here’s the error in the /etc/seafile/logs/seahub_django_request.log:

2017-10-27 12:35:35,203 [WARNING] django.request:170 get_response Not Found: /media/img/seafile-logo.png

Since I don’t see obvious configuration or file permission issues, I am running out of ideas on how to fix this. Any help would be greatly appreciated!


#2

Have you tried to clear cache? You can find more information here: https://manual.seafile.com/faq/upgrade.html


#3

Hi Daniel, yes, i use memcached an I have cleared the cache manually (using the flash_all command), I restared the memcached service and even the whole server multiple times without success.


#4

Have you checked, I think, the seahub_settings.py around the area to do with memcache. I have a vague recollection I had a similar problem. Sorry to be vague but I’m on holiday so unable to be more specific.

good luck.


#5

You problem seems to be different from the manual. Because the image files can’t be found too (404 error in Apache). Have you run “./minor_upgrade.sh”?


#6

Hi @daniel.pan
upgrading from 6.1 to 6.2 didn’t go as expected in the first place:

  • I wanted to go directly to 6.2.2 (and skip 6.2.0 and 6.2.1). Downloaded the package, ran the upgrade_6.1_6.2.sh script, got the same error like this guy (sqlite3.OperationalError: no such table: sysadmin_extra_userloginlog)
  • I thought I should give 6.2.1 a try, so I downloaded the package, ran the upgrade script, got the same error message. I then modified the ./upgrade/sql/6.2.0/sqlite3/seahub.sqlfile so that it would first create the table that was missing as described here:
CREATE TABLE IF NOT EXISTS "sysadmin_extra_userloginlog" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "username" varchar(255) NOT NULL, "login_date" datetime NOT NULL, "login_ip" varchar(128) NOT NULL);
CREATE INDEX IF NOT EXISTS "sysadmin_extra_userloginlog_14c4b06b" ON "sysadmin_extra_userloginlog" ("username");
CREATE INDEX IF NOT EXISTS "sysadmin_extra_userloginlog_28ed1ef0" ON "sysadmin_extra_userloginlog" ("login_date");
  • Re-ran the update_6.1_6.2.sh script in the 6.2.1 upgrade folder, everything went fine (at least without obvious errors). Didn’t test if Seafile would actually start but proceeded directly to the next minor upgrade.
  • Ran the minor-upgrade.sh script in the 6.2.2 folder to upgrade from 6.2.1 to 6.2.2, no errors showed up, everything seemed fine.

So I think it’s quite possible that something went wrong during the whole upgrade procedure (although there were no obvious errors when I did the last minor upgrade).

@Sledgehammer:
Here’s the CACHES configuration part from my seahub_settings.py, which looks okay to me:

CACHES = {
        'default': {
                'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
                'LOCATION': '127.0.0.1:11211',
        }
}

[Solved] "Page unavailable" error when upgading from 6.0.9 to 6.2.5 and 6.3.2
#7

try this

CACHES = {
        'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
                'LOCATION': '127.0.0.1:11211',
                }
          }

Which is in the documentation somewhere.


#8

@Sledgehammer:
Thanks for the quick info, unfortunately it didn’t work. Seems that one of the Seafile services (probably seahub) doesn’t even start, so the Apache will give me a 503. No errors in the Seafile logs, though.
I also tried switching back to file-based cache, but the result is the same (Apache responding with 503).


#9

I have now double- and triple-checked every config file (Apache, Seafile, Seahub), every symlink, every folder permission. I have downloaded the SQLite DB to my Windows machine and checked it with a GUI tool for errors in the constance_config table. I made sure that all changes from the SQL upgrade script have been correctly applied to the database.
I have been using Seafile since 3.0.x and all previous upgrades went really smooth, but this one broke it for me. :frowning:

Since I still assume there’s something wrong with my seahub settings, here’s the complete config file:

SECRET_KEY = "my_secret_key"
SERVE_STATIC = False
MEDIA_URL = '/media/'
SITE_ROOT = '/'
SITE_BASE = 'https://seafile.mydomain.tld/'
SITE_NAME = 'seafile.mydomain.tld'
SITE_TITLE = 'Seafile'
HTTP_SERVER_ROOT = 'https://seafile.mydomain.tld/seafhttp'
EMAIL_USE_TLS = True
EMAIL_HOST = 'my_external_host'
EMAIL_HOST_USER = 'my_user'
EMAIL_HOST_PASSWORD = 'my_password'
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = 'seafile@mydomain.tld'
SERVER_EMAIL = 'seafile@mydomain.tld'
CACHES = {
        'default': {
                'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
                'LOCATION': '127.0.0.1:11211',
        }
}
ENABLE_WIKI = True

Still, any help would be appreciated!


#10

I have now found out that my /etc/ld.so.conf file was corrupted and therefore seahub wouldn’t start with the django_pylibmc.memcached.PyLibMCCache backend option.

So I fixed that and upgraded to 6.2.3 but the error persists.

Switching back to file based cache worked when I set the CACHE_DIR variable to ‘/tmp’ and put an import os as the first line in the seahub_settings.py file, but still I get the errors in the seahub_django_request.log:

2017-11-20 16:12:05,254 [WARNING] django.request:170 get_response Not Found: /media/assets/css/bootstrap.min.b00faad199b5.css
2017-11-20 16:12:05,342 [WARNING] django.request:170 get_response Not Found: /media/css/seahub.min.css
2017-11-20 16:12:05,343 [WARNING] django.request:170 get_response Not Found: /media/css/jstree_default_theme/style.min.css
2017-11-20 16:12:05,345 [WARNING] django.request:170 get_response Not Found: /media/assets/css/magnific-popup.656241b2c8ed.css
2017-11-20 16:12:05,386 [WARNING] django.request:170 get_response Not Found: /media/js/jquery-1.12.1.min.js
2017-11-20 16:12:05,423 [WARNING] django.request:170 get_response Not Found: /media/assets/scripts/lib/jquery.simplemodal.67fb20a63282.js
2017-11-20 16:12:05,431 [WARNING] django.request:170 get_response Not Found: /media/assets/scripts/lib/jstree.min.baba5642f663.js
2017-11-20 16:12:05,438 [WARNING] django.request:170 get_response Not Found: /media/assets/scripts/lib/jquery.ui.tabs.7406a3c5d2e3.js
2017-11-20 16:12:05,444 [WARNING] django.request:170 get_response Not Found: /media/img/login-bg.jpg
2017-11-20 16:12:05,492 [WARNING] django.request:170 get_response Not Found: /media/img/seafile-logo.png
2017-11-20 16:12:05,497 [WARNING] django.request:170 get_response Not Found: /media/js/jq.min.js
2017-11-20 16:12:05,519 [WARNING] django.request:170 get_response Not Found: /media/js/base.js
2017-11-20 16:12:05,540 [WARNING] django.request:170 get_response Not Found: /media/assets/scripts/lib/jstree.min.baba5642f663.js
2017-11-20 16:12:05,595 [WARNING] django.request:170 get_response Not Found: /media/js/jq.min.js
2017-11-20 16:12:05,651 [WARNING] django.request:170 get_response Not Found: /media/js/base.js
2017-11-20 16:13:10,631 [WARNING] django.request:170 get_response Not Found: /media/assets/css/bootstrap.min.b00faad199b5.css
2017-11-20 16:13:10,682 [WARNING] django.request:170 get_response Not Found: /media/css/jstree_default_theme/style.min.css
2017-11-20 16:13:10,706 [WARNING] django.request:170 get_response Not Found: /media/assets/css/magnific-popup.656241b2c8ed.css
2017-11-20 16:13:10,710 [WARNING] django.request:170 get_response Not Found: /media/js/jquery-1.12.1.min.js
2017-11-20 16:13:10,729 [WARNING] django.request:170 get_response Not Found: /media/css/seahub.min.css
2017-11-20 16:13:10,768 [WARNING] django.request:170 get_response Not Found: /media/assets/scripts/lib/jquery.simplemodal.67fb20a63282.js
2017-11-20 16:13:10,793 [WARNING] django.request:170 get_response Not Found: /media/assets/scripts/lib/jstree.min.baba5642f663.js
2017-11-20 16:13:10,796 [WARNING] django.request:170 get_response Not Found: /media/assets/scripts/lib/jquery.ui.tabs.7406a3c5d2e3.js
2017-11-20 16:13:10,797 [WARNING] django.request:170 get_response Not Found: /media/js/jq.min.js
2017-11-20 16:13:10,834 [WARNING] django.request:170 get_response Not Found: /media/js/base.js
2017-11-20 16:13:10,852 [WARNING] django.request:170 get_response Not Found: /media/img/login-bg.jpg
2017-11-20 16:13:10,862 [WARNING] django.request:170 get_response Not Found: /media/img/seafile-logo.png

I am about to make a backup of the database and seafile-data directory and re-install the whole Seafile installation. Any better solution would still be appreciated.


#11

If I recall correctly, I ran into the same problem - I solved it by simply symlinking media from the root directory of my web server to the …/seafile-server-latest/seahub/media directory …


#12

Unfortunately that didn’t solve the problem for me.
This part of the Apache configuration should take care of the redirection anyways, so symlinking should not be necessary:

Alias /media /etc/seafile/seafile-server-latest/seahub/media
<Location /media>
    Require all granted
</Location>

From the log entries it seems like a Django-related configuration issue to me :confused:


#13

I have now given up trying to fix this issue.

Instead I made a fresh install of 6.2.3, copied the relevant folders and databases over from the old installation and everything seems to work OK so far.


#14

I ran into the same problem - the media directory is not served by apache2 because of the proxy of root /.
A ProxyPass ! for the media directory fixed the issue.

<Location /media>
    ProxyPass !
    Require all granted
</Location>