Paul …
Many thx. I used the file you provided to make an executable script …
#!/bin/sh
#
# Run this script if you do not have /var/log in tmpfs
for i in "redis" "apache2" "mysql" "openhab" "logrotate" "mosquitto" "supervisor"; do mkdir /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" "supervisor/supervisord.log" "ntp_update.log"; do touch /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" "supervisor/supervisord.log" "ntp_update.log"; do ""chmod 666"" /var/log/"$i"; done
chown -R root:adm /var/log/apache2
chown -R redis:redis /var/log/redis
chown -R mysql:adm /var/log/mysql
chown -R openhab:openhab /var/log/openhab
chown -R pi:pi /var/log/logrotate
chown -R mosquitto:mosquitto /var/log/mosquitto
chown -R dataplicity:dataplicity /var/log/supervisor;
# Restart random seed process now ~/data RW partition has been mounted
sudo systemctl restart systemd-random-seed.service
# Start / Restart services,they should run happy now log dir's are created
sleep 3
service mysql restart
service redis-server restart
service mosquitto restart
service emonhub restart
service emonPiLCD restart
service apache2 restart
service supervisor restart
service feedwriter restart
service mqtt_input restart
service lwrfd restart
exit 0
The script ran, created the extra files/directories and they survived a reboot.
I could access the emonTx/RPi via SSH but I could not browse to it - could not establish a connection (not the FORBIDDEN message)
I could see that watchman another emonTx/RPi on the network was receiving inputs from the problem instance. And, best of all, the hundreds of sylog error lines no longer appeared. I went to bed.
This AM I discovered from syslog that in the early hours it had crashed and rebooted itself …
Mar 6 03:01:50 emonpi-node-13 emonhub.py[305]: 2019-03-06 03:01:50,112 DEBUG SerialTx 1659 Timestamp : 1551841310.11
Mar 6 03:01:50 emonpi-node-13 emonhub.py[305]: 2019-03-06 03:01:50,113 DEBUG SerialTx 1659 From Node : 13
Mar 6 03:01:50 emonpi-node-13 emonhub.py[305]: 2019-03-06 03:01:50,113 DEBUG SerialTx 1659 Values : [0, 0, 0, 0, 244.44, 3020, 3010, 3010, 3010, 3010, 3010, 1]
Mar 6 03:01:50 emonpi-node-13 emonhub.py[305]: 2019-03-06 03:01:50,114 DEBUG SerialTx 1659 Sent to channel(start)' : ToEmonCMS
Mar 6 03:01:50 emonpi-node-13 emonhub.py[305]: 2019-03-06 03:01:50,115 DEBUG SerialTx 1659 Sent to channel(end)' : ToEmonCMS
Mar 6 02:25:57 emonpi-node-13 systemd-modules-load[92]: Inserted module 'i2c_dev'
Mar 6 02:25:57 emonpi-node-13 fake-hwclock[94]: Wed 6 Mar 02:17:01 UTC 2019
Mar 6 02:25:57 emonpi-node-13 systemd[1]: Started Restore / save the current clock.
Mar 6 02:25:57 emonpi-node-13 systemd[1]: Time has been changed
Mar 6 02:25:57 emonpi-node-13 systemd[1]: Starting File System Check on Root Device...
Mar 6 02:25:57 emonpi-node-13 systemd-fsck[129]: Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line.
Mar 6 02:25:57 emonpi-node-13 systemd[1]: Started File System Check on Root Device.
Mar 6 02:25:57 emonpi-node-13 systemd[1]: Starting Remount Root and Kernel File Systems...
But after the self reboot, it failed to connect to MQTT …
Mar 6 02:26:07 emonpi-node-13 lwrfd[381]: Reconnecting to MQTT ...
Mar 6 02:26:07 emonpi-node-13 supervisord[500]: 2019-03-06 02:26:07,688 INFO RPC interface 'supervisor' initialized
Mar 6 02:26:07 emonpi-node-13 supervisord[500]: 2019-03-06 02:26:07,690 CRIT Server 'unix_http_server' running without any HTTP authentication checking
Mar 6 02:26:07 emonpi-node-13 supervisord[500]: 2019-03-06 02:26:07,691 INFO supervisord started with pid 500
Mar 6 02:26:07 emonpi-node-13 lwrfd[381]: Failed to connect to MQTT, return code -1
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,232 DEBUG SerialTx 2 NEW FRAME : 13 0 0 0 0 24853 30200 30100 30100 30100 30100 30100 1
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,234 DEBUG SerialTx 2 Timestamp : 1551839168.23
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,234 DEBUG SerialTx 2 From Node : 13
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,235 DEBUG SerialTx 2 Values : [0, 0, 0, 0, 248.53, 3020, 3010, 3010, 3010, 3010, 3010, 1]
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,235 DEBUG SerialTx 2 Sent to channel(start)' : ToEmonCMS
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,236 DEBUG SerialTx 2 Sent to channel(end)' : ToEmonCMS
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,361 INFO MQTT Connecting to MQTT Server
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,461 DEBUG To_watchman Buffer size: 1
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,463 INFO To_watchman sending: http://watchman/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1551839168.232513,13,0,0,0,0,248.53,3020,3010,3010,3010,3010,3010,1]]&sentat=1551839168
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,469 INFO MQTT connection status: Connection successful
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,471 DEBUG MQTT CONACK => Return code: 0
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,572 INFO MQTT on_subscribe
Mar 6 02:26:08 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:08,751 DEBUG To_watchman acknowledged receipt with 'ok' from http://watchman/emoncms
It died seconds thereafter with no syslog entries until I rebooted at about 10am …
Mar 6 02:26:23 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:23,296 DEBUG MQTT Publishing: emon/3phase_node13/temp6 3010
Mar 6 02:26:23 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:23,298 DEBUG MQTT Publishing: emon/3phase_node13/pulse 1
Mar 6 02:26:23 emonpi-node-13 emonhub.py[303]: 2019-03-06 02:26:23,300 INFO MQTT Publishing: emonhub/rx/13/values 0,0,0,0,248.77,3020,3010,3010,3010,3010,3010,1
Mar 6 10:00:54 emonpi-node-13 systemd-timesyncd[259]: Synchronized to time server 129.250.35.251:123 (2.debian.pool.ntp.org).
Mar 6 10:00:54 emonpi-node-13 systemd[1]: Time has been changed
Mar 6 10:00:54 emonpi-node-13 systemd[1]: apt-daily-upgrade.timer: Adding 47min 27.605566s random time.
Mar 6 10:00:54 emonpi-node-13 systemd[1]: apt-daily.timer: Adding 8h 8min 5.313266s random time.
Mar 6 10:00:54 emonpi-node-13 systemd[1]: Starting Clean php session files...
Mar 6 10:00:55 emonpi-node-13 systemd[1]: Starting Daily apt upgrade and clean activities...
Mar 6 10:00:55 emonpi-node-13 supervisord[500]: 2019-03-06 10:00:55,014 INFO exited: tuxtunnel (terminated by SIGKILL; not expected)
Mar 6 10:00:55 emonpi-node-13 emonhub.py[303]: 2019-03-06 10:00:55,018 DEBUG To_watchman Buffer size: 3
Mar 6 10:00:55 emonpi-node-13 emonhub.py[303]: 2019-03-06 10:00:55,019 INFO To_watchman sending: http://watchman/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1551839173.214865,13,0,0,0,0,248.62,3020,3010,3010,3010,3010,3010,1],[1551839178.220762,13,0,0,0,0,248.99,3020,3010,3010,3010,3010,3010,1],[1551839183.25114,13,0,0,0,0,248.77,3020,3010,3010,3010,3010,3010,1]]&sentat=1551866455
Mar 6 10:00:55 emonpi-node-13 emonhub.py[303]: 2019-03-06 10:00:55,187 DEBUG To_watchman acknowledged receipt with 'ok' from http://watchman/emoncms
Mar 6 10:00:55 emonpi-node-13 systemd[1]: Started Clean php session files.
It then crashed and self rebooted at 11:29 …
Mar 6 11:29:47 emonpi-node-13 emonhub.py[303]: 2019-03-06 11:29:47,619 DEBUG MQTT Publishing: emon/3phase_node13/temp4 3010
Mar 6 11:29:47 emonpi-node-13 emonhub.py[303]: 2019-03-06 11:29:47,621 DEBUG MQTT Publishing: emon/3phase_node13/temp5 3010
Mar 6 11:29:47 emonpi-node-13 emonhub.py[303]: 2019-03-06 11:29:47,623 DEBUG MQTT Publishing: emon/3phase_node13/temp6 3010
Mar 6 11:29:47 emonpi-node-13 emonhub.py[303]: 2019-03-06 11:29:47,625 DEBUG MQTT Publishing: emon/3phase_node13/pulse 1
Mar 6 11:29:47 emonpi-node-13 emonhub.py[303]: 2019-03-06 11:29:47,627 INFO MQTT Publishing: emonhub/rx/13/values 0,0,0,0,249.05,3020,3010,3010,3010,3010,3010,1
Mar 6 11:17:06 emonpi-node-13 systemd-modules-load[98]: Inserted module 'i2c_dev'
Mar 6 11:17:06 emonpi-node-13 fake-hwclock[94]: Wed 6 Mar 11:17:01 UTC 2019
Mar 6 11:17:06 emonpi-node-13 systemd[1]: Time has been changed
Mar 6 11:17:06 emonpi-node-13 systemd[1]: Started Restore / save the current clock.
Mar 6 11:17:06 emonpi-node-13 systemd[1]: Starting File System Check on Root Device...
Mar 6 11:17:06 emonpi-node-13 systemd-fsck[131]: Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line.
Mar 6 11:17:06 emonpi-node-13 systemd[1]: Started File System Check on Root Device.
But it only ran until 11:17 before dying again.
I rebooted at 12:16 and currently it’s still running (crippled tho’ as I cannot browse to it) …
Mar 6 11:17:32 emonpi-node-13 emonhub.py[322]: 2019-03-06 11:17:32,998 DEBUG MQTT Publishing: emon/3phase_node13/temp5 3010
Mar 6 11:17:33 emonpi-node-13 emonhub.py[322]: 2019-03-06 11:17:33,000 DEBUG MQTT Publishing: emon/3phase_node13/temp6 3010
Mar 6 11:17:33 emonpi-node-13 emonhub.py[322]: 2019-03-06 11:17:33,002 DEBUG MQTT Publishing: emon/3phase_node13/pulse 1
Mar 6 11:17:33 emonpi-node-13 emonhub.py[322]: 2019-03-06 11:17:33,004 INFO MQTT Publishing: emonhub/rx/13/values 0,0,0,0,246.38,3020,3010,3010,3010,3010,3010,1
Mar 6 12:16:08 emonpi-node-13 systemd-timesyncd[261]: Synchronized to time server 193.150.34.2:123 (2.debian.pool.ntp.org).
Mar 6 12:16:08 emonpi-node-13 systemd[1]: Time has been changed
Mar 6 12:16:08 emonpi-node-13 systemd[1]: apt-daily.timer: Adding 10h 33min 24.520174s random time.
Mar 6 12:16:08 emonpi-node-13 systemd[1]: apt-daily-upgrade.timer: Adding 8min 35.155840s random time.
Mar 6 12:16:08 emonpi-node-13 systemd[1]: Starting Clean php session files...
Mar 6 12:16:08 emonpi-node-13 emonhub.py[322]: 2019-03-06 12:16:08,784 DEBUG To_watchman Buffer size: 3
Mar 6 12:16:08 emonpi-node-13 emonhub.py[322]: 2019-03-06 12:16:08,825 INFO To_watchman sending: http://watchman/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1551871042.872834,13,0,0,0,0,245.72,3020,3010,3010,3010,3010,3010,1],[1551871047.901405,13,0,0,0,0,246.72,3020,3010,3010,3010,3010,3010,1],[1551871052.884299,13,0,0,0,0,246.38,3020,3010,3010,3010,3010,3010,1]]&sentat=1551874568
Mar 6 12:16:08 emonpi-node-13 emonhub.py[322]: 2019-03-06 12:16:08,977 DEBUG To_watchman acknowledged receipt with 'ok' from http://watchman/emoncms
Mar 6 12:16:09 emonpi-node-13 supervisord[498]: 2019-03-06 12:16:09,211 INFO exited: tuxtunnel (terminated by SIGKILL; not expected)
Mar 6 12:16:09 emonpi-node-13 systemd[1]: Started Clean php session files.
There were 2 occasions when it crashed and self rebooted.
When I read the syslog line using Notepad++, there are many NUL’s across the line which do not seem to show up in this posting.
Googling suggests …
NUL bytes in the syslog are a common effect of a crash that prevented the system from cleanly syncing and unmounting the filesystem. They don’t give an indication of what actually triggered the crash.
Usually complete system crashes are caused by some fault in drivers, the kernel, hardware, etc.
Could be a representation that the system was in mid write when it crashed.
Could it be a duff RPi or USB HDD? I’ll start over again with a different RPi to begin with.
Also there have been 4 crashes today. On 3 occasions immediately before the crash, syslog records MQTT publishing. On the other occasion, it was Serial Tx being sent. Might this be relevant?
There are many entries in the mosquito log like this …
1551867304: New connection from 127.0.0.1 on port 1883.
1551867304: New connection from 127.0.0.1 on port 1883.
1551867304: Socket error on client , disconnecting.
1551867304: Socket error on client , disconnecting.
Finally - thx again for yr steer to getting all log files & directories visible.