/var/lock/mrtg disappears on reboot

Bug #30428 reported by Pasi Savolainen
26
Affects Status Importance Assigned to Milestone
mrtg (Ubuntu)
Fix Released
High
Unassigned
Nominated for Dapper by Oibaf
Nominated for Edgy by Luca Falavigna

Bug Description

In current dapper /var/lock/mrtg -directory disappears on reboot.
Without this directory mrtg won't run, and won't update stats.
Creation of this directory as root makes it work again, but it will disappear again on reboot.

Related branches

Revision history for this message
mek (ubuntubug-w48) wrote :

I can confirm the problem.

varrun on /var/run type tmpfs (rw)
varlock on /var/lock type tmpfs (rw)

are mounted as tmpfs (good idea by the way),
so its ok that it dissapears, the problem is that
it is not generated automaticaly.

Revision history for this message
Dennis Kaarsemaker (dennis) wrote : Re: [Bug 30428] /var/lock/mrtg disappears on reboot

Confirmed. Simple patch (I'm not that fluent at perl):
 subscribe <email address hidden>

--- mrtg-2.12.2/bin/mrtg 2006-04-23 02:28:54.000000000 +0200
+++ mrtg-2.12.2.new/bin/mrtg 2006-04-23 02:28:29.000000000 +0200
@@ -1629,7 +1629,12 @@
                  " aged $lockage seconds is hanging around and I can't remove\n".
                  " it because another process is still using it.";
         }
-
+
+ # Create lockdir if it doesn't exist yet
+ my $lockdir = `dirname "$lockfile"`
+ if (!-e $lockdir) {
+ `mkdir -p "$lockdir"`
+ }
         open (LOCK, ">$lockfile") or
           die "ERROR: Creating lockfile $lockfile: $!\n";
         print LOCK "$$\n";

Revision history for this message
Alex Mauer (hawke) wrote :

The patch does not work. It looks to me like it only happens in the NT/VMS lockfile creation step, it doesn't have semicolons at the end of appropriate lines, and dirname seems to append a newline to the dirname, so it makes the directory "/var/lock/mrtg
/" once it's been moved to the right place and formatted correctly.

Revision history for this message
Kevin Otte (nivex) wrote :

my workaround:
add "mkdir /var/lock/mrtg" to /etc/rc.local

You could probably do a check in the cron entry to see if the directory exists and create it, or some other easily packagable "hack".

-- Kevin

Revision history for this message
Vassilis Pandis (pandisv) wrote :

status Confirmed

Changed in mrtg:
status: Unconfirmed → Confirmed
Revision history for this message
Victor Hugo dos Santos (victorhugops) wrote :

one solution for this problem is change the file /etc/cron.d/mrtg from:

*/5 * * * * root if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ]; then env LANG=C /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log 2>&1; fi

for:

*/5 * * * * root if [ -d /var/lock/mrtg ]; then if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ]; then env LANG=C /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log 2>&1; fi else mkdir /var/lock/mrtg; fi

all caracteres in alone line.

bye

Revision history for this message
Kevin Otte (nivex) wrote : Re: [Bug 30428] Re: /var/lock/mrtg disappears on reboot

On Thu, Aug 24, 2006 at 08:33:41PM -0000, Victor Hugo dos Santos wrote:
> */5 * * * * root if [ -d /var/lock/mrtg ]; then if [ -x
> /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ]; then env LANG=C /usr/bin/mrtg
> /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log 2>&1; fi else mkdir
> /var/lock/mrtg; fi

The problem with this is that no data is logged during this run. You will
have a 10 minute gap in all your graphs.

It is probably better to simply do the mkdir in /etc/rc.local until the
package itself is corrected.

--
Kevin Otte, N8VNR
<email address hidden>
http://www.nivex.net/

-=-

"Those who cannot remember the past are condemned to repeat it."
-- George Santayana

"It seems no one reads Santayana anymore."
-- Cdr. Susan Ivanova, Babylon 5

Revision history for this message
Victor Hugo dos Santos (victorhugops) wrote : Re: [Bug 30428] Re: [Bug 30428] Re: /var/lock/mrtg disappears on reboot

2006/8/24, Kevin Otte <email address hidden>:
> On Thu, Aug 24, 2006 at 08:33:41PM -0000, Victor Hugo dos Santos wrote:
> > */5 * * * * root if [ -d /var/lock/mrtg ]; then if [ -x
> > /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ]; then env LANG=C /usr/bin/mrtg
> > /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log 2>&1; fi else mkdir
> > /var/lock/mrtg; fi
>
> The problem with this is that no data is logged during this run. You will
> have a 10 minute gap in all your graphs.

ooppss.. is true !!! :(

mmm.. the command line correct/arranged is:

*/5 * * * * root if [ ! -d /var/lock/mrtg ]; then mkdir
/var/lock/mrtg; fi && if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ];
then env LANG=C /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log
2>&1; fi

where not is necesary wait 10 minutes for run mrtg !!! :D

it's ok ??

> It is probably better to simply do the mkdir in /etc/rc.local until the
> package itself is corrected.

mmm.. yes.. is one option, but i (IMHO) dont belive that is better.

tks.

--
--
Victor Hugo dos Santos
Linux Counter #224399

Revision history for this message
Rocco Stanzione (trappist) wrote :

This should do it.

Revision history for this message
Rocco Stanzione (trappist) wrote :

assigning to motu-reviewers

Changed in mrtg:
assignee: nobody → motureviewers
Revision history for this message
Carlos Perelló Marín (carlos) wrote :

This bug is also present in Edgy

Revision history for this message
Oibaf (oibaf) wrote :

What about releasing an updated package?
Without the fix mrtg is unusable.

Revision history for this message
JB (jb-ubuntu1804) wrote :

Any news? Same Problem on Dapper.

Changed in mrtg:
assignee: motureviewers → nobody
Revision history for this message
ciskje (ferrara) wrote :

Found this problem also for me... but today is 24 DEC !!!
Why this bug is not resolved ?

Revision history for this message
Sarah Kowalik (hobbsee-deactivatedaccount) wrote :

does this still exist with the later version, on feisty?

https://wiki.ubuntu.com/MOTU/SRU needs to be followed to get it into edgy/dapper

Changed in mrtg:
status: Confirmed → Needs Info
Revision history for this message
Pasi Savolainen (pasi.savolainen) wrote :

Can confirm that this exists in dapper, edgy and feisty.

I don't have suitable debian/sid -chroot atm., so can't check what they've done.
There are no mentions about lock/mrtg in debian bugs-db.

Revision history for this message
Alex Mauer (hawke) wrote :

Does Debian use a tmpfs for /var/lock? I don't believe they do.

Revision history for this message
Carlos Perelló Marín (carlos) wrote :

Yes, it still happen with latest Feisty version

Changed in mrtg:
status: Needs Info → Confirmed
Revision history for this message
Barry deFreese (bddebian) wrote :

Fix uploaded to Feisty. Possible SRU candidate?

Changed in mrtg:
status: Confirmed → Fix Committed
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

Version 2.14.7-2ubuntu1 built and uploaded into archives.

Changed in mrtg:
status: Fix Committed → Fix Released
Revision history for this message
Jay R. Wren (evarlast) wrote :

I just wanted to say thanks for the elegant fix to this problem.

Revision history for this message
Thomas Sommer (flightsupport) wrote :

Any chance that an updated package is released for Dapper?
For the meantime I use the workaround in /etc/rc.local

Revision history for this message
Daniel Holbach (dholbach) wrote :

http://wiki.ubuntu.com/StableReleaseUpdates is the process for that. Unsubscribing ubuntu-universe-sponsors - please re-subscribe the team if appropriate patches are available.

Revision history for this message
beadon (bryant-eadon) wrote :

This is an easy fix. Please read the mrtg man pages, no need to make extra directories, etc.

       --lock-file filename
           Use an alternate lock-file (the default is to use the configura-
           tion-file appended with "_l").

Use this crontab ( my system is FreeBSD so changethe path to mrtg ):

*/5 * * * * /usr/local/bin/mrtg --lock-file /tmp/mrtg.lockfile /etc/mrtg_server.cfg > /var/log/mrtg/mrtg.log

Revision history for this message
Scott Evans (vk7hse) wrote :

This seems to be a common regression across dist upgrades with ubuntu! my current fresh install of Lucid Lynx on my desktop is failing with ...

2010-02-21 21:30:01: ERROR: Creating templock /var/lock/mrtg/_etc_mrtg.cfg_l_3647:
No such file or directory at /usr/bin/mrtg line 1833.

this is a critical bug for all of us that use the MRTG package it looks like I'll have to strt using this from source if it's not resolved...

Changed in mrtg (Ubuntu):
status: Fix Released → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mrtg - 2.16.2-5ubuntu2

---------------
mrtg (2.16.2-5ubuntu2) lucid; urgency=low

  * debian/cron.d: Create /var/run/lock if it doesn't exist (LP: #30428,
    #545250). This is also fixed in Debian, so we can drop this change at the
    next merge.
 -- Iain Lane <email address hidden> Tue, 23 Mar 2010 17:40:14 +0000

Changed in mrtg (Ubuntu):
status: Incomplete → Fix Released
Revision history for this message
Sönke von Heymann (soenke-von-heymann) wrote :

I have Version 2.16.2-5ubuntu2 (10.04) installed, but still getting the same error after server reboot:

2010-10-11 12:42:03 -- 2010-10-11 12:42:03: ERROR: Creating templock /var/lock/mrtg/_etc_mrtg_abc.cfg_l_15240: No such file or directory at /usr/bin/mrtg line 1833.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.