Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 493072 - net-analyzer/ntop-5.0.1-r1 installs /etc/cron.monthly/ntop-update-geoip-db which calls /etc/init.d/ntop which is not compatible with systemd
Summary: net-analyzer/ntop-5.0.1-r1 installs /etc/cron.monthly/ntop-update-geoip-db wh...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-01 21:17 UTC by Juergen Rose
Modified: 2018-02-14 15:47 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Rose 2013-12-01 21:17:43 UTC
'journalctl -b' reports:
...
Dec 01 05:30:01 impala run-crons[26352]: (root) CMD (/etc/cron.monthly/ntop-update-geoip-db)
Dec 01 05:30:56 impala dbus-daemon[8924]: **** Refreshing ATA SMART data for /sys/devices/pci0000:00/0000:00:11.0/ata4/host3/target3:0:0/3:0:0:0/block/sdc
Dec 01 05:30:56 impala dbus-daemon[8924]: helper(pid 26363): launched job udisks-helper-ata-smart-collect on /dev/sdc
Dec 01 05:30:56 impala dbus-daemon[8924]: **** Refreshing ATA SMART data for /sys/devices/pci0000:00/0000:00:11.0/ata1/host0/target0:0:0/0:0:0:0/block/sda
Dec 01 05:30:56 impala dbus-daemon[8924]: helper(pid 26364): launched job udisks-helper-ata-smart-collect on /dev/sda
Dec 01 05:30:56 impala dbus-daemon[8924]: **** Refreshing ATA SMART data for /sys/devices/pci0000:00/0000:00:11.0/ata2/host1/target1:0:0/1:0:0:0/block/sdb
Dec 01 05:30:56 impala dbus-daemon[8924]: helper(pid 26365): launched job udisks-helper-ata-smart-collect on /dev/sdb
Dec 01 05:30:56 impala dbus-daemon[8924]: helper(pid 26363): completed with exit code 0
Dec 01 05:30:56 impala dbus-daemon[8924]: **** EMITTING CHANGED for /sys/devices/pci0000:00/0000:00:11.0/ata4/host3/target3:0:0/3:0:0:0/block/sdc
Dec 01 05:30:57 impala dbus-daemon[8924]: helper(pid 26364): completed with exit code 0
Dec 01 05:30:57 impala dbus-daemon[8924]: **** EMITTING CHANGED for /sys/devices/pci0000:00/0000:00:11.0/ata1/host0/target0:0:0/0:0:0:0/block/sda
Dec 01 05:30:57 impala dbus-daemon[8924]: helper(pid 26365): completed with exit code 0
Dec 01 05:30:57 impala dbus-daemon[8924]: **** EMITTING CHANGED for /sys/devices/pci0000:00/0000:00:11.0/ata2/host1/target1:0:0/1:0:0:0/block/sdb
Dec 01 05:32:52 impala /etc/init.d/ntop[26383]: You are attempting to run an openrc service on a
Dec 01 05:32:52 impala /etc/init.d/ntop[26384]: system which openrc did not boot.
Dec 01 05:32:52 impala /etc/init.d/ntop[26385]: You may be inside a chroot or you may have used
Dec 01 05:32:52 impala /etc/init.d/ntop[26386]: another initialization system to boot this system.
Dec 01 05:32:52 impala /etc/init.d/ntop[26387]: In this situation, you will get unpredictable results!
Dec 01 05:32:52 impala /etc/init.d/ntop[26389]: If you really want to do this, issue the following command:
Dec 01 05:32:52 impala /etc/init.d/ntop[26390]: touch /run/openrc/softlevel
Comment 1 Rick Farina (Zero_Chaos) gentoo-dev 2013-12-02 14:32:30 UTC
I don't mind systemd compatibility, but I'll definitely need someone fluent with insane to help fix.
Comment 2 Sean McGovern 2013-12-02 14:40:01 UTC
Install vixie-cron in the meantime?
Comment 3 Juergen Rose 2013-12-02 14:44:02 UTC
(In reply to Sean McGovern from comment #2)
> Install vixie-cron in the meantime?

I suppose etc/cron.monthly/ntop-update-geoip-db is executed by vixie-cron. At least vixie-cron is installed.
Comment 4 Juergen Rose 2013-12-02 14:49:06 UTC
(In reply to Rick Farina (Zero_Chaos) from comment #1)
> I don't mind systemd compatibility, but I'll definitely need someone fluent
> with insane to help fix.

I assume a /usr/lib/systemd/system/ntop.service (similar to /etc/init.d/ntop) should be created. And int /etc/cron.monthly/ntop-update-geoip-db

/etc/init.d/ntop --quiet status && /etc/init.d/ntop restart

could be replace by:

if ps -ef | grep systemd | grep -v grep; then
  systemctl restart ntop
else
  /etc/init.d/ntop --quiet status && /etc/init.d/ntop restart
fi
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2013-12-02 16:02:02 UTC
(In reply to Juergen Rose from comment #4)
> (In reply to Rick Farina (Zero_Chaos) from comment #1)
> > I don't mind systemd compatibility, but I'll definitely need someone fluent
> > with insane to help fix.
> 
> I assume a /usr/lib/systemd/system/ntop.service (similar to
> /etc/init.d/ntop) should be created. And int
> /etc/cron.monthly/ntop-update-geoip-db
> 
> /etc/init.d/ntop --quiet status && /etc/init.d/ntop restart
> 
> could be replace by:
> 
> if ps -ef | grep systemd | grep -v grep; then

Wait, what? I don't know systemd internals that well, but I am absolutely sure there is a better way than screen-scraping ps output with grep (badly) twice.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-12-02 16:22:38 UTC
If we're really talking about finding out which RC is being run:

1. [ -d /run/systemd/system ] (it's the method used in systemd libraries),

2. [ ! -e "/run/openrc/softlevel" ] (it's used e.g. in NetworkManager, see bug #489396).


But in fact, either way sucks. It's weird to make random cron scripts aware of any random service supervisors. It'd be better if ntop simply was able to find out when the files are updated and automatically reload them.

From systemd side, this can be easily handled via a .path unit.
Comment 7 Rick Farina (Zero_Chaos) gentoo-dev 2013-12-02 17:52:53 UTC
(In reply to Michał Górny from comment #6)
> If we're really talking about finding out which RC is being run:
> 
> 1. [ -d /run/systemd/system ] (it's the method used in systemd libraries),
> 
> 2. [ ! -e "/run/openrc/softlevel" ] (it's used e.g. in NetworkManager, see
> bug #489396).
> 
> 
> But in fact, either way sucks. It's weird to make random cron scripts aware
> of any random service supervisors. It'd be better if ntop simply was able to
> find out when the files are updated and automatically reload them.
> 
> From systemd side, this can be easily handled via a .path unit.

And that's why I included systemd on this. :-)

Would you be kind enough to handle this ".path unit" and I'll update the script to not reload the service if openrc isn't in control?  That should be a pretty good solution...
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-12-02 19:09:47 UTC
I don't mind trying, however... shouldn't ntop get a systemd unit first? I kinda don't see one in the ebuild, or am I missing something?
Comment 9 Rick Farina (Zero_Chaos) gentoo-dev 2013-12-02 19:54:04 UTC
(In reply to Michał Górny from comment #8)
> I don't mind trying, however... shouldn't ntop get a systemd unit first? I
> kinda don't see one in the ebuild, or am I missing something?

I don't know anything about systemd, and as such I can't support it. The best I can do it accept what I'm given, and I'm happy to do that.
Comment 10 Pacho Ramos gentoo-dev 2013-12-09 10:14:32 UTC
(In reply to Rick Farina (Zero_Chaos) from comment #9)
> (In reply to Michał Górny from comment #8)
> > I don't mind trying, however... shouldn't ntop get a systemd unit first? I
> > kinda don't see one in the ebuild, or am I missing something?
> 
> I don't know anything about systemd, and as such I can't support it. The
> best I can do it accept what I'm given, and I'm happy to do that.

I expect to have a bit of time for this in some days... but you can start to work on the updated cron file (I guess it will simply run "systemctl start ntop" when needed) in parallel, then we can attach the file here, I will do the same with unit file and we can commit both at the same time
Comment 11 Pacho Ramos gentoo-dev 2013-12-09 10:29:17 UTC
Regarding how to pass options to ntop, I like to fedora approach for this concrete case:
https://wiki.gentoo.org/wiki/Project:Systemd/Ebuild_policy#Unit_file_guidelines

They rely on the ability of ntop to parse a config file like "ntop @/etc/ntop.conf" for getting the parameters like:
http://pkgs.fedoraproject.org/cgit/ntop.git/tree/ntop.conf

Maybe this could be reused for init.d file also

What does maintainer think?
Comment 12 Pacho Ramos gentoo-dev 2018-02-14 15:47:15 UTC
removed from the tree