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

**URL:** <https://travis-ci.community/t/trusty-environment-redis-server-not-starting-with-redis-tools-installed/650>\
**Category:** Linux\
**Tags:** redis\
**Created:** [November 4, 2018, 6:47pm UTC](https://travis-ci.community/t/trusty-environment-redis-server-not-starting-with-redis-tools-installed/650 "2018-11-04T18:47:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nolanlawson](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/nolanlawson/32/353_2.png) [@nolanlawson](https://travis-ci.community/u/nolanlawson)\
**Post date:** [November 4, 2018, 6:47pm UTC](https://travis-ci.community/t/trusty-environment-redis-server-not-starting-with-redis-tools-installed/650/1 "2018-11-04T18:47:41Z")

</div>

As of yesterday, installing both `redis-server` and `redis-tools` in Trusty causes Redis not to start. I have a [small repo](https://github.com/nolanlawson/repro-travis-redis-issue) to reproduce this issue, using a minimal `.travis.yml` file:

```auto
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](https://travis-ci.org/nolanlawson/repro-travis-redis-issue/builds/450554140)):

```auto
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.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [November 5, 2018, 1:54pm UTC](https://travis-ci.community/t/trusty-environment-redis-server-not-starting-with-redis-tools-installed/650/2 "2018-11-05T13:54:05Z")

</div>

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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![nolanlawson](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/nolanlawson/32/353_2.png) [@nolanlawson](https://travis-ci.community/u/nolanlawson)\
**Post date:** [November 5, 2018, 4:35pm UTC](https://travis-ci.community/t/trusty-environment-redis-server-not-starting-with-redis-tools-installed/650/3 "2018-11-05T16:35:26Z")

</div>

Thank you for the fix! That makes sense. 🙂

---

<div class="post-metadata">

**Author:** ![karussell](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@karussell](https://travis-ci.community/u/karussell)\
**Post date:** [December 5, 2018, 5:45pm UTC](https://travis-ci.community/t/trusty-environment-redis-server-not-starting-with-redis-tools-installed/650/4 "2018-12-05T17:45:31Z")

</div>

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

```auto
before_install:
   sudo service redis-server start --bind 127.0.0.1

```
