Jump to content

emby-server won't start at jail boot-up: term: Undefined variable


dolphin
Go to solution Solved by dolphin,

Recommended Posts

dolphin

I'm running FreeNAS 11.2.

I've created a jail with command

iocage create -n emby -r 11.2-RELEASE ip4_addr="lagg0|10.0.0.6/24" boot=on

mounted my media folder

iocage fstab --add emby /mnt/zpool/media /media nullfs rw 0 0

fired up the emby jail console

iocage console emby

followed instructions and installed emby-server stable > https://emby.media/freebsd-server.html

then enabled it as a service to start at jail boot-up and eventually started it

sysrc emby_server_enable="YES"
service emby-server start

Service gets started, everything seems to work just fine, but whenever FreeNAS gets rebooted, all of my 6 jails are auto-started and so are all their configured services except for the emby server.

So I ran iocage console emby to open a shell inside the emby jail, ran ps aux to show running processes and emby is not there.

Starting the emby service manually returns the following, wierd, error.

root@emby:/root# service emby-server start
Starting emby_server.
term: Undefined variable.

But if I exit to the FreeNAS shell and run

root@freenas:/root# iocage restart -s emby
Soft restarting emby (emby)

the emby server does get started!

What would you do?? I'm at a loss! Thanks.

Link to comment
Share on other sites

makarai

Hi,

 

tbh, i would use the normal jail creation in DHCP mode, change from DHCP to Static in the gui, if you need to. (I just force my router/firewall to give the jail a specific ip, and stick to dhcp). This creates a virtual adapter that attaches to your lagg0 device, and creates a full functioning network stack, imporant if you want to use mutlicast (for live tv)

 

EASY :Start a new Jail with:

cd /tmp
wget https://raw.githubusercontent.com/ma-karai/iocage-plugin-emby/master/emby-server.json
iocage fetch -P dhcp=on vnet=on bpf=yes allow_raw_sockets=1 -n emby-server.json --branch 'master' 

MORE COMPLICATED: If you use the Freebsd installation instruction for a jail you need to do some other things as well,

 

i.e.

 

Your start parameter needs to be defined with boot=on and some other things. 

iocage fetch -P --name emby-server.json ip4_addr="vnet0|192.168.0.112/24" defaultrouter="192.168.0.1" vnet="on" allow_raw_sockets="1" boot="on" host_hostname="emby" host_domainname=""

and maybe:

# Enable the service
sysrc -f /etc/rc.conf emby_server_enable="YES"

# Start the service
service emby-server start 2>/dev/null
Edited by makarai
Link to comment
Share on other sites

dolphin

Thank you makarai, I did what you suggested, but got stuck at Fetching artifact... (I've replaced my actual domain with mydomain.com).

Fetching artifact...
Exception: CertificateError:hostname 'github.com' doesn't match either of '*.mydomain.com', 'mydomain.com' occured, destroyed emby-server.
Link to comment
Share on other sites

makarai

 

Thank you makarai, I did what you suggested, but got stuck at Fetching artifact... (I've replaced my actual domain with mydomain.com).

Fetching artifact...
Exception: CertificateError:hostname 'github.com' doesn't match either of '*.mydomain.com', 'mydomain.com' occured, destroyed emby-server.

 

 

Which suggestion did you use, because there are two

Link to comment
Share on other sites

makarai

Please use this one in the beginning

cd /tmp
# type ls to check if you have old emby-server.json files in this folder if so delete them
wget https://raw.githubusercontent.com/ma-karai/iocage-plugin-emby/master/emby-server.json
iocage fetch -P dhcp=on vnet=on bpf=yes allow_raw_sockets=1 -n emby-server.json --branch 'master'
Edited by makarai
Link to comment
Share on other sites

dolphin

 

Please use this one in the beginning

cd /tmp
# type ls to check if you have old emby-server.json files in this folder if so delete them
wget https://raw.githubusercontent.com/bott0r/iocage-plugin-emby/master/emby-server.json
iocage fetch -P dhcp=on vnet=on bpf=yes allow_raw_sockets=1 -n emby-server.json --branch 'master'

 

Thank you.

I've made sure no old emby-server.json file was in /tmp and then copy-pasted your commands but I got the same error as before:

root@freenas:/tmp# iocage fetch -P dhcp=on vnet=on bpf=yes allow_raw_sockets=1 -n emby-server.json --branch 'master'
Plugin: emby-server
  Official Plugin: False
  Using RELEASE: 11.2-RELEASE
  Using Branch: master
  Post-install Artifact: https://github.com/bott0r/iocage-plugin-emby.git
  These pkgs will be installed:
    - lang/mono
    - multimedia/libass
    - x11-fonts/fontconfig
    - print/freetype2
    - converters/fribidi
    - security/gnutls
    - converters/iconv
    - audio/opus
    - net/samba48
    - databases/sqlite3
    - multimedia/libtheora
    - multimedia/libva
    - audio/libvorbis
    - graphics/webp
    - multimedia/libx264
    - graphics/libraw
    - devel/libzvbi
Secure packagesite detected, installing ca_root_nss package.

Testing SRV response to FreeBSD
pkg.freebsd.org's SRV record could not be verified.

Testing DNSSEC response to FreeBSD
pkg.freebsd.org could not be reached via DNSSEC.

Testing DNS response to FreeBSD

Testing SRV response to plugin-default
Testing DNSSEC response to plugin-default

Installing plugin packages:
  - lang/mono...
  - multimedia/libass...
  - x11-fonts/fontconfig...
  - print/freetype2...
  - converters/fribidi...
  - security/gnutls...
  - converters/iconv...
  - audio/opus...
  - net/samba48...
  - databases/sqlite3...
  - multimedia/libtheora...
  - multimedia/libva...
  - audio/libvorbis...
  - graphics/webp...
  - multimedia/libx264...
  - graphics/libraw...
  - devel/libzvbi...

Fetching artifact...
Exception: CertificateError:hostname 'github.com' doesn't match either of '*.mydomain.com', 'mydomain.com' occured, destroyed emby-server.
Link to comment
Share on other sites

makarai

What freenas version? Latest i suppose?

Can you create a normal jail, with the GUI

 

Jails > Add > fillout name > 11.2-release > next ? DHCP ticked vnet ticked next -> submit 

 

start the jail

 

enter the jail shell

sudo pkg install mono libass fontconfig freetype2 fribidi gnutls iconv opus samba48 sqlite3 libtheora libva libvorbis webp libx264 libzvbi libraw
pkg add -f https://github.com/MediaBrowser/Emby.Releases/releases/download/4.0.1.0/emby-server-freebsd_4.0.1.0_amd64.txz 
sysrc -f /etc/rc.conf emby_server_enable="YES"
service emby-server start 2>/dev/null

restart jail

 

if it gets an ip address add port and check

Edited by makarai
Link to comment
Share on other sites

dolphin

Thank you makarai, this worked!

So as far as I can understand, by diffing this new jail's properties over my previous broken emby jail, these are the properties that make all the difference:

  • dhcp=on
  • bpf=yes
  • vnet=on

All my other jails work just fine with fixed IP addresses so I never bothered but emby is different! Thank you for helping me figure this out!

Link to comment
Share on other sites

makarai

Thank you makarai, this worked!

So as far as I can understand, by diffing this new jail's properties over my previous broken emby jail, these are the properties that make all the difference:

  • dhcp=on
  • bpf=yes
  • vnet=on

All my other jails work just fine with fixed IP addresses so I never bothered but emby is different! Thank you for helping me figure this out!

 

You can run it in static mode, but if you want a full networkstack (needed for livetv) you have to use a virtual interface (vnet0 or similar) if you direct attach the jail to em0 or igb0 or so some things just dont work.

  • Like 1
Link to comment
Share on other sites

makarai

Right, I get it. Thanks!

 

Sorry for being a  little to assertive. I always loved static ip addresses but always run into some problems, so i just went to DHCP everything and let the firewall push the static addresses to the clients, and it works flawelessly.

Edited by makarai
Link to comment
Share on other sites

dolphin

One last thing: since I'd rather give my servers fixed IP addresses than create static DHCP leases for them on my pfSense router, I modified slightly your jail creation command as follows (might help others):

iocage create -r 11.2-RELEASE boot=on vnet=on bpf=yes ip4_addr="vnet0|10.0.0.6/24" defaultrouter="10.0.0.1" -n emby
Link to comment
Share on other sites

dolphin

Thank you, that is helpful!

One more question: can you please clarify in what way Emby needs to allow raw network sockets?

I've read the iocage man page and wikipedia so I've learned more or less what they're for, but I don't understand why you recommend allowing them for Emby server. For Live TV? For multicast?

Link to comment
Share on other sites

  • Solution
dolphin

Just to follow up on myself, I eventually understood why I was getting that wierd term: Undefined variable error!

I had made some wierd modifications to root's .cshrc .... nothing to do with Emby!!

  • Like 1
Link to comment
Share on other sites

unhooked

Just to follow up on myself, I eventually understood why I was getting that wierd term: Undefined variable error!

I had made some wierd modifications to root's .cshrc .... nothing to do with Emby!!

this is why it's generally advised not to diddle with root, and if you need a customized environment (shell swap most often) that you use the toor account to do this.  ;-)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...