Hi,
I'm having a peculiar problem for which I don't see the solution
straight away, perhaps someone can point me in the right direction.
I'm trying to get Varnish 3.0.2 compiled from source to work on a CentOS
6 x64 running on an OpenVZ container (the openvz kernel could be messing
with me here).
If I manually start Varnish in the foreground, it works:
> # varnishd -F -f /usr/local/etc/varnish/default.vcl
> socket(): Address family not supported by protocol
> child (5214) Started
> Child (5214) said Child starts
> Child (5214) said SMF.s0 mmap'ed 104857600 bytes of 104857600
> ^CManager got SIGINT => CTRL+C killed
> Stopping Child
If I try via the service, it fails:
> # service varnish start
> Starting Varnish Cache: [FAILED]
When I strace it, I don't see any immediate problem:
> # strace -e trace=file service varnish start
> execve("/sbin/service", ["service", "varnish", "start"], [/* 18 vars
*/]) = 0
> access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
> open("/etc/ld.so.cache", O_RDONLY) = 3
> open("/lib64/libtinfo.so.5", O_RDONLY) = 3
> open("/lib64/libdl.so.2", O_RDONLY) = 3
> open("/lib64/libc.so.6", O_RDONLY) = 3
> open("/dev/tty", O_RDWR|O_NONBLOCK) = 3
> open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
> open("/proc/meminfo", O_RDONLY) = 3
> stat("/root", {st_mode=S_IFDIR|0550, st_size=4096, ...}) = 0
> stat(".", {st_mode=S_IFDIR|0550, st_size=4096, ...}) = 0
> open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 3
> open("/sbin/service", O_RDONLY) = 3
> open("/etc/init.d/functions", O_RDONLY) = 3
> --- SIGCHLD (Child exited) @ 0 (0) ---
> stat("/etc/sysconfig/i18n", {st_mode=S_IFREG|0644, st_size=47, ...}) =
0
> open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
> open("/etc/profile.d/lang.sh", O_RDONLY) = 3
> stat("/root/.i18n", 0x7fffa8819680) = -1 ENOENT (No such file or
directory)
> stat("/etc/sysconfig/init", {st_mode=S_IFREG|0644, st_size=1153, ...})
= 0
> open("/etc/sysconfig/init", O_RDONLY) = 3
> open("/usr/share/locale/locale.alias", O_RDONLY) = 3
> open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/initscripts.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/usr/share/locale/en_US.utf8/LC_MESSAGES/initscripts.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/usr/share/locale/en_US/LC_MESSAGES/initscripts.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
> open("/usr/share/locale/en.UTF-8/LC_MESSAGES/initscripts.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
> open("/usr/share/locale/en.utf8/LC_MESSAGES/initscripts.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
> open("/usr/share/locale/en/LC_MESSAGES/initscripts.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
> --- SIGCHLD (Child exited) @ 0 (0) ---
> --- SIGCHLD (Child exited) @ 0 (0) ---
> chdir("/") = 0
> stat("/etc/init.d/varnish", {st_mode=S_IFREG|0755, st_size=2851, ...})
= 0
> stat(".", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
> stat("/sbin/env", 0x7fffa881a600) = -1 ENOENT (No such file or
directory)
> stat("/usr/sbin/env", 0x7fffa881a600) = -1 ENOENT (No such file or
directory)
> stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
> stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
> access("/bin/env", X_OK) = 0
> stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
> access("/bin/env", R_OK) = 0
> stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
> stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
> access("/bin/env", X_OK) = 0
> stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
> vaccess("/bin/env", R_OK) = 0
> Starting Varnish Cache: [FAILED]
> --- SIGCHLD (Child exited) @ 0 (0) ---
It fails right after the /bin/env call, which leads me to believe it is
probably environment-related, but I don't see any indication on where to
look.
The init.d script I used is in attachment, that one works fine on all
CentOS 5 x64 machines.
Regards,
Mattias
#! /bin/sh
#
# varnish Control the Varnish Cache
#
# chkconfig: - 90 10
# description: Varnish is a high-perfomance HTTP accelerator # processname:
varnishd # config: /etc/sysconfig/varnish # pidfile: /var/run/varnishd.pid
### BEGIN INIT INFO
# Provides: varnish
# Required-Start: $network $local_fs $remote_fs # Required-Stop: $network
$local_fs $remote_fs # Default-Start:
# Default-Stop:
# Should-Start: $syslog
# Short-Description: start and stop varnishd # Description: Varnish is a
high-perfomance HTTP accelerator ### END INIT INFO
# Source function library.
. /etc/init.d/functions
retval=0
pidfile=/var/run/varnish.pid
exec="/usr/local/sbin/varnishd"
reload_exec="/usr/local/sbin/varnish_reload_vcl"
prog="varnishd"
config="/etc/sysconfig/varnish"
lockfile="/var/lock/subsys/varnish"
# Include varnish defaults
[ -e /etc/sysconfig/varnish ] && . /etc/sysconfig/varnish
start() {
if [ ! -x $exec ]
then
echo $exec not found
exit 5
fi
if [ ! -f $config ]
then
echo $config not found
exit 6
fi
echo -n "Starting Varnish Cache: "
# Open files (usually 1024, which is way too small for varnish)
ulimit -n ${NFILES:-131072}
# Varnish wants to lock shared memory log in memory.
ulimit -l ${MEMLOCK:-82000}
# $DAEMON_OPTS is set in /etc/sysconfig/varnish. At least, one
# has to set up a backend, or /tmp will be used, which is a bad idea.
if [ "$DAEMON_OPTS" = "" ]; then
echo "\$DAEMON_OPTS empty."
echo -n "Please put configuration options in $config"
return 6
else
# Varnish always gives output on STDOUT
daemon --pidfile $pidfile $exec -P $pidfile "$DAEMON_OPTS" >
/dev/null 2>&1
retval=$?
if [ $retval -eq 0 ]
then
touch $lockfile
echo_success
echo
else
echo_failure
echo
fi
return $retval
fi
}
stop() {
echo -n "Stopping Varnish Cache: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
if [ "$RELOAD_VCL" = "1" ]
then
$reload_exec
else
force_reload
fi
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
configtest() {
if [ -f "$VARNISH_VCL_CONF" ]; then
$exec -f "$VARNISH_VCL_CONF" -C -n /tmp > /dev/null && echo "Syntax ok"
else
echo "VARNISH_VCL_CONF is unset or does not point to a file"
fi
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
configtest)
configtest
;;
*)
echo "Usage: $0
{start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc