Announcement

Collapse
No announcement yet.

Autostart Homeseer on Linux

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Autostart Homeseer on Linux

    Hi!

    I am trying to get Homeseer to start automatically on reboot using this guide: https://forums.homeseer.com/showthre...368&styleid=8?

    I am having a problem that I was hoping to shed some light on:
    When copying your instructions above I can start Homeseer by using "systemctl start homeseer.service"

    But when I enable the service running "systemctl enable homeseer.service" the service doesn't start up when the server boots, I get the following error message:
    homeseer.service - HomeSeer HS3 Home Automation Server
    Loaded: loaded (/etc/systemd/system/homeseer.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sat 2017-08-26 06:41:11 CEST; 7h left
    Process: 1710 ExecStop=/home/christian/HomeSeer/stop_homeseer.sh (code=exited, status=210/CHROOT)
    Process: 1700 ExecStart=/usr/bin/mono /home/christian/HomeSeer/HSConsole.exe --log (code=exited, status=210/CHROOT)
    Main PID: 1700 (code=exited, status=210/CHROOT)
    CPU: 0

    Aug 26 06:41:11 homeseer systemd[1]: homeseer.service: Control process exited, code=exited status=210
    Aug 26 06:41:11 homeseer systemd[1]: homeseer.service: Unit entered failed state.
    Aug 26 06:41:11 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.
    Aug 26 06:41:11 homeseer systemd[1]: homeseer.service: Service hold-off time over, scheduling restart.
    Aug 26 06:41:11 homeseer systemd[1]: Stopped HomeSeer HS3 Home Automation Server.
    Aug 26 06:41:11 homeseer systemd[1]: homeseer.service: Start request repeated too quickly.
    Aug 26 06:41:11 homeseer systemd[1]: Failed to start HomeSeer HS3 Home Automation Server.
    Aug 26 06:41:11 homeseer systemd[1]: homeseer.service: Unit entered failed state.
    Aug 26 06:41:11 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.

    This was on August 25th by the way so don't know why the date and time is wrong. But the can't see why this is not working, am I requesting another startup at the same time?
    Thanks in advance!

  • #2
    I would recommend that you post where you found the script.

    Meanwhile here is one that I have used for a while except I do not really use it to stop Homeseer.

    It just runs a PID and I stop Homeseer with the GUI.

    It does automatically start Homeseer and I have not had an issue with it.

    It's been running now since first installation of the Homeseer lite program. (Over a year now)

    I tested the stop, start, restart and it works fine.

    Note you will need to edit it for your Homeseer. I have my Homeseer running in the root directory.

    Code:
    #!/bin/bash
    ### BEGIN INIT INFO
    # Provides:          HomeSeer
    # Required-Start:    $local_fs $network
    # Required-Stop:     $local_fs
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: HomeSeer
    # Description:       HomeSeer daemon
    ### END INIT INFO
    
    NAME='HomeSeer'            # Server handle for the screen session
    DIR='/HomeSeer'
    USER='root'                # Start HomeSeer as root. You may use a non privileged user
                               # Note: if homeseer is running as non-root user
                               # remove 'sudo' command in file 'go' in HomeSeer folder
                               # and change setting gWebSvrPort to value > 1024 in settings.ini
    PWD=`pwd`
    RETVAL=0 
    
    service_start() {
        if [ -f /var/run/$NAME.pid ]; then
            if [ "$(ps -p `cat /var/run/$NAME.pid` | wc -l)" -gt 1 ]; then
                echo -e "$NAME is already running (pidfile exists)."
                return 1
            else
                rm -f /var/run/$NAME.pid
            fi
        fi
        [ -f $DIR/go ] && cd $DIR && su -c "/usr/bin/screen -S $NAME -d -m ./go" $USER
        cd $PWD
        sleep 5
        ps -ef | egrep "[S]CREEN.+${NAME}" | awk '{ print $2 }' > /var/run/$NAME.pid
        [ -s /var/run/$NAME.pid ] && echo "$NAME started."
    }
    
    service_stop() {
        if [ -f /var/run/$NAME.pid ]; then
            if [ $(ps -ef | egrep -c "[S]CREEN.+$NAME") -ge 1 ]; then
                #invoke shutdown command to homeseer...
                for char in $(printf "\\r s h u t d o w n \\r") ; do 
                    su -c "/usr/bin/screen -p 0 -S $NAME -X stuff $char" $USER
                    sleep 0.1
                done
                sleep 15
            fi
            if [ "$(ps -p `cat /var/run/$NAME.pid` | wc -l)" -gt 1 ]; then
                echo -e "$NAME did not stop gacefully. Killing it"
                [ -s /var/run/$NAME.pid ] && kill `cat /var/run/$NAME.pid`
            fi
            rm -f /var/run/$NAME.pid
        else
            echo -e "$NAME is not running."
        fi
    }
    
    case "$1" in
    'start')
        service_start
    ;;
    'stop')
        service_stop
    ;;
    'restart')
        service_stop
        sleep 5
        service_start
    ;;
    *)
        echo "Usage $0 start|stop|restart"
    esac
    # --------------------------------------------------------
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU - Mono 6.00
    Homeseer Zee2 (Lite) - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.00

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation.

    Comment


    • #3
      Thanks for the response, the method I use currently is the first link in my post. I will have a look at your script as well, thanks for the input!

      Comment


      • #4
        How do you start this script then?

        Originally posted by Pete View Post
        I would recommend that you post where you found the script.

        Meanwhile here is one that I have used for a while except I do not really use it to stop Homeseer.

        It just runs a PID and I stop Homeseer with the GUI.

        It does automatically start Homeseer and I have not had an issue with it.

        It's been running now since first installation of the Homeseer lite program. (Over a year now)

        I tested the stop, start, restart and it works fine.

        Note you will need to edit it for your Homeseer. I have my Homeseer running in the root directory.

        Code:
        #!/bin/bash
        ### BEGIN INIT INFO
        # Provides:          HomeSeer
        # Required-Start:    $local_fs $network
        # Required-Stop:     $local_fs
        # Default-Start:     2 3 4 5
        # Default-Stop:      0 1 6
        # Short-Description: HomeSeer
        # Description:       HomeSeer daemon
        ### END INIT INFO
        
        NAME='HomeSeer'            # Server handle for the screen session
        DIR='/HomeSeer'
        USER='root'                # Start HomeSeer as root. You may use a non privileged user
                                   # Note: if homeseer is running as non-root user
                                   # remove 'sudo' command in file 'go' in HomeSeer folder
                                   # and change setting gWebSvrPort to value > 1024 in settings.ini
        PWD=`pwd`
        RETVAL=0 
        
        service_start() {
            if [ -f /var/run/$NAME.pid ]; then
                if [ "$(ps -p `cat /var/run/$NAME.pid` | wc -l)" -gt 1 ]; then
                    echo -e "$NAME is already running (pidfile exists)."
                    return 1
                else
                    rm -f /var/run/$NAME.pid
                fi
            fi
            [ -f $DIR/go ] && cd $DIR && su -c "/usr/bin/screen -S $NAME -d -m ./go" $USER
            cd $PWD
            sleep 5
            ps -ef | egrep "[S]CREEN.+${NAME}" | awk '{ print $2 }' > /var/run/$NAME.pid
            [ -s /var/run/$NAME.pid ] && echo "$NAME started."
        }
        
        service_stop() {
            if [ -f /var/run/$NAME.pid ]; then
                if [ $(ps -ef | egrep -c "[S]CREEN.+$NAME") -ge 1 ]; then
                    #invoke shutdown command to homeseer...
                    for char in $(printf "\\r s h u t d o w n \\r") ; do 
                        su -c "/usr/bin/screen -p 0 -S $NAME -X stuff $char" $USER
                        sleep 0.1
                    done
                    sleep 15
                fi
                if [ "$(ps -p `cat /var/run/$NAME.pid` | wc -l)" -gt 1 ]; then
                    echo -e "$NAME did not stop gacefully. Killing it"
                    [ -s /var/run/$NAME.pid ] && kill `cat /var/run/$NAME.pid`
                fi
                rm -f /var/run/$NAME.pid
            else
                echo -e "$NAME is not running."
            fi
        }
        
        case "$1" in
        'start')
            service_start
        ;;
        'stop')
            service_stop
        ;;
        'restart')
            service_stop
            sleep 5
            service_start
        ;;
        *)
            echo "Usage $0 start|stop|restart"
        esac
        # --------------------------------------------------------

        Comment


        • #5
          The script is sitting on my Ubuntu 16.04 server and initially the server was running Ubuntu 14.04 such that it is an upstart script.

          It's been a long time that I installed it and originally it was running on the RPi.

          Thinking I short cut it using Webmin.

          I utilize Webmin here for my two Homeseer 3 boxes. It's an easy to use management GUI.

          Installing an Upstart or Systemd startup script is very easy with the Webmin GUI. IE: you just go to the Upstart / Systemd section and click on add and do a copy and paste from above.

          Here looking the script resides in the /etc/init.d/ directory and it is called homeseer.


          1 - Create the autostart upstart script typing and doing a copy and paste from above.

          nano /etc/init.d/homeseer

          2 - make the script executable typing:

          chmod u+x /etc/init.d/homeseer

          3 - make it run automagically on boot by typing:

          /etc/init.d/homeseer enable

          4 - remove it from autostarting it by typing:

          /etc/init.d/homeseer disable

          For a systemd service do the following:

          1 - nano /etc/systemd/system/homeseer.service
          2 - chmod u+x /etc/systemd/system/homeseer.service
          2 - systemctl enable homeseer.service or systemctl disable homeseer.service

          Ubuntu 16.04 and Jessie utilize systemd

          Ubuntu 14.04 and Wheezy utilize upstart.

          If you do not want to create a PID or shut Homeseer down via the command line and only use the GUI to shut it down you can just add a cron job on boot:

          I did this before when I first started using Homeseer. It's basic and works fine.

          sleep 60 && exec sh /HomeSeer/autostart_hs

          autostart_hs is just a bash file inside of the homeseer directory.

          #!/bin/sh
          export LANG=en_US.UTF-8
          cd /HomeSeer
          mono HSConsole.exe

          add the line in crontab typing:

          crontab -e

          @reboot sleep 60 && exec sh /HomeSeer/autostart_hs #Homeseer 3

          Note all this does is start Homeseer 3. To shut Homeseer down you have to utilize the Homeseer 3 GUI.

          Over the years here have autostarted Homeseer via Upstart, Systemd and a cron job. A cron job is the easiest as it is just a one liner.

          Using Webmin you can enable or disable any of the above at any time.

          What are you running Homeseer on? RPi Jessie or Linux ?

          Here my main Homeseer 3 box is an Ubuntu 16.04 64bit box with 16Gb of memory. It is a LAMP server and also running Oracle Virtual box for Microsoft SAPI text to speech which connects to the HS3 Pro running in Ubuntu. It is also an Apache2 server, php server, et al. Well also it is an email proxy using STunnel these days. Next installing WeeWx for weather which concurrently will run with Cumulus on an RPi.

          The Homeseer 3 lite box is running on an ARM or AMD (testing) box with 2Gb of RAM only and doing Ubuntu 16.04 64 bit. One runs via a microSD card (ARM) and the other AMD is running via an SSD card. The AMD is more a micro computer cube - Xi5a and the ARM computer is a Pine64 2Gb device (very RPI like).

          The old RPi2 has a ZWave dot me GPIO card and a PiFace RTC shim and it is a ser2net ZWave slave machine POE connected in the attic of this home.
          Another RPi today is a 1-wire hub and another one is running Cumulus and another one is dedicated to running the Lightning sensor board.

          Doing X10, UPB, Z-Wave and Zigbee (indirectly via my OmniPro panel and Smarthings Hub). Primary light switches here are UPB though.

          Over the last few months helped a Homeseer user build an 8 Drive NAS box in Ubuntu which is doing similiar to mine except it also has an LSi raid card for the NAS. This box too is running a CCTV NVR. He is doing much today using his RFXCom stuff and Z-Wave for his light switches.
          Last edited by Pete; September 17th, 2017, 05:35 AM.
          - Pete

          Auto mator
          Homeseer 3 Pro - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU - Mono 6.00
          Homeseer Zee2 (Lite) - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.00

          X10, UPB, Zigbee, ZWave and Wifi MQTT automation.

          Comment


          • #6
            Here have noticed issues depending on where HomeSeer 3 is installed. If HS3 is installed duplicating the HS3 Lite (Zee) ==> /usr/local/HomeSeer then no changes need to be done to any of the bash scripts that use the directory structure.

            I have seen Homeseer 3 installed in the user's Home directory, /Opt directory and root (/).

            Here installed both my Homeseer Lite and Homeseer Pro stuff in the root directory.

            Before doing this though with the build of the box have created one addition user and deleted or disabled the default Homeseer users (including the RPi user).

            Then after creating the root /HomeSeer directory have given RW rights to the additional users of Homeseer.

            IE: users with access to Homeseer are homeseer and pete. Default and RPi users are disabled or deleted.

            I did it mostly such that I wouldn't have to type as much. IE: it is easier to do a cd /HomeSeer than a cd /usr/local/Homeseer here for me. I could also use symlinks.

            After this I have edited any bash scripts inside of the HomeSeer directory that point to the the use of /usr/local/HomeSeer as a directory.

            A Homeseer user that I have helped installed his Homeseer directory in the /opt/HomeSeer directory. I did the same for that person as I did for my configuration.

            So in a recap maybe just copying the HomeSeer directory to the /user/local/Homeseer directory, using the original unedited script might work better.
            - Pete

            Auto mator
            Homeseer 3 Pro - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU - Mono 6.00
            Homeseer Zee2 (Lite) - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.00

            X10, UPB, Zigbee, ZWave and Wifi MQTT automation.

            Comment


            • #7
              Thanks for the info!

              I have changed the autostart.hs file located in the HomeSeer folder, but can't see if there are any other files where I need to change the file paths? I would like to not have to reinstall...

              Comment


              • #8
                Remember that Homeseer is just a directory. There are bash scripts there with no sh extension too.

                Looking at my two setups which reside in the root directory /HomeSeer the two HS3 installs are identical.

                Here utilize autostart_hs (no extension) in both HS3 set ups.

                /HomeSeer# cat autostart_hs
                #!/bin/sh
                export LANG=en_US.UTF-8
                cd /HomeSeer
                mono HSConsole.exe

                Anyhow add a sudo Homeseer and personal user to your build first.

                Then give same user rights to your Homeseer directory wherever it resides.

                Such that Homeseer or personal user can access the Homeseer directory without sudo rights.

                Adding users:

                1 - SSH to your Linux box and

                A - adduser homeseer
                B - usermod -aG sudo

                Thinking by default you already have a christian user.

                2 - Give Homeseer directory user rights wherever it is.

                chmod -R 0755 /HomeSeer

                3 - I still utilize WinSCP to access the Homeseer Linux box from Windows. In order for me to use WinSCP I use root. By default and per Linux recommendations it is advised not to use root for SSH access. I use it anyways.

                Basically:

                a - passwd root
                b - configure ssh to allow user of root
                - Pete

                Auto mator
                Homeseer 3 Pro - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU - Mono 6.00
                Homeseer Zee2 (Lite) - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.00

                X10, UPB, Zigbee, ZWave and Wifi MQTT automation.

                Comment


                • #9
                  Remember that Homeseer is just a directory. There are bash scripts there with no sh extension too.

                  You can have 10 directories named Homeseer in your Linux box. When you run Homeseer you are running it within the directory.

                  Looking at my two setups which reside in the root directory /HomeSeer the two HS3 installs are identical.

                  Make it easy on yourself and copy the Homeseer directory over to same set up as the Zee. IE: copy the HomeSeer directory over to /usr/local/HomeSeer.

                  Here utilize autostart_hs (no extension) in both HS3 set ups.

                  /HomeSeer# cat autostart_hs
                  #!/bin/sh
                  export LANG=en_US.UTF-8
                  cd /HomeSeer
                  mono HSConsole.exe

                  Anyhow add a sudo Homeseer and personal user to your build first.

                  Then give same user rights to your Homeseer directory wherever it resides.

                  Such that Homeseer or personal user can access the Homeseer directory without sudo rights.

                  Adding users:

                  1 - SSH to your Linux box and

                  A - adduser homeseer
                  B - usermod -aG sudo

                  Thinking by default you already have a christian user.

                  2 - Give Homeseer directory user rights wherever it is.

                  chmod -R 0755 /HomeSeer

                  3 - I still utilize WinSCP to access the Homeseer Linux box from Windows. In order for me to use WinSCP I use root. By default and per Linux recommendations it is advised not to use root for SSH access. I use it anyways.

                  Basically:

                  a - passwd root
                  b - configure ssh to allow user of root

                  Baby steps. You cannot lose your set up if you have a backup of it.

                  Way long time ago I would kill the mono processes to kill Homeseer which really is not a good thing to do anyhow.

                  BTW (by the way) similar issues have cropped up installing Homeseer in the /home/user/HomeSeer directory. I don't recall when but thinking it was last year sometime.
                  Last edited by Pete; September 18th, 2017, 08:07 AM.
                  - Pete

                  Auto mator
                  Homeseer 3 Pro - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU - Mono 6.00
                  Homeseer Zee2 (Lite) - 3.0.0.534 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.00

                  X10, UPB, Zigbee, ZWave and Wifi MQTT automation.

                  Comment


                  • #10
                    I'm still curious about your original error message. To get more details about it, could you please post the output of this command (as root user):

                    Code:
                     # journalctl -r --unit=homeseer
                    This will give all messages from the Homeseer unit sorted with most recent first.

                    -A

                    Comment


                    • #11
                      I am putting the init.d approach on hold while I attempt to make a systemd based autostart approach work.

                      I have been asking about this in this thread: https://forums.homeseer.com/showthre...22#post1324322

                      Both scripts and systemd has so far failed and my initial thought is that this has to be something with permissions, but I cant figure out what..

                      Might be important that I am running this on a virtual machine with Ubuntu 17.04 server.

                      Logs below ( no idea why the time of the system is wrong):
                      Code:
                      -- Logs begin at Tue 2017-09-19 08:56:45 CEST, end at Tue 2017-09-19 16:56:34 CE
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Failed with result 'exit-
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Unit entered failed state
                      Sep 19 16:56:16 homeseer systemd[1]: Failed to start HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Start request repeated to
                      Sep 19 16:56:16 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Service hold-off time ove
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Failed with result 'exit-
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Unit entered failed state
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Main process exited, code
                      Sep 19 16:56:16 homeseer systemd[1]: Started HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Service hold-off time ove
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Failed with result 'exit-
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Unit entered failed state
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Main process exited, code
                      Sep 19 16:56:16 homeseer systemd[1]: Started HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Service hold-off time ove
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Failed with result 'exit-
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Unit entered failed state
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Main process exited, code
                      Sep 19 16:56:15 homeseer systemd[1]: Started HomeSeer.
                      lines 1-23...skipping...
                      -- Logs begin at Tue 2017-09-19 08:56:45 CEST, end at Tue 2017-09-19 16:56:34 CEST. --
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Unit entered failed state.
                      Sep 19 16:56:16 homeseer systemd[1]: Failed to start HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Start request repeated too quickly.
                      Sep 19 16:56:16 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Service hold-off time over, scheduling restart.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Unit entered failed state.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Main process exited, code=exited, status=210/CHROOT
                      Sep 19 16:56:16 homeseer systemd[1]: Started HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Service hold-off time over, scheduling restart.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Unit entered failed state.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Main process exited, code=exited, status=210/CHROOT
                      Sep 19 16:56:16 homeseer systemd[1]: Started HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:16 homeseer systemd[1]: homeseer.service: Service hold-off time over, scheduling restart.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Unit entered failed state.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Main process exited, code=exited, status=210/CHROOT
                      Sep 19 16:56:15 homeseer systemd[1]: Started HomeSeer.
                      Sep 19 16:56:15 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Service hold-off time over, scheduling restart.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Unit entered failed state.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Main process exited, code=exited, status=210/CHROOT
                      Sep 19 16:56:15 homeseer systemd[1]: Started HomeSeer.
                      Sep 19 16:56:15 homeseer systemd[1]: Stopped HomeSeer.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Service hold-off time over, scheduling restart.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Failed with result 'exit-code'.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Unit entered failed state.
                      Sep 19 16:56:15 homeseer systemd[1]: homeseer.service: Main process exited, code=exited, status=210/CHROOT
                      Sep 19 16:56:15 homeseer systemd[1]: Started HomeSeer.

                      Comment


                      • #12
                        A few observations:

                        systemd tries to start Homeseer but fails with "210/CHROOT" error.
                        systemd sees that Homeseer failed and tries to restart it. This is happening more than 10 times per second, which leads to the "Start request repeated too quickly" error - at which point the Homeseer service enters the "Failed State". This would seem to mean that Homeseer itself is refusing to start - as it normally takes a few seconds for it to start up.

                        Just to clarify; when you disable HS3
                        Code:
                        # systemctl disable homeseer.service
                        and reboot, you can then successfully start HS3 with:
                        Code:
                        # systemctl start homeseer.service
                        ?

                        What is the output of
                        Code:
                        # systemctl status homeseer.service
                        when you do this?

                        Also a few questions about versions: You said you were running Ubuntu Server 17.04 as a virtual machine - which program are you using for virtualization? Also, what version of Mono is included with 17.04 server? And what is the Host OS - are you running Linux or Windows as primary on the real hardware?

                        Finally, I noticed your time zone is CEST - not sure if that's the one you want. And sometimes Linux thinks the BIOS time is set to UTC when it's actually local - that one has gotten me before.

                        -A

                        Comment


                        • #13
                          Sounds about right, thanks for looking into this along with Peter

                          The output of "systemctl status homeseer.service" after disabling it and then starting the homeseer.service after reboot is:

                          Code:
                          christian@homeseer:~$ systemctl status homeseer.service
                          ● homeseer.service - HomeSeer
                             Loaded: loaded (/etc/systemd/system/homeseer.service; disabled; vendor preset
                             Active: active (running) since Tue 2017-09-19 19:59:19 CEST; 7s ago
                           Main PID: 2078 (sudo)
                              Tasks: 67 (limit: 4915)
                             Memory: 239.0M
                                CPU: 3.491s
                             CGroup: /system.slice/homeseer.service
                                     ├─2078 /usr/bin/sudo mono /home/christian/HomeSeer/HSConsole.exe --lo
                                     ├─2095 mono /home/christian/HomeSeer/HSConsole.exe --log
                                     ├─2136 /usr/bin/mono /home/christian/HomeSeer/HSPI_HSTOUCH.exe
                                     ├─2152 /usr/bin/mono /home/christian/HomeSeer/HSPI_JowiHue.exe
                                     └─2167 /usr/bin/mono /home/christian/HomeSeer/HSPI_Nest.exe
                          
                          Sep 19 19:59:26 homeseer sudo[2078]: 07:59:26:5526:[JowiHue]->InitIO:Plugin basi
                          Sep 19 19:59:26 homeseer sudo[2078]: (plugin.InitIO) InitIO:Plugin basic initial
                          Sep 19 19:59:26 homeseer sudo[2078]: (HueTools.InitPlugin) Debug: InitPlugin: in
                          Sep 19 19:59:26 homeseer sudo[2078]: 07:59:26:6051:[Plug-In]->Finished initializ
                          Sep 19 19:59:26 homeseer sudo[2078]: (MyBridges.FindBridgesSelf) Debug: InitDevi
                          Sep 19 19:59:26 homeseer sudo[2078]: Sep-19 19:59:26 INFO Plugin: Nest Instance:
                          Sep 19 19:59:26 homeseer sudo[2078]: Sep-19 19:59:26 INFO Connecting to server a
                          Sep 19 19:59:26 homeseer sudo[2078]: Sep-19 19:59:26 INFO Connection attempt #1
                          Sep 19 19:59:26 homeseer sudo[2078]: 07:59:26:8024:[Info]->Plugin Nest has conne
                          lines 1-23...skipping...
                          ● homeseer.service - HomeSeer
                             Loaded: loaded (/etc/systemd/system/homeseer.service; disabled; vendor preset: enabled)
                             Active: active (running) since Tue 2017-09-19 19:59:19 CEST; 7s ago
                           Main PID: 2078 (sudo)
                              Tasks: 67 (limit: 4915)
                             Memory: 239.0M
                                CPU: 3.491s
                             CGroup: /system.slice/homeseer.service
                                     ├─2078 /usr/bin/sudo mono /home/christian/HomeSeer/HSConsole.exe --log
                                     ├─2095 mono /home/christian/HomeSeer/HSConsole.exe --log
                                     ├─2136 /usr/bin/mono /home/christian/HomeSeer/HSPI_HSTOUCH.exe
                                     ├─2152 /usr/bin/mono /home/christian/HomeSeer/HSPI_JowiHue.exe
                                     └─2167 /usr/bin/mono /home/christian/HomeSeer/HSPI_Nest.exe
                          
                          Sep 19 19:59:26 homeseer sudo[2078]: 07:59:26:5526:[JowiHue]->InitIO:Plugin basic initialisation done
                          Sep 19 19:59:26 homeseer sudo[2078]: (plugin.InitIO) InitIO:Plugin basic initialisation done
                          Sep 19 19:59:26 homeseer sudo[2078]: (HueTools.InitPlugin) Debug: InitPlugin: initial checks
                          Sep 19 19:59:26 homeseer sudo[2078]: 07:59:26:6051:[Plug-In]->Finished initializing plug-in JowiHue
                          Sep 19 19:59:26 homeseer sudo[2078]: (MyBridges.FindBridgesSelf) Debug: InitDevices: Searching for Hue devices
                          Sep 19 19:59:26 homeseer sudo[2078]: Sep-19 19:59:26 INFO Plugin: Nest Instance:  starting...
                          Sep 19 19:59:26 homeseer sudo[2078]: Sep-19 19:59:26 INFO Connecting to server at 127.0.0.1...
                          Sep 19 19:59:26 homeseer sudo[2078]: Sep-19 19:59:26 INFO Connection attempt #1
                          Sep 19 19:59:26 homeseer sudo[2078]: 07:59:26:8024:[Info]->Plugin Nest has connected. IP:127.0.0.1:38878
                          Sep 19 19:59:26 homeseer sudo[2078]: Sep-19 19:59:26 INFO Connected (HomeSeer API 3). Waiting to be initialized.
                          On your other questions:
                          - I am using ESXi for virtualization
                          - Running ESXi barebone on a Intel Nuc

                          Version of Mono:
                          Code:
                          christian@homeseer:~$ mono --version
                          Mono JIT compiler version 4.6.2 (Debian 4.6.2.7+dfsg-1ubuntu1)
                          Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
                                  TLS:           __thread
                                  SIGSEGV:       altstack
                                  Notifications: epoll
                                  Architecture:  amd64
                                  Disabled:      none
                                  Misc:          softdebug
                                  LLVM:          supported, not enabled.
                                  GC:            sgen
                          And will have a look at time on the machine once more..

                          Comment


                          • #14
                            This is a bit odd, when I had it to the point you have it, all I did was
                            Code:
                            # systemctl enable homeseer.service
                            and it worked fine. I initially thought that the problem might be related to the virtual machine as HS3 expects to be able to access the HW directly - but the fact that you can use systemctl to start it after the system is running would seem to rule that out.

                            So the unit file commands work After the system is up, but not while the system is Starting (if it's not the how, we'll look at the when). I'm not sure exactly what differs between the boot up and running states, but maybe it's trying to start it too early and fails for that reason. Could you post the output of these commands:
                            Code:
                            # systemctl show homeseer.service
                            # systemctl list-dependencies homeseer.service
                            # cat /etc/systemd/system/homeseer.service
                            and we'll do some more digging.

                            -A

                            Comment


                            • #15
                              Figured it was odd too, thanks for helping me dig!

                              # systemctl show homeseer.service
                              Code:
                              christian@homeseer:~$ systemctl show homeseer.service
                              Type=simple
                              Restart=on-failure
                              NotifyAccess=none
                              RestartUSec=100ms
                              TimeoutStartUSec=1min 30s
                              TimeoutStopUSec=1min 30s
                              RuntimeMaxUSec=infinity
                              WatchdogUSec=0
                              WatchdogTimestamp=Tue 2017-09-19 19:59:19 CEST
                              WatchdogTimestampMonotonic=110932237
                              FailureAction=none
                              PermissionsStartOnly=no
                              RootDirectoryStartOnly=no
                              RemainAfterExit=no
                              GuessMainPID=yes
                              MainPID=2078
                              ControlPID=0
                              FileDescriptorStoreMax=0
                              NFileDescriptorStore=0
                              StatusErrno=0
                              Result=success
                              UID=4294967295
                              GID=4294967295
                              ExecMainStartTimestamp=Tue 2017-09-19 19:59:19 CEST
                              ExecMainStartTimestampMonotonic=110932203
                              ExecMainExitTimestampMonotonic=0
                              ExecMainPID=2078
                              ExecMainCode=0
                              ExecMainStatus=0
                              ExecStart={ path=/usr/bin/sudo ; argv[]=/usr/bin/sudo mono /home/christian/HomeS
                              Slice=system.slice
                              ControlGroup=/system.slice/homeseer.service
                              MemoryCurrent=730050560
                              CPUUsageNSec=182869013077
                              TasksCurrent=226
                              Delegate=no
                              CPUAccounting=no
                              CPUWeight=18446744073709551615
                              StartupCPUWeight=18446744073709551615
                              CPUShares=18446744073709551615
                              StartupCPUShares=18446744073709551615
                              CPUQuotaPerSecUSec=infinity
                              IOAccounting=no
                              IOWeight=18446744073709551615
                              StartupIOWeight=18446744073709551615
                              BlockIOAccounting=no
                              BlockIOWeight=18446744073709551615
                              StartupBlockIOWeight=18446744073709551615
                              lines 1-48...skipping...
                              Type=simple
                              Restart=on-failure
                              NotifyAccess=none
                              RestartUSec=100ms
                              TimeoutStartUSec=1min 30s
                              TimeoutStopUSec=1min 30s
                              RuntimeMaxUSec=infinity
                              WatchdogUSec=0
                              WatchdogTimestamp=Tue 2017-09-19 19:59:19 CEST
                              WatchdogTimestampMonotonic=110932237
                              FailureAction=none
                              PermissionsStartOnly=no
                              RootDirectoryStartOnly=no
                              RemainAfterExit=no
                              GuessMainPID=yes
                              MainPID=2078
                              ControlPID=0
                              FileDescriptorStoreMax=0
                              NFileDescriptorStore=0
                              StatusErrno=0
                              Result=success
                              UID=4294967295
                              GID=4294967295
                              ExecMainStartTimestamp=Tue 2017-09-19 19:59:19 CEST
                              ExecMainStartTimestampMonotonic=110932203
                              ExecMainExitTimestampMonotonic=0
                              ExecMainPID=2078
                              ExecMainCode=0
                              ExecMainStatus=0
                              ExecStart={ path=/usr/bin/sudo ; argv[]=/usr/bin/sudo mono /home/christian/HomeS
                              Slice=system.slice
                              ControlGroup=/system.slice/homeseer.service
                              MemoryCurrent=730050560
                              CPUUsageNSec=182869013077
                              TasksCurrent=226
                              Delegate=no
                              CPUAccounting=no
                              CPUWeight=18446744073709551615
                              StartupCPUWeight=18446744073709551615
                              CPUShares=18446744073709551615
                              StartupCPUShares=18446744073709551615
                              CPUQuotaPerSecUSec=infinity
                              IOAccounting=no
                              IOWeight=18446744073709551615
                              StartupIOWeight=18446744073709551615
                              BlockIOAccounting=no
                              BlockIOWeight=18446744073709551615
                              StartupBlockIOWeight=18446744073709551615
                              MemoryAccounting=no
                              MemoryLow=0
                              MemoryHigh=18446744073709551615
                              MemoryMax=18446744073709551615
                              MemorySwapMax=18446744073709551615
                              MemoryLimit=18446744073709551615
                              DevicePolicy=auto
                              TasksAccounting=yes
                              TasksMax=4915
                              UMask=0022
                              lines 1-58...skipping...
                              Type=simple
                              Restart=on-failure
                              NotifyAccess=none
                              RestartUSec=100ms
                              TimeoutStartUSec=1min 30s
                              TimeoutStopUSec=1min 30s
                              RuntimeMaxUSec=infinity
                              WatchdogUSec=0
                              WatchdogTimestamp=Tue 2017-09-19 19:59:19 CEST
                              WatchdogTimestampMonotonic=110932237
                              FailureAction=none
                              PermissionsStartOnly=no
                              RootDirectoryStartOnly=no
                              RemainAfterExit=no
                              GuessMainPID=yes
                              MainPID=2078
                              ControlPID=0
                              FileDescriptorStoreMax=0
                              NFileDescriptorStore=0
                              StatusErrno=0
                              Result=success
                              UID=4294967295
                              GID=4294967295
                              ExecMainStartTimestamp=Tue 2017-09-19 19:59:19 CEST
                              ExecMainStartTimestampMonotonic=110932203
                              ExecMainExitTimestampMonotonic=0
                              ExecMainPID=2078
                              ExecMainCode=0
                              ExecMainStatus=0
                              ExecStart={ path=/usr/bin/sudo ; argv[]=/usr/bin/sudo mono /home/christian/HomeS
                              Slice=system.slice
                              ControlGroup=/system.slice/homeseer.service
                              MemoryCurrent=730050560
                              CPUUsageNSec=182869013077
                              TasksCurrent=226
                              Delegate=no
                              CPUAccounting=no
                              CPUWeight=18446744073709551615
                              StartupCPUWeight=18446744073709551615
                              CPUShares=18446744073709551615
                              StartupCPUShares=18446744073709551615
                              CPUQuotaPerSecUSec=infinity
                              IOAccounting=no
                              IOWeight=18446744073709551615
                              StartupIOWeight=18446744073709551615
                              BlockIOAccounting=no
                              BlockIOWeight=18446744073709551615
                              StartupBlockIOWeight=18446744073709551615
                              MemoryAccounting=no
                              MemoryLow=0
                              MemoryHigh=18446744073709551615
                              MemoryMax=18446744073709551615
                              MemorySwapMax=18446744073709551615
                              MemoryLimit=18446744073709551615
                              DevicePolicy=auto
                              TasksAccounting=yes
                              TasksMax=4915
                              UMask=0022
                              LimitCPU=18446744073709551615
                              LimitCPUSoft=18446744073709551615
                              LimitFSIZE=18446744073709551615
                              LimitFSIZESoft=18446744073709551615
                              lines 1-62
                              Type=simple
                              Restart=on-failure
                              NotifyAccess=none
                              RestartUSec=100ms
                              TimeoutStartUSec=1min 30s
                              TimeoutStopUSec=1min 30s
                              RuntimeMaxUSec=infinity
                              WatchdogUSec=0
                              WatchdogTimestamp=Tue 2017-09-19 19:59:19 CEST
                              WatchdogTimestampMonotonic=110932237
                              FailureAction=none
                              PermissionsStartOnly=no
                              RootDirectoryStartOnly=no
                              RemainAfterExit=no
                              GuessMainPID=yes
                              MainPID=2078
                              ControlPID=0
                              FileDescriptorStoreMax=0
                              NFileDescriptorStore=0
                              StatusErrno=0
                              Result=success
                              UID=4294967295
                              GID=4294967295
                              ExecMainStartTimestamp=Tue 2017-09-19 19:59:19 CEST
                              ExecMainStartTimestampMonotonic=110932203
                              ExecMainExitTimestampMonotonic=0
                              ExecMainPID=2078
                              ExecMainCode=0
                              ExecMainStatus=0
                              ExecStart={ path=/usr/bin/sudo ; argv[]=/usr/bin/sudo mono /home/christian/HomeS
                              Slice=system.slice
                              ControlGroup=/system.slice/homeseer.service
                              MemoryCurrent=730050560
                              CPUUsageNSec=182869013077
                              TasksCurrent=226
                              Delegate=no
                              CPUAccounting=no
                              CPUWeight=18446744073709551615
                              StartupCPUWeight=18446744073709551615
                              CPUShares=18446744073709551615
                              StartupCPUShares=18446744073709551615
                              CPUQuotaPerSecUSec=infinity
                              IOAccounting=no
                              IOWeight=18446744073709551615
                              StartupIOWeight=18446744073709551615
                              BlockIOAccounting=no
                              BlockIOWeight=18446744073709551615
                              StartupBlockIOWeight=18446744073709551615
                              MemoryAccounting=no
                              MemoryLow=0
                              MemoryHigh=18446744073709551615
                              MemoryMax=18446744073709551615
                              MemorySwapMax=18446744073709551615
                              MemoryLimit=18446744073709551615
                              DevicePolicy=auto
                              TasksAccounting=yes
                              TasksMax=4915
                              UMask=0022
                              # systemctl list-dependencies homeseer.service
                              Code:
                              christian@homeseer:~$ systemctl list-dependencies homeseer.service
                              homeseer.service
                              ● ├─-.mount
                              ● ├─system.slice
                              ● └─sysinit.target
                              ●   ├─apparmor.service
                              ●   ├─console-setup.service
                              ●   ├─dev-hugepages.mount
                              ●   ├─dev-mqueue.mount
                              ●   ├─friendly-recovery.service
                              ●   ├─iscsid.service
                              ●   ├─keyboard-setup.service
                              ●   ├─kmod-static-nodes.service
                              ●   ├─lvm2-lvmetad.socket
                              ●   ├─lvm2-lvmpolld.socket
                              ●   ├─lvm2-monitor.service
                              ●   ├─open-iscsi.service
                              ●   ├─plymouth-read-write.service
                              ●   ├─plymouth-start.service
                              ●   ├─proc-sys-fs-binfmt_misc.automount
                              ●   ├─resolvconf.service
                              ●   ├─setvtrgb.service
                              ●   ├─sys-fs-fuse-connections.mount
                              ●   ├─sys-kernel-config.mount
                              ●   ├─sys-kernel-debug.mount
                              ●   ├─systemd-ask-password-console.path
                              ●   ├─systemd-binfmt.service
                              ●   ├─systemd-hwdb-update.service
                              ●   ├─systemd-journal-flush.service
                              ●   ├─systemd-journald.service
                              ●   ├─systemd-machine-id-commit.service
                              ●   ├─systemd-modules-load.service
                              ●   ├─systemd-random-seed.service
                              ●   ├─systemd-sysctl.service
                              ●   ├─systemd-timesyncd.service
                              ●   ├─systemd-tmpfiles-setup-dev.service
                              ●   ├─systemd-tmpfiles-setup.service
                              ●   ├─systemd-udev-trigger.service
                              ●   ├─systemd-udevd.service
                              ●   ├─systemd-update-utmp.service
                              ●   ├─cryptsetup.target
                              ●   │ └─systemd-cryptsetup@cryptswap1.service
                              ●   ├─local-fs.target
                              ●   │ ├─-.mount
                              ●   │ ├─systemd-fsck-root.service
                              ●   │ └─systemd-remount-fs.service
                              ●   └─swap.target
                              ●     └─dev-mapper-cryptswap1.swap
                              # cat /etc/systemd/system/homeseer.service
                              Code:
                              [Unit]
                              Description=HomeSeer
                              After=network.target
                              
                              [Service]
                              WorkingDirectory=/home/christian/HomeSeer
                              ExecStart=/usr/bin/sudo mono /home/christian/HomeSeer/HSConsole.exe --log
                              Restart=on-failure
                              
                              [Install]
                              WantedBy=multi-user.target
                              I see that the output from this shows one change I made, adding sudo to the Exceccommand, but tried without as well earlier.

                              Comment

                              Working...
                              X