[SOLVED] ArchLinux and Systemd auto-start

For help and support with issues specific to Linux/Unix
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply.

[SOLVED] ArchLinux and Systemd auto-start

Postby james_3pp » Sun Jun 08, 2014 10:59 pm

Preamble

For java, I have the following packages installed:
Code: Select all
# pacman -Ss java | grep installed
extra/jdk7-openjdk 7.u55_2.4.7-1 [installed]
extra/jre7-openjdk 7.u55_2.4.7-1 [installed]
extra/jre7-openjdk-headless 7.u55_2.4.7-1 [installed]
extra/js17 17.0.0-1 [installed]


To humour regulars, here is what I can provide from guidelines:
    - Debug log is not appliable to this situation. Purely related to boot behaviour. However, when the shell script is launched normally, the logs are appropriate and predictable
    - Client streaming is all good when manually run
    - Gigabit internal network. All ethernet

Details

Arch Linux

Goal: To install and boot the pms.service file automatically on boot.

By removing tsmuxer in the PKGBUILD script, I was able to install from the AUR version of pms.
Installation went very smoothly using AUR package. I will be sticking with ffmpeg anyway, don't need tsmuxer or other alternatives. Copied pms.service file into /etc/systemd/system and enabled the unit.

On a reboot, you can see the following results of the unit trying to start from a status query. Looks like some crazy java stuff, but I know nothing of that sort. At this point, the clients cannot connect or see the server.

Code: Select all
# systemctl status pms

● pms.service - PS3 Media Server
   Loaded: loaded (/etc/systemd/system/pms.service; enabled)
   Active: active (running) since Sun 2014-06-08 16:50:52 CDT; 21s ago
 Main PID: 329 (java)
   CGroup: /system.slice/pms.service
           └─329 java -Xmx768M -Xss1024k -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djna.nosys=true -classpath update.jar:pms.jar net.pms.PMS

Jun 08 16:50:59 archlinux-server PMS.sh[329]: at java.lang.Thread.run(Thread.java:744) [na:1.7.0_55]
Jun 08 16:51:00 archlinux-server PMS.sh[329]: ERROR 2014-06-08 16:51:00.560 [UPNPHelper] UPNP network exception
Jun 08 16:51:00 archlinux-server PMS.sh[329]: java.net.SocketException: No such device
Jun 08 16:51:00 archlinux-server PMS.sh[329]: at java.net.PlainDatagramSocketImpl.join(Native Method) ~[na:1.7.0_55]
Jun 08 16:51:00 archlinux-server PMS.sh[329]: at java.net.AbstractPlainDatagramSocketImpl.join(AbstractPlainDatagramSocketImpl.java:178) ~[na:1.7.0_55]
Jun 08 16:51:00 archlinux-server PMS.sh[329]: at java.net.MulticastSocket.joinGroup(MulticastSocket.java:319) ~[na:1.7.0_55]
Jun 08 16:51:00 archlinux-server PMS.sh[329]: at net.pms.network.UPNPHelper$2.run(UPNPHelper.java:384) ~[pms.jar:1.90.1]
Jun 08 16:51:00 archlinux-server PMS.sh[329]: at java.lang.Thread.run(Thread.java:744) [na:1.7.0_55]
Jun 08 16:51:08 archlinux-server PMS.sh[329]: INFO  2014-06-08 16:51:08.091 [UPNPHelper] No IP filter specified, access granted to /192.168.1.114
Jun 08 16:51:08 archlinux-server PMS.sh[329]: INFO  2014-06-08 16:51:08.093 [UPNPHelper] Using the following UUID configured in PMS.conf: 3fa0020c-bdfd-407c-b4e0-7e2763eed2c1


I perform a restart of the service and another query. The results are different.

Code: Select all
# systemctl restart pms
# systemctl status pms

● pms.service - PS3 Media Server
   Loaded: loaded (/etc/systemd/system/pms.service; enabled)
   Active: active (running) since Sun 2014-06-08 16:52:21 CDT; 2s ago
 Main PID: 522 (java)
   CGroup: /system.slice/pms.service
           ├─522 java -Xmx768M -Xss1024k -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djna.nosys=true -classpath update.jar:pms.jar net.pms.PMS
           └─561 ping -c 3 -s 64000 192.168.1.114

Jun 08 16:52:22 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:22.350 [main] Using address /192.168.1.75 found on network interface: name:enp0s7 (enp0s7)
Jun 08 16:52:22 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:22.351 [main] Created socket: /192.168.1.75:5001
Jun 08 16:52:22 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:22.449 [main] Using the following UUID configured in PMS.conf: 3fa0020c-bdfd-407c-b4e0-7e2763eed2c1
Jun 08 16:52:22 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:22.705 [main] The server should now appear on your renderer
Jun 08 16:52:23 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:23.014 [New I/O server worker #1-5] No IP filter specified, access granted to /192.168.1.114
Jun 08 16:52:23 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:23.029 [New I/O server worker #1-2] Another renderer like XBMC was found!
Jun 08 16:52:23 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:23.032 [New I/O server worker #1-4] Another renderer like XBMC was found!
Jun 08 16:52:23 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:23.033 [pool-4-thread-1] Checking IP: 192.168.1.114 for XBMC
Jun 08 16:52:23 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:23.035 [New I/O server worker #1-3] Another renderer like XBMC was found!
Jun 08 16:52:23 archlinux-server PMS.sh[522]: INFO  2014-06-08 16:52:23.214 [pool-4-thread-1] Renderer XBMC found on this address: 192.168.1.114


That's a lot cleaner, and now my devices can recognize and use the server.

Is there another dependency that should be added to the default pms.service file? What do (we) need to do to make this work? Or is there some kind of weird hack (we) could throw together to make this thing load properly? I don't think it's a java issue, but you never know!

If you want a look at the unit, I am using the unmodified one straight from the tarball.

Thanks!
Last edited by james_3pp on Sun Jun 08, 2014 11:36 pm, edited 1 time in total.
james_3pp
 
Posts: 2
Joined: Sun Jun 08, 2014 10:25 pm

Re: ArchLinux and Systemd auto-start

Postby james_3pp » Sun Jun 08, 2014 11:34 pm

Solution

Modified pms.service file slightly to add a timeout of 16 seconds (you can set this to whatever you find comfortable). Code is as follows. Only thing appended is the ExecStartPre line. Thanks to nDuff in freenode for the guidance!

Code: Select all
[Unit]
Description=PS3 Media Server
After=syslog.target network.target rpcbind.service

[Service]
User=%i
Group=users
WorkingDirectory=/opt/pms/
Type=simple
ExecStartPre=/usr/bin/sleep 16
ExecStart=/opt/pms/PMS.sh

[Install]
WantedBy=multi-user.target
james_3pp
 
Posts: 2
Joined: Sun Jun 08, 2014 10:25 pm


Return to Linux/Unix Support

Who is online

Users browsing this forum: Google [Bot] and 3 guests