3

In my varnish default.vcl i have the following code:

include "vars.vcl";

When i try to start my varnish i get this error message:

Message from VCC-compiler:
Cannot read file 'vars.vcl': No such file or directory
('input' Line 6 Pos 9)
include "vars.vcl";
--------##########-

Running VCC-compiler failed, exited with 2

VCL compilation failed

The file 'vars.vcl' is in the directory /etc/varnish/ where also the default.vcl is stored. it is a symlink to the actual vars.vcl.

I have no idea why the include won't work, could it be that varnish can't work with symlinks? Why can't it find the file?

Nafta
  • 71
  • 1
  • 7
  • I just tried reloading varnish with a include to a symlink-vcl on the same block device - that wasn't a problem at all. Maybe it wouldn't work if it's on another volume? Is the default.vcl also a symlink to somewhere else? For clarification please also try specifying the absolute path to the symlink-vcl (eg. /etc/varnish/vars.vcl) – r_3 Nov 28 '14 at 13:25
  • double checked vars.vcl permissions? – DRC Nov 28 '14 at 13:27
  • the default vcl is not a symlink. the vars.vcl is in my user diretory, the path is `accountname\projects\...\vars.vcl`. the vars.vcl is readable by everyone – Nafta Nov 28 '14 at 13:31
  • @Nafta just being pedantic, the varnish user has access to the dir all the way down to that file, right? and then, why separating paths with backslashes, is that windows? – DRC Nov 28 '14 at 16:43
  • I bumped into the same problem while changing configuration paths. I ended up adding the absolute path (/etc/varnish/file.vcl) and that worked. – dabito Dec 11 '14 at 20:59

3 Answers3

5

You have to pass the parameter vcl_dir to varnishd. You can test it with:

varnishd -p vcl_dir=/path/to/vars.vcl -C -f default.vcl
2

As @francisv mention you have to pass the directory location with -p(parameter)

vcl_dir is deprecated in 6.1.0 version so you have to use vcl_path instead

varnishd -p vcl_path=/path/to/vars.vcl -C -f default.vcl

Just make sure path name should start from / other wise it won't work

RAVI SINGH
  • 379
  • 2
  • 7
0

I had the same issue when upgrading from Varnish 6.5 to 6.6. It is solved with

include "./vars.vcl";
Thomasleveil
  • 95,867
  • 15
  • 119
  • 113