Error starting Home Assistant on Synology for first time

Hi- trying to get Home Assistant running on my Synology D1815+, running DSM 6.0-7321, Update 3. I’ve been following instructions here:
https://home-assistant.io/getting-started/installation-synology/

Ran into a number of issues, but finally seem to have pip going and home assistant installed; however, when I try to start Home assistant for the first time, I get permission denied on the log file:
root@DiskStation:/volume1/homeassistant# sh hass-daemon start
Starting Home Assistant …
sh: /volume1/homeassistant/home-assistant.log: Permission denied

Any ideas on what can help? I went in to DSM and tried to explicitly set read/write privileges for the homeassistant user on this directory, but I get the same error message.

Here’s the listing for the homeassitant directory:
root@DiskStation:/volume1/homeassistant# dir
total 28
drw-rw-r-- 3 homeassistant users 4096 Apr 30 11:11 .
drwxr-xr-x 13 root root 4096 Apr 30 09:27 …
-rw-rw-r-- 1 homeassistant users 43 Apr 30 11:11 configuration.yaml
drw-rw-r-- 3 homeassistant users 4096 Apr 30 09:27 @eaDir
-rwxrwxrwx 1 homeassistant users 6489 Apr 29 16:53 hass-daemon
lrwxrwxrwx 1 homeassistant users 75 Apr 29 16:03 homeassistant -> /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/homeassistant
lrwxrwxrwx 1 homeassistant users 37 Apr 29 16:03 python3 -> /volume1/@appstore/py3k/usr/local/bin

As a follow up, I got past this error by deleting the homeassistant directory the instructions told me to create through ssh and instead created the directory through File Station in DSM, setting permissions there. In my research, it appears DSM is tightening security restrictions, so a number of things people could do are harder to do now (for example, for me to install a number of things, I had too ssh in as admin then use sudo -i to change to root. You can’t ssh in as root anymore, and admin wouldn’t install the files).

Now everything loads! However, now no dependencies are getting installed.For example, in the log file:
16-05-01 10:58:19 homeassistant.util.package: Attempting install of netdisco==0.6.4
16-05-01 10:58:20 homeassistant.bootstrap: Not initializing discovery because could not install dependency netdisco==0.6.4

At the start of the log, I have an error:
/volume1/@appstore/py3k/usr/local/bin/python3: Error while finding spec for ‘pip.main’ (<class ‘ValueError’>: invalid literal for int() with base 10: ‘20-2014’); ‘pip’ is a package and cannot be directly executed

Not sure if all that is related. So I’m looking into everything…any advice would be appreciated!

1 Like

In looking in this this, this is probably related to an incompatibility between pip and DSM6:
https://github.com/pypa/pip/issues/3588#

While trying to get this working, I upgraded pip to 8.1.1, and now pip is no longer working at all on the machine. I’m getting nearly the exact same error in Home Assistant as before (and it matches the error if I try to run pip), so my hope is that if pip can get working again then I can get Home Assistant working. For reference, the error is now:
/volume1/@appstore/py3k/usr/local/bin/python3: Error while finding spec for ‘pip.main’ (<class ‘ValueError’>: invalid literal for int() with base 10: ‘20-2014’); ‘pip’ is a package and cannot be directly executed

Fortunately, the folks working at pip have made a fix, but it hasn’t been released yet. Looks like it’ll be in 8.2 of pip. So for now, I’m going wait until that release until I try anything else.

I just got my Home Assistant installed onto my Synology NAS running DSM5, and I ran into a couple of problems you described.

First up, I had Python to installed. Another package needs it. So now my NAS has both Python 2 and Python 3 running.

For Home Assistant, I had to do a couple of things differently from the setup guide.

I had to use python3 -m pip install homeassistant to get it installed on the correct version of Python. I also had to enable the “users service”, which was causing some “folders not found” errors I was getting.

For the netgeo error, I too am getting that. For now I’ve disabled the discovery service and hardcoded my Sonos and Plex IPs. To install the netgeo service (and there’s another service nmap for network sniffing), you need to install ipkg: http://rescene.wikidot.com/synology-ipkg

I haven’t done this yet, but will probably try that to at least get nmap installed so I can see devices on my network.

Success! Pip 8.1.2, released a week ago, integrated the bug fix I mentioned, and I was able to get this version of Pip installed under Python3 DSM 6. With it installed, Home Assistant started and dependencies could be downloaded and installed.

Now I’m going to start looking into getting everything setup. Phil, thanks for your reply and the heads-up that you couldn’t get discovery going with the netdisco error. I’m still seeing that, but like you, if I put in a component directly it seems to work so far (like the Hue lighting component- it would download, install, and start seeing my lights).

To summarize the changes from the installation procedure at https://home-assistant.io/getting-started/installation-synology/ (I may have missed something in this list, but I think it’s complete):

  1. I had to create the volume1/HomeAssistant directory in File Station through DSM6, setting permissions and owners there.
  2. I had to ssh in as admin, then use sudo -i to switch to root (can’t ssh in as root under DSM6)
  3. Did not run the chown, or chmod commands in the instructions. Running this screwed everything up. You set permissions from File Station.
  4. To get the right version of Pip installed, I had to run python3 -m easy_install https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz#md5=87083c0b9867963b29f7aba3613e8f4a
    Downloading https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz#md5=87083c0b9867963b29f7aba3613e8f4a

This is the direct download link to pip 8.1.2. Recall my old pip was all screwed up and wouldn’t run at all due to how DSM names some of it’s component (this was a bug submitted to pip). Running python3 -m ensurepip wouldn’t update anything. Just running easy_install pip only installed the new version in Python 2.7. Running python3 -m easy_install pip gave me an error that pip was not a recognized archive type, so I went to the direct download.

I hope some of what I wrote here helps others!

1 Like

Thanks Lanky

As an update for my install, I got discovery and Zwave working by running Home Assistant through a Docker Image. So that might be another option for people to use as well.

Hey Guys,

I’m running into issues with the discover component in HA running on my DSM as well.

I get “Not initializing discovery because could not install dependency netdisco==0.6.1” in the log and know that I need to install python3-dev package to correct this (as per https://home-assistant.io/components/discovery/).

Trouble is it won’t install with ipkg and I’m not sure where I can get the package from and where to unpack it. Has anyone done this before?

1 Like

Hello,

My first post here, so bear with me. Just started 2 weeks ago with HASS…

I was able to “install” netdisco (and it’s dependencies) on my DS411j (which does not support docker). It took me a full weekend of hacking, but at the end, the solution is quiet simpel…

For those that are still interested in this, here is a small procedure. It is not a detailed procedure since I just kept going but feel free to ask in this thread if you would run into problems:

The goal is to install a system into our DS so we can build like we want to…

  1. Install Debian Chroot from SynoCommunity by following this guide: http://www.hang321.net/en/2014/08/16/debian-chroot-on-dsm/

  2. Since this Debian is a Jessie release, it has Python 3.4, while our DS has 3.5. So we need to upgrade to Stretch release. Do this inside Debian Chroot
    a. vim /etc/apt/sources.list. Comment all Jessie, uncomment all testing
    b. vim /etc/apt/preferences.
    Packages stable should have priority -10
    Packages testing should have a priority 900
    c. apt-get update

  3. Now we need to install python3.5.
    a. apt-get install libpython3.5-dev (not sure if this is needed)
    b. apt-get install python3.5

  4. Let’s install netdisco on our debian
    a. python3.5 -m pip install netdisco

All files are now installed inside debian. We just need to copy them over to our DS.

  1. Inside SSH of DS:
    cd /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/
    cp /usr/local/debian-chroot/var/chroottarget//usr/local/lib/python3.5/dist-packages/* . -R

Now just restart HASS and discovery should be OK.

Please let me know your comments or remarks.

2 Likes

Thanks molano, with your help I could get it running.

As I run into some problems, I update your steps how it worked for me:

  1. Install Debian Chroot from SynoCommunity. I could not use the guide provided above. But just install Debian Chroot, then use following command to go into the chroot:
    /var/packages/debian-chroot/scripts/start-stop-status chroot

  2. I had to go into the bin dir:
    cd /usr/bin/

  3. Since this Debian is a Jessie release, it has Python 3.4, while our DS has 3.5. So we need to upgrade to Stretch release. Do this inside Debian Chroot. (I had to use vi, no vim there)
    a. vi /etc/apt/sources.list. Comment all Jessie, uncomment all testing
    b. vi /etc/apt/preferences.
    Packages stable should have priority -10
    Packages testing should have a priority 900
    c. apt-get update

  4. Now we need to install python3.5 AND python3-pip
    a. apt-get install libpython3.5-dev (not sure if this is needed)
    b. apt-get install python3.5
    c. apt-get install python3.5-pip

  5. Let’s install netdisco on our debian
    a. python3.5 -m pip install netdisco

All files are now installed inside debian. We just need to copy them over to our DS.

  1. Inside SSH of DS:
    cd /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/
    cp /usr/local/debian-chroot/var/chroottarget//usr/local/lib/python3.5/dist-packages/* . -R
1 Like

Please forgive me if this is off-topic, but I had such a hard time both trying to (1) compile an updated package for Home-Assistant (using the spksrc repository) and (2) manually install home-assistant on the Synology host OS, that I evetnually broke down and went the Docker route, which has been a cakewalk in comparison (for me).

If you’re interested in pursuing this approach, it was very easy using the official Synology Docker package, together with the “homeassistant/home-assistant” image on the official docker hub registry. The only wrinkle was having to access the Synolgoy via SSH to issue the command “docker pull homeassistant/home-assistant:latest”, since the web UI for the Docker package wouldn’t download the most recent version available. Installation then only required mapping a local directory to “/config” for the image, and setting up a port to forward to the image’s port 8123.

Hello,

I do fully agree that docker is much more simple, but the problem is that “older” Synology’s do not support docker.
For me it’s a no go, that’s why I had to do it manually.

But in the meantime, I have bought myself a Raspberry Pi and I am setting it up as we speak. :wink:

Hi All! Sorry for the noob question, I’m using an old Synology which doesnt support docker i suppose. I follow the installation guide from homeassistant and when I wanted to start the hass-daemon, i got the error below, a very noob question, how do I create this pid file or what does it contain? Thanks. :frowning:

cat: /volume1/homeassistant/home-assistant.pid: No such file or directory

Hello, i am new and i need help .
i have a synology dS112 and dsm 6.1 beta ( is this a problem ? )
i install normal over paket center and i take a configuration from broadlink switch
i wrote ip and mac adressebut i get error

homeassistant: hass.local_api is deprecated. Use hass.config.api

the same by limitless light
is something wrong or i have to install some other things ?
Thanks for Help

I also had problems with installing Home Assistant on my Synology NAS for the first time.
After following the installation guide, I got the error home-assistant.log: Permission denied.
The solution for this problem was to create the errors with File Station in DSM, als @Lanky mentioned above!

1 Like

Thanks molano and dedi.

An update to the process now that stretch is stable release. Got this going with the following steps:

  1. Install Debian Chroot from SynoCommunity

  2. SSH into Synology DiskStation. Use this command to go into chroot: /var/packages/debian-chroot/scripts/start-stop-status chroot

  3. cd /usr/bin/

  4. I prefer nano which was thankfully available but vi should do the job (vim was not available).
    nano /etc/apt/sources.list
    Change all “jessie” sources to “stretch”. Thats it, no messing around with preferences.

  5. Installing python and pip:
    a. apt-get install libpython3.5-dev
    b. apt-get install python3.5
    c. apt-get install python3-pip (note: no 3.5)

  6. Install netdisco: **python3.5 -m pip install netdisco

  7. Get back to the DS SSH with: exit

  8. Copy all packages:
    cd /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/
    cp /usr/local/debian-chroot/var/chroottarget//usr/local/lib/python3.5/dist-packages/* . -R

  9. Restart home assistant /volume1/homeassistant/hass-daemon restart (assuming that’s where you put it).

1 Like

Thanks @nidalm for the update. Worked like a charm!

Quick note: Before step 5a, need an apt-get update, otherwise will get a

E: Unable to locate package libpython3.5-dev
E: Couldn't find any package by regex 'libpython3.5-dev'

I had an issue installing Python3.5 using apt-get update, I managed to build the package manually using:
sudo apt-get install libssl-dev openssl
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar xzvf Python-3.5.0.tgz
cd Python-3.5.0
./configure
make
sudo make install