Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I keep getting a permissions error when trying to dump the Redis .rdb file to my vagrant shared folder. The saves are working fine when going to the default /var/lib/redis location.

A few things I've tried (suggested in various forums / threads):

1) adding the following to /etc/init.d/redis-server:

USER=vagrant
GROUP=vagrant

2) Changing the umask flag to 022 in /etc/init.d/redis-server

3) Opening up permissions on the vagrant shared folder itself.

Pretty sure this one's just going over my head and that I'm doing something wrong. Spent 2 or 3 hours on it though and am starting to lose hair ;)

share|improve this question
    
What OS is hosting vagrant and what OS are you using for your box? –  tchester Oct 2 '13 at 22:35

2 Answers 2

On Ubuntu 13.04 (Raring-Ringtail) Server you need to modify the /etc/init.d/redis-server. Look for the following two sections that need to be changed:

...

start)
  echo -n "Starting $DESC: "
  mkdir -p $RUNDIR
  touch $PIDFILE
  chown redis:redis $RUNDIR $PIDFILE  # <---- Old Line
  chown vagrant:vagrant $RUNDIR $PIDFILE # <---- New Line

...

  # <-- Old Line
  if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS
  # <-- New Line
  if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid vagrant:vagrant --exec $DAEMON -- $DAEMON_ARGS

...

Basically you are looking for instances of the redis:redis (owner / group) text strings and replacing them with the equivalent vagrant:vagrant ones.

If you have run the redis-server at least once under the default redid user then you will also have to change the ownership of the log directory to the vagrant user otherwise the redis server will not restart.

chown -R vagrant:vagrant /var/log/redis

After you have restarted the redid-server you should be able to generate a dump to your /vagrant folder by issuing:

redis-cli save
share|improve this answer

re you using virtualbox as the provider here, or something else. if virtualbox, whats the host environment?

It might help to show us the error message you get, or (better) the point in strace output where the failure occurs. I'm wondering what exactly the failed operation is. Opening a file? Obtaining a lock?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.