Solved - Ubuntu 18.04 + Seafile server - not starting on system boot


#1

Hi,

I recently put together a new Ubuntu 18.04 PC using an UDOO x86 Ultra (Intel 64bit) and although the installation all went perfect and everything seemed to set up correctly Seafile server will not start on system boot.

According to the system.d output both seafile and seahub fail to start.

So I thought I’d use a cron job instead, that also fails to start the server on startup - but if I then run the cron manually both components start up and continue working.

Does any one have any thoughts on what could be wrong? I followed the installation instructions and I never had this issue with my previous Ubuntu 16 SBC.


#2

Yes… Make certain that you are using the direct path in systemd. Systemd doesn’t like symlinks and “seafile-server-latest” is a symlink. I ran into this same problem with my Debian install, and it lets you know that when you reboot/start the machine itself… Let’s you know on the console screen. But, since I keep older versions of Seafile on my server, I didn’t want to have to update the direct path in systemd every time a new version came out, so I use init.d instead. Works fine.

Check your systemd config and make certain it’s a direct path, not a symlink.


#3

I updated my systemd configs for the services and changed them from the …-latest to …-6.2.5 folder paths but they are still failing.

I also updated the cron jobs I was trying to use as well and they fail to start but can be successfully run manually.

Any other options?


#4

Please post your startup scripts for seafile and seahub.


#5

I’m not a big fan of systemd. I prefer init.d, and it works fine with Seafile. The instructions on how to use init.d to start Seafile on startup are in the manual, and fairly easy to follow.


#6

Finally worked it out.

After looking through the journalctl -xe log I realised that seafood was trying to connect to the database using localhost despite the config files using the ip address for localhost 127.0.0.1.

So, I changed the mysql user permissions from localhost to 127.0.0.1 and the config files and it finally worked on system start up.


#7

Initd is not available in Ubuntu 18.04.


#8

Interesting… I haven’t fooled around with 18.04 yet. So, they deprecated it? It was available in prior versions. I use Debian these days.


#9

Apparently it was removed but installable in 17.04, but removed and blocked in 18.


#10

I did a little research earlier. Yup… It’s deprecated, but there are instructions on how to bring it back in version 18. :slight_smile:


#11

I had the same Problem, i solved it like that:
/etc/systemd/system/seafile.service

[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target httpd.service

[Service]
Type=forking
ExecStart=/var/seafile/haiwen/seafile-server-latest/seafile.sh start
ExecStop=/var/seafile/haiwen/seafile-server-latest/seafile.sh stop
User=seafile
Group=seafile

[Install]
WantedBy=multi-user.target

/etc/systemd/system/seahub.service

[Unit]
Description=Seafile hub
After=network.target seafile.service

[Service]
Type=forking
ExecStart=/var/seafile/haiwen/seafile-server-latest/seahub.sh start
ExecStop=/var/seafile/haiwen/seafile-server-latest/seahub.sh stop
User=seafile
Group=seafile

[Install]
WantedBy=multi-user.target

#12

If I remember correctly localhost has a special meaning in MySQL and only applies to socket connections - not ip connections.


#13

I also added in some extra ‘After’ services to ensure seafile wasn’t started before mySQL, but that didn’t help. It was only after changing all the localhosts to 127.0.0.1 that finally fixed the problem for me.

@shoeper I think you’re correct localhost and 127.0.0.1 are different in mySQL, despite being the same thing at a network level.


#14

Seafile should be started after the database, as it is in need of, but I didn’t have to configure it explicitly.


#15

My problem with Ubuntu 18.04 + Seafile server was the deprecation of the Python package python-imaging, resulting in the seahub service not starting on boot.

journalctl -xe was outputting:

ImportError: No module named Image

… pointing towards a missing python module Image.

The module python-imaging has been deprecated, but got this working by installing python-pil, as this package is a fork of python-imaging:

sudo apt-get install python-pil

Hope this may help somebody! :slight_smile:


Seafile Server on Ubuntu Server 18.04 LTS
#16

Glad you got it working. But, it’s strange that you were able to start Seafile manually. I wasn’t aware that there was an additional dependency for starting Seafile at boot.


#17

Great, thx. How did you find out? I had nothing in the logs pointing that direction…