Project

General

Profile

Actions

Bug #4282

closed

Vnstat2 1.11 Does Configuration Parser Error

Added by Bryce Chidester over 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
01/24/2015
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.2
Affected Plus Version:
Affected Architecture:

Description

Since upgrading to 2.2 (and reinstalling all packages), vnstat2 errors out every time.

X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin>
X-Cron-Env: <HOME=/var/log>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

Error: Unable to open database directory "/var/lib/vnstat".
Make sure it exists and is at least read enabled for current user.
Exiting...

If I add --debug to the vnstat invocation in /usr/local/pkg/vnstat2/vnstat2.sh I see that the DatabaseDir directive vnstat is using, and supposedly reading from the correct configuration file does not match the actual contents of that configuration file.

Config file: /usr/local/etc/vnstat.conf
  c: Interface "eth0" 
   -> "Interface": "eth0" 
  c: DatabaseDir "/var/lib/vnstat" 
   -> "DatabaseDir": "/var/lib/vnstat" 
  c: Locale "-" 
   -> "Locale": "-" 
  i: MonthRotate 1
   -> "MonthRotate": 1
  c: DayFormat    "%x" 
   -> "DayFormat": "%x" 
  c: MonthFormat  "%b '%y" 
   -> "MonthFormat": "%b '%y" 
  c: TopFormat    "%x" 
   -> "TopFormat": "%x" 
  c: RXCharacter       "%" 
   -> "RXCharacter": "%" 
  c: TXCharacter       ":" 
   -> "TXCharacter": ":" 
  c: RXHourCharacter   "r" 
   -> "RXHourCharacter": "r" 
  c: TXHourCharacter   "t" 
   -> "TXHourCharacter": "t" 
  i: UnitMode 0
   -> "UnitMode": 0
  i: OutputStyle 3
   -> "OutputStyle": 3
  i: RateUnit 1
   -> "RateUnit": 1
  i: MaxBandwidth 100
   -> "MaxBandwidth": 100
  i: Sampletime 5
   -> "Sampletime": 5
  i: QueryMode 0
   -> "QueryMode": 0
  i: CheckDiskSpace 1
   -> "CheckDiskSpace": 1
  i: UseFileLocking 1
   -> "UseFileLocking": 1
  i: BootVariation 15
   -> "BootVariation": 15
  i: TrafficlessDays 1
   -> "TrafficlessDays": 1
  i: UpdateInterval 30
   -> "UpdateInterval": 30
  i: PollInterval 5
   -> "PollInterval": 5
  i: SaveInterval 5
   -> "SaveInterval": 5
  i: OfflineSaveInterval 30
   -> "OfflineSaveInterval": 30
  i: SaveOnStatusChange 1
   -> "SaveOnStatusChange": 1
  i: UseLogging 2
   -> "UseLogging": 2
  c: LogFile "/var/log/vnstat.log" 
   -> "LogFile": "/var/log/vnstat.log" 
  c: PidFile "/var/run/vnstat.pid" 
   -> "PidFile": "/var/run/vnstat.pid" 
  c: HeaderFormat "%x %H:%M" 
   -> "HeaderFormat": "%x %H:%M" 
  i: HourlyRate 1
   -> "HourlyRate": 1
  i: SummaryRate 1
   -> "SummaryRate": 1
  i: SummaryLayout 1
   -> "SummaryLayout": 1
  i: TransparentBg 0
   -> "TransparentBg": 0
  c: CBackground     "FFFFFF" 
   -> "CBackground": "FFFFFF" 
  c: CEdge           "AEAEAE" 
   -> "CEdge": "AEAEAE" 
  c: CHeader         "606060" 
   -> "CHeader": "606060" 
  c: CHeaderTitle    "FFFFFF" 
   -> "CHeaderTitle": "FFFFFF" 
  c: CHeaderDate     "FFFFFF" 
   -> "CHeaderDate": "FFFFFF" 
  c: CText           "000000" 
   -> "CText": "000000" 
  c: CLine           "B0B0B0" 
   -> "CLine": "B0B0B0" 
  c: CLineL          "-" 
   -> "CLineL": "-" 
  c: CRx             "92CF00" 
   -> "CRx": "92CF00" 
  c: CTx             "606060" 
   -> "CTx": "606060" 
  c: CRxD            "-" 
   -> "CRxD": "-" 
  c: CTxD            "-" 
   -> "CTxD": "-" 
ibw list is empty.
arg 1: "--debug" 
arg 2: "-u" 
Updating database...
Error: Unable to open database directory "/var/lib/vnstat".
Make sure it exists and is at least read enabled for current user.
Exiting...

Actual /usr/local/etc/vnstat.conf

# vnStat 1.10 config file
##

# location of the database directory
DatabaseDir "/conf/vnstat" 

# on which day should months change
MonthRotate 1

# vnstati
##

# image colors
CBackground     "F0F0F0" 
CEdge           "AEAEAE" 
CHeader         "990000" 
CHeaderTitle    "F0F0F0" 
CHeaderDate     "FFFFFF" 
CText           "000000" 
CLine           "B0B0B0" 
CLineL          "-" 
CRx             "666666" 
CTx             "990000" 
CRxD            "-" 
CTxD            "-" 

After some digging, I found /usr/pbi/vnstat-i386/local/etc/vnstat.conf whose contents match the --debug output exactly.

From this I conclude that this is a bug in vnstat 1.11 reporting that it's reading the correct file but in actuality reading/parsing a different and incorrect file. Even after passing the correct file with --config, the behaviour continues.
After upgrading to vnstat 1.12 (from FreeBSD packages), the issue is resolved.

Clearly this is an upstream bug that has since been squashed. A simple package upgrade to match FreeBSD's 1.12 should resolve the issue completely.

Actions

Also available in: Atom PDF