Failed to start vnStat network traffic monitor

Hi all, :wave:

I´ve got a problem with vnstat.service. :slightly_frowning_face:

Background:

For some special reason I wanted to change some values of the vnstat database (/var/lib/vnstat/vnstat.db). So as a precautionary backup I copied the original vnstat.db to a safe place.

Tinkering with the vnstat.db (what I had in mind) didn´t go well, so I decided to put my original vnstat.db (the one I saved as a first step) back to it´s original place.

The steps were the following:

sudo service vnstat stop
sudo rm /var/lib/vnstat/vnstat.db
sudo mv vnstat.db /var/lib/vnstat/  # from my backup location to where it belongs
sudo service vnstat start

Then I seemed to have run into problems as I cannot get the vnstat service running again :slightly_frowning_face::

 systemctl status vnstat
● vnstat.service - vnStat network traffic monitor
     Loaded: loaded (/lib/systemd/system/vnstat.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2021-10-23 15:05:10 CEST; 14min ago
       Docs: man:vnstatd(8)
             man:vnstat(1)
             man:vnstat.conf(5)
    Process: 1121 ExecStart=/usr/sbin/vnstatd -n (code=exited, status=1/FAILURE)
   Main PID: 1121 (code=exited, status=1/FAILURE)

Okt 23 15:05:10 rosika-10159 systemd[1]: vnstat.service: Scheduled restart job, restart counte>
Okt 23 15:05:10 rosika-10159 systemd[1]: Stopped vnStat network traffic monitor.
Okt 23 15:05:10 rosika-10159 systemd[1]: vnstat.service: Start request repeated too quickly.
Okt 23 15:05:10 rosika-10159 systemd[1]: vnstat.service: Failed with result 'exit-code'.
Okt 23 15:05:10 rosika-10159 systemd[1]: Failed to start vnStat network traffic monitor.

I did some research on the topic of "vnstat.service: Start request repeated too quickly" and found something on
debian - How to fix ".service: Start request repeated too quickly." on custom service? - Unix & Linux Stack Exchange .

The solution provided however didn´t work with me: :anguished:

systemctl reset-failed SERVICE
systemctl start SERVICE
systemctl status SERVICE

I replaced “SERVICE” with vnstat.service of course.

I also shut down the system, waited for 10 mins and then performed a cold start again - to no avail.
I still get the same status report (see above). :thinking:

Hopefully someone in this forum may be able to help.

Thanks so much in advance
Many greetings.
Rosika :slightly_smiling_face:

UPDATE:

Hi again,

perhaps I´ve got it running again:
Still I´m not quite sure. :thinking:

I put my two VMs (Bodhi and Debian) to good use by checking the contents of /var/lib/vnstat/ there.
On e.g. Debian it looks like this:

rosika2@debian /v/l/vnstat> ll
insgesamt 4,0K
-rw-r--r-- 1 vnstat vnstat 2,8K Okt 14 17:28 enp1s0

whereas on my main system (the one that gave me the problems) it looks like this:

rosika@rosika-10159 ~> ll /var/lib/vnstat
insgesamt 100K
-rw-r--r-- 1 root root 96K Okt 23 14:46 vnstat.db

So somehow owner and group have changed. :roll_eyes:

Accordingliy I did this:

sudo chown vnstat:vnstat vnstat.db

and now vnstat.service seems to be running alright:

 systemctl status vnstat
● vnstat.service - vnStat network traffic monitor
     Loaded: loaded (/lib/systemd/system/vnstat.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-10-23 16:40:29 CEST; 10min ago
       Docs: man:vnstatd(8)
             man:vnstat(1)
             man:vnstat.conf(5)
   Main PID: 16937 (vnstatd)
      Tasks: 1 (limit: 4513)
     Memory: 1.2M
     CGroup: /system.slice/vnstat.service
             └─16937 /usr/sbin/vnstatd -n

Okt 23 16:40:29 rosika-10159 systemd[1]: Started vnStat network traffic monitor.
Okt 23 16:40:29 rosika-10159 vnstatd[16937]: Info: vnStat daemon 2.6 started. (pid:16937 uid:122 gid:133 64-bit)
Okt 23 16:40:29 rosika-10159 vnstatd[16937]: Info: Monitoring (2): enx001e101f0000 (1000 Mbit) enp2s0 (1000 Mbit)

Many greetings.
Rosika :slightly_smiling_face:

P.S.:
right now I notice vnstat is running as it counts data again. :grinning:
Phew, I´m glad I could set things right again. :relaxed: