1

I am currently trying to run Unified Remote Server before login. (Need to use it to login)

I have managed to have it running after login, so it works generally.

This is my systemd .service file

[Unit]
Description=Unified Remote Server
After=syslog.target network.target

[Service]
Type=forking
User=root
Group=sudo
Environment=HOME=~
Environment=OPENSSL_CONF=/etc/ssl/
ExecStart=/opt/urserver/urserver-start --no-manager --no-notify
ExecStop=/opt/urserver/urserver-stop

[Install]
WantedBy=default.target

Error Output

   Loaded: loaded (/lib/systemd/system/urserver.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-07-17 01:07:06 EDT; 1h 52min ago

urserver-start[8014]: 140156550736640:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
urserver-start[8014]: 140156550736640:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_
urserver-start[8014]: 140156550736640:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_con
urserver-start[8014]: skipping manager
urserver-stop[8032]: cat: /.urserver/urserver.pid: No such file or directory
urserver-stop[8032]: process not detected
urserver-stop[8032]: rm: cannot remove '/.urserver/urserver.pid': No such file or directory
systemd[1]: urserver.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: urserver.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Unified Remote Server.

It seems I have 2 errors

  1. From the cat: /.urserver/urserver.pid: No such file or directory line, I assume the $HOME environment variable is not resolving properly.
  2. It seems that some dependencies might not be loaded yet, how do I ensure that it is?

2 Answers 2

2

On Raspberry Pi 4B with Buster, I had different errors trying to start urserver as a systemd service. May not at all be related to your problems.

This worked for me: I think the key was to exit the start script with exit 0 to make systemd ignore the errors triggered by triggerhappy.

urserver.service:

[Unit]
Description=Unified Remote Server
After=syslog.target network.target

[Service]
Type=forking
User=root
Group=root
ExecStart=/opt/urserver/urserver-start --no-notify
ExecStop=/opt/urserver/urserver-stop
SyslogIdentifier=urserver

[Install]
WantedBy=multi-user.target

urserver-start:

#!/bin/sh


#
# Path to installation directory
#
EXEC_PATH="/opt/urserver/urserver"
PID_PATH="$HOME/.urserver/urserver.pid"
ICON_PATH="/usr/share/icons/hicolor/96x96/apps/urserver.png"
REMOTES_PATH="$HOME/.urserver/remotes"
BACKUP_PATH="$HOME/.urserver/backup"


#
# Check arguments
#
NO_COPY=false
NO_MANAGER=false
NO_NOTIFY=false

for var in "$@"
do
       if [ "$var" = "--no-copy" ]; then
               NO_COPY=true
       elif [ "$var" = "--no-manager" ]; then
               NO_MANAGER=true
       elif [ "$var" = "--no-notify" ]; then
               NO_NOTIFY=true
       fi
done


#
# Copy user files
#
if ! "$NO_COPY" = true; then
   echo "copying user files"
   mkdir -p "$HOME/.config/autostart/"
   cp -uf /opt/urserver/urserver-autostart.desktop $HOME/.config/autostart/urserver.desktop

   echo "backup remotes"
   mkdir -p $BACKUP_PATH/
   cp -af $REMOTES_PATH/. $BACKUP_PATH/

   echo "create custom folder"
   mkdir -p $REMOTES_PATH/custom/

   echo "copying remotes"
   rm -rf $REMOTES_PATH/remotes/
   rm -rf $REMOTES_PATH/bundled/
   mkdir -p $REMOTES_PATH/bundled/
   cp -af /opt/urserver/remotes/. $REMOTES_PATH/bundled/
else
   echo "skipping copy"
fi


#
# Start the server
#
echo "starting server"
mkdir -p "$HOME/.urserver"
$EXEC_PATH --remotes=$REMOTES_PATH --daemon


#
# Open the web manager
#
if ! "$NO_MANAGER" = true; then
   echo "opening manager"
   sleep 1
   xdg-open http://localhost:9510/web 2> /dev/null
else
   echo "skipping manager"
fi
exit 0
0

I'd start by deleting Environment=HOME=~.

systemd automatically sets $HOME so you never need to specify it unless you want it to be non-default. When the user is root, I think $HOME will probably be set to /root. Also, ~ is something that is a sh shortcut for the home directory, but outside of your shell it doesn't mean anything. systemd is not sh and does not support all of the sh syntax. You'll also notice things like && or | will not work in ExecStart=.

Removing the Environment= line may fix all of your issues. But if not, here are some other things to look for:


User=root
Group=sudo

This one is a little strange. User=root is already implied when it's run in the system bus, so it's redundant. I could only see Group=sudo being useful in that new files may be created owned by the sudo group, though that is probably only interesting if root is actually a member of sudo and your default umask creates new files as group-readable/writable. I think you can delete these, though it may not make a massive difference.


Since your service is Type=forking, consider adding:

PIDFile=/root/.urserver/urserver.pid

this will help systemd reliably identify the main process of the service


The DSO_load errors indicate that your application can't dynamically load a module. The message looks truncated but related to ssl.

When I look up man openssl, I see that the OPENSSL_CONF variable should point to the configuration file, not the directory containing the configuration file. Try deleting this line or using something like:

Environment=OPENSSL_CONF=/etc/ssl/openssl.cnf

Note that this is probably the default location, so the variable probably doesn't need to be set.

1
  • Ok will try that Commented Jan 15, 2021 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .