3

I have got a question and hope that somebody can help me. I own a vServer on a OpenVZ basis (I hate the kernel limitation) and can't install Redis.

What do I do:

  • Clean install Ubuntu 16.04. LTS minimal
  • Login as root
  • run: apt update
  • run: apt upgrade

(I don't know if this is relevant, but this appears during the process:

Installing new version of config file /etc/systemd/system.conf ... addgroup: The group `systemd-journal' already exists as a system group. Exiting. [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring. Failed to validate path /var/run/sshd: Too many levels of symbolic links Failed to validate path /var/run/sudo: Too many levels of symbolic links Failed to validate path /var/run/sudo/ts: Too many levels of symbolic links (Reading database ... 16369 files and directories currently installed.)

  • run: apt install redis-server

Problem appears:

Setting up redis-server (2:3.0.6-1) ...

fchownat() of /run/redis failed: Invalid argument

insserv: warning: script is corrupt or invalid: /etc/init.d/../rc2.d/S15ssh_gen_host_keys

Job for redis-server.service failed because a timeout was exceeded. See "systemctl status redis-server.service" and "journalctl -xe" for details.

invoke-rc.d: initscript redis-server, action "start" failed.

...

Process: 11845 ExecStopPost=/bin/run-parts --verbose /etc/redis/redis-server.p ost-down.d (code=exited, status=0/SUCCESS)

Process: 11839 ExecStartPost=/bin/run-parts --verbose /etc/redis/redis-server. post-up.d (code=exited, status=0/SUCCESS)

Process: 11837 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exi ted, status=0/SUCCESS)

Process: 11833 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-server.p re-up.d (code=exited, status=0/SUCCESS)

systemd[1]: Failed to start Advanced key-value ....

systemd[1]: redis-server.service: Unit entered ....

systemd[1]: redis-server.service: Failed with r....

Hint: Some lines were ellipsized, use -l to show in full.

dpkg: error processing package redis-server (--configure): subprocess installed post-installation script returned error exit status 1

Processing triggers for libc-bin (2.23-0ubuntu10) ...

Processing triggers for systemd (229-4ubuntu21.9) ...

Processing triggers for ureadahead (0.100.0-19) ...

Errors were encountered while processing: redis-server

E: Sub-process /usr/bin/dpkg returned an error code (1)

W: Operation was interrupted before it could finish

  • run: systemctl status redis-server.service

redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled) Active: activating (start-post) since Mon 2018-11-19 19:41:53 CET; 54s ago Docs: http://redis.io/documentation, man:redis-server(1) Process: 11966 ExecStopPost=/bin/run-parts --verbose /etc/redis/redis-server.post-down.d (code=exited, status=0/SUCC
Process: 11978 ExecStartPost=/bin/run-parts --verbose /etc/redis/redis-server.post-up.d (code=exited, status=0/SUCCE
Process: 11976 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS) Process: 11972 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d (code=exited, status=0/SUCCESS CGroup: /system.slice/redis-server.service └─11977 /usr/bin/redis-server 127.0.0.1:6379

systemd[1]: Starting Advanced key-value store...

run-parts[11972]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example

run-parts[11978]: run-parts: executing /etc/redis/redis-server.post-up.d/00_example

systemd[1]: redis-server.service: PID file /var/run/redis/redis-server.pid not readable (

After that I can't start Redis-Server (failed because a timeout was exceeded). What can I do to fix this problem? I saw many threads about redis in this forum, but the solutions didn't help me. Sorry for my bad english. Thanks in advance.

Firehead
  • 31
  • 1
  • 3
  • Welcome! Run commands `ls -lah /var/run/redis/redis-server.pid` and `ls -lah /var/run/redis/` then show returns for both here. – slava Nov 19 '18 at 18:56
  • ls: cannot access '/var/run/redis/redis-server.pid': No such file or directory – Firehead Nov 19 '18 at 18:59
  • total 0 | drwxrwsr-x 2 root root 40 . | rrwxr-xr-x 13 root root 440 .. – Firehead Nov 19 '18 at 19:01
  • try with root user run `chmod -R 777 /var/run/redis/` then run redis server again. – slava Nov 19 '18 at 19:03
  • Now `-rw-r--r-- 1 redis root 6 Nov 19 20:07 /var/run/redis/redis-server.pid` – Firehead Nov 19 '18 at 19:09
  • And `total 4.OK` `drwxrwsrwx 2 root root 60 .` `drwxr-xr-x 13 root root 440 ..` `-rw-r--r-- 1 redis root 6 redis-server.pid` – Firehead Nov 19 '18 at 19:11
  • As i see `redis-server.pid` is created. Redis still not work? – slava Nov 19 '18 at 19:13
  • still not working :( – Firehead Nov 19 '18 at 19:26
  • hmm, redis works when I install it before the first `apt update && apt upgrade`. So something is wrong within the upgrade – Firehead Nov 20 '18 at 07:58
  • When I upgrade after the install of redis, redis is still working. But when I send the `reboot` command, the server doesn't reboot anymore and I have to reinstall the image. – Firehead Nov 20 '18 at 08:08
  • Hi @Firehead! Our Ubuntu 16.04 server automatically updated itself at 2018-11-20 04:00 CET, and SSH stopped to work. It could to be somewhat related to your issue as we run two Redis instances on that server. What have you done to get a connection to your server again? Do you have errors related to `systemd-tmpfiles` in your log files? – ominug Nov 20 '18 at 23:06

1 Answers1

3

To fix your error: Install Redis as non-root user.

sudo apt-get update
sudo apt-get install build-essential tcl

Download and Extract the Source Code

cd /tmp

Now, download the latest stable version of Redis. This is always available at a stable download URL:

curl -O http://download.redis.io/redis-stable.tar.gz

Unpack the tarball by typing:

tar xzvf redis-stable.tar.gz

Move into the Redis source directory structure that was just extracted:

cd redis-stable

Build and Install Redis

Compiling dependencies:

cd deps
sudo make hiredis jemalloc linenoise lua geohash-int
cd ..

Compile the Redis binaries by typing:

make

After the binaries are compiled, run the test suite to make sure everything was built correctly. You can do this by typing:

make test

This will typically take a few minutes to run. Once it is complete, you can install the binaries onto the system by typing:

sudo make install

Begin by creating the redis user and group. This can be done in a single command by typing:

sudo adduser --system --group --no-create-home redis

Now, we can create the /var/lib/redis directory by typing:

sudo mkdir /var/lib/redis

We should give the redis user and group ownership over this directory:

sudo chown redis:redis /var/lib/redis

Adjust the permissions so that regular users cannot access this location:

sudo chmod 770 /var/lib/redis

Starting Redis

Start up the systemd service by typing:

sudo systemctl start redis

Check that the service had no errors by running:

sudo systemctl status redis

Source: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04

slava
  • 3,787
  • 9
  • 30
  • 65
  • make[1]: Entering directory '/tmp/redis-stable/src' CC Makefile.dep CC adlist.o In file included from adlist.c:34:0: zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory compilation terminated. Makefile:232: recipe for target 'adlist.o' failed make[1]: *** [adlist.o] Error 1 make[1]: Leaving directory '/tmp/redis-stable/src' Makefile:6: recipe for target 'all' failed make: *** [all] Error 2 – Firehead Nov 19 '18 at 19:27
  • try run: `cd deps` `sudo make hiredis jemalloc linenoise lua geohash-int` `cd ..` `sudo make install` separately – slava Nov 19 '18 at 19:31
  • thanks, I will try this later, server refuses connection, don't know why :D – Firehead Nov 19 '18 at 19:35
  • that didn't work neither -- make test: [exception]: Executing test client: couldn't open socket: no buffer space available. couldn't open socket: no buffer space available... – Firehead Nov 19 '18 at 22:14
  • try run `redis-cli` in command-line to check installation.. Redis socket you may setup separately (this is another question related redis setup. Example: https://guides.wp-bullet.com/how-to-configure-redis-to-use-unix-socket-speed-boost/) – slava Nov 20 '18 at 06:31
  • result is: `Could not connect to Redis at 127.0.0.1:6379: Connection refused` – Firehead Nov 20 '18 at 11:43