0

Can't start Ubooquity from systemd; able to start from command line; same command!

theRascal 4 weeks ago updated 4 weeks ago 1

Hardware: Raspberry Pi 4B 8GB; OS: Raspberry Pi OS with latest updates. Any ideas would be very welcome. I'm new to systemd and linux in general. I did just resolve my Samba issues and got my Plex media server running so this is the last thing to solve!


I'm able to run Ubooquity from the command line, however, using systemd, it won't start using the exact same command. The error is highlighted below in the status listing: 

pi@RFDPi4BMediaServer:/ $ sudo systemctl daemon-reload
pi@RFDPi4BMediaServer:/ $ sudo systemctl start ubooquity
pi@RFDPi4BMediaServer:/ $ sudo systemctl status ubooquity
● ubooquity.service - Ubooquity
Loaded: loaded (/etc/systemd/system/ubooquity.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-11-03 20:32:33 PST; 3s ago
Process: 9909 ExecStart=/usr/bin/java -jar /opt/ubooquity/Ubooquity.jar --adminport 2022 --libraryport 3456 --remoteadmin --headless (code=exited, status=0/SUCCESS)
Main PID: 9909 (code=exited, status=0/SUCCESS)

Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: at com.ubooquity.e.a.a(SourceFile:823)
Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: at com.ubooquity.Launcher.main(SourceFile:10)
Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: Caused by: java.lang.ClassNotFoundException: Failure to load: javafx.application.Platform
Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: at com.ubooquity.e.a.loadClass(SourceFile:992)
Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)

Nov 03 20:32:32 RFDPi4BMediaServer java[9909]: ... 7 more
Nov 03 20:32:33 RFDPi4BMediaServer systemd[1]: ubooquity.service: Succeeded.

The unit file is:

# acquired script from https://gist.github.com/thenaterhood/e79eb6f05badaa56a2d9
# revised 2020-11-03 for my installation

[Unit]
Description=Ubooquity
After=network.target

[Service]
WorkingDirectory=/opt/ubooquity
User=pi
Group=pi

Type=simple
ExecStart=/usr/bin/java -jar /opt/ubooquity/Ubooquity.jar --adminport 2022 --libraryport 3456 --remoteadmin --headless
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

I tried various ideas posted in this forum such as memory parameters to the execute command, but no joy. I thought this was permissions to start Java, but I can run the exact command at the command line successfully. Replacing pi with root also works, but moves the database. The working folder is owned by pi. I do notice the database does not go to the working folder specified... it goes to the root of pi's home folder. 



I just solved it... the folder /opt/ubooquity was owned by pi:pi, however, the underlying folders were owned by root. Changed the ownership and now it loads and the database is in the correct working folder. Oy! Not sure why that happened. I unzipped Ubooquity.zip in that folder after the ownership was changed. Maybe I did that as sudo? Next time I'll check!