I upgraded emonbase to the latest version, low-write 10.0.2, and after a power outage, I didn’t had any values in the input feeds. I checked and emonhub service was stopped and I couldn’t get it to start.
pi@emonpi(ro):log$ sudo systemctl status emonhub
● emonhub.service - emonHub service description
Loaded: loaded (/home/pi/emonhub/service/emonhub.service; disabled)
Active: failed (Result: start-limit) since Tue 2019-05-28 21:42:39 UTC; 4min 50s ago
Process: 3114 ExecStart=/usr/share/emonhub/emonhub.py --config-file=/home/pi/data/emonhub.conf --logfile=/var/log/emonhub/emonhub.log (code=exited, status=2)
Main PID: 3114 (code=exited, status=2)
May 28 21:42:39 emonpi systemd[1]: Unit emonhub.service entered failed state.
May 28 21:42:39 emonpi systemd[1]: emonhub.service holdoff time over, scheduling restart.
May 28 21:42:39 emonpi systemd[1]: Stopping emonHub service description...
May 28 21:42:39 emonpi systemd[1]: Starting emonHub service description...
May 28 21:42:39 emonpi systemd[1]: emonhub.service start request repeated too quickly, refusing to start.
May 28 21:42:39 emonpi systemd[1]: Failed to start emonHub service description.
May 28 21:42:39 emonpi systemd[1]: Unit emonhub.service entered failed state.
I noticed that the there is a logfile parameter pointing to a file that doesn’t exist.
pi@emonpi(ro):log$ less /var/log/emonhub/emonhub.log
/var/log/emonhub/emonhub.log: No such file or directory
I then created the directory emonhub and file and was able to start the emonhub service. The problem that I now have is that every time I restart or have a power outage, this directory and file are removed and emonhub service won’t start!
Before running any further updates, can you please upload your emonpiupdate.log for us to take a look at?
Recent changes to the emonhub repo brought in the --logfile path and simultaneous changes to the emonpi repo should have created the emonhub log folder and added a entry to rc,local so it is added on a restart.
It sounds like some of the intended changes haven’t happened/stuck. It’s unlikely to have anything to do with the update to emoncms itself.
If you haven’t updated in the last 2days could you update emonhub again ( I would just use the update all to be safe) it should pull in the more recent changes that auto create the emonhub log folder.
Starting update via service-runner-update.sh (v2.0) >
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
- emonSD version: emonSD-26Oct17
emonSD base image check passed...continue update
git pull /home/pi/emonpi
* master
wifiap
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
1
nothing added to commit but untracked files present (use "git add" to track)
Already up-to-date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Sun 26 May 02:15:57 UTC 2019
EUID: 1000
usrdir: /home/pi
type: emoncms
firmware: emonpi
Checking environment:
- pi user found
EUID: 1000
Hardware detected: rfm2pi
Stopping emonPiLCD service
Display update message on LCD
I2C LCD NOT DETECTED on either 0x['27', '3f'] ...exiting LCD script
Start emoncms update:
-------------------------------------------------------------
Emoncms update started
Emoncms update script V1.3 (26th March 2019)
-------------------------------------------------------------
- usr directory: /home/pi
- emoncms directory: /var/www/emoncms
current settings.php md5: 468b110786bf0ab60a856fa3c0036f0f
Default settings.php md5: 468b110786bf0ab60a856fa3c0036f0f
settings.php has NOT been user modifed
Checking status of /var/www/emoncms git repository
- git branch: stable
- no local changes
- running: git pull origin stable
From https://github.com/emoncms/emoncms
* branch stable -> FETCH_HEAD
Already up-to-date.
NEW default settings.php md5: 468b110786bf0ab60a856fa3c0036f0f
settings.php not updated
-------------------------------------------------------------
Updating Emoncms Modules
-------------------------------------------------------------
------------------------------------------
Updating /var/www/emoncms/Modules/app module
------------------------------------------
- git branch: stable
- git tags: 1.2.0-108-g6e5016a
- no local changes
- running: git pull origin stable
From https://github.com/emoncms/app
* branch stable -> FETCH_HEAD
Already up-to-date.
------------------------------------------
Updating /var/www/emoncms/Modules/config module
------------------------------------------
- git branch: stable
- git tags: 1.0.0-63-g1d9238e
- no local changes
- running: git pull origin stable
From https://github.com/emoncms/config
* branch stable -> FETCH_HEAD
Already up-to-date.
------------------------------------------
Updating /var/www/emoncms/Modules/dashboard module
------------------------------------------
- git branch: stable
- git tags: 1.3.1-100-g7e3c332
- no local changes
- running: git pull origin stable
From https://github.com/emoncms/dashboard
* branch stable -> FETCH_HEAD
Already up-to-date.
------------------------------------------
Updating /var/www/emoncms/Modules/device module
------------------------------------------
- git branch: master
- git tags: 1.1.1-46-g8ac9145
- no local changes
- running: git pull origin master
From https://github.com/emoncms/device
* branch master -> FETCH_HEAD
Already up-to-date.
------------------------------------------
Updating /var/www/emoncms/Modules/graph module
------------------------------------------
- git branch: stable
- git tags: 1.2.1-145-g9209240
- no local changes
- running: git pull origin stable
From https://github.com/emoncms/graph
* branch stable -> FETCH_HEAD
9209240..c7f4ea9 stable -> origin/stable
Updating 9209240..c7f4ea9
Fast-forward
Views/sidebar.php | 2 +-
embed.php | 8 ++++----
graph.js | 11 +++++++----
module.json | 2 +-
4 files changed, 13 insertions(+), 10 deletions(-)
------------------------------------------
Updating /var/www/emoncms/Modules/wifi module
------------------------------------------
- git branch: stable
- git tags: 1.2.0-39-gb67783d
- no local changes
- running: git pull origin stable
From https://github.com/emoncms/wifi
* branch stable -> FETCH_HEAD
Already up-to-date.
------------------------------------------
Updating postprocess module
------------------------------------------
- git branch: emonpi
- git tags: 2.0.0
- no local changes
- running: git pull origin emonpi
Already up-to-date.
Already on 'emonpi'
Your branch is up-to-date with 'remotes/origin/emonpi'.
------------------------------------------
Updating sync module
------------------------------------------
- git branch: master
- git tags: 2.0.1
- no local changes
- running: git pull origin master
Already up-to-date.
Already on 'master'
Your branch is up-to-date with 'origin/master'.
------------------------------------------
Updating backup module
------------------------------------------
- git branch: stable
- git tags: 2.0.0-2-g18c6189
- no local changes
- running: git pull origin stable
Already up-to-date.
Already on 'stable'
Your branch is up-to-date with 'origin/stable'.
------------------------------------------
Auto Installation of Emoncms Modules
------------------------------------------
- graph module already installed
- device module already installed
- postprocess module already installed
- sync module already installed
- backup module already installed
www-data : www-data video systemd-journal
------------------------------------------
SERVICES
------------------------------------------
emoncms_mqtt.service already installed
feedwriter.service already installed
service-runner.service already installed
------------------------------------------
Reloading systemctl deamon
Update Emoncms database
[]
Restarting Services...
- sudo systemctl restart feedwriter.service
--- ActiveState=active ---
- sudo systemctl restart emoncms_mqtt.service
--- ActiveState=active ---
- sudo systemctl restart emonhub.service
--- ActiveState=active ---
- sudo /etc/init.d/openhab restart
Restarting openhab (via systemctl): openhab.service.
● openhab.service - Starts and stops the openHAB Home Automation Bus
Loaded: loaded (/usr/lib/systemd/system/openhab.service; enabled)
Active: active (running) since Sun 2019-05-26 02:16:18 UTC; 90ms ago
Docs: http://www.openhab.org
Process: 29775 ExecStartPre=/usr/share/openhab/bin/setpermissions.sh (code=exited, status=0/SUCCESS)
Main PID: 29822 (openhab.sh)
CGroup: /system.slice/openhab.service
├─29822 /bin/sh /usr/share/openhab/bin/openhab.sh -o
└─29847 /usr/bin/java -Dlogback.configurationFile=/etc/openhab/logback.xml -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.port=8080 -Dopenhab.configfile=/etc/openhab/configurations/openhab.cfg -Dopenhab.configdir=/etc/openhab/configurations -Dopenhab.logdir=/var/log/openhab -Dsmarthome.userdata=/var/lib/openhab -Djetty.home=/usr/share/openhab -Djetty.port.ssl=8443 -Djetty.config=/etc/openhab/jetty -Djetty.logs=/var/log/openhab -Djetty.rundir=/usr/share/openhab -Dfelix.fileinstall.dir=/usr/share/openhab/addons -Dfelix.fileinstall.filter=.*\.jar -Djava.library.path=/usr/share/openhab/lib -Djava.security.auth.login.config=/etc/openhab/login.conf -Dorg.quartz.properties=/etc/openhab/quartz.properties -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar /usr/share/openhab/server/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar -configuration /var/lib/openhab/workspace -data /var/lib/openhab/workspace -console 5555
May 26 02:16:18 emonpi setpermissions.sh[29775]: setting owner openhab:openhab recursively for /var/lib/openhab
May 26 02:16:18 emonpi setpermissions.sh[29775]: setting permissions and owner openhab:openhab recursively for /var/log/openhab
May 26 02:16:18 emonpi setpermissions.sh[29775]: setting permissions and owner openhab:openhab recursively for /etc/openhab/configurations
May 26 02:16:18 emonpi setpermissions.sh[29775]: setting permissions and owner openhab:openhab for /usr/share/openhab/webapps/static
May 26 02:16:18 emonpi setpermissions.sh[29775]: setting permissions and owner openhab:openhab for /etc/openhab/jetty/etc/keystore
May 26 02:16:18 emonpi setpermissions.sh[29775]: setting permissions and owner openhab:openhab for /etc/openhab/configurations/users.cfg
May 26 02:16:18 emonpi systemd[1]: Started Starts and stops the openHAB Home Automation Bus.
Installing emoncms logrotate...
Now setting up Logrotate...
Backing up old logrotate configuration...
Linked to new logrotate configuration...
Backing up old logrotate cron job...
mv: cannot stat ‘/etc/cron.daily/logrotate’: No such file or directory
Linked to new logrotate cron job...
Completed
Completed
Running logrotate...
set log rotate config owner to root
------------------------------------------
Emoncms update script complete
------------------------------------------
Starting emonPi LCD service..
Filesystem is locked - Read Only access
type ' rpi-rw ' to unlock
-------------------------------------------------------------
emonPi update done: Sun 26 May 02:16:25 UTC 2019
-------------------------------------------------------------
restarting service-runner
#!/bin/sh
#
# rc.local
echo" My IP address is":
hostname -I
# WLAN fix on RasPi 3B+ Stretch
rm /var/run/wpa_supplicant/wlan0
ifdown wlan0
sleep 1
ifup wlan0
# Will only run if /var/log is mounted in tmpfs
if ( mount | grep "on /var/log "| grep -q "^tmpfs " )
then
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
service service-runner restart
service emoncms_mqtt restart
fi
# Run emonPi Update of first factory boot as Pi user (run condition > web connection exisits && ~/data/emonpiu$
su pi -c '/home/pi/emonpi/./firstbootupdate'
## Start Wifi AP (uncomment if required) see emonpi/wifiAP/readme.md
/home/pi/emonpi/wifiAP/startAP.sh
exit 0
so the previous update log was over written, but it seems you have a recent, but not the latest emonhub.service unit so can you update again as I suggested above?
@borpin@pb66 I have rebooted it and it now recreates the folder emonnhub and the log file so emonhub starts normally. Thank you for your quick reply and assistance. I really appreciate it.