Description of problem: Scripts (dzvents / pl) don't run. Version-Release number of selected component (if applicable): How reproducible: Logging of scripts being executed doesn't show up in the logfiles. Dummy devices which are supposed to be updated by the scripts aren't updated. Steps to Reproduce: 1. Fedora domoticz package doesn't run any scripts. 2. systemctl stop domoticz 3. Change /etc/systemd/system/multi-user.target.wants/domoticz.service, add this line: ExecStart=/usr/bin/domoticz -f /etc/domoticz.conf Remove these lines: EnvironmentFile=/etc/sysconfig/domoticz ExecStart=/usr/bin/domoticz -www $WWW_PORT -sslwww $SSL_PORT -sslcert $SSLCERT -sslpass $SSLPASS -sslmethod $SSLMETHOD -ssloptions $SSLOPTIONS -ssldhparam $SSLDHPARAM -wwwroot $WWW_ROOT -dbase $DBASE -userdata $USERDATA -log $LOG -loglevel $LOGLEVEL Add /etc/domoticz.conf file with this content: http_port=8081 ssl_port=0 http_root=/usr/share/domoticz/www dbase_file=/var/lib/domoticz/domoticz.db app_path=/usr/share/domoticz/ userdata_path=/usr/share/domoticz/ 4. systemctl daemon-reload 5. systemctl start domoticz Actual results: <no domoticz scripts logging> Expected results: # tail -f /var/log/messages | grep domoticz | grep script Oct 8 15:43:00 void domoticz[30273]: 2019-10-08 15:43:00.047 Status: dzVents: Info: ------ Start external script: luftdaten.lua:, trigger: every minute Oct 8 15:43:00 void domoticz[30273]: 2019-10-08 15:43:00.047 Status: dzVents: Info: ------ Start external script: sunscreen.lua:, trigger: every minute Additional info:
I'm not going to support a custom conf file. That's why I have the /etc/sysconfig/domoticz file available. I updated the default USERDATA path to /var/lib/domoticz to allow domoticz to read and write. Your path needs to be updated, too. If you switch back to the package defaults you can reopen this bug, but I'm going to close it for now.
You do have a point. I'll try to go back to a supported configuration. On a spare computer I've installed FC30 (minimal), followed by: - dnf install domoticz - systemctl enable domoticz - systemctl start domoticz Added a tiny dzVents script in the dzVents script directory which was created by installing the package: # cat /usr/share/domoticz/scripts/dzVents/scripts/I-am-on.lua return { active = true, on = { timer = { 'every minute' } }, execute = function(domoticz) domoticz.log('I am on!', domoticz.LOG_INFO) end } I would then expect to see a message in the logs every minute, but this doesn't happen on the fresh install. On the other host (with the hacked configuration) it does (copied from the domoticz event viewer): 2019-10-09 13:49:00.412 Status: dzVents: Info: ------ Start external script: I-am-on.lua:, trigger: every minute 2019-10-09 13:49:00.412 Status: dzVents: Info: I am on! 2019-10-09 13:49:00.412 Status: dzVents: Info: ------ Finished I-am-on.lua
Because /usr/share/domoticz is not where you should store them. As stated above, /var/lib/domoticz is the new default userdata directory. /var/lib/domoticz/scripts/dzVents/scripts is the correct path. I need to move those handful of /usr/share directories over to /var/lib.
Trying that now. mkdir /var/lib/domoticz/scripts ; rsync -av /usr/share/domoticz/scripts/ /var/lib/domoticz/scripts/ Increased the debug level to 5 and restarted domoticz: 2019-10-09 20:43:46.085 Starting shared server on: :::6144 2019-10-09 20:44:00.164 Error: EventSystem: in /usr/bin/dzVents/runtime/dzVents.lua: cannot open /usr/bin/dzVents/runtime/dzVents.lua: No such file or directory Interesting why it's looking for it there... # locate dzVents.lua /usr/share/domoticz/dzVents/runtime/dzVents.lua
I'm pushing an update that should fix the default scripts folder to be located in /var/lib/domoticz. It won't fix this issue, but please keep providing feedback.
Please add: APP_ROOT="/usr/share/domoticz" to /etc/sysconfig/domoticz and add: -approot $APP_ROOT to the ExecStart line in the domoticz.service source file. Permissions of the scripts directories also need to be updated. Domoticz should at least have write access to /var/lib/domoticz/scripts/dzVents/generated_scripts/ This seems to help dzVents to start, but I still don't see evidence of it executing scripts in the logs. I'll continue looking.
Updated to domoticz-4.11553-0.git20191207.1.fc30.x86_64 (fedora package) on my fc30 test system. dzvents scripts still don't work: 2019-12-21 14:39:00.454 Error: EventSystem: in /usr/bin/dzVents/runtime/dzVents.lua: cannot open /usr/bin/dzVents/runtime/dzVents.lua: No such file or directory
1/ Updated test system to fc32 beta 2/ removed domoticz package 3/ removed all domoticz files 4/ installed domoticz-2020.1-1.fc32.x86_64 5/ Setup --> More Options --> Events, added dzVents --> Minimal, replaced the text with: return { active = true, on = { timer = { 'every minute' } }, execute = function(domoticz) domoticz.log('I am on!', domoticz.LOG_INFO) end } 6/ named it "I-am-on" 7/ enabled it 8/ nothing appears in the logs. 9/ file is write to disk: /var/lib/domoticz/scripts/dzVents/generated_scripts/I-am-on.lua Conclusion: dzVents events don't work.
Run a strace on the domoticz process, in the mean time disable and enable the "I-am-on" dzvents event: $ sudo strace -f -p 628 2>&1 | grep -i dzvents [pid 680] openat(AT_FDCWD, "/usr/bin/dzVents/runtime/dzVents.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 670] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/generated_scripts/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 31 [pid 670] unlink("/var/lib/domoticz/scripts/dzVents/generated_scripts/I-am-on.lua") = 0 [pid 670] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/generated_scripts/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 30 [pid 670] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/generated_scripts/I-am-on.lua", O_RDWR|O_CREAT|O_TRUNC, 0666) = 30 [pid 680] openat(AT_FDCWD, "/usr/bin/dzVents/runtime/dzVents.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 680] openat(AT_FDCWD, "/usr/bin/dzVents/runtime/dzVents.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 680] openat(AT_FDCWD, "/usr/bin/dzVents/runtime/dzVents.lua", O_RDONLY) = -1 ENOENT (No such file or directory) Notice that it can't find /usr/bin/dzVents/runtime/dzVents.lua. This file is located here: /usr/share/domoticz/dzVents/runtime/dzVents.lua and is part of the domoticz package. Add the approot configuration: $ diff /etc/sysconfig/domoticz.rpmorig /etc/sysconfig/domoticz -ur --- /etc/sysconfig/domoticz.rpmorig 2020-03-28 11:28:49.288383921 +0100 +++ /etc/sysconfig/domoticz 2020-03-28 11:29:33.091924422 +0100 @@ -10,4 +10,5 @@ USERDATA="/var/lib/domoticz/" LOG="/var/log/domoticz.log" LOGLEVEL="1" +APP_ROOT="/usr/share/domoticz" $ diff domoticz.service /usr/lib/systemd/system/domoticz.service -ur --- domoticz.service 2020-03-28 11:39:16.607232336 +0100 +++ /usr/lib/systemd/system/domoticz.service 2020-03-28 11:39:50.327860056 +0100 @@ -5,7 +5,7 @@ User=domoticz Group=domoticz EnvironmentFile=/etc/sysconfig/domoticz -ExecStart=/usr/bin/domoticz -www $WWW_PORT -sslwww $SSL_PORT -sslcert $SSLCERT -sslpass $SSLPASS -sslmethod $SSLMETHOD -ssloptions $SSLOPTIONS -ssldhparam $SSLDHPARAM -wwwroot $WWW_ROOT -dbase $DBASE -userdata $USERDATA -log $LOG -loglevel $LOGLEVEL +ExecStart=/usr/bin/domoticz -www $WWW_PORT -sslwww $SSL_PORT -sslcert $SSLCERT -sslpass $SSLPASS -sslmethod $SSLMETHOD -ssloptions $SSLOPTIONS -ssldhparam $SSLDHPARAM -approot $APP_ROOT -wwwroot $WWW_ROOT -dbase $DBASE -userdata $USERDATA -log $LOG -loglevel $LOGLEVEL WorkingDirectory=/usr/share/domoticz # Give the right to open priviliged ports. This allows you to run on a port <1024 without root permissions (user/group setting above) #CapabilityBoundingSet=CAP_NET_BIND_SERVICE $ ps -ef | grep domoti domoticz 1461 1 9 11:40 ? 00:00:00 /usr/bin/domoticz -www 8080 -sslwww 8443 -sslcert /var/lib/domoticz/domoticz.pem -sslpass -sslmethod -ssloptions -ssldhparam -approot /usr/share/domoticz -wwwroot /usr/share/domoticz/www -dbase /var/lib/domoticz/domoticz.db -userdata /var/lib/domoticz/ -log /var/log/domoticz.log -loglevel 1 stefan 1482 855 0 11:40 pts/0 00:00:00 grep --color=auto domoti [stefan@ion sysconfig]$ sudo strace -f -p 1461 2>&1 | grep -i dzvents [pid 1468] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/generated_scripts/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 31 [pid 1468] unlink("/var/lib/domoticz/scripts/dzVents/generated_scripts/I-am-on.lua") = 0 [pid 1468] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/generated_scripts/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 31 [pid 1468] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/generated_scripts/I-am-on.lua", O_RDWR|O_CREAT|O_TRUNC, 0666) = 31 [pid 1478] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/dzVents.lua", O_RDONLY) = 31 [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/EventHelpers.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/EventHelpers.lua", O_RDONLY) = 32 [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/EventHelpers.lua", O_RDONLY) = 31 [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/lodash.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/lodash.lua", O_RDONLY) = 31 [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/lodash.lua", O_RDONLY) = 31 [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/Utils.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/Utils.lua", O_RDONLY) = 31 [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/Utils.lua", O_RDONLY) = 31 [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/usr/share/domoticz/dzVents/runtime/device-adapters/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/dzVents/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/scripts/JSON.lua", O_RDONLY <unfinished ...> [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/../lua/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/scripts/modules/JSON.lua", O_RDONLY <unfinished ...> [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/JSON.lua", O_RDONLY <unfinished ...> [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/generated_scripts/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/data/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 1492] openat(AT_FDCWD, "/var/lib/domoticz/scripts/dzVents/modules/JSON.lua", O_RDONLY) = -1 ENOENT (No such file or directory) JSON.lua is located /usr/share/domoticz/scripts/lua/JSON.lua, if the scripts are stored in /usr/share/domoticz, it would have been found with searching for ../lua/ Similar issue is also open on the domoticz issue tracker: https://github.com/domoticz/domoticz/issues/2580
I took some time to try and debug a solution, but I cannot get dzVents to "Enable" in the Settings dialogue. I would like to test it prior to pushing a package update. It appears that 'webem' handling has broke in the 2020 update and I can't save settings. I'll see what upstream says.
After being able to test I am now pushing an update. Please make sure your /etc/sysconfig/domoticz file gets updated to have APP_DATA defined. I am dropping the WWW_ROOT variable as it is now redundant. Thanks for the help looking into this.
s/APP_DATA/APP_ROOT
FEDORA-2020-0bafc02eac has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-0bafc02eac
FEDORA-2020-29d74fb34b has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-29d74fb34b
FEDORA-2020-0bafc02eac has been pushed to the Fedora 32 testing repository. In short time you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-0bafc02eac` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-0bafc02eac See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
I've backported your changes into my package (current github version). It works. Thank you! There are some other small cosmetic issues which could be addressed. Shall I send an e-mail for those?
Yes, I will look at them. Looks like I've been banned from the upstream github. Sigh. I wish upstream was not so combative. This project could really take off.
FEDORA-2020-29d74fb34b has been pushed to the Fedora 31 testing repository. In short time you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-29d74fb34b` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-29d74fb34b See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2020-29d74fb34b has been pushed to the Fedora 31 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2020-0bafc02eac has been pushed to the Fedora 32 stable repository. If problem still persists, please make note of it in this bug report.