INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: JRiver MediaCenter on (x86_64) Synology NAS  (Read 8361 times)

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
JRiver MediaCenter on (x86_64) Synology NAS
« on: June 25, 2014, 12:39:12 pm »

I know I have a wiki to finish, but this is more fun  :P.

This isn't complete yet, I'm working on it since I recently got myself a Synology NAS. A 1513+ to be exact. It has an Atom D2700 dual core.

My idea is to install Debian Wheezy 32-bit in a chroot environment, install the required dependencies (xorg, alsa, etc) and run MC inside that. The reason for this approach is because MC is known to run stable on Debian 32-bit. Secondly, I coudn't find the required dependencies natively for whatever distro runs on the NAS. I installed ipkg and it lists some X11 packages, some ALSA libs but even then, I would have to copy the MC binaries natively and who knows what else I run into. The chroot environment seemed the better approach at this point. Nonetheless, running it directly might even be an option too who knows.

Several things I need to figure out still;
- how to access the media volume from within the chroot environment; it might be simple I just haven't looked into it yet;
- how to configure MC; I tried to configure X11 forwarding and launch MC but the chroot environment is complicating things. I copied my local .jriver profile and tried to launch mediacenter19 /mediaserver but it segfaults.
- how to make it actually work :P

Here's what I've done so far. Note, this is NOT a how-to! It's not working (yet). It's not a step-by-step guide so do NOT follow these steps unless you know what you're doing and like to break things and fix them again. There might be typo's and there missing steps like, obvious things :P.

On a Debian machine (VM will do):
Code: [Select]
apt-get install debootstrap
Code: [Select]
mkdir @chroot (in a suitable location obvioiusly)
Code: [Select]
debootstrap --foreign --arch i386 wheezy @chroot
Code: [Select]
tar -cvzf chroot.tar.gz @chroot
Copy the tarball to your NAS and ssh to the NAS as root. mv or cp the tarball to the root of volume1 (or whatever volume you wish to create the chroot environment). Unpack it:

Code: [Select]
tar -xvzf chroot.tar.gz
run:
Code: [Select]
hostname > /volume1/@chroot/etc/hostname
Assuming the NAS is configured properly with DNS etc:
Code: [Select]
cp /etc/resolv.conf /volume1/@chroot/etc/
Finish the environment:
Code: [Select]
chroot /volume1/@chroot /debootstrap/debootstrap --second-stage
create the following file:
/usr/syno/etc/rc.d/S91chroot.sh
Code: [Select]
case $1 in
start)
 /bin/mount -o bind /dev /volume1/@chroot/dev
 /bin/mount -o bind /proc /volume1/@chroot/proc
 /bin/mount -o bind /dev/pts /volume1/@chroot/dev/pts
 /bin/mount -o bind /sys /volume1/@chroot/sys
 ;;
stop)
 /bin/umount /volume1/@chroot/proc
 /bin/umount /volume1/@chroot/dev/pts
 /bin/umount /volume1/@chroot/dev
 /bin/umount /volume1/@chroot/sys
 ;;
*)
 echo "Usage: $0 [start|stop]"
 ;;
esac

Code: [Select]
chmod 755 /usr/syno/etc/rc.d/S91chroot.sh
Code: [Select]
sh /usr/syno/etc/rc.d/S91chroot.sh start
Code: [Select]
chroot /volume1/@chroot /bin/bash
edit /etc/apt/sources.list. Change the mirror to one near you.

Code: [Select]
deb http://mirror.1000mbps.com/debian/ wheezy main contrib non-free
#deb-src http://mirror.1000mbps.com/debian/ wheezy main contrib non-free
 
deb http://security.debian.org/ wheezy/updates main contrib non-free
#deb-src http://security.debian.org/ wheezy/updates main contrib non-free
 
deb http://mirror.1000mbps.com/debian/ wheezy-updates main contrib non-free
#deb-src http://mirror.1000mpbs.com/debian/ wheezy-updates main contrib non-free

Code: [Select]
apt-get update
Exit chroot environment, stop it and back it up:
Code: [Select]
exit
Code: [Select]
/usr/syno/etc/rc.d/S91chroot.sh stop
Code: [Select]
tar -cvzf chroot.tar.gz @chroot
Start it again:
Code: [Select]
/usr/syno/etc/rc.d/S91chroot.sh start
Code: [Select]
chroot /volume1/@chroot /bin/bash
Code: [Select]
apt-get install xserver-xorg-video-dummy
Follow the 'run MC without GUI' sticky thread.

Code: [Select]
wget http://files.jriver.com/mediacenter/channels/v19/latest/MediaCenter-19.0.144.deb
Code: [Select]
dpkg -i MediaCenter-19.0.144.deb
Code: [Select]
apt-get install -f
At this point I couldn't get MC to start because forwarding X11 session from a chroot environment is .. tricky. I don't even know if its possible. I copied my local .jriver, but running mediacenter19 /mediaserver doesn't run.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13951
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #1 on: June 25, 2014, 01:39:28 pm »

To test this,  I always use something simple like xterm in the chroot environment first.
I don't see anything obvious wrong with your logic.
You might try a non-ssh forward. IE in chroot do:
export DISPLAY=whateveryourclientmachoineipaddressis:0
(and on the client, xhost +)
then just mediacenter (without the /mediaserver)  to see if it runs.
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #2 on: June 26, 2014, 01:45:30 am »

The parameters for chroot are limited. Where a full blown distro has a chroot that can be configured to run as other users this one only accepts the path and command. So I'm stuck to running it as root.

I configured a regular user and installed sudo, so I can run programs in the chroot with 'sudo -u username'. It keeps complaining it can't find the display %s.

I did manage to configure sshd to go straight to the chroot environment. I'm thinking I can run 2 ssh daemons, 1 on port 22 for regular NAS login and another on port 2222 for the chroot environment. Then I should be able to login as a regular user. A problem I noticed with this was that for the user I created its looking for the user profile in the wrong directory, this might be the reason MC is not starting because the profile folder its looking for doesn't exist.

Then I think I made a typo somewhere and when I try to login as root on the NAS, it says /bin/ash cannot be found and drops me back to the shell. I can login as another user but I can't see where I made the typo. In passwd there's a shell line for each user but there it simply says /bin/bash :s. But sshd also drops me in the chroot, so I basically locked myself out from logging into the NAS as root.

I created a nice mess for myself :P. I'm sure there's a loophole somewhere though.

I gave up it was getting late. I'll fiddle around some more tonight :P.
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #3 on: June 26, 2014, 10:43:03 am »

Access to the NAS was an easy fix via the webGUI.

Now that I'm back in, I fixed the homedir thingy and also some permissions on folders. I had to copy .Xauthority from the NAS homefolder to the chroot homefolder. Then starting xterm worked. Starting MediaCenter worked somewhat, it opened a dialogscreen for a second and the closed.

Figured I'd restore the license from the command line and lo and behold, MC started and stayed running but unfortunately I did not see a GUI. I did see a flash but that was it. But it was running. So I pressed ctrl-c, MC exited and when I started it again it just dropped me back to the prompt. It's been dead since.

But I'm getting closer :P.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13951
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #4 on: June 26, 2014, 11:06:26 am »

I don't know how much this affects you but MC always looks for the user directories in /home
This should be changed at some point but you can fix it with a symlink too.
Same thing for root. It will run as root if you symlink the root directory like this:
ln -s /root /home/root
Logged

Opawesome

  • Recent member
  • *
  • Posts: 32
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #5 on: July 01, 2014, 07:07:54 am »

I know I have a wiki to finish, but this is more fun  :P.

This isn't complete yet, I'm working on it since I recently got myself a Synology NAS. A 1513+ to be exact. It has an Atom D2700 dual core.

My idea is to install Debian Wheezy 32-bit in a chroot environment, install the required dependencies (xorg, alsa, etc) and run MC inside that. The reason for this approach is because MC is known to run stable on Debian 32-bit. Secondly, I coudn't find the required dependencies natively for whatever distro runs on the NAS. I installed ipkg and it lists some X11 packages, some ALSA libs but even then, I would have to copy the MC binaries natively and who knows what else I run into. The chroot environment seemed the better approach at this point. Nonetheless, running it directly might even be an option too who knows.

Several things I need to figure out still;
- how to access the media volume from within the chroot environment; it might be simple I just haven't looked into it yet;
- how to configure MC; I tried to configure X11 forwarding and launch MC but the chroot environment is complicating things. I copied my local .jriver profile and tried to launch mediacenter19 /mediaserver but it segfaults.
- how to make it actually work :P

Here's what I've done so far. Note, this is NOT a how-to! It's not working (yet). It's not a step-by-step guide so do NOT follow these steps unless you know what you're doing and like to break things and fix them again. There might be typo's and there missing steps like, obvious things :P.

On a Debian machine (VM will do):
Code: [Select]
apt-get install debootstrap
Code: [Select]
mkdir @chroot (in a suitable location obvioiusly)
Code: [Select]
debootstrap --foreign --arch i386 wheezy @chroot
Code: [Select]
tar -cvzf chroot.tar.gz @chroot
Copy the tarball to your NAS and ssh to the NAS as root. mv or cp the tarball to the root of volume1 (or whatever volume you wish to create the chroot environment). Unpack it:

Code: [Select]
tar -xvzf chroot.tar.gz
run:
Code: [Select]
hostname > /volume1/@chroot/etc/hostname
Assuming the NAS is configured properly with DNS etc:
Code: [Select]
cp /etc/resolv.conf /volume1/@chroot/etc/
Finish the environment:
Code: [Select]
chroot /volume1/@chroot /debootstrap/debootstrap --second-stage
create the following file:
/usr/syno/etc/rc.d/S91chroot.sh
Code: [Select]
case $1 in
start)
 /bin/mount -o bind /dev /volume1/@chroot/dev
 /bin/mount -o bind /proc /volume1/@chroot/proc
 /bin/mount -o bind /dev/pts /volume1/@chroot/dev/pts
 /bin/mount -o bind /sys /volume1/@chroot/sys
 ;;
stop)
 /bin/umount /volume1/@chroot/proc
 /bin/umount /volume1/@chroot/dev/pts
 /bin/umount /volume1/@chroot/dev
 /bin/umount /volume1/@chroot/sys
 ;;
*)
 echo "Usage: $0 [start|stop]"
 ;;
esac

Code: [Select]
chmod 755 /usr/syno/etc/rc.d/S91chroot.sh
Code: [Select]
sh /usr/syno/etc/rc.d/S91chroot.sh start
Code: [Select]
chroot /volume1/@chroot /bin/bash
edit /etc/apt/sources.list. Change the mirror to one near you.

Code: [Select]
deb http://mirror.1000mbps.com/debian/ wheezy main contrib non-free
#deb-src http://mirror.1000mbps.com/debian/ wheezy main contrib non-free
 
deb http://security.debian.org/ wheezy/updates main contrib non-free
#deb-src http://security.debian.org/ wheezy/updates main contrib non-free
 
deb http://mirror.1000mbps.com/debian/ wheezy-updates main contrib non-free
#deb-src http://mirror.1000mpbs.com/debian/ wheezy-updates main contrib non-free

Code: [Select]
apt-get update
Exit chroot environment, stop it and back it up:
Code: [Select]
exit
Code: [Select]
/usr/syno/etc/rc.d/S91chroot.sh stop
Code: [Select]
tar -cvzf chroot.tar.gz @chroot
Start it again:
Code: [Select]
/usr/syno/etc/rc.d/S91chroot.sh start
Code: [Select]
chroot /volume1/@chroot /bin/bash
Code: [Select]
apt-get install xserver-xorg-video-dummy
Follow the 'run MC without GUI' sticky thread.

Code: [Select]
wget http://files.jriver.com/mediacenter/channels/v19/latest/MediaCenter-19.0.144.deb
Code: [Select]
dpkg -i MediaCenter-19.0.144.deb
Code: [Select]
apt-get install -f
At this point I couldn't get MC to start because forwarding X11 session from a chroot environment is .. tricky. I don't even know if its possible. I copied my local .jriver, but running mediacenter19 /mediaserver doesn't run.

Man, when I read this I realise that I am not even close to ever get a simple "NAS only" configuration which would be able to run a MC server so that I can control it via my laptop or my tablet...
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13951
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #6 on: July 01, 2014, 11:17:52 am »

When you run with the /mediaserver switch you'll not see a window, you'll just get that flash on the main window.
When testing, setting the DISPLAY variable to your remote machine, if you can get xterm you should get MC working (after fixing the home dir issue).
To run with the /mediaserver switch and the dummy Xorg server you'll need to start it up similar to this:

Code: [Select]
#startup the xserver
cd /tmp
nohup Xorg >/dev/null 2>&1 &
#give X and IP some time to start
sleep 20
su - [user you want mc to run as] -c"export DISPLAY=:0;mediacenter19 /mediaserver >/dev/null 2>&1"&

and use a /etc/X11/xorg.conf config file similar to this:

Code: [Select]
Section "Files"
        FontPath        "/usr/share/fonts/X11/misc"
        FontPath        "/usr/X11R6/lib/X11/fonts/misc"
        FontPath        "/usr/share/fonts/X11/cyrillic"
        FontPath        "/usr/X11R6/lib/X11/fonts/cyrillic"
        FontPath        "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath        "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
        FontPath        "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath        "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
        FontPath        "/usr/share/fonts/X11/Type1"
        FontPath        "/usr/X11R6/lib/X11/fonts/Type1"
        FontPath        "/usr/share/fonts/X11/100dpi"
        FontPath        "/usr/X11R6/lib/X11/fonts/100dpi"
        FontPath        "/usr/share/fonts/X11/75dpi"
        FontPath        "/usr/X11R6/lib/X11/fonts/75dpi"
        # path to defoma fonts
        FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection
Section "Device"
    Identifier  "Configured Video Device"
    Driver      "dummy"
EndSection

Section "Monitor"
    Identifier  "Configured Monitor"
    HorizSync 31.5-48.5
    VertRefresh 50-70
EndSection

Section "Screen"
    Identifier  "Default Screen"
    Monitor     "Configured Monitor"
    Device      "Configured Video Device"
    DefaultDepth 24
    SubSection "Display"
    Depth 24
    Modes "1152x864"
    EndSubSection
EndSection
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #7 on: July 01, 2014, 11:37:15 am »

Man, when I read this I realise that I am not even close to ever get a simple "NAS only" configuration which would be able to run a MC server so that I can control it via my laptop or my tablet...

Obviously what I am trying to do is highly experimental. If (big IF) its going to work reliably, someone will probably create a package for compatible synology NASes to make it more user friendly.

I haven't done much with it the past couple of days as I have some weird permission problems I need to solve first.
Logged

jmczen

  • Recent member
  • *
  • Posts: 12
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #8 on: July 21, 2014, 09:51:43 am »

Just want to encourage you with your experiments. Hope you get to the stage where you can get a syno package done ;)
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #9 on: July 21, 2014, 10:28:25 am »

Thanks.

I'm reasonably sure that it can work. But I messed up the chroot environment a couple of weeks ago; I did a chown -R over a directory and forgot the chroot was there as well  :-[.

I need to redo the whole thing but personal stuff has been getting in the way; there isn't a lot of motivation right now to really dig into this again, it may be a while.

Also i don't think I could make a syno package; MediaCenter is proprietary software that I can't repackage and besides I think the stuff involved with the chroot makes it very difficult to do.
Logged

gmeardi

  • Recent member
  • *
  • Posts: 11
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #10 on: July 27, 2014, 06:05:37 am »

Good try, friends! I think JRiver is aware there's some good people out there with Synology NAS's (I've the same 1513+): please support us with a specific package :-)  I'd rather not risk lowering my NAS reliability with unsupported modding (I'm not a real linux expert).
Thanks!
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #11 on: September 05, 2014, 02:11:10 pm »

I'm not going to finish this, sorry. Reason is that I'm selling the NAS and I am not getting another one.

I never liked NAS devices and the Synology turned out to be no exception.
Logged

Patatorz

  • Recent member
  • *
  • Posts: 48
Re: JRiver MediaCenter on (x86_64) Synology NAS
« Reply #12 on: November 22, 2014, 11:06:28 am »

Hi Nothing new on this topic ?
Logged
Pages: [1]   Go Up