Mailing List Archive

opensuse 42.2 systemd varnishlog.service fails to start after system reboot
Hello Varnish Community,

I'm running an openSUSE 42.2 server with varnish 5.1.2

My problem is that varnishlog.service always fails starting after a
system reboot.

cx40:~ # systemctl status varnishlog.service
? varnishlog.service - Varnish log generator
Loaded: loaded (/etc/systemd/system/varnishlog.service; enabled;
vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-08-09 16:30:47
CEST; 1min 7s ago
Process: 1162 ExecStart=/usr/sbin/varnishncsa $VARNISHLOG_PARAMS -P
/var/run/varnishlog.pid (code=exited, status=1/FAILURE)
Main PID: 1162 (code=exited, status=1/FAILURE)

Aug 09 16:30:42 cx40 systemd[1]: Started Varnish log generator.
Aug 09 16:30:42 cx40 varnishncsa[1162]: Cannot open log - retrying for 5
seconds
Aug 09 16:30:47 cx40 varnishncsa[1162]: Abandoned VSM file (Varnish not
running?) /var/cache/varnish/cx40/_.vsm
Aug 09 16:30:47 cx40 systemd[1]: varnishlog.service: Main process
exited, code=exited, status=1/FAILURE
Aug 09 16:30:47 cx40 systemd[1]: varnishlog.service: Unit entered failed
state.
Aug 09 16:30:47 cx40 systemd[1]: varnishlog.service: Failed with result
'exit-code'.

If I look at the varnish.service it is reported running

cx40:~ # systemctl status varnish.service
? varnish.service - Varnish HTTP accelerator/reverse proxy
Loaded: loaded (/usr/lib/systemd/system/varnish.service; enabled;
vendor preset: disabled)
Active: active (running) since Wed 2017-08-09 16:30:48 CEST; 1min
41s ago
Main PID: 1579 (varnishd)
Tasks: 218 (limit: 512)
CGroup: /system.slice/varnish.service
??1579 /usr/sbin/varnishd -j unix,user=varnish -f
/etc/varnish/main.vcl -a :80 -T localhost:6082 -s default=malloc,2G -s
static=file,/var/cache/varnish,5G -P /var/run/varnishd.pid -F
??1672 /usr/sbin/varnishd -j unix,user=varnish -f
/etc/varnish/main.vcl -a :80 -T localhost:6082 -s default=malloc,2G -s
static=file,/var/cache/varnish,5G -P /var/run/varnishd.pid -F

Aug 09 16:30:48 cx40 systemd[1]: Started Varnish HTTP
accelerator/reverse proxy.
Aug 09 16:30:49 cx40 varnishd[1579]: Platform:
Linux,4.4.79-18.23-default,x86_64,-junix,-smalloc,-sfile,-smalloc,-hcritbit
Aug 09 16:30:49 cx40 varnishd[1579]: Debug: Platform:
Linux,4.4.79-18.23-default,x86_64,-junix,-smalloc,-sfile,-smalloc,-hcritbit
Aug 09 16:30:49 cx40 varnishd[1579]: Child (1672) Started
Aug 09 16:30:49 cx40 varnishd[1579]: Debug: Child (1672) Started
Aug 09 16:30:49 cx40 varnishd[1579]: Child (1672) said Child starts
Aug 09 16:30:49 cx40 varnishd[1579]: Child (1672) said SMF.static
mmap'ed 5368709120 bytes of 5368709120
Aug 09 16:30:49 cx40 varnishd[1579]: Info: Child (1672) said Child starts
Aug 09 16:30:49 cx40 varnishd[1579]: Info: Child (1672) said SMF.static
mmap'ed 5368709120 bytes of 5368709120

If I start the varnishlog.service manually there's no problem at all

cx40:~ # systemctl start varnishlog.service
cx40:~ # systemctl status varnishlog.service
? varnishlog.service - Varnish log generator
Loaded: loaded (/etc/systemd/system/varnishlog.service; enabled;
vendor preset: disabled)
Active: active (running) since Wed 2017-08-09 16:32:53 CEST; 4s ago
Main PID: 3439 (varnishncsa)
Tasks: 1 (limit: 512)
CGroup: /system.slice/varnishlog.service
??3439 /usr/sbin/varnishncsa -f
/etc/varnish/varnishncsa-log-format-string -a -w
/var/log/varnish/varnish.log -P /var/run/varnishlog.pid

Aug 09 16:32:53 cx40 systemd[1]: Started Varnish log generator.

For me it looks like that varnishlog.service is waiting for
varnish.service to start and the varnish.service seems to take a bit
long to start up?
Is there a systemd service option to wait for a few seconds before
starting varnishlog.service

something like a delayed start of the service?

I also override the default varnishlog.service in
/usr/lib/systemd/system/varnishlog.service

with my own version in /etc/systemd/system/varnishlog.service

I do this because I need the [service] option WorkingDirectory

/etc/systemd/system/varnishlog.service

[Unit]
Description=Varnish log generator
Requires=varnish.service
#After= is not required

[Service]
WorkingDirectory=/var/log/varnish
EnvironmentFile=/etc/sysconfig/varnish
PIDFile=/var/run/varnishlog.pid
ExecStart=/usr/sbin/varnishncsa $VARNISHLOG_PARAMS -P
/var/run/varnishlog.pid

[Install]
WantedBy=multi-user.target

The $VARNISHLOG_PARAMS are defined in /etc/sysconfig/varnish

VARNISHLOG_PARAMS="-f /etc/varnish/varnishncsa-log-format-string -a -w
/var/log/varnish/varnish.log"

and the format string is defined in
/etc/varnish/varnishncsa-log-format-string

%{VCL_Log:myhost}x %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"

All is working fine, except varnishlog.service won't properly start
after a system reboot ;)

Any help is more than welcome ...

Thanks, greetings & best wishes
Becki


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: opensuse 42.2 systemd varnishlog.service fails to start after system reboot [ In reply to ]
On Wed, Aug 9, 2017 at 4:46 PM, Admin Beckspaced <admin@beckspaced.com> wrote:
> Hello Varnish Community,
>
> I'm running an openSUSE 42.2 server with varnish 5.1.2

Update to 5.1.3, your Varnish instance can be DoS'd remotely!

> For me it looks like that varnishlog.service is waiting for varnish.service
> to start and the varnish.service seems to take a bit long to start up?

Correct.

> Is there a systemd service option to wait for a few seconds before starting
> varnishlog.service
> something like a delayed start of the service?

Not a systemd option, but you can use the `-t` option in varnishncsa
or varnishlog to increase the timeout (defaults to 5s).

> VARNISHLOG_PARAMS="-f /etc/varnish/varnishncsa-log-format-string -a -w
> /var/log/varnish/varnish.log"

This is where you want to add a timeout option. See man varnishncsa.

Cheers,
Dridi

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: opensuse 42.2 systemd varnishlog.service fails to start after system reboot [ In reply to ]
Hey Dridi,

thanks a lot for your input. Highly appreciated ;)

Will test out later and see if things work out ok.

Greetings
Becki


On 09.08.2017 17:36, Dridi Boukelmoune wrote:
> On Wed, Aug 9, 2017 at 4:46 PM, Admin Beckspaced <admin@beckspaced.com> wrote:
>> Hello Varnish Community,
>>
>> I'm running an openSUSE 42.2 server with varnish 5.1.2
> Update to 5.1.3, your Varnish instance can be DoS'd remotely!
>
>> For me it looks like that varnishlog.service is waiting for varnish.service
>> to start and the varnish.service seems to take a bit long to start up?
> Correct.
>
>> Is there a systemd service option to wait for a few seconds before starting
>> varnishlog.service
>> something like a delayed start of the service?
> Not a systemd option, but you can use the `-t` option in varnishncsa
> or varnishlog to increase the timeout (defaults to 5s).
>
>> VARNISHLOG_PARAMS="-f /etc/varnish/varnishncsa-log-format-string -a -w
>> /var/log/varnish/varnish.log"
> This is where you want to add a timeout option. See man varnishncsa.
>
> Cheers,
> Dridi
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
>


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: opensuse 42.2 systemd varnishlog.service fails to start after system reboot [ In reply to ]
On 09.08.2017 17:36, Dridi Boukelmoune wrote:
> On Wed, Aug 9, 2017 at 4:46 PM, Admin Beckspaced <admin@beckspaced.com> wrote:
>> Hello Varnish Community,
>>
>> I'm running an openSUSE 42.2 server with varnish 5.1.2
> Update to 5.1.3, your Varnish instance can be DoS'd remotely!
>
>> For me it looks like that varnishlog.service is waiting for varnish.service
>> to start and the varnish.service seems to take a bit long to start up?
> Correct.
>
>> Is there a systemd service option to wait for a few seconds before starting
>> varnishlog.service
>> something like a delayed start of the service?
> Not a systemd option, but you can use the `-t` option in varnishncsa
> or varnishlog to increase the timeout (defaults to 5s).
>
>> VARNISHLOG_PARAMS="-f /etc/varnish/varnishncsa-log-format-string -a -w
>> /var/log/varnish/varnish.log"
> This is where you want to add a timeout option. See man varnishncsa.
>
> Cheers,
> Dridi
Just to report back on the startup issue ...

added the timeout option to the startup via '-t 30'
and after a system reboot systemctl status reports

cx40:~ # systemctl status varnishlog.service
? varnishlog.service - Varnish log generator
Loaded: loaded (/etc/systemd/system/varnishlog.service; enabled;
vendor preset: disabled)
Active: active (running) since Thu 2017-08-10 08:35:19 CEST; 1min
35s ago
Main PID: 1145 (varnishncsa)
Tasks: 1 (limit: 512)
CGroup: /system.slice/varnishlog.service
??1145 /usr/sbin/varnishncsa -t 30 -f
/etc/varnish/varnishncsa-log-format-string -a -w
/var/log/varnish/varnish.log -P /var/run/varnishlog.pid

Aug 10 08:35:19 cx40 systemd[1]: Started Varnish log generator.
Aug 10 08:35:19 cx40 varnishncsa[1145]: Cannot open log - retrying for
30 seconds
Aug 10 08:35:28 cx40 varnishncsa[1145]: Log opened

so ... all has worked out fine ;)

Thanks & greetings
Becki

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc