Post Reply 
 
Thread Rating:
  • 3 Vote(s) - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Installing MinimServer on FreeNAS or FreeBSD
11-02-2020, 08:44
Post: #61
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
In this section of code:

Code:
pid="$(cat "${MINIMPIDFILE}" 2>/dev/null)"
if [ -n "$pid" ]; then
    cmdline="$(cat /proc/$pid/cmdline | tr '\0' ' ' 2>/dev/null)"
else
    cmdline=
fi
if [ -z "$cmdline" ]; then
    if [ -s "${OUTFILE}" ]; then
        cat "${OUTFILE}" 1>&2
    else
        echo "Failed to start Minim${WS}" 1>&2
    fi
    exit 1
fi

the startd script is looking for the minimserver.pid file to be non-null and checking whether /proc/$pid/cmdline is also non-null. If the minimserver.pid file is non-null and /proc/$pid/cmdline is null, the "Failed to start" message will be produced.

Does /proc/$pid/cmdline work on BSD? If it doesn't, this would explain the error message.

The other possibility is that the minimserver.pid file is non-null and /proc/$pid/cmdline is null because of some startup sequencing/timing issue. If this is the case, adding a short delay into this check might solve the problem.

I can't check this myself because it is working for me on Linux.
Find all posts by this user
Quote this message in a reply
12-02-2020, 03:30
Post: #62
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
(11-02-2020 08:44)simoncn Wrote:  In this section of code:

Code:
pid="$(cat "${MINIMPIDFILE}" 2>/dev/null)"
if [ -n "$pid" ]; then
    cmdline="$(cat /proc/$pid/cmdline | tr '\0' ' ' 2>/dev/null)"
else
    cmdline=
fi
if [ -z "$cmdline" ]; then
    if [ -s "${OUTFILE}" ]; then
        cat "${OUTFILE}" 1>&2
    else
        echo "Failed to start Minim${WS}" 1>&2
    fi
    exit 1
fi

the startd script is looking for the minimserver.pid file to be non-null and checking whether /proc/$pid/cmdline is also non-null. If the minimserver.pid file is non-null and /proc/$pid/cmdline is null, the "Failed to start" message will be produced.

Does /proc/$pid/cmdline work on BSD? If it doesn't, this would explain the error message.

The other possibility is that the minimserver.pid file is non-null and /proc/$pid/cmdline is null because of some startup sequencing/timing issue. If this is the case, adding a short delay into this check might solve the problem.

I can't check this myself because it is working for me on Linux.

There is no procfs mounted by default on FreeBSD. So I wouldn't count on it, although in my jail it is there as part of some dependency. Nor will this work on a mac. Why not check $(uname) and do something like

Code:
ps auxww | grep minim | grep mserver.jar | awk {print $2}

for *BSD and Darwin?
Find all posts by this user
Quote this message in a reply
12-02-2020, 11:57
Post: #63
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
Thanks for confirming the cause of the problem.

This script is part of the Linux version of MinimServer. As I have said previously, the Linux scripts are not intended to support the Mac.

I cannot add BSD-dependent behaviour to these scripts because I have no way to test or support this.

Your suggestion can give a false positive by matching other MinimServer processes. It is necessary to check for a process that has the specific PID in the minimserver.pid file, perhaps using something like:

ps ww -p $pid

and then extracting the command line from the ps output.

I will not be pursuing this any further as the current code is working correctly on Linux
Find all posts by this user
Quote this message in a reply
12-02-2020, 15:25
Post: #64
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
Then just tell users to mount procfs. Add that to prerequisites in instructions. On FreeBSD,

Code:
$ mount -t procfs proc /proc

and/or add it to /etc/fstab if it is not there.
Find all posts by this user
Quote this message in a reply
28-02-2020, 06:04 (This post was last modified: 28-02-2020 06:06 by imush.)
Post: #65
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
Meanwhile I still have some trouble with my network. minimserver disappears from upnp queries after some time.

I obtained a tool to run ssdp queries and I see this for the minimserver:

Code:
HTTP/1.1 200 OK
SERVER: Posix/200112.0 UPnP/1.1 ohNet/1.0
CACHE-CONTROL: max-age=1800
EXT:
LOCATION: http://192.168.1.5:9791/9efa022f-bcd6-41ed-a223-01abcaf1f139/Upnp/device.xml
BOOTID.UPNP.ORG: 1
CONFIGID.UPNP.ORG: 1
ST: uuid:9efa022f-bcd6-41ed-a223-01abcaf1f139
USN: uuid:9efa022f-bcd6-41ed-a223-01abcaf1f139

So it expires after 30 minutes. Shouldn't ohnet send a new broadcast once in a while? Who sets the max-age=1800? My Oppo BDP-105 sits on the same network behind the same switch and it does not disappear. The player entry is as follows:

Code:
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1800
DATE: Fri, 28 Feb 2020 04:55:06 GMT
EXT:
LOCATION: http://192.168.1.15:2870/dmr.xml
SERVER: OPPO PLAYER UPnP/1.0 DLNADOC/1.50
ST: urn:schemas-upnp-org:service:AVTransport:1
USN: uuid:140479c0-58f3-1cef-84bf-0022de8b940b::urn:schemas-upnp-org:service:AVTransport:1
Find all posts by this user
Quote this message in a reply
28-02-2020, 10:24
Post: #66
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
MinimServer/ohNet does send an SSDP "alive" notification before the 30 minutes elapses. This is probably being dropped by your router or switch for some reason. The SSDP message you have posted looks like an M-SEARCH response, not an "alive" notification.

Please start another thread if you want to discuss how the UPnP protocol works and how to further investigate what might be happening with your network setup. It seems unlikely that this issue is related to whether MinimServer is runnng on Linux or FreeNAS.
Find all posts by this user
Quote this message in a reply
22-06-2020, 09:46 (This post was last modified: 22-06-2020 09:50 by Hibiki.)
Post: #67
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
Hi all,

I'm using FreeNAS 11.3-U3.1.
I created a Jail by following the tutorial provided by airflow (and improved for the automatic startup by imush).
For the dependencies, I use pkg install and it works perfectly.

I confirm I have the same error message when I type "service minimserver start":
Code:
Starting minimserver.
Failed to start MinimServer

However it starts anyway Angel

By typing "service minimserver stop", it works perfectly.

I also confirm that out of the Jail, by doing iocage stop Minimserver (my Jail's name) and the iocage start Minimserver, it works well!

I notice something:
When I'm in /usr/local/share and I typed "minimserver/bin/startc", I have no error message.
When I typed "minimserver/bin/startd", I got the "Failed to start MinimServer" but it started anyway.

So it confirms as Simoncn said that it is linked to startd script.

I didn't bring anything here... Except that I confirm to have the same issue Tongue
And I would like to thank all for their effort on FreeNAS (FreeBSD) for making MinimServer alive!


I have a question about several instances of MinimServer (one for Classical, one for other genres and one for "garbage / to be tagged"):
Do I have to follow a Linux thread on this topic?
Is there any restriction on FreeNAS (FreeBSD) to use the same Jail for having multiple MinimServer instances?

I will try to make it alive Big Grin
Find all posts by this user
Quote this message in a reply
27-06-2020, 15:08 (This post was last modified: 27-06-2020 15:10 by Hibiki.)
Post: #68
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
So, I tried to make multiple instances within FreeNAS with the following access paths:
/usr/local/share/minimserver
/usr/local/share/minimserver-2/minimserver
/usr/local/share/minimserver-3/minimserver

I changed http.port and ohnet.port on every instances to never get the 2 same port numbers.
Is it really important for ohnet.port?

So basically, I have for the first instance:
Code:
http.port = 9790
ohnet.port = 9791

The second one:
Code:
http.port = 9792
ohnet.port = 9793

And the third one:
Code:
http.port = 9794
ohnet.port = 9795

All can be manually launched.
Then I tried to modify the script for the automatic launch at boot.

Just before, I sent the commands:
Code:
/usr/bin/sed -i -- 's/-eo pid,user,vsz,stat,args/-exo pid,user,vsz,stat,args/g' /usr/local/share/minimserver-2/minimserver/bin/stopall
/usr/bin/sed -i -- 's/-eo pid,user,vsz,stat,args/-exo pid,user,vsz,stat,args/g' /usr/local/share/minimserver-3/minimserver/bin/stopall

Then I modified the script /etc/rc.d/minimserver like this:
Code:
#!/bin/sh
#
# $FreeBSD: /usr/local/etc/rc.d/minimserver, 2020/02/03 05:55:56 isaac Exp $
#
# PROVIDE: minimserver
# KEYWORD: FreeBSD
#
# minimserver startup
#

. /etc/rc.subr

minimserver_enable=${minimserver_enable}
minimserver_flags=${minimserver_flags}

name=minimserver
rcvar=minimserver_enable
minimserver1_path=/usr/local/share/minimserver
minimserver2_path=/usr/local/share/minimserver-2/minimserver
minimserver3_path=/usr/local/share/minimserver-3/minimserver
start_cmd=minimserver_start
stop_cmd=minimserver_stop

minimserver_start() {
    PATH=${PATH}:/usr/local/sbin:/usr/local/bin
    export PATH
    LANG=en_US.UTF-8
    export LANG
    LC_CTYPE=en_US.UTF-8
    export LC_CTYPE
    LC_ALL=en_US.UTF-8
    export LC_ALL
    checkyesno minimserver_enable && echo "Starting minimserver." && \
        ${minimserver1_path}/bin/startd ${minimserver_flags}
        ${minimserver2_path}/bin/startd ${minimserver_flags}
        ${minimserver3_path}/bin/startd ${minimserver_flags}
}

minimserver_stop() {
    checkyesno minimserver_enable && echo "Stopping minimserver." && \
        ${minimserver1_path}/bin/stopall
        ${minimserver2_path}/bin/stopall
        ${minimserver3_path}/bin/stopall
}

load_rc_config ${name}
run_rc_command "$1"

And it doesn't really work... Inside the Jail when I type : service minimserver stop the first time I got (while all instances were running):
Code:
root@Minimserver:/etc/rc.d # service minimserver stop
Stopping minimserver.
Stopping MinimServer process 20226
No MinimServer instances are running
No MinimServer instances are running

Only the first instance is stopped, the two others are running...

I tried a second time:
Code:
root@Minimserver:~ # service minimserver stop
Stopping minimserver.
No MinimServer instances are running
No MinimServer instances are running
No MinimServer instances are running

No change...

With:
Code:
root@Minimserver:/etc/rc.d # service minimserver start
Starting minimserver.
Failed to start MinimServer
Failed to start MinimServer
Failed to start MinimServer

Only the first instance is starting...

When I exit the Jail and I stop the Jail (iocage stop Minimserver).
I restart the Jail (iocage start Minimserver), it starts all MinimServer instances (?!)

Where am I wrong?
When I changed
Code:
checkyesno minimserver_enable && echo "Starting minimserver." && \
        ${minimserver1_path}/bin/startd ${minimserver_flags}
        ${minimserver2_path}/bin/startd ${minimserver_flags}
        ${minimserver3_path}/bin/startd ${minimserver_flags}

to

Code:
checkyesno minimserver_enable && echo "Starting minimserver." && \
        ${minimserver1_path}/bin/startd ${minimserver_flags} &&\
        ${minimserver2_path}/bin/startd ${minimserver_flags} &&\
        ${minimserver3_path}/bin/startd ${minimserver_flags}

Nothing started at all (I thought I missed the "&&\" to split the same command on several lines).

May you help me, please?

Cheers
Find all posts by this user
Quote this message in a reply
27-06-2020, 15:14
Post: #69
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
(12-02-2020 15:25)imush Wrote:  Then just tell users to mount procfs. Add that to prerequisites in instructions. On FreeBSD,

Code:
$ mount -t procfs proc /proc

and/or add it to /etc/fstab if it is not there.

Hi imush,

I tried this command and I got:
Code:
root@Minimserver:/etc # mount -t procfs proc /proc
mount: proc: Operation not permitted

File /etc/fstab is not existing also... I do not know if it is linked...

Thanks for the help Big Grin
Find all posts by this user
Quote this message in a reply
01-07-2020, 12:54
Post: #70
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
If it helps I am successfully running two instances of Minimserver on FreeNAS-11.3-U3.2 in a single jail and have configured startup in the jail as follows:

1. Create the file /etc/rc.d/minimserver with the following contents:
#!/bin/sh
PATH=${PATH}:/usr/local/sbin:/usr/local/bin
export PATH
LANG=en_US.UTF-8
export LANG
LC_CTYPE=en_US.UTF-8
export LC_CTYPE
LC_ALL=en_US.UTF-8
export LC_ALL
/usr/local/share/minimhome-audio/minimserver/bin/startd
/usr/local/share/minimhome-radio/minimserver/bin/startd

2. Make the file executable:
chmod +x /etc/rc.d/minimserver

3. Edit the file /etc/rc.conf and add the line:
minimserver_enable="YES"
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)