I'm developing on a Virtual Box on a Mac, and every time I log into the CP, I can log in successfully and click on one (maybe two) links before getting redirected to login again. I tested this on a staging server and it's working, but not in vagrant. However, I can get other things like Wordpress to allow me to login fine on the Vagrant box, so it seems to be some combination of Craft + Vagrant issue.

Any thoughts on where I might look to debug?

Note: I understand this is probably a vagrant issue, but curious if I can get any pointers of where to start looking inside of craft to find the potential problem/incompatibility.


I kind of doubt this is it, but Craft does have a couple of config settings that might be coming into play here.

You can tell if you're being affected by these by looking in your craft/storage/runtime/logs files and see if there are any messages being logged with a [warning] related to not being able to restore session.

If you are being affected by those, try setting both of them to false just to see if that helps.

  • Didn't see that error, but saw this one - Tried to restore session from a cookie, but the given hashed database token value does not appear to belong to the given login name
    – user814584
    Jul 9 '14 at 19:09
  • 1
    Sounds like maybe Varnish isn't letting Craft set the authentication cookie it needs for every authenticated request.
    – Brad Bell
    Jul 9 '14 at 19:17
  • So I watched the storage/runtime/sessions and noticed that the sessions are not getting updated. All that happens is an initial session file is created, but no data is ever added to it, even though the path is write and the settings are 777.
    – user814584
    Jul 10 '14 at 19:38

Something to note is that Vagrant can have issues with syncing a massive amount of files. Without much information, here are a few things to maybe help you narrow it down.

  1. Check the folder sync type in your Vagrant file. Vagrant should use NFS as it offers some improvement over the alternatives.
  2. Ensure that your craft config is not referencing a "hard path" to the storage directory (i.e /home/yourname/site/projectname/storage).
  3. Ensure that virtual box and vagrant are using the latest versions. Virtual box tends to be the culprit with sync issues. In fact, Oracles latest version fails when trying to update itself...

I know thats not too much help but I have found those to be a common issue for my setup.

Also, if you are using git make sure you are ignoring the /storage directory as that will cause the same type of erratic behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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