Update and Solution: The solution was to ensure that all directories are readable by 'nobody'. See the updated luci-app-statistics page in the wiki for more about that package. (Note: Link updated 3Feb2023)
Original problem statement... Using LEDE 17.01.4 with external USB drive installed at /opt Everything works fine if I leave the Storage directory at the default /tmp/rrd.
But I wanted the data to be preserved across reboots, so I used the LuCI GUI to change the Storage directory to the USB drive in a directory at /opt/rrd. Now the message I see on the web page when trying to display the expected chart is:
/usr/lib/lua/luci/dispatcher.lua:460: Failed to execute call dispatcher target for entry '/admin/statistics/graph/uptime'.
The called action terminated with an exception:
/usr/lib/lua/luci/statistics/datatree.lua:159: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'assert'
/usr/lib/lua/luci/dispatcher.lua:460: in function 'dispatch'
/usr/lib/lua/luci/dispatcher.lua:141: in function </usr/lib/lua/luci/dispatcher.lua:140>
Potentially interesting diagnostic info:
After installing collectd & collectd-mod-uptime, I installed luci-app-statistics and got the message:
root@LEDE-ArcherC7:/etc/config# opkg install luci-app-statistics
Installing luci-app-statistics (git-18.007.32064-ff21f2f-1) to root...
Downloading http://downloads.lede-project.org/releases/17.01.4/packages/mips_24kc/luci/luci-app-statistics_git-18.007.32064-ff21f2f-1_all.ipk
Configuring luci-app-statistics.
uci: Entry not found
Why did it say, uci: Entry not found? Is that a problem?
This worked fine when installing those packages onto another router with 17.04.02. Specifically, I changed Storage directory to /opt/rrd and the charts continued to work.
I have read elsewhere that permissions might be a problem. Here's what I show for the affected router (permissions for all directories are 755, the uptime.rrd file itself is 644):
root@LEDE-ArcherC7:/opt# ls -al
drwx------ 5 1000 1000 4096 Jan 15 09:39 .
drwxr-xr-x 1 root root 0 Jan 14 19:45 ..
-rw-r--r-- 1 root root 0 Dec 18 17:24 3.2.1
drwxrwxr-x 9 root root 4096 Dec 18 17:24 YAMon3
-rwxr-xr-x 1 root root 6450 Nov 13 13:34 install.sh
drwx------ 2 root root 16384 Oct 25 22:55 lost+found
drwxr-xr-x 3 root root 4096 Jan 15 09:39 rrd
root@LEDE-ArcherC7:/opt# ls -al rrd
drwxr-xr-x 3 root root 4096 Jan 15 09:39 .
drwx------ 5 1000 1000 4096 Jan 15 09:39 ..
drwxr-xr-x 8 root root 4096 Jan 15 09:39 LEDE-ArcherC7
root@LEDE-ArcherC7:/opt# ls -al rrd/LEDE-ArcherC7/
drwxr-xr-x 8 root root 4096 Jan 15 09:39 .
drwxr-xr-x 3 root root 4096 Jan 15 09:39 ..
drwxr-xr-x 2 root root 4096 Jan 15 09:39 interface-br-lan
drwxr-xr-x 2 root root 4096 Jan 15 09:39 iwinfo-wlan0
drwxr-xr-x 2 root root 4096 Jan 15 09:39 iwinfo-wlan1
drwxr-xr-x 2 root root 4096 Jan 15 09:39 load
drwxr-xr-x 2 root root 4096 Jan 15 09:39 memory
drwxr-xr-x 2 root root 4096 Jan 15 09:39 uptime
root@LEDE-ArcherC7:/opt# ls -al rrd/LEDE-ArcherC7/uptime/
drwxr-xr-x 2 root root 4096 Jan 15 09:39 .
drwxr-xr-x 9 root root 4096 Jan 15 09:40 ..
-rw-r--r-- 1 root root 5544 Jan 15 09:40 uptime.rrd
I also have moved my statistics database to a USB drive, so it works. The "uci: Entry not found" message means that there is an error on some file at "/etc/config"; I would start by checking all files. You can also post here the relevant config files, and I can compare them to mine.
Bingo! The top-level /opt directory was 700 (see ls -al above). Changing that to 755 (chmod 755 /opt) solved the problem.
Marginally-related question: I installed the USB drive using Quick Start for Adding USB Drive. That left the top-level directory with permissions of 700 (I believe - I did it a long time ago. I certainly didn't set it to 700 on purpose.)
What advice might be useful/necessary for that quick start guide to avoid the problem I had here? Thanks again.
@eduperez I see that only two files have been modified recently in /etc/config: ucitrack and luci_statistics. Here they are - do you see anything peculiar? Thanks!
Advice: Adjust permissions as needed for your usecase.
Nobody knows what the user wants to do with the freshly installed USB drive. Advice regarding required permissions should be given in the description of the application needing those permissions, not on the general USB drive installation page.
But that was added just to master (as 17.01 had already been branched off). The advice should likely be backported to 17.01 as it is naturally valid also there.
@richb-hanover No, compared your files with mine, but could not find anything weird; I even tried using your files in my device, and "uci" did not complain at all.
Hmmm... Is there a way to "run luci against a config file" so that it will blurt out an error if there's a problem in the config? I could run it against all dozen or so files in /etc/config to see what generated that uci: Entry not found message. Thanks
You can run "uci show" to get a list of all parameters; it will scan all config files in alphabetical order, and show the error when it finds it. Or you can run "uci show secion", to scan a single section, and then find out the file where such section is stored.
If I remember correctly, the error message may also pop up in certain situations if you have non-uci files in /etc/config
Additionally, the error may pop up with package installation/removal if the handling of postinst and prerm (pre-removal) scripts of the package fails. If I remember right, there was bug in handling of those in conneciton with default-postinst and default-prerm, and that has been fixed at least in master, but not quite sure about 17.01.
Great.
I ran into that same error a while ago, as I had stored some extra files in /etc/config to make them easily survive sysupgrade. I finally moved the files away and got rid of the error.
It was working until mid-April (I just noticed it) and writing to a 64GB USB stick in a WRT3200ACM. I am using the latest Davidc502 build (Lede SNAPSHOT r7093-4fdc6ca31b / LuCI Master (git-18.152.60731-18b5b06).
USB stick is set for 777 permissions cascaded down through the complete directory structure.
I can read the old data by the graphs from before mid-April but no new data is being feed to the RDD files.
My set-up for the luci-statistics config file is below. Can anyone see any errors in the setup or provide some help to get it working again?