Bug 199133 - [net/vnstat] Fresh vnstat installation breaks after reboot with database file permissions
Summary: [net/vnstat] Fresh vnstat installation breaks after reboot with database file...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Felder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-03 01:41 UTC by Yuri Victorovich
Modified: 2015-05-09 08:27 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (feld)


Attachments
patch (2.50 KB, patch)
2015-04-14 01:59 UTC, Yuri Victorovich
no flags Details | Diff
patch (2.50 KB, patch)
2015-04-14 02:18 UTC, Yuri Victorovich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer 2015-04-03 01:41:26 UTC
Error messages I am getting:

> Apr  2 18:21:15 freebsd64 vnstatd[578]: Error: Unable to create database backup "/var/lib/vnstat/.em0".
> Apr  2 18:21:15 freebsd64 vnstatd[578]: Error: Unable to write database, continuing with cached data.
> Apr  2 18:21:15 freebsd64 vnstatd[578]: Error: Unable to open database "/var/lib/vnstat/tap0" for writing: Permission denied
> Apr  2 18:26:16 freebsd64 vnstatd[578]: Error: Unable to create database backup "/var/lib/vnstat/.em0".
> Apr  2 18:26:16 freebsd64 vnstatd[578]: Error: Unable to open database "/var/lib/vnstat/tap0" for writing: Permission denied
> Apr  2 18:27:45 freebsd64 login: ROOT LOGIN (root) ON ttyv0
> Apr  2 18:29:14 freebsd64 login: ROOT LOGIN (root) ON ttyv1
> Apr  2 18:31:18 freebsd64 vnstatd[578]: Error: Unable to create database backup "/var/lib/vnstat/.em0".
> Apr  2 18:31:18 freebsd64 vnstatd[578]: Error: Unable to open database "/var/lib/vnstat/tap0" for writing: Permission denied

Actual file permissions:
> # ls -l /var/lib/ | grep vnstat
> drwxr-xr-x  2 vnstat     vnstat     6 Mar 31 21:14 vnstat

> # ls -la /var/lib/vnstat
> total 19
> drwxr-xr-x  2 vnstat  vnstat     6 Mar 31 21:14 .
> drwxr-xr-x  9 root    wheel      9 Mar 31 21:03 ..
> -rw-r--r--  1 root    vnstat  2792 Mar 31 21:08 .em0
> -rw-r-----  1 vnstat  vnstat  2792 Apr  2 18:36 .tap0
> -rw-r--r--  1 root    vnstat  2792 Mar 31 21:08 em0
> -rw-r--r--  1 root    vnstat  2792 Mar 31 21:08 tap0


Security info:
> # procstat -s 578
>  PID COMM              EUID  RUID SVUID  EGID  RGID SVGID UMASK FLAGS GROUPS         
>  578 vnstatd            284   284   284   284   284   284     - -     284
Comment 1 Mark Felder freebsd_committer 2015-04-06 14:20:37 UTC
Hello,

Did you happen to run the "vnstat --create ..." command as root? That's supposed to be run as the vnstat user, which might be confusing if you've never run vnstat before.
Comment 2 Yuri Victorovich freebsd_committer 2015-04-14 01:59:57 UTC
Created attachment 155582 [details]
patch

Hi Mark,

I made vnstat service start smoothly when Interface in config file is valid. Otherwise it fails with the meaningful message.
I also added the ability to add vnstat_additional_ifaces in rc.conf. Also all databases are created automatically when requested but missing with the right permissions.

I tested it on both base system where vnstat was already running, and on the freshly installed 10.1 system.
Comment 3 Yuri Victorovich freebsd_committer 2015-04-14 02:18:41 UTC
Created attachment 155583 [details]
patch
Comment 4 Yuri Victorovich freebsd_committer 2015-05-06 10:38:27 UTC
Maintainer timeout.
Comment 5 commit-hook freebsd_committer 2015-05-08 13:25:05 UTC
A commit references this bug:

Author: feld
Date: Fri May  8 13:24:36 UTC 2015
New revision: 385777
URL: https://svnweb.freebsd.org/changeset/ports/385777

Log:
  Improve configuration and setup of vnstat through the rc script

  PR:		199133

Changes:
  head/net/vnstat/Makefile
  head/net/vnstat/files/pkg-message.in
  head/net/vnstat/files/vnstat.in
Comment 6 Mark Felder freebsd_committer 2015-05-08 13:25:56 UTC
Sorry about the delay, but the changes have finally landed. 

Thanks for your submission!
Comment 7 Yuri Victorovich freebsd_committer 2015-05-09 08:27:24 UTC
Thanks! No problem!