Hi
how to autostart pimatic after a pi reboot?
Evertime after a reboot I have to start pimatic with a ssl connection and sudo service pimatic start
Sebastian
Autostart after reboot
Hi
how to autostart pimatic after a pi reboot?
Evertime after a reboot I have to start pimatic with a ssl connection and sudo service pimatic start
Sebastian
@shgmongo Here is a guide for thhis: https://pimatic.org/guide/getting-started/autostarting/
wget https://raw.githubusercontent.com/pimatic/pimatic/v0.9.x/install/pimatic-init-d
sudo cp pimatic-init-d /etc/init.d/pimatic
sudo chmod +x /etc/init.d/pimatic
sudo chown root:root /etc/init.d/pimatic
sudo update-rc.d pimatic defaults
sudo service pimatic start
pimatic-google-calendar | pimatic-wmi | pimatic-snmp | pimatic-wakeonlan |
Like my work? Then consider a donation
Follow me: www.thorstenreichelt.de
This is not working for me. I followed the instruction given on [https://pimatic.org/guide/getting-started/autostarting/](link url) but if i try to start pimatic with sudo service pimatic start following failure occurs.
Job for pimatic.service failed. See ‘systemctl status pimatic.service’ and ‘journalctl -xn’ for details.
This failure occurs on a fresh installation of pimatic. I just changed to v0.9.
Did you also follow the step for installing globally? - https://pimatic.org/guide/getting-started/running/
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
yes, i have done all this. But i just tried again to make sure that have done no mistakes.
So i think everything is working fine up to this point. But the Autostart option is not working i think so
Please execute the given commands on the command line after that error
systemctl status pimatic.service
and
journalctl -xn
and please report what they mention.
edit: and please do a ls -l /etc/init.d/pim*
and see if there is a pimatic service script.
Hi, thanks for helping me so far. I executed these commands and got the following responses:
please do a cat /etc/init.d/pimatic
and share the PATH statement with us.
and please do a node --version
and a which node
on the command line.
To see if the normal environment when starting pimatic calls other versions of node, then when called from the pimatic service script (setting its own PATH).
okay, i have done this
@thost96 This doesn´t work for me. It doesn´t start after a reboot.
Is it possible to start it with an script?
@Fabian : Everything checked so far is completely correct.
The only thing I can think off right now is to stop pimatic.
Then do a sudo service pimatic start
(which will fail I assume).
If it doesn’t fail but start correctly I’m really confused.
If it doesn’t start correctly, please do a sudo egrep -i "pimatic|node" /var/log/syslog
. This will check for all lines with node and/or pimatic in it and please check those for error messages.
If you find a message but it is not entitely clear from that one line then please do a sudo grep -B 3 -A 3 "search term" /var/log/syslog
. (will show the line containing “search term” and the 3 lines before and after)
Note that if the search term contains strange characters like []()<>
etc. you might need to escape them.
Oh, this list me a lot of erros. There are some which are shown very often.
Error calling EVI0CSKEYCODE on device node ‘/dev/input/event0’ with differnt scan codes and key codes and ending with Invalide argument
Error: Your node.js version v0.10.29 is too old. Please update node.js to version >=4.0.0 and run pimatic again.
==> But node.js is the version v4.6.2 like you have told me to check.
For example these errors are listed:
If i do sudo grep -B 3 -A 3 “Error” /var/log/syslog i got a lot more Error massages…
I try to get some more error idetifying information out of this. Thank you so far.
The issue is displayed in the logs: “… ERROR: Your node.js version 0.10.29 is too old …”.
This means that your old version of node is still available on your system and it is the standard Debian system version.
Please do a sudo apt-get purge node
and if that one is not found do a sudo apt-get purge node.js
@thost96
Maybe my problem is to install pimatic globally.
I can run pimatic without problems, when I start it with sudo pimatic.js
I have tried to install it globaly . In node_modules I have no pimatic folder but a pimatic-homeduino folder.
When I do pi@raspberrypi:~/node_modules/pimatic-homeduino $ sudo npm link
I got following message:
npm WARN peerDependencies The peer dependency pimatic included from pimatic-home duino will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerD ependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
-
> serialport@2.0.6 install /home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport
> node-pre-gyp install --fallback-to-build
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/4.6.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/.node-gyp"
make: Entering directory '/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build'
make: *** No rule to make target '../.node-gyp/4.6.2/include/node/common.gypi', needed by 'Makefile'. Schluss.
make: Leaving directory '/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/pi/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
gyp ERR! System Linux 4.4.34-v7+
gyp ERR! command "/usr/local/bin/node" "/home/pi/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build/Release/node-v46-linux-arm/serialport.node" "--module_name=serialport" "--module_path=/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build/Release/node-v46-linux-arm"
gyp ERR! cwd /home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport
gyp ERR! node -v v4.6.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /home/pi/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build/Release/node-v46-linux-arm/serialport.node --module_name=serialport --module_path=/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build/Release/node-v46-linux-arm' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:854:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
node-pre-gyp ERR! System Linux 4.4.34-v7+
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport
node-pre-gyp ERR! node -v v4.6.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.18
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /home/pi/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build/Release/node-v46-linux-arm/serialport.node --module_name=serialport --module_path=/home/pi/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/build/Release/node-v46-linux-arm' (1)
npm ERR! Linux 4.4.34-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "link"
npm ERR! node v4.6.2
npm ERR! npm v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! serialport@2.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@2.0.6 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs serialport
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/node_modules/pimatic-homeduino/npm-debug.log
seems like root is running on a wrong node version.
do a sudo node --version
and you might see 0.10.29
user pi is having node 4.6.2
if so, do the following :
delete node
sudo apt-get purge nodejs
whereis node
.sudo rm -r /usr/local/bin/node /usr/local/bin/npm /usr/local/lib/node_modules
node --version
. It should output command not found.reinstall with
wget https://nodejs.org/dist/v4.6.2/node-v4.6.2-linux-armv7l.tar.gz -P /tmp
cd /usr/local
sudo tar xzvf /tmp/node-v4.6.2-linux-armv7l.tar.gz --strip=1
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
@Fabian and @shgmongo : Please do as @leader21 says.
The problem is indeed the standard Debian nodejs combined with an “inconvenient” PATH statement in the /etc/init.d/pimatic
service script.
The PATH in the service script is PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/node/bin
The PATH in a normal shell is PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
From the command line /usr/local/bin comes first holding the new node.
In the service script /usr/bin
comes first holding the old node.
I think this requires a change in the service script.
@Harry-van-der-Wolf and @leader21
When I type in sudo which node
I only get
pi@raspberrypi:/usr/local $ sudo which node
/usr/local/bin/node
With node --version
I get
pi@raspberrypi:/usr/local $ node --version
v4.6.2
pi@raspberrypi:/usr/local $ sudo node --version
v4.6.2
Anyway, I have done it like @leader21 mentioned and reinstalled it.
Afterwards, I checked the /etc/init.d/pimatic
and I got follwoing path
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/node/bin
Is this the correct path or have I to edit the path. If I have to edit it, please tell me where.
Sebastian
@shgmongo said in Autostart after reboot:
@Harry-van-der-Wolf and @leader21
When I type in
sudo which node
I only getpi@raspberrypi:/usr/local $ sudo which node /usr/local/bin/node
That is the problem between the standard nodejs version and the version we need to install for pimatic 0.9 in combination with the incorrect pimatic service script.
If you would do a sudo which nodejs
you would find the one in /usr/bin which the service script takes instead of the one pimatic wants. If the service script would maintain the sequence used in a normal PATH statement it would work.
Even more: If the pimatic service script would at least prefer the PATH where the necessary pimatic node version is installed, we would not have these issues all the time in the forum.
@mwittig and @sweetpi : I created a patch that should fix this. Please inspect and apply.
Thank you all for your help. At first i deleted node like @leader21 had posted before. This all works fine like @shgmongo has posted after reinstalling i also got the node versions v4.6.2 and the path /usr/local/bin/node.
But sudo service pimatic start doesn’t work!
So i tried to change the Path in /etc/init.d/pimatic/ like @Harry-van-der-Wolf recommanded for the patch.
=> But at least after doing sudo update-rc.d pimatic defaults it also doesn’t work to start pimatic with sudo service pimatic start
Then i tried to do what @shgmongo had posted at least
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
=> But at least after doing sudo update-rc.d pimatic defaults it also doesn’t work to start pimatic with sudo service pimatic start
So at least i tried to install pimatic globally again
cd ./node_modules/pimatic
sudo npm link
and now sudo service pimatic start works fine!!!
Many thanks to @Harry-van-der-Wolf , @leader21 and @shgmongo.