Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Vnstatd: Unable to write database [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
HeXiLeD
Veteran
Veteran


Joined: 20 Aug 2005
Posts: 1092
Location: Online

PostPosted: Sat Nov 20, 2010 9:55 pm    Post subject: Vnstatd: Unable to write database [SOLVED] Reply with quote

I have been getting this error for long while now. everything was working and i think after some update it started to happen. I have googled and tried some solutions but i still get this error all the time:

Quote:
Error: Unable to write database "/var/lib/vnstat/eth0"


Happens for all network interfaces but it does store data:



Code:
 # ls /var/lib/vnstat/ -lah
total 57K
drwxr-xr-x  2 vnstat vnstat  432 2010-10-12 23:28 .
drwxr-xr-x 53 root   root   1.4K 2010-11-16 06:05 ..
-rw-r--r--  1 root   root   2.8K 2010-11-20 16:27 br0
-rw-r--r--  1 vnstat vnstat 2.8K 2010-11-20 16:36 .br0
-rw-r--r--  1 root   root   2.8K 2010-11-20 16:28 eth0
-rw-r--r--  1 vnstat vnstat 2.8K 2010-11-20 16:36 .eth0
-rw-r--r--  1 root   root   2.8K 2010-11-20 16:28 eth1
-rw-r--r--  1 vnstat vnstat 2.8K 2010-11-20 16:36 .eth1
-rw-r--r--  1 root   root   2.8K 2010-11-20 16:28 eth2
-rw-r--r--  1 vnstat vnstat 2.8K 2010-11-20 16:36 .eth2
-rw-r--r--  1 root   root   2.8K 2010-11-20 16:28 eth3
-rw-r--r--  1 vnstat vnstat 2.8K 2010-11-20 16:36 .eth3
-rw-r--r--  1 vnstat vnstat    0 2010-08-08 08:28 .keep_net-analyzer_vnstat-0
-rw-r--r--  1 root   root   2.8K 2010-11-20 16:28 vbox0
-rw-r--r--  1 vnstat vnstat 2.8K 2010-11-20 16:36 .vbox0
-rw-r--r--  1 root   root   2.8K 2010-11-20 16:28 vbox1
-rw-r--r--  1 vnstat vnstat 2.8K 2010-11-20 16:36 .vbox1


Both files for each interface show content as well as the output of any vnstat option.

Config: /etc/vnstat.conf

Code:
# vnStat 1.10 config file
##

# default interface
Interface "br0"

# location of the database directory
DatabaseDir "/var/lib/vnstat"

# locale (LC_ALL) ("-" = use system locale)
Locale "-"

# on which day should months change
MonthRotate 1

# date output formats for -d, -m, -t and -w
# see 'man date' for control codes
DayFormat    "%x"
MonthFormat  "%b '%y"
TopFormat    "%x"

# characters used for visuals
RXCharacter       "%"
TXCharacter       ":"
RXHourCharacter   "r"
TXHourCharacter   "t"

# how units are prefixed when traffic is shown
# 0 = IEC standard prefixes (KiB/MiB/GiB/TiB)
# 1 = old style binary prefixes (KB/MB/GB/TB)
UnitMode 0

# output style
# 0 = minimal & narrow, 1 = bar column visible
# 2 = same as 1 except rate in summary and weekly
# 3 = rate column visible
OutputStyle 3

# used rate unit (0 = bytes, 1 = bits)
RateUnit 1

# maximum bandwidth (Mbit) for all interfaces, 0 = disable feature
# (unless interface specific limit is given)
MaxBandwidth 100

# interface specific limits
#  example 8Mbit limit for eth0 (remove # to activate):
#MaxBWeth0 8

# how many seconds should sampling for -tr take by default
Sampletime 5

# default query mode
# 0 = normal, 1 = days, 2 = months, 3 = top10
# 4 = dumpdb, 5 = short, 6 = weeks, 7 = hours
QueryMode 0

# filesystem disk space check (1 = enabled, 0 = disabled)
CheckDiskSpace 1

# database file locking (1 = enabled, 0 = disabled)
UseFileLocking 1
# how much the boot time can variate between updates (seconds)
BootVariation 15

# log days without traffic to daily list (1 = enabled, 0 = disabled)
TrafficlessDays 1


# vnstatd
##

# how often (in seconds) interface data is updated
UpdateInterval 30

# how often (in seconds) interface status changes are checked
PollInterval 5

# how often (in minutes) data is saved to file
SaveInterval 5

# how often (in minutes) data is saved when all interface are offline
OfflineSaveInterval 30

# force data save when interface status changes (1 = enabled, 0 = disabled)
SaveOnStatusChange 1

# enable / disable logging (0 = disabled, 1 = logfile, 2 = syslog)
UseLogging 2

# file used for logging if UseLogging is set to 1
LogFile "/var/log/vnstatd.log"

# file used as daemon pid / lock file
PidFile "/var/run/vnstatd/vnstatd.pid"


# vnstati
##

# title timestamp format
HeaderFormat "%x %H:%M"

# show hours with rate (1 = enabled, 0 = disabled)
HourlyRate 1

# show rate in summary (1 = enabled, 0 = disabled)
SummaryRate 1

# layout of summary (1 = with monthly, 0 = without monthly)
SummaryLayout 1

# transparent background (1 = enabled, 0 = disabled)
TransparentBg 0

# image colors
CBackground     "FFFFFF"
CEdge           "AEAEAE"
CHeader         "606060"
CHeaderTitle    "FFFFFF"
CHeaderDate     "FFFFFF"
CText           "000000"
CLine           "B0B0B0"
CLineL          "-"
CRx             "92CF00"
CTx             "606060"
CRxD            "-"
CTxD            "-"


Code:
# vnstat -u -i <iface>

Works without output or errors.

Any ideas?
_________________
Do you hear the sound of inevitability?
With age, comes great grumpiness and that, was 20 years ago...

CertFP: becbbd161d5a5c31de3c45171b77bf710911db29 / d985d21f89fe2977b593c4d381a1a86802e62990d9328d893db76d59f9935244


Last edited by HeXiLeD on Tue Jan 04, 2011 5:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
Herring42
Guru
Guru


Joined: 10 Mar 2004
Posts: 373
Location: Buckinghamshire

PostPosted: Mon Dec 13, 2010 5:36 pm    Post subject: Reply with quote

It might be because the files are owned by root.

Which user are you running vnstat as?
Try making the files temporarily world writeable, and see if that helps. If it does, use chown to change the owner of the files to the one that you normally use to update them.
_________________
"The problem with quotes on the internet is that it is difficult
to determine whether or not they are genuine." -- Abraham Lincoln
Back to top
View user's profile Send private message
HeXiLeD
Veteran
Veteran


Joined: 20 Aug 2005
Posts: 1092
Location: Online

PostPosted: Tue Jan 04, 2011 5:10 pm    Post subject: Reply with quote

After an emerge -e system and -e world the problem got some how fixed.

The files permissions also changed:

Code:
 # ls -lah /var/lib/vnstat/
total 57K
drwxr-xr-x  2 vnstat vnstat  432 Dec 17 18:06 .
drwxr-xr-x 56 root   root   1.5K Dec 15 21:16 ..
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 br0
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 .br0
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 eth0
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 .eth0
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 eth1
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 .eth1
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 eth2
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 .eth2
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 eth3
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 .eth3
-rw-r--r--  1 vnstat vnstat    0 Dec 17 18:06 .keep_net-analyzer_vnstat-0
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 vbox0
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 .vbox0
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 vbox1
-rw-r--r--  1 vnstat vnstat 2.8K Jan  4 12:08 .vbox1


The service runs as vnstat user.

Problem is SOLVED.
_________________
Do you hear the sound of inevitability?
With age, comes great grumpiness and that, was 20 years ago...

CertFP: becbbd161d5a5c31de3c45171b77bf710911db29 / d985d21f89fe2977b593c4d381a1a86802e62990d9328d893db76d59f9935244
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum