Trusty environment: redis-server not starting with redis-tools installed

As of yesterday, installing both redis-server and redis-tools in Trusty causes Redis not to start. I have a small repo to reproduce this issue, using a minimal .travis.yml file:

dist: trusty
sudo: false
addons:
  apt:
    packages:
    - redis-tools
services:
  - redis-server
script: echo PING | nc localhost 6379

This fails because Redis did not start up correctly, and is not available on port 6379.

You can see an installation error in the logs (sample run):

Preparing to unpack .../redis-server_5%3a5.0.0-3chl1~trusty1_amd64.deb ...
runlevel:/var/run/utmp: No such file or directory
Stopping redis-server: redis-server.
Unpacking redis-server (5:5.0.0-3chl1~trusty1) over (4:4.0.6-1chl1~trusty1) ...
dpkg: warning: unable to delete old directory '/etc/redis/redis-server.post-up.d': Directory not empty
dpkg: warning: unable to delete old directory '/etc/redis/redis-server.post-down.d': Directory not empty
dpkg: warning: unable to delete old directory '/etc/redis/redis-server.pre-up.d': Directory not empty
dpkg: warning: unable to delete old directory '/etc/redis/redis-server.pre-down.d': Directory not empty

As far as I can tell, this started failing recently due to a new version of Redis published to the Chris Lea PPA (5:5.0.0-3chl1~trusty1, published 3 November 2018). Before that, this configuration was working.

If I don’t include the redis-tools package, then the build passes. I’m not sure why.

1 Like

I dug into this a little bit, and it appears to me that the newer package now tries to bind to IPv6 ::1 as well as 127.0.0.1. IPv6 is not available on our images, so the server fails to start. You’ll have to remove ::1 from /etc/redis/redis.conf after the new package has been installed, and start the service after that.

before_install:
  - sudo sed -e 's/^bind.*/bind 127.0.0.1/' /etc/redis/redis.conf > redis.conf
  - sudo mv redis.conf /etc/redis
  - sudo service redis-server start
  - echo PING | nc localhost 6379
1 Like

Thank you for the fix! That makes sense. :slight_smile:

Thanks - stumbled over the same issue. This is a bit shorter and solved it for me:

before_install:
   sudo service redis-server start --bind 127.0.0.1
1 Like