Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 2024 15:55:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 278465] net/vnstat will not start after a reboot because of wrong ownership of db
Message-ID:  <bug-278465-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278465

            Bug ID: 278465
           Summary: net/vnstat will not start after a reboot because of
                    wrong ownership of db
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: sunpoet@FreeBSD.org
          Reporter: void@f-m.fm
             Flags: maintainer-feedback?(sunpoet@FreeBSD.org)
          Assignee: sunpoet@FreeBSD.org

Hi,

net/vnstat once installed and configured runs under the U/GID of vnstat.
This is with vnstat_enable=3D"YES" in /etc/rc.conf

In order to get it working, one has to change the ownership of /var/db/vnst=
at
and /var/db/vnstat/* and /var/run/vnstat from root:wheel to vnstat:vnstat a=
nd
then 'service vnstat (re)start' every time the machine boots.

###
root:~ # cd /var/run/vnstat
root:/var/run/vnstat # ls -lah
total 12
drwxr-xr-x   2 root wheel  512B Apr 19 13:09 .
drwxr-xr-x  13 root wheel  1.0K Apr 19 13:11 ..
-rw-r--r--   1 root wheel    6B Apr 19 13:11 vnstat.pid
root:/var/run/vnstat # service vnstat restart
Stopping vnstat.
kill: 47758: No such process
vnstat already running?  (pid=3D47758).
root:/var/run/vnstat # chown -R vnstat:vnstat /var/run/vnstat
root:/var/run/vnstat # service vnstat restart
Stopping vnstat.
kill: 47758: No such process
vnstat already running?  (pid=3D47758).
root:/var/run/vnstat # ls -lah
total 12
drwxr-xr-x   2 vnstat vnstat  512B Apr 19 13:09 .
drwxr-xr-x  13 root   wheel   1.0K Apr 19 13:11 ..
-rw-r--r--   1 vnstat vnstat    6B Apr 19 13:11 vnstat.pid
root:/var/run/vnstat # cat vnstat.pid
47758
root:/var/run/vnstat # rm vnstat.pid
root:/var/run/vnstat # service vnstat start
Starting vnstat.
Error: Exec step failed (8: attempt to write a readonly database): "update =
info
set value=3D'2.12' where name=3D'vnstatversion'"
Error: Failed to open database "/var/db/vnstat/vnstat.db" in read/write mod=
e.
Exiting...
/usr/local/etc/rc.d/vnstat: WARNING: failed to start vnstat
root:/var/run/vnstat # chown -R vnstat:vnstat /var/db/vnstat
root:/var/run/vnstat # service vnstat start
Starting vnstat.
root:/var/run/vnstat #=20
root:/var/run/vnstat # ls -lah
total 12
drwxr-xr-x   2 vnstat vnstat  512B Apr 19 16:48 .
drwxr-xr-x  13 root   wheel   1.0K Apr 19 13:11 ..
-rw-r--r--   1 vnstat vnstat    5B Apr 19 16:48 vnstat.pid
root:/var/run/vnstat #=20

On reboot, the situation reverts. Below output from the console:

Starting vnstat.
Error: Exec step failed (8: attempt to write a readonly database): "update =
info
set value=3D'2.12' where name=3D'vnstatversion'"
Error: Failed to open database "/var/db/vnstat/vnstat.db" in read/write mod=
e.
Exiting...
/etc/rc: WARNING: failed to start vnstat

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-278465-7788>