Page 1 of 1

ip6 troubles [resolved]

PostPosted: Wed Mar 31, 2010 4:32 am
by tekniklr
After installing subsonic in debian unstable, I am unable to connect to the web interface. After a bit of troubleshooting, I think I have tracked this problem to an ip6 issue- it looks like subsonic is only binding to the ip6 interface, regardless of what I pass with --HOST (tried 0.0.0.0, 127.0.0.1, and my local IP)

Here is the config section of my /etc/init.d/subsonic file:
Code: Select all
SUBSONIC_ARGS="--host=0.0.0.0"

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Subsonic Daemon"
NAME=subsonic
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="--pidfile=$PIDFILE $SUBSONIC_ARGS"
SCRIPTNAME=/etc/init.d/$NAME


Subsonic is running:
Code: Select all
tekniklr@eldritch:rc2.d $ ps aux | grep subsonic
root      8803  0.0  0.2  40412  9548 ?        Ss   00:16   0:00 gvim /etc/init.d/subsonic
root      8886  1.8  1.7 228044 74488 pts/1    Sl   00:16   0:08 java -Xmx64m - subsonic.home=/var/subsonic -Dsubsonic.host=0.0.0.0 -Dsubsonic.port=4040 -Dsubsonic.contextPath=/ -Dsubsonic.defaultMusicFolder=/var/music -Dsubsonic.defaultPodcastFolder=/var/music/Podcast -Dsubsonic.defaultPlaylistFolder=/var/playlists -jar subsonic-booter-jar-with-dependencies.jar
root      8932  0.0  0.0   2880   640 pts/2    S+   00:16   0:00 tail -f /var/subsonic/subsonic_sh.log
tekniklr 10281  0.0  0.0   2944   836 pts/1    S+   00:24   0:00 grep --color=auto -i subsonic


And the port is open:
Code: Select all
tekniklr@eldritch:rc2.d $ netstat -ltn | grep LISTEN | grep 4040
tcp6       0      0 :::4040                 :::*                    LISTEN


However, http://localhost:4040 does not work.

Comparing the subsonic port to a known working port (631/cups) I saw this:
Code: Select all
tekniklr@eldritch:rc2.d $ netstat -ltn | grep LISTEN | grep 631
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN

Cups got two lines, and subsonic only got one.

Looking in /etc/hosts, I saw:
Code: Select all
# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Sure enough, browsing to http://ip6-localhost:4040 WORKS.

The only problem with that is, it won't work from outside my network.

What do I do to make subsonic work in ip4 and ip6, a la cups?

PostPosted: Sun Apr 04, 2010 11:00 pm
by DasBoot
You add the following to /usr/share/subsonic/subsonic.sh:

-Djava.net.preferIPv4Stack=true

Java 1.6 favours IPv6 by default so if an application does not specify which stack to use AND IPv6 is available it will only create an IPv6 socket. The solution to this problem would be for Subsonic to explicitly create IPv4 and IPv6 sockets.

For now the following patch will work:

--- /usr/share/subsonic/subsonic.sh.org 2010-04-05 00:56:44.407098870 +0200
+++ /usr/share/subsonic/subsonic.sh 2010-04-04 22:52:03.987118994 +0200
@@ -107,6 +107,7 @@
-Dsubsonic.defaultMusicFolder=${SUBSONIC_DEFAULT_MUSIC_FOLDER} \
-Dsubsonic.defaultPodcastFolder=${SUBSONIC_DEFAULT_PODCAST_FOLDER} \
-Dsubsonic.defaultPlaylistFolder=${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} \
+ -Djava.net.preferIPv4Stack=true \
-jar subsonic-booter-jar-with-dependencies.jar > ${LOG} 2>&1 &

# Write pid to pidfile if it is defined.

PostPosted: Tue Apr 06, 2010 4:23 am
by tekniklr
Thanks! That worked.