Login Redis Error

Hello,

On trying to login the following error appears:

Fatal error: Uncaught RedisException: MISCONF Redis is configured to save RDB snapshots, but it’s currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error. in /var/www/emoncms/Modules/user/user_model.php:1157 Stack trace: #0 /var/www/emoncms/Modules/user/user_model.php(1157): Redis->incr() #1 /var/www/emoncms/Modules/user/user_model.php(460): User->is_rate_limited() #2 /var/www/emoncms/Modules/user/user_controller.php(138): User->login() #3 /var/www/emoncms/core.php(111): user_controller() #4 /var/www/emoncms/index.php(258): controller() #5 {main} thrown in /var/www/emoncms/Modules/user/user_model.php on line 1157

and login fails.

Also any options on the LCD button menus are not available.

Switching off the power is the only way to reboot.

Following this i am able to login, so long as i do quickly.

I have found this message in the emoncms log:

2026-09-04 13:58:50.888|ERROR|emoncms_mqtt.php|RedisException: MISCONF Redis is configured to save RDB snapshots, but it’s currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error. in /var/www/emoncms/Modules/input/input_model.php:124
Stack trace:
#0 /var/www/emoncms/Modules/input/input_model.php(124): Redis->hMset()
#1 /var/www/emoncms/scripts/services/emoncms_mqtt/emoncms_mqtt.php(468): Input->set_timevalue()
#2 [internal function]: message()
#3 /var/www/emoncms/scripts/services/emoncms_mqtt/emoncms_mqtt.php(157): Mosquitto\Client->loop()
#4 {main}

In the short period between reboot, login and the error appearing it does look like the unit is operating.

EmonPi2 with Pi Zero low-write 11.16.8

Can anyone help solve the issue?

Andy

Hello Andy

I wonder if your disk is full?

You can either check this on the emoncms admin info page if you can get there? or via SSH with command df -h

Hello Trystan,

Thanks for the reply.

I have managed to get it working alot better.
I renamed /var/lib/redis/dump.rdb to add .old on the end, restarted and it has now been running the longest time since it went wrong.

> pi@emonpi:\~ $ sudo ls -la /var/lib/redis
> total 20520
> drwxr-x---  2 redis redis    4096 Sep  4 19:24 .
> drwxr-xr-x 33 root  root     4096 Feb  1  2024 ..
> -rw-rw----  1 redis redis   29022 Sep  4 19:24 dump.rdb
> -rw-rw----  1 redis redis 4192657 Sep  4 18:38 dump.rdb.old
> -rw-rw----  1 redis redis 4194304 Sep  2 18:27 temp-1337.rdb
> -rw-rw----  1 redis redis 4194304 Sep  2 18:26 temp-588.rdb
> -rw-rw----  1 redis redis 4194304 Sep  2 18:24 temp-589.rdb
> -rw-rw----  1 redis redis 4194304 Sep  4 18:48 temp-597.rdb

Running df -h provides the following highlights:

> Filesystem      Size  Used Avail Use% Mounted on
> udev             80M     0   80M   0% /dev
> tmpfs            43M  2.8M   40M   7% /run
> /dev/mmcblk0p2  4.4G  3.1G  1.2G  72% /
> tmpfs           214M     0  214M   0% /dev/shm
> tmpfs           5.0M  8.0K  5.0M   1% /run/lock
> tmpfs            30M   28K   30M   1% /tmp
> tmpfs           1.0M  4.0K 1020K   1% /var/lib/php/sessions
> tmpfs           128M     0  128M   0% /var/tmp
> /dev/mmcblk0p1  510M   93M  418M  19% /boot/firmware
> /dev/mmcblk0p3  9.7G  381M  8.9G   5% /var/opt/emoncms
> log2ram          50M  4.7M   46M  10% /var/log
> tmpfs            43M     0   43M   0% /run/user/1000

could it be that the original dump.rdb was corrupted?

what hardware and image version are you running?

What do you get if your run the following (my systems answers included here as examples)


pi@emonpi:~ $ redis-cli dbsize
(integer) 1111

pi@emonpi:~ $ redis-cli --bigkeys

# Scanning the entire keyspace to find biggest keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

[00.00%] Biggest hash   found so far '"input:644783"' with 5 fields
[00.00%] Biggest hash   found so far '"feed:165231"' with 11 fields
[00.00%] Biggest string found so far '"hpctrl:temp"' with 4 bytes
[00.90%] Biggest zset   found so far '"feed:165230:buffer"' with 28 members
[00.90%] Biggest string found so far '"emoncms_sync:feed_status:1"' with 22910 bytes
[28.89%] Biggest set    found so far '"user:device:1"' with 21 members
[82.09%] Biggest set    found so far '"user:feeds:1"' with 209 members
[98.56%] Biggest set    found so far '"user:inputs:1"' with 309 members

-------- summary -------

Sampled 1111 keys in the keyspace!
Total key length in bytes is 17829 (avg len 16.05)

Biggest   hash found '"feed:165231"' has 11 fields
Biggest string found '"emoncms_sync:feed_status:1"' has 22910 bytes
Biggest    set found '"user:inputs:1"' has 309 members
Biggest   zset found '"feed:165230:buffer"' has 28 members

0 lists with 0 items (00.00% of keys, avg size 0.00)
898 hashs with 4709 fields (80.83% of keys, avg size 5.24)
111 strings with 27040 bytes (09.99% of keys, avg size 243.60)
0 streams with 0 entries (00.00% of keys, avg size 0.00)
4 sets with 637 members (00.36% of keys, avg size 159.25)
98 zsets with 2212 members (08.82% of keys, avg size 22.57)

EmonPi2 based on pi Zero2w

emonSD-01Feb24

pi@emonpi:~ $ redis-cli dbsize
(integer) 276
pi@emonpi:~ $ redis-cli --bigkeys

Scanning the entire keyspace to find biggest keys as well as
average sizes per key type. You can use -i 0.1 to sleep 0.1 sec
per 100 SCAN commands (not usually needed).

[00.00%] Biggest hash found so far ‘“input:133”’ with 5 fields
[00.00%] Biggest hash found so far ‘“feed:220”’ with 11 fields
[08.66%] Biggest string found so far ‘“diskstats:mmcblk0p3:write”’ with 7 bytes
[21.65%] Biggest string found so far ‘“diskstats:starttime”’ with 10 bytes
[30.30%] Biggest set found so far ‘“feed:bufferactive”’ with 53 members
[39.83%] Biggest set found so far ‘“user:feeds:1”’ with 60 members
[65.80%] Biggest string found so far ‘“admin:systeminfo”’ with 4071 bytes

-------- summary -------

Sampled 231 keys in the keyspace!
Total key length in bytes is 3140 (avg len 13.59)

Biggest hash found ‘“feed:220”’ has 11 fields
Biggest string found ‘“admin:systeminfo”’ has 4071 bytes
Biggest set found ‘“user:feeds:1”’ has 60 members

0 lists with 0 items (00.00% of keys, avg size 0.00)
216 hashs with 1146 fields (93.51% of keys, avg size 5.31)
11 strings with 4124 bytes (04.76% of keys, avg size 374.91)
0 streams with 0 entries (00.00% of keys, avg size 0.00)
4 sets with 168 members (01.73% of keys, avg size 42.00)
0 zsets with 0 members (00.00% of keys, avg size 0.00)

i also have 4x EmonTH2

This issue has reappeared again this afternoon.

On looking in the redis log file I found about the time thing went wrong the following appeared:

596:M 27 Sep 2026 16:17:13.068 * Background saving started by pid 20809
20809:C 27 Sep 2026 16:17:13.709 * DB saved on disk
20809:C 27 Sep 2026 16:17:13.715 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
596:M 27 Sep 2026 16:17:13.773 * Background saving terminated with success
596:M 27 Sep 2026 16:22:14.085 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:22:14.090 * Background saving started by pid 20994
20994:C 27 Sep 2026 16:22:14.713 * DB saved on disk
20994:C 27 Sep 2026 16:22:14.718 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
596:M 27 Sep 2026 16:22:14.795 * Background saving terminated with success
596:M 27 Sep 2026 16:27:15.074 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:27:15.079 * Background saving started by pid 21184
21184:C 27 Sep 2026 16:27:15.705 * DB saved on disk
21184:C 27 Sep 2026 16:27:15.710 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
596:M 27 Sep 2026 16:27:15.784 * Background saving terminated with success
596:M 27 Sep 2026 16:32:16.071 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:16.076 * Background saving started by pid 21372
596:M 27 Sep 2026 16:32:16.478 # Background saving terminated by signal 31
596:M 27 Sep 2026 16:32:22.019 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:22.024 * Background saving started by pid 21374
596:M 27 Sep 2026 16:32:22.427 # Background saving terminated by signal 31
596:M 27 Sep 2026 16:32:28.068 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:28.073 * Background saving started by pid 21376
596:M 27 Sep 2026 16:32:28.476 # Background saving terminated by signal 31
596:M 27 Sep 2026 16:32:34.017 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:34.022 * Background saving started by pid 21382
596:M 27 Sep 2026 16:32:34.425 # Background saving terminated by signal 31
596:M 27 Sep 2026 16:32:40.068 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:40.073 * Background saving started by pid 21383
596:M 27 Sep 2026 16:32:40.476 # Background saving terminated by signal 31
596:M 27 Sep 2026 16:32:46.020 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:46.024 * Background saving started by pid 21384
596:M 27 Sep 2026 16:32:46.427 # Background saving terminated by signal 31
596:M 27 Sep 2026 16:32:52.070 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:52.075 * Background saving started by pid 21385
596:M 27 Sep 2026 16:32:52.478 # Background saving terminated by signal 31
596:M 27 Sep 2026 16:32:58.022 * 100 changes in 300 seconds. Saving...
596:M 27 Sep 2026 16:32:58.027 * Background saving started by pid 21386
596:M 27 Sep 2026 16:32:58.430 # Background saving terminated by signal 31

It looks like it went wrong at 16:32:16

I was able to get it running again buy renaming the dump.rdp file again (appended .2) and rebooting:

pi@emonpi:/var/log/redis $ sudo ls -la /var/lib/redis
total 24612
drwxr-x---  2 redis redis    4096 Sep 27 20:56 .
drwxr-xr-x 33 root  root     4096 Feb  1  2024 ..
-rw-rw----  1 redis redis   28112 Sep 27 20:56 dump.rdb
-rw-rw----  1 redis redis 4192657 Sep  4 18:38 dump.rdb.old
-rw-rw----  1 redis redis 4191830 Sep 27 16:27 dump.rdb.old.2
-rw-rw----  1 redis redis 4194304 Sep  2 18:27 temp-1337.rdb
-rw-rw----  1 redis redis 4194304 Sep  2 18:26 temp-588.rdb
-rw-rw----  1 redis redis 4194304 Sep  2 18:24 temp-589.rdb
-rw-rw----  1 redis redis 4194304 Sep 27 17:25 temp-596.rdb

On searching for “redis Background saving terminated by signal 31” i found this

redis rdb saving fails with signal 31 on 32bit machine - due to integer overflow? · Issue #13671 · redis/redis

The dump file size almost tallies with that mentioned in the report.

should this file be getting towards the 4mb size?

System Information

System Information

Emoncms

Server

  • CPU: Cortex-A53 | 1 Threads(s) | 4 Core(s) | 1 Sockets(s) | 64.00MIPS |
  • OS: Linux 6.1.0-rpi8-rpi-v7
  • Host: emonpi | emonpi | (192.168.20.3)
  • Date: 2026-09-27 20:29:19 BST
  • Uptime: 20:29:19 up 3:03, 0 user, load average: 0.69, 0.53, 0.47

Memory

  • RAM: Used: 39.56% | Total: 426.74 MB | Used: 168.81 MB | Free: 257.93 MB
  • Swap: Used: 94.69% | Total: 100 MB | Used: 94.69 MB | Free: 5.31 MB

Disk

  • /: Used: 68.96% | Total: 4.39 GB | Used: 3.03 GB | Free: 1.15 GB | Read Load: 6.33 KB/s | Write Load: 2.28 KB/s | Load Time: 3 hours 1 mins
  • /boot/firmware: Used: 18.51% | Total: 509.99 MB | Used: 94.42 MB | Free: 415.57 MB | Read Load: n/a | Write Load: n/a | Load Time: n/a
  • /var/opt/emoncms: Used: 3.97% | Total: 9.68 GB | Used: 393.05 MB | Free: 8.8 GB | Read Load: 24.81 KB/s | Write Load: 269.44 B/s | Load Time: 3 hours 1 mins
  • /var/log: Used: 6.82% | Total: 50 MB | Used: 3.41 MB | Free: 46.59 MB | Read Load: n/a | Write Load: n/a | Load Time: n/a

HTTP

  • Server: Apache/2.4.57 (Raspbian) HTTP/1.1 CGI/1.1 80

MySQL

  • Version: 10.11.3-MariaDB-1+rpi1
  • Host: 127.0.0.1 (127.0.0.1)
  • Date: 2026-09-27 20:29:39 (UTC 01:00)
  • Stats: Uptime: 11004 Threads: 7 Questions: 8321 Slow queries: 0 Opens: 50 Open tables: 43 Queries per second avg: 0.756

PHP

  • Version: 8.1.34 (Zend Version 4.1.34)
  • Run user: User: www-data Group: www-data video Script Owner: pi
  • Modules: apache2handler , calendar , Core , ctype , curl , date , dom v20031129, exif , FFI , fileinfo , filter , ftp , gd , gettext , hash , iconv , json , libxml , mbstring , mosquitto v0.4.0, mysqli , mysqlnd vmysqlnd 8.1.34, openssl , pcre , PDO , pdo_mysql , Phar , posix , readline , redis v6.0.3-dev, Reflection , session , shmop , SimpleXML , sockets , sodium , SPL , standard , sysvmsg , sysvsem , sysvshm , tokenizer , xml , xmlreader , xmlwriter , xsl , Zend OPcache , zlib

Redis

  • Redis Server: 7.0.11
  • PHP Redis: 6.0.3-dev
  • Host: localhost:6379
  • Uptime: 0 days

MQTT Server

  • Version: Mosquitto 2.0.11
  • Host: localhost:1883 (127.0.0.1)

Pi

  • Model: BCM2835
  • Serial num.: 764A9087
  • GPU Temperature: 42.9°C
  • File-system: read-write
  • emonpiRelease: emonSD-01Feb24
Client Information

Client Information

  • Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36 Edg/154.0.0.0
  • IP: 192.168.xx.xx
  • Client Hostname: 192.168.xx.xx

Can you run these commands to check the redis persistance settings:

redis-cli config get save
redis-cli info persistence | grep -E 'rdb_last_bgsave_status|rdb_saves|rdb_changes'
grep -n -E '^\s*#?\s*save' /etc/redis/redis.conf

Then you could run:

sudo sed -i -E 's/^\s*save\s/# &/' /etc/redis/redis.conf
echo 'save ""' | sudo tee -a /etc/redis/redis.conf
sudo sed -i -E 's/^\s*appendonly\s+yes/appendonly no/' /etc/redis/redis.conf

To disable redis saving, followed by:

sudo systemctl restart redis-server

Redis shouldnt be saving to disk, Il have to spin up a emonSD–01Feb24 image to see if we missed this on that image build! It shouldnt have as it’s in the build script: EmonScripts/install/redis.sh at master · openenergymonitor/EmonScripts · GitHub

Hello Trystan,

pi@emonpi:~ $ redis-cli config get save
1) "save"
2) "3600 1 300 100 60 10000"

pi@emonpi:~ $ redis-cli info persistence | grep -E 'rdb_last_bgsave_status|rdb_saves|rdb_changes' grep -n -E '^\s*#?\s*save' /etc/redis/redis.conf
grep: grep: No such file or directory
grep: ^\s*#?\s*save: No such file or directory
grep: /etc/redis/redis.conf: Permission denied

pi@emonpi:~ $ sudo sed -i -E 's/^\s*save\s/# &/' /etc/redis/redis.conf echo 'save ""' | sudo tee -a /etc/redis/redis.conf
sed: can't read echo: No such file or directory
sed: can't read save "": No such file or directory

pi@emonpi:~ $ sudo sed -i -E 's/^\s*appendonly\s+yes/appendonly no/' /etc/redis/redis.conf
pi@emonpi:~ $

To an untrained eye that doesn’t seem to have been sucessfull

redis.conf seems to exist:

pi@emonpi:~ $ sudo systemctl restart redis-server
pi@emonpi:~ $ sudo ls -la /etc/redis/
total 116
drwxrws---   2 redis redis   4096 Sep 29 21:53 .
drwxr-xr-x 101 root  root    4096 Sep 29 18:18 ..
-rw-r-----   1 redis redis 106612 Sep 29 21:53 redis.conf

pi@emonpi:~ $ redis-cli info persistence
# Persistence
loading:0
async_loading:0
current_cow_peak:0
current_cow_size:0
current_cow_size_age:0
current_fork_perc:0.00
current_save_keys_processed:0
current_save_keys_total:0
rdb_changes_since_last_save:10477
rdb_bgsave_in_progress:0
rdb_last_save_time:1790715418
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_saves:0
rdb_last_cow_size:0
rdb_last_load_keys_expired:0
rdb_last_load_keys_loaded:289
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_rewrites:0
aof_rewrites_consecutive_failures:0
aof_last_write_status:ok
aof_last_cow_size:0
module_fork_in_progress:0
module_fork_last_cow_size:0

using nano from redis.conf (extract):

############################## APPEND ONLY MODE ###############################

# By default Redis asynchronously dumps the dataset on disk. This mode is
# good enough in many applications, but an issue with the Redis process or
# a power outage may result into a few minutes of writes lost (depending on
# the configured save points).
#
# The Append Only File is an alternative persistence mode that provides
# much better durability. For instance using the default data fsync policy
# (see later in the config file) Redis can lose just one second of writes in a
# dramatic event like a server power outage, or a single write if something
# wrong with the Redis process itself happens, but the operating system is
# still running correctly.
#
# AOF and RDB persistence can be enabled at the same time without problems.
# If the AOF is enabled on startup Redis will load the AOF, that is the file
# with the better durability guarantees.
#
# Please check https://redis.io/topics/persistence for more information.

appendonly no

# The base name of the append only file.
#
# Redis 7 and newer use a set of append-only files to persist the dataset
# and changes applied to it. There are two basic types of files in use:
#
# - Base files, which are a snapshot representing the complete state of the
#   dataset at the time the file was created. Base files can be either in
#   the form of RDB (binary serialized) or AOF (textual commands).
# - Incremental files, which contain additional commands that were applied
#   to the dataset following the previous file.
#