NtopNG does not start when Ram Disks for tmp and var are on
-
If I turn on Ram disks NtopNg does not start after a reboot. Fresh install of NtopNG starts ok, but doesnt start after reboot. Logs show:
Mar 22 08:13:13 php-fpm 51795 /rc.start_packages: The command '/usr/local/bin/redis-cli SET ntopng.user.admin.password 'f9f16d97c90d8c6f2cab37bb6d1f1992'' returned exit code '1', the output was 'Could not connect to Redis at 127.0.0.1:6379: Operation timed out Could not connect to Redis at 127.0.0.1:6379: Operation timed out'
-
It would appear that /var/db/redis does not get saved/restored on reboot. without /var/db/redis redis fails to start and without it NtopNG cant run.
After manually creating that directory and starting the redis service NtopNG starts as expected but of course the /var/db/redis does not survive reboot.
Can this be fixed in the ramdisk save/restore script run at boot/reboot?
Thanks
-
As a workaround for now you could use the package shellcmd:
If it just needs the directory to be there on boot:
Then setup a shellcmd to```
mkdir /var/db/redisIf it needs the contents of the directory, create a directory to store the temp files:
mkdir /usr/local/etc/ntopng_tmp
then before you shutdown (or as a cronjob):
cp -iprv /var/db/redis /usr/local/etc/ntopng_tmp
and as a shellcmd:
cp -iprv /usr/local/etc/ntopng_tmp /var/db/redis
or if the directory also must be created each time:
mkdir /var/db/redis && cp -iprv /usr/local/etc/ntopng_tmp /var/db/redis
-
I'll give shellcmd a try, hopefully it will try to create the directory after the ram disk is created but before redis seervice gets started.
I just wanted to make the developer aware of the bug so that it can be fixed.
I dont know if I can file a bug myself. Over the years I have always described problem I found here in the forum and the dev took care of it.
Thanks for taking time to answer
-
Shellcmd or earlycmd does not work for me. Maybe wrong timing in the directory creation.
However manuallly editing /etc/pfSense-rc like this works well. I gues this is the fix that could be implemented. Of course it does not save/restore any data and perhaps there is a better place to create this dir
make some directories in /var
/bin/mkdir -p $varrunpath /var/log /var/etc /var/db/entropy /var/db/rrd /var/at/jobs/ /var/empty /var/db/ntopng /var/log/nginx
2>/dev/null
chmod 0555 /var/empty
/bin/rm -rf $varrunpath/* -
This package will NOT work properly with the ramdisks. It is also a rather horrible idea if you ask me.
# du -sh /var/db/ntopng/ 4.5G /var/db/ntopng/
The above is data accumulated after some ~6 months of usage on a site with pretty moderate traffic (~100GB/month). Sure like hell you do not want that to be in your RAM, or be backing that up and restoring on reboot.
-
This package will NOT work properly with the ramdisks. It is also a rather horrible idea if you ask me.
# du -sh /var/db/ntopng/ 4.5G /var/db/ntopng/
The above is data accumulated after some ~6 months of usage on a site with pretty moderate traffic (~100GB/month). Sure like hell you do not want that to be in your RAM, or be backing that up and restoring on reboot.
No I actually don't care about historical data but I find ntopng quite useful to have a glimpse on the traffic that is going through pfsense in a nicely presented interface. I am ok with the db being cleared on reboot. I dont know though what will happen if var runs out of space, i.e. will dhcpd be unable to write leases on disk etc.