Mailing List Archive

varnishd gives 'Cannot create working directory' error
I'm trying to install varnish with some help from a friend who knows a lot
more about Linux. Since I copied his instructions exactly, I know exactly
what I typed to install it. I followed all of the steps below, but still
whne I try to start varnishd I get the error:

[root at sls-ce3p12 ~]# /etc/rc.d/init.d/varnishd start
Starting varnishd: Cannot create working directory
'NONE/var/varnish/sls-ce3p12'
: No such file or directory

Here's everything I did to get installed:

cd /usr/tmp
wget wget
http://downloads.sourceforge.net/varnish/varnish-1.1.1.tar.gz?modtime=1187647873&big_mirror=0
tar xzvf varnish-1.1.1.tar.gz
cd varnish-1.1.1
yum install gcc
./configure
yum install ncurses-devel
make
make install

Then I put everything between the ">>>" lines into /etc/vcl.conf :
>>>
backend www {
set backend.host = "localhost";
set backend.port = "8080";
}

sub vcl_recv {
if (req.request == "GET" && req.url ~ "\.(gif|jpg|swf|css|js)$") {
lookup;
}
}
>>>

Then I put everything between the ">>>" lines into
/etc/rc.d/init.d/varnishd:
>>>
#!/bin/bash
#
# varnishd Startup script for the Varnishd proxy
#
# chkconfig: - 85 15
# description: Varnish is a state-of-the-art, high-performance HTTP
# accelerator.
#
# processname: httpd
# config: /etc/vcl.conf
# pidfile: /var/run/varnishd.pid

# Source function library.
. /etc/rc.d/init.d/functions

# various paths
varnishd=/usr/local/sbin/varnishd
prog=varnishd
pidfile=/var/run/varnishd.pid
lockfile=/var/lock/subsys/varnishd
RETVAL=0

# startup options

options='-T localhost:81 -f /etc/vcl.conf'

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init
scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
daemon $varnishd $options
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $varnishd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $varnishd
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $prog {start|stop|restart|status}"
exit 1
esac

exit $RETVAL
>>>

chkconfig --add varnishd
chkconfig --level 345 varnishd on
/etc/rc.d/init.d/httpd stop

And then finally I tried to run:
/etc/rc.d/init.d/varnishd start

and got the error:

Starting varnishd: Cannot create working directory
'NONE/var/varnish/sls-ce3p12'
: No such file or directory

What should I do?

-Bennett

bennett at peacefire.org http://www.peacefire.org
(425) 497 9002
varnishd gives 'Cannot create working directory' error [ In reply to ]
----- "Bennett Haselton" <bennett at peacefire.org> wrote:
> [root at sls-ce3p12 ~]# /etc/rc.d/init.d/varnishd start
> Starting varnishd: Cannot create working directory
> 'NONE/var/varnish/sls-ce3p12'
> : No such file or directory

Try :
"mkdir /var/varnish"

check which user varnish is run under in your configuration, and chown /var/varnish to that user.

"chown varnish:varnish /var/varnish"

Then try starting varnish again, should do the trick really.

Regards
--
Denis
varnishd gives 'Cannot create working directory' error [ In reply to ]
At 09:58 AM 10/21/2007 +0200, =?utf-8?Q?Denis_Br=C3=A6khus?= wrote:
>----- "Bennett Haselton" <bennett at peacefire.org> wrote:
> > [root at sls-ce3p12 ~]# /etc/rc.d/init.d/varnishd start
> > Starting varnishd: Cannot create working directory
> > 'NONE/var/varnish/sls-ce3p12'
> > : No such file or directory
>
>Try :
>"mkdir /var/varnish"
>
>check which user varnish is run under in your configuration, and chown
>/var/varnish to that user.

Denis, thanks. How do I determine which user varnish is run under?

>"chown varnish:varnish /var/varnish"

I tried that command but I got the error "chown: `varnish:varnish': invalid
user".

>Then try starting varnish again, should do the trick really.
>
>Regards
>--
>Denis
varnishd gives 'Cannot create working directory' error [ In reply to ]
Re-sending this to the whole list...

At 03:15 AM 10/21/2007 -0700, =?utf-8?Q?Denis_Br=C3=A6khus?= wrote:
>At 11:14 AM 10/21/2007 +0200, =?utf-8?Q?Denis_Br=C3=A6khus?= wrote:
>>----- "Bennett Haselton" <bennett at peacefire.org> wrote:
>> > Denis, thanks. How do I determine which user varnish is run under?
>> > >"chown varnish:varnish /var/varnish"
>> > I tried that command but I got the error "chown: `varnish:varnish':
>> > invalid
>> > user".
>>
>>Did you try starting varnish again? If it throws the same error, try :
>
>Yes, I still get the error:
>Starting varnishd: Cannot create working directory
>'NONE/var/varnish/sls-ce3p12'
>: No such file or directory
>
>>"chmod 777 /var/varnish"
>>and then start varnish.
>
>Here I run into the same problem -- I did
>chmod 777 /var/varnish
>but then when I try to run
>/etc/rc.d/init.d/varnishd start
>I still get the error:
>
>Starting varnishd: Cannot create working directory
>'NONE/var/varnish/sls-ce3p12': No such file or directory
>
>I think that what's obviously happening, is that somewhere in the code is
>some option where you can specify something to go in front of the root
>directory /var/varnish , and some configuration setting somewhere is
>saying "NONE", and the program is taking that literally and putting "NONE"
>in front, so it can't find the directory. But I have no idea where that's
>happening.
>
>Thanks for your help so far though!
>
>>Then :
>>
>>"ps axf | grep varnish" and see which user it runs as. Then :
>>
>>"chmod 640 /var/varnish ; chown USER:USER /var/varnish" (substitute USER
>>with the user you got when checking ps).
>>
>>Regards
>>--
>>Denis
varnishd gives 'Cannot create working directory' error [ In reply to ]
bennett,
i had the same issue a week ago.
Did you check that you have not many instances of varnishd ?
I was using a varnishd from a compile without the --prefix option,
when i thought i was using the other compiled with --prefix
/opt/varnish
try removing all varnish* and recompile all the package.
Damien,


Bennett Haselton writes:
> Re-sending this to the whole list...
>
> At 03:15 AM 10/21/2007 -0700, =?utf-8?Q?Denis_Br=C3=A6khus?= wrote:
> >At 11:14 AM 10/21/2007 +0200, =?utf-8?Q?Denis_Br=C3=A6khus?= wrote:
> >>----- "Bennett Haselton" <bennett at peacefire.org> wrote:
> >> > Denis, thanks. How do I determine which user varnish is run under?
> >> > >"chown varnish:varnish /var/varnish"
> >> > I tried that command but I got the error "chown: `varnish:varnish':
> >> > invalid
> >> > user".
> >>
> >>Did you try starting varnish again? If it throws the same error, try :
> >
> >Yes, I still get the error:
> >Starting varnishd: Cannot create working directory
> >'NONE/var/varnish/sls-ce3p12'
> >: No such file or directory
> >
> >>"chmod 777 /var/varnish"
> >>and then start varnish.
> >
> >Here I run into the same problem -- I did
> >chmod 777 /var/varnish
> >but then when I try to run
> >/etc/rc.d/init.d/varnishd start
> >I still get the error:
> >
> >Starting varnishd: Cannot create working directory
> >'NONE/var/varnish/sls-ce3p12': No such file or directory
> >
> >I think that what's obviously happening, is that somewhere in the code is
> >some option where you can specify something to go in front of the root
> >directory /var/varnish , and some configuration setting somewhere is
> >saying "NONE", and the program is taking that literally and putting "NONE"
> >in front, so it can't find the directory. But I have no idea where that's
> >happening.
> >
> >Thanks for your help so far though!
> >
> >>Then :
> >>
> >>"ps axf | grep varnish" and see which user it runs as. Then :
> >>
> >>"chmod 640 /var/varnish ; chown USER:USER /var/varnish" (substitute USER
> >>with the user you got when checking ps).
> >>
> >>Regards
> >>--
> >>Denis
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
varnishd gives 'Cannot create working directory' error [ In reply to ]
Bennett Haselton <bennett at peacefire.org> writes:
> [root at sls-ce3p12 ~]# /etc/rc.d/init.d/varnishd start
> Starting varnishd: Cannot create working directory
> 'NONE/var/varnish/sls-ce3p12'
> : No such file or directory

This is caused by a bug in the configure script. You should re-run
configure with an explicit --prefix, rebuild and reinstall.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no