vnstat not updatingVnstat showing large amount of trafficvnstat chmod permissionsCan I cap the monthly...

What's a good word to describe a public place that looks like it wouldn't be rough?

Absorbing damage with Planeswalker

Words and Words with "ver-" Prefix

Is using an 'empty' metaphor considered bad style?

Am I a Rude Number?

Use two 8s and two 3s to make the number 24

Increment each digit in a number to form a new number

Why did Luke use his left hand to shoot?

Graph with overlapping labels

SET NOCOUNT Error in handling SQL call after upgrade

Why was Lupin comfortable with saying Voldemort's name?

How would an AI self awareness kill switch work?

Eww, those bytes are gross

What does it mean for a caliber to be flat shooting?

Is it possible to grant users sftp access without shell access? If yes, how is it implemented?

What would the chemical name be for C13H8Cl3NO

Early credit roll before the end of the film

How to make ice magic work from a scientific point of view?

Has any human ever had the choice to leave Earth permanently?

Play Zip, Zap, Zop

Is a new Boolean field better than a null reference when a value can be meaningfully absent?

Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act (2019 S.130)?

Why am I able to open Wireshark in macOS without root privileges?

How old is the day of 24 equal hours?



vnstat not updating


Vnstat showing large amount of trafficvnstat chmod permissionsCan I cap the monthly network transfer of a process?Short but (very) consistent lag spikes after upgrading to Ubuntu 14.04Unable to connect to internet with VirtualBox using bridged adapter?Cannot connect to internet on wired connectionWhy no TCP_HITS using squid-deb-proxyErrors executing Visual Studio Code in 14.04Monitor Usage and Switch OffTouchscreen worked during install and now does notEthernet Connection Not DetectedVnstat on Ubuntu 18.04













16















I installed vnstat on my Ubuntu 14.04 server to track my internet usage (I have a limited monthly transfer). The database never updates, however. I've tried uninstalling/reinstalling, but that doesn't work. What do I need to do to get vnstat to update and be accurate?










share|improve this question



























    16















    I installed vnstat on my Ubuntu 14.04 server to track my internet usage (I have a limited monthly transfer). The database never updates, however. I've tried uninstalling/reinstalling, but that doesn't work. What do I need to do to get vnstat to update and be accurate?










    share|improve this question

























      16












      16








      16


      4






      I installed vnstat on my Ubuntu 14.04 server to track my internet usage (I have a limited monthly transfer). The database never updates, however. I've tried uninstalling/reinstalling, but that doesn't work. What do I need to do to get vnstat to update and be accurate?










      share|improve this question














      I installed vnstat on my Ubuntu 14.04 server to track my internet usage (I have a limited monthly transfer). The database never updates, however. I've tried uninstalling/reinstalling, but that doesn't work. What do I need to do to get vnstat to update and be accurate?







      networking 14.04 vnstat






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 21 '14 at 14:39









      vaindilvaindil

      2633618




      2633618






















          7 Answers
          7






          active

          oldest

          votes


















          14














          Run



          sudo chown -R vnstat:vnstat /var/lib/vnstat


          This fixed my problem on Ubuntu 14.04.



          Make sure you have following files in that folder and have proper ownership.



          boby@fwhlin:/var/lib/vnstat$ ls -la
          total 16
          drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
          drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
          -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
          -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0
          boby@fwhlin:/var/lib/vnstat$


          .eth0 is temp file, that may disappear sometimes.






          share|improve this answer































            8














            After installing vnstat the database need to be created (one time). To create the database you can use the update switch, which create new database in the base of no database. Create DB: sudo vnstat -i eth0 -u where eth0 is the name of the network interface. If you are unsure update for all interfaces by sudo vnstat -u. After sometime (1 minute) you can view the details vnstat -i eth0 or simply vnstat .



            Update



            It seems vnstat not running ! . Start the daemon by running sudo /etc/init.d/vnstat start and check for the result after 5 minutes.



            Example



            sudo vnstat -u -i eth0



            Error: Unable to read database “/var/lib/vnstat/eth0.
            Info: -> A new database has been created.




            sudo /etc/init.d/vnstat start




            • Starting vnStat daemon vnstatd [ OK ]




            Once database have been initialiase, its ready to monitor bandwidth usage. You can view the report by invoke command vnstat.






            share|improve this answer


























            • @Vaindil, did you tried this?

              – totti
              Jul 27 '14 at 12:04






            • 1





              Yes, I did do this after I installed vnstat. Doing vnstat does show the output, but it shows that the database hasn't been updated in weeks.

              – vaindil
              Jul 28 '14 at 15:42











            • Does vnstat running ? What's the output of ps aux | grep vnstat

              – totti
              Jul 28 '14 at 15:56











            • steven 6475 0.0 0.1 11744 916 pts/0 S+ 13:35 0:00 grep --color=auto vnstat (vnstat shows up red in the terminal, if it matters or helps)

              – vaindil
              Jul 30 '14 at 17:36













            • When attempting to run sudo /etc/init.d/vnstat start, I get the following: Starting vnStat daemon: vnstatd. / pidfile: No such file or directory and then it sits as if it's doing something, but it sits indefinitely.

              – vaindil
              Jul 31 '14 at 18:14



















            2














            Are you sure that vnstatd is running, i.e. the daemon (background process) that does the data collection? If not, check with



            ps aux | grep vnstatd


            You should see it there.



            For me, after upgrading to 14.04 vnstatd kept crashing on start-up.



            My solution was to remove the folder it uses to store its data (/var/lib/vnstat) and create a new empty directory instead. You may need to run vnstatd manually once to create the database after that:



            vnstatd -n -s


            Apart from that, I also needed to apply



            sudo chown -R vnstat:vnstat /var/lib/vnstat


            as suggested by HostOnNet.






            share|improve this answer

































              1














              Same issues here.



              After checking the details it turned out that the databases for the different devices (eth0, ppp0, wlan0, etc.) were created in /var/lib/vnstat but these files were owned by the USER.
              After
              sudo chown -R vnstat:vnstat /var/lib/vnstat
              it seems to be ok. I also had to check the default interface in /etc/vnstat.conf - it was the wrong one for me, so I just changed it.






              share|improve this answer


























              • I forgat to add that I let run "vnstat -u -i wlan0" (and same for the other devices) as ROOT. This could also cause issues with permission. And one more thing: You have to check whether you are using systemd, init or upstart and start the daemon according to this.

                – bradley
                Jan 19 '16 at 14:36



















              1














              Sorry I had to make this its own answer instead of editing Boby's since my edit was rejected :|



              By default, when you install vnstat, it auto starts a vnstatd daemon, which collects metrics every 30 seconds and "updates them" (for all local devices) every 5 minutes. So in essence, after installing vnstat packet, you should start to see metrics 5 minutes later.



              Appears to sometimes be a problem with the install package however. It sometimes seems to create /var/lib/vnstat directory in such a way that it isn't writable by user vnstat so vnstat program only works when run as root (the daemon runs as user vnstat).



              You can check if this is your problem by running this:



              ll /var/lib | grep vnstat
              drwxr-xr-x 2 root root 4096 Oct 25 2014 vnstat


              If it is owned by root (as it is in this example), then that may be your problem. You can also look for the cause in your /var/log/syslog file, it'll probably have lines like this:



              Jul 27 22:06:19 xxx vnstatd[13276]: Error: Unable to open database "/var/lib/vnstat/eth0" for writing: Permission denied


              Run



               sudo chown -R vnstat:vnstat /var/lib/vnstat


              This fixed my problem on Ubuntu 15.10.



              Make sure you have following files in that folder and have proper ownership, should look like this when you're done:



              /var/lib/vnstat$ ls -la
              total 16
              drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
              drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
              -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
              -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0


              You may need to restart your vnstat daemon via sudo /etc/init.d/vnstat restart if it died from its initial failed startup attempt. You should start getting data for all devices in 5 minutes after the fix.






              share|improve this answer

































                0














                Try to output some from this help:



                $ vnstat --help
                vnStat 1.11 by Teemu Toivola

                -q, --query query database
                -h, --hours show hours
                -d, --days show days
                -m, --months show months
                -w, --weeks show weeks
                -t, --top10 show top10
                -s, --short use short output
                -u, --update update database
                -i, --iface select interface (default: eth0)
                -?, --help short help
                -v, --version show version
                -tr, --traffic calculate traffic
                -ru, --rateunit swap configured rate unit
                -l, --live show transfer rate in real time

                See also "--longhelp" for complete options list and "man vnstat".


                READ MORE






                share|improve this answer































                  0














                  In addition, to fix



                  Error: Unable to create database backup "/var/lib/vnstat/.ppp0"



                  I have had to setuid vnstat



                  sudo chmod 4755 /usr/bin/vnstat



                  so that



                  -rwsr-xr-x 1 root root 105016 Dec 6 2015 /usr/bin/vnstat






                  share|improve this answer























                    Your Answer








                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "89"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: true,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: 10,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f500663%2fvnstat-not-updating%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    7 Answers
                    7






                    active

                    oldest

                    votes








                    7 Answers
                    7






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    14














                    Run



                    sudo chown -R vnstat:vnstat /var/lib/vnstat


                    This fixed my problem on Ubuntu 14.04.



                    Make sure you have following files in that folder and have proper ownership.



                    boby@fwhlin:/var/lib/vnstat$ ls -la
                    total 16
                    drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                    drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                    -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                    -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0
                    boby@fwhlin:/var/lib/vnstat$


                    .eth0 is temp file, that may disappear sometimes.






                    share|improve this answer




























                      14














                      Run



                      sudo chown -R vnstat:vnstat /var/lib/vnstat


                      This fixed my problem on Ubuntu 14.04.



                      Make sure you have following files in that folder and have proper ownership.



                      boby@fwhlin:/var/lib/vnstat$ ls -la
                      total 16
                      drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                      drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                      -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                      -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0
                      boby@fwhlin:/var/lib/vnstat$


                      .eth0 is temp file, that may disappear sometimes.






                      share|improve this answer


























                        14












                        14








                        14







                        Run



                        sudo chown -R vnstat:vnstat /var/lib/vnstat


                        This fixed my problem on Ubuntu 14.04.



                        Make sure you have following files in that folder and have proper ownership.



                        boby@fwhlin:/var/lib/vnstat$ ls -la
                        total 16
                        drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                        drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                        -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                        -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0
                        boby@fwhlin:/var/lib/vnstat$


                        .eth0 is temp file, that may disappear sometimes.






                        share|improve this answer













                        Run



                        sudo chown -R vnstat:vnstat /var/lib/vnstat


                        This fixed my problem on Ubuntu 14.04.



                        Make sure you have following files in that folder and have proper ownership.



                        boby@fwhlin:/var/lib/vnstat$ ls -la
                        total 16
                        drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                        drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                        -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                        -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0
                        boby@fwhlin:/var/lib/vnstat$


                        .eth0 is temp file, that may disappear sometimes.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jul 25 '14 at 18:59









                        Yujin BobyYujin Boby

                        1616




                        1616

























                            8














                            After installing vnstat the database need to be created (one time). To create the database you can use the update switch, which create new database in the base of no database. Create DB: sudo vnstat -i eth0 -u where eth0 is the name of the network interface. If you are unsure update for all interfaces by sudo vnstat -u. After sometime (1 minute) you can view the details vnstat -i eth0 or simply vnstat .



                            Update



                            It seems vnstat not running ! . Start the daemon by running sudo /etc/init.d/vnstat start and check for the result after 5 minutes.



                            Example



                            sudo vnstat -u -i eth0



                            Error: Unable to read database “/var/lib/vnstat/eth0.
                            Info: -> A new database has been created.




                            sudo /etc/init.d/vnstat start




                            • Starting vnStat daemon vnstatd [ OK ]




                            Once database have been initialiase, its ready to monitor bandwidth usage. You can view the report by invoke command vnstat.






                            share|improve this answer


























                            • @Vaindil, did you tried this?

                              – totti
                              Jul 27 '14 at 12:04






                            • 1





                              Yes, I did do this after I installed vnstat. Doing vnstat does show the output, but it shows that the database hasn't been updated in weeks.

                              – vaindil
                              Jul 28 '14 at 15:42











                            • Does vnstat running ? What's the output of ps aux | grep vnstat

                              – totti
                              Jul 28 '14 at 15:56











                            • steven 6475 0.0 0.1 11744 916 pts/0 S+ 13:35 0:00 grep --color=auto vnstat (vnstat shows up red in the terminal, if it matters or helps)

                              – vaindil
                              Jul 30 '14 at 17:36













                            • When attempting to run sudo /etc/init.d/vnstat start, I get the following: Starting vnStat daemon: vnstatd. / pidfile: No such file or directory and then it sits as if it's doing something, but it sits indefinitely.

                              – vaindil
                              Jul 31 '14 at 18:14
















                            8














                            After installing vnstat the database need to be created (one time). To create the database you can use the update switch, which create new database in the base of no database. Create DB: sudo vnstat -i eth0 -u where eth0 is the name of the network interface. If you are unsure update for all interfaces by sudo vnstat -u. After sometime (1 minute) you can view the details vnstat -i eth0 or simply vnstat .



                            Update



                            It seems vnstat not running ! . Start the daemon by running sudo /etc/init.d/vnstat start and check for the result after 5 minutes.



                            Example



                            sudo vnstat -u -i eth0



                            Error: Unable to read database “/var/lib/vnstat/eth0.
                            Info: -> A new database has been created.




                            sudo /etc/init.d/vnstat start




                            • Starting vnStat daemon vnstatd [ OK ]




                            Once database have been initialiase, its ready to monitor bandwidth usage. You can view the report by invoke command vnstat.






                            share|improve this answer


























                            • @Vaindil, did you tried this?

                              – totti
                              Jul 27 '14 at 12:04






                            • 1





                              Yes, I did do this after I installed vnstat. Doing vnstat does show the output, but it shows that the database hasn't been updated in weeks.

                              – vaindil
                              Jul 28 '14 at 15:42











                            • Does vnstat running ? What's the output of ps aux | grep vnstat

                              – totti
                              Jul 28 '14 at 15:56











                            • steven 6475 0.0 0.1 11744 916 pts/0 S+ 13:35 0:00 grep --color=auto vnstat (vnstat shows up red in the terminal, if it matters or helps)

                              – vaindil
                              Jul 30 '14 at 17:36













                            • When attempting to run sudo /etc/init.d/vnstat start, I get the following: Starting vnStat daemon: vnstatd. / pidfile: No such file or directory and then it sits as if it's doing something, but it sits indefinitely.

                              – vaindil
                              Jul 31 '14 at 18:14














                            8












                            8








                            8







                            After installing vnstat the database need to be created (one time). To create the database you can use the update switch, which create new database in the base of no database. Create DB: sudo vnstat -i eth0 -u where eth0 is the name of the network interface. If you are unsure update for all interfaces by sudo vnstat -u. After sometime (1 minute) you can view the details vnstat -i eth0 or simply vnstat .



                            Update



                            It seems vnstat not running ! . Start the daemon by running sudo /etc/init.d/vnstat start and check for the result after 5 minutes.



                            Example



                            sudo vnstat -u -i eth0



                            Error: Unable to read database “/var/lib/vnstat/eth0.
                            Info: -> A new database has been created.




                            sudo /etc/init.d/vnstat start




                            • Starting vnStat daemon vnstatd [ OK ]




                            Once database have been initialiase, its ready to monitor bandwidth usage. You can view the report by invoke command vnstat.






                            share|improve this answer















                            After installing vnstat the database need to be created (one time). To create the database you can use the update switch, which create new database in the base of no database. Create DB: sudo vnstat -i eth0 -u where eth0 is the name of the network interface. If you are unsure update for all interfaces by sudo vnstat -u. After sometime (1 minute) you can view the details vnstat -i eth0 or simply vnstat .



                            Update



                            It seems vnstat not running ! . Start the daemon by running sudo /etc/init.d/vnstat start and check for the result after 5 minutes.



                            Example



                            sudo vnstat -u -i eth0



                            Error: Unable to read database “/var/lib/vnstat/eth0.
                            Info: -> A new database has been created.




                            sudo /etc/init.d/vnstat start




                            • Starting vnStat daemon vnstatd [ OK ]




                            Once database have been initialiase, its ready to monitor bandwidth usage. You can view the report by invoke command vnstat.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jul 31 '14 at 5:51

























                            answered Jul 24 '14 at 6:58









                            tottitotti

                            5,02013042




                            5,02013042













                            • @Vaindil, did you tried this?

                              – totti
                              Jul 27 '14 at 12:04






                            • 1





                              Yes, I did do this after I installed vnstat. Doing vnstat does show the output, but it shows that the database hasn't been updated in weeks.

                              – vaindil
                              Jul 28 '14 at 15:42











                            • Does vnstat running ? What's the output of ps aux | grep vnstat

                              – totti
                              Jul 28 '14 at 15:56











                            • steven 6475 0.0 0.1 11744 916 pts/0 S+ 13:35 0:00 grep --color=auto vnstat (vnstat shows up red in the terminal, if it matters or helps)

                              – vaindil
                              Jul 30 '14 at 17:36













                            • When attempting to run sudo /etc/init.d/vnstat start, I get the following: Starting vnStat daemon: vnstatd. / pidfile: No such file or directory and then it sits as if it's doing something, but it sits indefinitely.

                              – vaindil
                              Jul 31 '14 at 18:14



















                            • @Vaindil, did you tried this?

                              – totti
                              Jul 27 '14 at 12:04






                            • 1





                              Yes, I did do this after I installed vnstat. Doing vnstat does show the output, but it shows that the database hasn't been updated in weeks.

                              – vaindil
                              Jul 28 '14 at 15:42











                            • Does vnstat running ? What's the output of ps aux | grep vnstat

                              – totti
                              Jul 28 '14 at 15:56











                            • steven 6475 0.0 0.1 11744 916 pts/0 S+ 13:35 0:00 grep --color=auto vnstat (vnstat shows up red in the terminal, if it matters or helps)

                              – vaindil
                              Jul 30 '14 at 17:36













                            • When attempting to run sudo /etc/init.d/vnstat start, I get the following: Starting vnStat daemon: vnstatd. / pidfile: No such file or directory and then it sits as if it's doing something, but it sits indefinitely.

                              – vaindil
                              Jul 31 '14 at 18:14

















                            @Vaindil, did you tried this?

                            – totti
                            Jul 27 '14 at 12:04





                            @Vaindil, did you tried this?

                            – totti
                            Jul 27 '14 at 12:04




                            1




                            1





                            Yes, I did do this after I installed vnstat. Doing vnstat does show the output, but it shows that the database hasn't been updated in weeks.

                            – vaindil
                            Jul 28 '14 at 15:42





                            Yes, I did do this after I installed vnstat. Doing vnstat does show the output, but it shows that the database hasn't been updated in weeks.

                            – vaindil
                            Jul 28 '14 at 15:42













                            Does vnstat running ? What's the output of ps aux | grep vnstat

                            – totti
                            Jul 28 '14 at 15:56





                            Does vnstat running ? What's the output of ps aux | grep vnstat

                            – totti
                            Jul 28 '14 at 15:56













                            steven 6475 0.0 0.1 11744 916 pts/0 S+ 13:35 0:00 grep --color=auto vnstat (vnstat shows up red in the terminal, if it matters or helps)

                            – vaindil
                            Jul 30 '14 at 17:36







                            steven 6475 0.0 0.1 11744 916 pts/0 S+ 13:35 0:00 grep --color=auto vnstat (vnstat shows up red in the terminal, if it matters or helps)

                            – vaindil
                            Jul 30 '14 at 17:36















                            When attempting to run sudo /etc/init.d/vnstat start, I get the following: Starting vnStat daemon: vnstatd. / pidfile: No such file or directory and then it sits as if it's doing something, but it sits indefinitely.

                            – vaindil
                            Jul 31 '14 at 18:14





                            When attempting to run sudo /etc/init.d/vnstat start, I get the following: Starting vnStat daemon: vnstatd. / pidfile: No such file or directory and then it sits as if it's doing something, but it sits indefinitely.

                            – vaindil
                            Jul 31 '14 at 18:14











                            2














                            Are you sure that vnstatd is running, i.e. the daemon (background process) that does the data collection? If not, check with



                            ps aux | grep vnstatd


                            You should see it there.



                            For me, after upgrading to 14.04 vnstatd kept crashing on start-up.



                            My solution was to remove the folder it uses to store its data (/var/lib/vnstat) and create a new empty directory instead. You may need to run vnstatd manually once to create the database after that:



                            vnstatd -n -s


                            Apart from that, I also needed to apply



                            sudo chown -R vnstat:vnstat /var/lib/vnstat


                            as suggested by HostOnNet.






                            share|improve this answer






























                              2














                              Are you sure that vnstatd is running, i.e. the daemon (background process) that does the data collection? If not, check with



                              ps aux | grep vnstatd


                              You should see it there.



                              For me, after upgrading to 14.04 vnstatd kept crashing on start-up.



                              My solution was to remove the folder it uses to store its data (/var/lib/vnstat) and create a new empty directory instead. You may need to run vnstatd manually once to create the database after that:



                              vnstatd -n -s


                              Apart from that, I also needed to apply



                              sudo chown -R vnstat:vnstat /var/lib/vnstat


                              as suggested by HostOnNet.






                              share|improve this answer




























                                2












                                2








                                2







                                Are you sure that vnstatd is running, i.e. the daemon (background process) that does the data collection? If not, check with



                                ps aux | grep vnstatd


                                You should see it there.



                                For me, after upgrading to 14.04 vnstatd kept crashing on start-up.



                                My solution was to remove the folder it uses to store its data (/var/lib/vnstat) and create a new empty directory instead. You may need to run vnstatd manually once to create the database after that:



                                vnstatd -n -s


                                Apart from that, I also needed to apply



                                sudo chown -R vnstat:vnstat /var/lib/vnstat


                                as suggested by HostOnNet.






                                share|improve this answer















                                Are you sure that vnstatd is running, i.e. the daemon (background process) that does the data collection? If not, check with



                                ps aux | grep vnstatd


                                You should see it there.



                                For me, after upgrading to 14.04 vnstatd kept crashing on start-up.



                                My solution was to remove the folder it uses to store its data (/var/lib/vnstat) and create a new empty directory instead. You may need to run vnstatd manually once to create the database after that:



                                vnstatd -n -s


                                Apart from that, I also needed to apply



                                sudo chown -R vnstat:vnstat /var/lib/vnstat


                                as suggested by HostOnNet.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Mar 10 '15 at 17:19

























                                answered Mar 9 '15 at 8:34









                                fuenfundachtzigfuenfundachtzig

                                24128




                                24128























                                    1














                                    Same issues here.



                                    After checking the details it turned out that the databases for the different devices (eth0, ppp0, wlan0, etc.) were created in /var/lib/vnstat but these files were owned by the USER.
                                    After
                                    sudo chown -R vnstat:vnstat /var/lib/vnstat
                                    it seems to be ok. I also had to check the default interface in /etc/vnstat.conf - it was the wrong one for me, so I just changed it.






                                    share|improve this answer


























                                    • I forgat to add that I let run "vnstat -u -i wlan0" (and same for the other devices) as ROOT. This could also cause issues with permission. And one more thing: You have to check whether you are using systemd, init or upstart and start the daemon according to this.

                                      – bradley
                                      Jan 19 '16 at 14:36
















                                    1














                                    Same issues here.



                                    After checking the details it turned out that the databases for the different devices (eth0, ppp0, wlan0, etc.) were created in /var/lib/vnstat but these files were owned by the USER.
                                    After
                                    sudo chown -R vnstat:vnstat /var/lib/vnstat
                                    it seems to be ok. I also had to check the default interface in /etc/vnstat.conf - it was the wrong one for me, so I just changed it.






                                    share|improve this answer


























                                    • I forgat to add that I let run "vnstat -u -i wlan0" (and same for the other devices) as ROOT. This could also cause issues with permission. And one more thing: You have to check whether you are using systemd, init or upstart and start the daemon according to this.

                                      – bradley
                                      Jan 19 '16 at 14:36














                                    1












                                    1








                                    1







                                    Same issues here.



                                    After checking the details it turned out that the databases for the different devices (eth0, ppp0, wlan0, etc.) were created in /var/lib/vnstat but these files were owned by the USER.
                                    After
                                    sudo chown -R vnstat:vnstat /var/lib/vnstat
                                    it seems to be ok. I also had to check the default interface in /etc/vnstat.conf - it was the wrong one for me, so I just changed it.






                                    share|improve this answer















                                    Same issues here.



                                    After checking the details it turned out that the databases for the different devices (eth0, ppp0, wlan0, etc.) were created in /var/lib/vnstat but these files were owned by the USER.
                                    After
                                    sudo chown -R vnstat:vnstat /var/lib/vnstat
                                    it seems to be ok. I also had to check the default interface in /etc/vnstat.conf - it was the wrong one for me, so I just changed it.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Jan 19 '16 at 18:29









                                    Mudit Kapil

                                    1,22552040




                                    1,22552040










                                    answered Jan 19 '16 at 14:03









                                    bradleybradley

                                    111




                                    111













                                    • I forgat to add that I let run "vnstat -u -i wlan0" (and same for the other devices) as ROOT. This could also cause issues with permission. And one more thing: You have to check whether you are using systemd, init or upstart and start the daemon according to this.

                                      – bradley
                                      Jan 19 '16 at 14:36



















                                    • I forgat to add that I let run "vnstat -u -i wlan0" (and same for the other devices) as ROOT. This could also cause issues with permission. And one more thing: You have to check whether you are using systemd, init or upstart and start the daemon according to this.

                                      – bradley
                                      Jan 19 '16 at 14:36

















                                    I forgat to add that I let run "vnstat -u -i wlan0" (and same for the other devices) as ROOT. This could also cause issues with permission. And one more thing: You have to check whether you are using systemd, init or upstart and start the daemon according to this.

                                    – bradley
                                    Jan 19 '16 at 14:36





                                    I forgat to add that I let run "vnstat -u -i wlan0" (and same for the other devices) as ROOT. This could also cause issues with permission. And one more thing: You have to check whether you are using systemd, init or upstart and start the daemon according to this.

                                    – bradley
                                    Jan 19 '16 at 14:36











                                    1














                                    Sorry I had to make this its own answer instead of editing Boby's since my edit was rejected :|



                                    By default, when you install vnstat, it auto starts a vnstatd daemon, which collects metrics every 30 seconds and "updates them" (for all local devices) every 5 minutes. So in essence, after installing vnstat packet, you should start to see metrics 5 minutes later.



                                    Appears to sometimes be a problem with the install package however. It sometimes seems to create /var/lib/vnstat directory in such a way that it isn't writable by user vnstat so vnstat program only works when run as root (the daemon runs as user vnstat).



                                    You can check if this is your problem by running this:



                                    ll /var/lib | grep vnstat
                                    drwxr-xr-x 2 root root 4096 Oct 25 2014 vnstat


                                    If it is owned by root (as it is in this example), then that may be your problem. You can also look for the cause in your /var/log/syslog file, it'll probably have lines like this:



                                    Jul 27 22:06:19 xxx vnstatd[13276]: Error: Unable to open database "/var/lib/vnstat/eth0" for writing: Permission denied


                                    Run



                                     sudo chown -R vnstat:vnstat /var/lib/vnstat


                                    This fixed my problem on Ubuntu 15.10.



                                    Make sure you have following files in that folder and have proper ownership, should look like this when you're done:



                                    /var/lib/vnstat$ ls -la
                                    total 16
                                    drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                                    drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                                    -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                                    -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0


                                    You may need to restart your vnstat daemon via sudo /etc/init.d/vnstat restart if it died from its initial failed startup attempt. You should start getting data for all devices in 5 minutes after the fix.






                                    share|improve this answer






























                                      1














                                      Sorry I had to make this its own answer instead of editing Boby's since my edit was rejected :|



                                      By default, when you install vnstat, it auto starts a vnstatd daemon, which collects metrics every 30 seconds and "updates them" (for all local devices) every 5 minutes. So in essence, after installing vnstat packet, you should start to see metrics 5 minutes later.



                                      Appears to sometimes be a problem with the install package however. It sometimes seems to create /var/lib/vnstat directory in such a way that it isn't writable by user vnstat so vnstat program only works when run as root (the daemon runs as user vnstat).



                                      You can check if this is your problem by running this:



                                      ll /var/lib | grep vnstat
                                      drwxr-xr-x 2 root root 4096 Oct 25 2014 vnstat


                                      If it is owned by root (as it is in this example), then that may be your problem. You can also look for the cause in your /var/log/syslog file, it'll probably have lines like this:



                                      Jul 27 22:06:19 xxx vnstatd[13276]: Error: Unable to open database "/var/lib/vnstat/eth0" for writing: Permission denied


                                      Run



                                       sudo chown -R vnstat:vnstat /var/lib/vnstat


                                      This fixed my problem on Ubuntu 15.10.



                                      Make sure you have following files in that folder and have proper ownership, should look like this when you're done:



                                      /var/lib/vnstat$ ls -la
                                      total 16
                                      drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                                      drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                                      -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                                      -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0


                                      You may need to restart your vnstat daemon via sudo /etc/init.d/vnstat restart if it died from its initial failed startup attempt. You should start getting data for all devices in 5 minutes after the fix.






                                      share|improve this answer




























                                        1












                                        1








                                        1







                                        Sorry I had to make this its own answer instead of editing Boby's since my edit was rejected :|



                                        By default, when you install vnstat, it auto starts a vnstatd daemon, which collects metrics every 30 seconds and "updates them" (for all local devices) every 5 minutes. So in essence, after installing vnstat packet, you should start to see metrics 5 minutes later.



                                        Appears to sometimes be a problem with the install package however. It sometimes seems to create /var/lib/vnstat directory in such a way that it isn't writable by user vnstat so vnstat program only works when run as root (the daemon runs as user vnstat).



                                        You can check if this is your problem by running this:



                                        ll /var/lib | grep vnstat
                                        drwxr-xr-x 2 root root 4096 Oct 25 2014 vnstat


                                        If it is owned by root (as it is in this example), then that may be your problem. You can also look for the cause in your /var/log/syslog file, it'll probably have lines like this:



                                        Jul 27 22:06:19 xxx vnstatd[13276]: Error: Unable to open database "/var/lib/vnstat/eth0" for writing: Permission denied


                                        Run



                                         sudo chown -R vnstat:vnstat /var/lib/vnstat


                                        This fixed my problem on Ubuntu 15.10.



                                        Make sure you have following files in that folder and have proper ownership, should look like this when you're done:



                                        /var/lib/vnstat$ ls -la
                                        total 16
                                        drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                                        drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                                        -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                                        -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0


                                        You may need to restart your vnstat daemon via sudo /etc/init.d/vnstat restart if it died from its initial failed startup attempt. You should start getting data for all devices in 5 minutes after the fix.






                                        share|improve this answer















                                        Sorry I had to make this its own answer instead of editing Boby's since my edit was rejected :|



                                        By default, when you install vnstat, it auto starts a vnstatd daemon, which collects metrics every 30 seconds and "updates them" (for all local devices) every 5 minutes. So in essence, after installing vnstat packet, you should start to see metrics 5 minutes later.



                                        Appears to sometimes be a problem with the install package however. It sometimes seems to create /var/lib/vnstat directory in such a way that it isn't writable by user vnstat so vnstat program only works when run as root (the daemon runs as user vnstat).



                                        You can check if this is your problem by running this:



                                        ll /var/lib | grep vnstat
                                        drwxr-xr-x 2 root root 4096 Oct 25 2014 vnstat


                                        If it is owned by root (as it is in this example), then that may be your problem. You can also look for the cause in your /var/log/syslog file, it'll probably have lines like this:



                                        Jul 27 22:06:19 xxx vnstatd[13276]: Error: Unable to open database "/var/lib/vnstat/eth0" for writing: Permission denied


                                        Run



                                         sudo chown -R vnstat:vnstat /var/lib/vnstat


                                        This fixed my problem on Ubuntu 15.10.



                                        Make sure you have following files in that folder and have proper ownership, should look like this when you're done:



                                        /var/lib/vnstat$ ls -la
                                        total 16
                                        drwxr-xrwx 2 vnstat vnstat 4096 May 16 01:50 .
                                        drwxr-xr-x 78 root root 4096 Jul 22 15:14 ..
                                        -rw-r--rwx 1 vnstat vnstat 2792 Jul 26 00:26 eth0
                                        -rw-rw-r-- 1 vnstat vnstat 2792 Jul 26 00:26 .eth0


                                        You may need to restart your vnstat daemon via sudo /etc/init.d/vnstat restart if it died from its initial failed startup attempt. You should start getting data for all devices in 5 minutes after the fix.







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Sep 15 '17 at 16:44

























                                        answered Jul 28 '16 at 16:51









                                        rogerdpackrogerdpack

                                        476513




                                        476513























                                            0














                                            Try to output some from this help:



                                            $ vnstat --help
                                            vnStat 1.11 by Teemu Toivola

                                            -q, --query query database
                                            -h, --hours show hours
                                            -d, --days show days
                                            -m, --months show months
                                            -w, --weeks show weeks
                                            -t, --top10 show top10
                                            -s, --short use short output
                                            -u, --update update database
                                            -i, --iface select interface (default: eth0)
                                            -?, --help short help
                                            -v, --version show version
                                            -tr, --traffic calculate traffic
                                            -ru, --rateunit swap configured rate unit
                                            -l, --live show transfer rate in real time

                                            See also "--longhelp" for complete options list and "man vnstat".


                                            READ MORE






                                            share|improve this answer




























                                              0














                                              Try to output some from this help:



                                              $ vnstat --help
                                              vnStat 1.11 by Teemu Toivola

                                              -q, --query query database
                                              -h, --hours show hours
                                              -d, --days show days
                                              -m, --months show months
                                              -w, --weeks show weeks
                                              -t, --top10 show top10
                                              -s, --short use short output
                                              -u, --update update database
                                              -i, --iface select interface (default: eth0)
                                              -?, --help short help
                                              -v, --version show version
                                              -tr, --traffic calculate traffic
                                              -ru, --rateunit swap configured rate unit
                                              -l, --live show transfer rate in real time

                                              See also "--longhelp" for complete options list and "man vnstat".


                                              READ MORE






                                              share|improve this answer


























                                                0












                                                0








                                                0







                                                Try to output some from this help:



                                                $ vnstat --help
                                                vnStat 1.11 by Teemu Toivola

                                                -q, --query query database
                                                -h, --hours show hours
                                                -d, --days show days
                                                -m, --months show months
                                                -w, --weeks show weeks
                                                -t, --top10 show top10
                                                -s, --short use short output
                                                -u, --update update database
                                                -i, --iface select interface (default: eth0)
                                                -?, --help short help
                                                -v, --version show version
                                                -tr, --traffic calculate traffic
                                                -ru, --rateunit swap configured rate unit
                                                -l, --live show transfer rate in real time

                                                See also "--longhelp" for complete options list and "man vnstat".


                                                READ MORE






                                                share|improve this answer













                                                Try to output some from this help:



                                                $ vnstat --help
                                                vnStat 1.11 by Teemu Toivola

                                                -q, --query query database
                                                -h, --hours show hours
                                                -d, --days show days
                                                -m, --months show months
                                                -w, --weeks show weeks
                                                -t, --top10 show top10
                                                -s, --short use short output
                                                -u, --update update database
                                                -i, --iface select interface (default: eth0)
                                                -?, --help short help
                                                -v, --version show version
                                                -tr, --traffic calculate traffic
                                                -ru, --rateunit swap configured rate unit
                                                -l, --live show transfer rate in real time

                                                See also "--longhelp" for complete options list and "man vnstat".


                                                READ MORE







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jul 23 '14 at 20:29









                                                swiftswift

                                                2,96621743




                                                2,96621743























                                                    0














                                                    In addition, to fix



                                                    Error: Unable to create database backup "/var/lib/vnstat/.ppp0"



                                                    I have had to setuid vnstat



                                                    sudo chmod 4755 /usr/bin/vnstat



                                                    so that



                                                    -rwsr-xr-x 1 root root 105016 Dec 6 2015 /usr/bin/vnstat






                                                    share|improve this answer




























                                                      0














                                                      In addition, to fix



                                                      Error: Unable to create database backup "/var/lib/vnstat/.ppp0"



                                                      I have had to setuid vnstat



                                                      sudo chmod 4755 /usr/bin/vnstat



                                                      so that



                                                      -rwsr-xr-x 1 root root 105016 Dec 6 2015 /usr/bin/vnstat






                                                      share|improve this answer


























                                                        0












                                                        0








                                                        0







                                                        In addition, to fix



                                                        Error: Unable to create database backup "/var/lib/vnstat/.ppp0"



                                                        I have had to setuid vnstat



                                                        sudo chmod 4755 /usr/bin/vnstat



                                                        so that



                                                        -rwsr-xr-x 1 root root 105016 Dec 6 2015 /usr/bin/vnstat






                                                        share|improve this answer













                                                        In addition, to fix



                                                        Error: Unable to create database backup "/var/lib/vnstat/.ppp0"



                                                        I have had to setuid vnstat



                                                        sudo chmod 4755 /usr/bin/vnstat



                                                        so that



                                                        -rwsr-xr-x 1 root root 105016 Dec 6 2015 /usr/bin/vnstat







                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered 15 mins ago









                                                        equatuxequatux

                                                        1




                                                        1






























                                                            draft saved

                                                            draft discarded




















































                                                            Thanks for contributing an answer to Ask Ubuntu!


                                                            • Please be sure to answer the question. Provide details and share your research!

                                                            But avoid



                                                            • Asking for help, clarification, or responding to other answers.

                                                            • Making statements based on opinion; back them up with references or personal experience.


                                                            To learn more, see our tips on writing great answers.




                                                            draft saved


                                                            draft discarded














                                                            StackExchange.ready(
                                                            function () {
                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f500663%2fvnstat-not-updating%23new-answer', 'question_page');
                                                            }
                                                            );

                                                            Post as a guest















                                                            Required, but never shown





















































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown

































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown







                                                            Popular posts from this blog

                                                            List of shipwrecks in 1808...

                                                            Is there a lightweight tool to crop images quickly?Cropping Images using Command Line Tools OnlyHow to crop...

                                                            Unit packagekit.service is masked Announcing the arrival of Valued Associate #679: Cesar...