So you’re stuck in systemctl start varnish
, now what?
Well, by default, systemd won’t tell you much.
$ systemctl start varnish Job for varnish.service failed. See 'systemctl status varnish.service' and 'journalctl -xn' for details.
View the status of the service:
$ systemctl status varnish varnish.service - Varnish a high-perfomance HTTP accelerator Loaded: loaded (/usr/lib/systemd/system/varnish.service; enabled) Active: failed (Result: exit-code) since Sun 2015-03-15 21:07:41 CET; 15s ago Process: 10062 ExecStart=/usr/sbin/varnishd -P /var/run/varnish.pid -f $VARNISH_VCL_CONF -a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} -t $VARNISH_TTL -u $VARNISH_USER -g $VARNISH_GROUP -S $VARNISH_SECRET_FILE -s $VARNISH_STORAGE $DAEMON_OPTS (code=exited, status=2) Process: 10049 ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF (code=exited, status=0/SUCCESS) Main PID: 6187 (code=exited, status=0/SUCCESS) site.be varnishd[10049]: .miss_func = VGC_function_vcl_miss, site.be varnishd[10049]: .hit_func = VGC_function_vcl_hit, site.be varnishd[10049]: .deliver_func = VGC_function_vcl_deliver, site.be varnishd[10049]: .synth_func = VGC_function_vcl_synth, site.be varnishd[10049]: .backend_fetch_func = VGC_function_vcl_backend_fetch, site.be varnishd[10049]: .backend_response_func = VGC_function_vcl_backend_response, site.be varnishd[10049]: .backend_error_func = VGC_function_vcl_backend_error, site.be varnishd[10049]: .init_func = VGC_function_vcl_init, site.be varnishd[10049]: .fini_func = VGC_function_vcl_fini, site.be varnishd[10049]: };
It’ll show the message that Varnish failed to start, and it will show the last 10 lines of output the program sent to stdout/stderr. But in Varnish’ case, that’s just the compiled VCL and it won’t actually tell you the error.
To start, test the syntax of your Varnish 4 VCL file.
$ varnishd -d -f /etc/varnish/default.vcl ... ----------------------------- Varnish Cache CLI 1.0 ----------------------------- ...
If you see a “Varnish Cache CLI”, your VCL compiled and is working. That means the problem could be in the way systemd starts its service.
$ grep systemd /var/log/messages Mar 15 21:07:41 lb01 systemd: Starting Varnish a high-perfomance HTTP accelerator... Mar 15 21:07:41 lb01 systemd: varnish.service: control process exited, code=exited status=2 Mar 15 21:07:41 lb01 systemd: Failed to start Varnish a high-perfomance HTTP accelerator. Mar 15 21:07:41 lb01 systemd: Unit varnish.service entered failed state.
So in this case, systemd failed to start the service with my requested parameters. Check your varnish.service
in /usr/lib/systemd/system/varnish.service
file for any typos or mis-configured environment variables and try again!