Office Preview not working - when started as root with sudo

in my last post: Office preview not working i posted a problem with office preview not working. the “solution” was that i have unpacked the tar-file again. seems that i have messed up some file access rights or so.

in the meantime i have updated to the final release of seafile pro server 6.0.2. now the preview was not longer working. i have tried different things again. tried to set logging to debug-level but can’t find any hints in the logs.

now i have again unpacked the tar file as user “seafile”. and now some magic:

seafile/seahub is running as user seafile (group www-data). i have unpacked the tar file as user seafile.

i use a small start-script as user root:

cd seafile-server-latest
sudo -u seafile ./ start
sudo -u seafile ./ start-fastcgi

seafile and seahub are coming up. i can use the clients and use my browser to access seafile. everything seems to work.BUT office preview is NOT working.

now comes some magic: if i change to user seafile and start

su - seafile
cd seafile-server-latest
./ start
./ start-fastcgi

everything is up AND office preview is now working!
it makes no difference, if i am root and change to seafile-server-latest and call both start-commands by hand.


I just had an issue like this. Seafile server starts fine when I sudo to seafile user and start manually, but seafile will not start from my systemd unit file. Turns out it is because when systemd unit file starts the server with a different PATH environment than my seafile user gets when bash runs. This caused seafile not to be able to find java, causing the error that caused the systemd unit not to start.

So… I would suggest checking somehow to see if environment variables are different when running "
su -" rather than “sudo”. I have no idea if this will be the case, but from my experience that’s what I’d check.

My solution, because I couldn’t figure out how to append to PATH in systemd unit file, was to modify to add the following near the top:

export PATH=$PATH:/usr/lib/jvm/default/bin

Not as clean a solution as I"d like, but at least my server starts with systemd for now.