Redis-server fails to start in VM

Playing around with --vm and i run into a problem with redis-server failing to start.

systemctl status redis-server
● redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
    Drop-In: /run/systemd/system/service.d
             └─zzz-lxc-service.conf
     Active: failed (Result: exit-code) since Thu 2021-07-22 03:18:15 UTC; 1min 33s ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
    Process: 965 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=1/FAILURE)

Jul 22 03:18:15 mail5 systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 5.
Jul 22 03:18:15 mail5 systemd[1]: Stopped Advanced key-value store.
Jul 22 03:18:15 mail5 systemd[1]: redis-server.service: Start request repeated too quickly.
Jul 22 03:18:15 mail5 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Jul 22 03:18:15 mail5 systemd[1]: Failed to start Advanced key-value store.

journal log says:

Jul 22 03:32:20 mail5 redis-server[2312]: *** FATAL CONFIG FILE ERROR ***
Jul 22 03:32:20 mail5 redis-server[2312]: Reading the configuration file, at line 175
Jul 22 03:32:20 mail5 redis-server[2312]: >>> 'logfile /var/log/redis/redis-server.log'
Jul 22 03:32:20 mail5 redis-server[2312]: Can't open the log file: Read-only file system
Jul 22 03:32:20 mail5 systemd[1]: redis-server.service: Control process exited, code=exited, status=1/FAILURE
Jul 22 03:32:20 mail5 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Jul 22 03:32:21 mail5 systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 4.
Jul 22 03:32:21 mail5 redis-server[2313]: *** FATAL CONFIG FILE ERROR ***
Jul 22 03:32:21 mail5 redis-server[2313]: Reading the configuration file, at line 175
Jul 22 03:32:21 mail5 redis-server[2313]: >>> 'logfile /var/log/redis/redis-server.log'
Jul 22 03:32:21 mail5 redis-server[2313]: Can't open the log file: Read-only file system
Have been running redis-serve in a nextcloud container without these Problems

I had a no such problem installing nextcloud with redis-server last year inside a container.

lxc info mail5

Name: mail5
Location: none
Remote: unix://
Architecture: x86_64
Created: 2021/07/22 19:44 UTC
Status: Running
Type: virtual-machine
Profiles: mail
Pid: 515242
Ips:
  enp5s0:       inet    aaa.bbb.ccc.ddd
  enp5s0:       inet6   ddddd::ccc:bbbb:aaaa:xxxx
  lo:   inet    127.0.0.1
  lo:   inet6   ::1
Resources:
  Processes: 80
  Disk usage:
    root: 1.77GB
  CPU usage:
    CPU usage (in seconds): 1574
  Memory usage:
    Memory (current): 3.34GB
    Memory (peak): 3.57GB
  Network usage:
    lo:
      Bytes received: 5.19MB
      Bytes sent: 5.19MB
      Packets received: 57540
      Packets sent: 57540
    enp5s0:
      Bytes received: 521.53MB
      Bytes sent: 8.25MB
      Packets received: 379379
      Packets sent: 99707

The errors suggest that your filesystem is read only, this can happen if your are experiencing a disk failure or perhaps you’ve run out of disk space.

redis-server[2313]: Can't open the log file: Read-only file system

It looks like @tomp is right - you’re attempting to write to a readonly fs.

I had a no such problem installing nextcloud with redis-server last year inside a container.

I like to use redis a fair bit and for me it’s the most reliable when built from source - I wrote a script that does as such - I generally run this first-thing after spining up a new debian/ubuntu instance; hope it helps.

#!/bin/bash

declare -a DEPS=( 
                    "pkg-config"
                    "gcc"
                    "autoconf"
                    "libtool"
                    "libgmp-dev"
                    "automake"
                    "python3"
                    "python3-mako"
                    "net-tools"
                    "zlib1g-dev"
                    "libsodium-dev"
                    "build-essential"
                    "make"
                    "libpq-dev"
                    "software-properties-common"
                    "curl"
                    "wget"
                    "ca-certificates"
                    "openssl"
                    "jq"
                    "ncat"
                    "tcl"
                    "git"
                    "magic-wormhole"
                    "libssl-dev"
                    "libjemalloc-dev"
                    "gnutls-bin"
                    "tclcurl"
                    "acl"
                    "autoconf"
                    "libacl1-dev"
                    "libcap-dev"
                    "libudev-dev"
                    "libtool"
                    "dnsmasq-base"
                    "snapd"
                    "libgsl-dev"
                    "libgbtools-dev"
                    "gawk"
                    "snapd"
                )

apt install -y ${DEPS[@]} 
apt update -y 
apt upgrade -y 
apt autoremove -y


tarfile="redis-stable.tar.gz"
url="http://download.redis.io/redis-stable.tar.gz"
REDISPORT=${1:-6379}
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/${REDISPORT}.conf"

cd /
rm -rf $tarfile
wget $url
tar -xzf $tarfile
mkdir -p /var/redis && mkdir -p /etc/redis && mkdir -p /var/redis/${REDISPORT}

cd /redis-stable
make distclean
make test
ln -s /redis-stable/src/redis-server /usr/local/bin/redis-server
ln -s /redis-stable/src/redis-cli /usr/local/bin/redis-cli
ln -s /redis-stable/redis.conf /etc/redis/${REDISPORT}.conf
ln -s /redis-stable/utils/redis_init_script /etc/init.d/redis_${REDISPORT}

update-rc.d redis_${REDISPORT} defaults

Sorry that it took me a while to find the time and come back this problem.

Plenty of disk space on this server.

root@mail7:~# ll /var/log/redis/
total 8
drwxr-s---  2 redis adm    4096 Aug  6 17:19 ./
drwxrwxr-x 15 root  syslog 4096 Aug  6 17:37 ../
root@mail7:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.8G     0  1.8G   0% /dev
tmpfs           366M  868K  365M   1% /run
/dev/sda2        27G  2.8G   25G  11% /
tmpfs           1.8G   68K  1.8G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.8G     0  1.8G   0% /sys/fs/cgroup
tmpfs            50M   11M   40M  21% /run/lxd_agent
/dev/sda1        99M  3.2M   96M   4% /boot/efi

I can write and create files like i tried testing with creating the /var/log/redis/redis-server.log file, the folder had already been created by the installer but not the log file itself, chmod and chown works too on the manually created file but redis-server will not start.

Upon further investigation i realized that i missed something in the log.

Systemctl start redis-server log error is either reporting,

redis-server[297187]: Can’t open the log file: Read-only file system

OR

redis-server[297183]: Can’t open the log file: Permission denied

when testing different chown options in the virtual machine.

So i still do not understand why installing redis-server in a container via apt works fine but not in a virtual machine.
Isn’t the virtual machine supposed to be a slower bare metal qemu, what am i missing?

Ordered New Bare Metal Server and at voila no problem to install redis-server in a vm.

Turns out there is something wrong, with my 20.04 LTS Server that used to be a 18.04 LTS that i had upgraded a while back and during that upgrade i got disconnected and also the updater setup screen console had died.
Back then i thought luckily i can LARA in, a service provided by hetzner and work as if i was siting in front of the Servers Monitor which seemed to work fine.
I had followed a guide and was able to continue with the update but this better not happen on my next LTS upgrade.
My other containers have been working fine since then also.
I lack knowledge, time and will to figure out what exactly went wrong.

Just wanted to close this thread and leave this note here in case anyone else runs into this.
Thanks for the tips and suggestions.