Bug 1685598 - Do not use sysV init script for anamon
Summary: Do not use sysV init script for anamon
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Beaker
Classification: Retired
Component: general
Version: develop
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 26.4
Assignee: Tomas Klohna 🔧
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-05 15:34 UTC by Lukas Slebodnik
Modified: 2019-04-05 13:38 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-04-05 13:38:54 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Beaker Project Gerrit 6457 0 None None None 2019-03-07 12:56:55 UTC

Description Lukas Slebodnik 2019-03-05 15:34:29 UTC
Description of problem:
Fedora rawhide does not contain the package initscripts by default.
But there is still code which generate shell base initscript but it fails due to missing dependencies.

fetch /etc/rc.d/init.d/anamon http://lab-01.example.com/beaker/anamon.init

chmod 755 /etc/rc.d/init.d/anamon /usr/local/sbin/anamon
if selinuxenabled &>/dev/null ; then
    restorecon /etc/rc.d/init.d/anamon /usr/local/sbin/anamon
fi

chkconfig --add anamon

cat << __EOT__ > /etc/sysconfig/anamon
XMLRPC_URL="http://lab-01.example.com:8000/RPC2"
RECIPE_ID="6589154"
LOGFILES="/var/log/boot.log /var/log/messages /var/log/dmesg"
__EOT__


How reproducible:
Deterministic

Steps to Reproduce:
1. Reserve rawhide machine in beaker e.g.
<job retention_tag="scratch">
  <whiteboard>fedora rawhide</whiteboard>
  <recipeSet priority="Normal">
    <recipe whiteboard="" role="RECIPE_MEMBERS" ks_meta="" kernel_options="" kernel_options_post="">
      <autopick random="false"/>
      <watchdog panic="ignore"/>
      <packages/>
      <ks_appends/>
      <repos/>
      <distroRequires>
        <and>
          <distro_family op="=" value="Fedorarawhide"/>
          <distro_variant op="=" value="Server"/>
          <distro_arch op="=" value="x86_64"/>
        </and>
      </distroRequires>
      <hostRequires>
        <system_type value="Machine"/>
      </hostRequires>
      <partitions/>
      <task name="/distribution/check-install" role="STANDALONE"/>
      <reservesys duration="86400" when="always"/>
    </recipe>
  </recipeSet>
</job>

2. ssh -l root $RAWHIDE_MACHINE systemctl --failed
3. ssh -l root $RAWHIDE_MACHINE journalctl -u anamon.service

Actual results:
sh$ ssh -l root fedora-rawhide.example.com systemctl --failed
Warning: Permanently added 'fedora-rawhide.example.com,10.16.64.106' (ECDSA) to the list of known hosts.
  UNIT           LOAD   ACTIVE SUB    DESCRIPTION                                               
● anamon.service loaded failed failed SYSV: anamon runs the first time a machine is booted after

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.


sh$ ssh -l root fedora-rawhide.example.comjournalctl -u anamon.service
Warning: Permanently added 'fedora-rawhide.example.com,10.16.64.106' (ECDSA) to the list of known hosts.
-- Logs begin at Tue 2019-03-05 07:26:06 EST, end at Tue 2019-03-05 12:26:43 EST. --
Mar 05 12:26:30 fedora-rawhide.example.com systemd[1]: Starting SYSV: anamon runs the first time a machine is booted after...
Mar 05 12:26:30 fedora-rawhide.example.com anamon[550]: /etc/rc.d/init.d/anamon: line 26: /etc/init.d/functions: No such file or directory
Mar 05 12:26:30 fedora-rawhide.example.com anamon[550]: Starting anamon: /etc/rc.d/init.d/anamon: line 50: daemon: command not found
Mar 05 12:26:32 fedora-rawhide.example.com systemd[1]: anamon.service: Control process exited, code=exited, status=127/n/a
Mar 05 12:26:32 fedora-rawhide.example.com systemd[1]: anamon.service: Failed with result 'exit-code'.
Mar 05 12:26:32 fedora-rawhide.example.com systemd[1]: Failed to start SYSV: anamon runs the first time a machine is booted after.

Expected results:
No failed services after boot (especially anamon.service)

Additional info:
sh$ rpm -qf /etc/init.d/functions
initscripts-10.01-2.fc30.x86_64

Comment 2 Lukas Slebodnik 2019-03-05 15:37:52 UTC
It should not be complicated to write simple systemd service file
and store it in /etc/systemd/system/anamon.service
(if you do not want to add it into /the directory /usr/lib/systemd/system/

Comment 3 Lukas Slebodnik 2019-03-07 20:46:20 UTC
I can see you added following check

+# OS without `initscripts` need to use systemd
+if [ -d /etc/init.d/functions ]; then

Is there any reason why you do not want to do that also on rhel7 ?
e.g.
+# OS without `initscripts` need to use systemd
+if [ -x /usr/bin/systemctl ]; then

Comment 4 Lukas Slebodnik 2019-03-07 20:48:23 UTC
And tiny question. What is a purpose of anamon. 
Because I cannot see any issues with reserving rawhide machine in beaker.

Comment 5 Tomas Klohna 🔧 2019-03-13 13:41:06 UTC
> Is there any reason why you do not want to do that also on rhel7 ?

Pretty simple, because the old solution works and there is no need to change it as it has been tested numerous times.

> And tiny question. What is a purpose of anamon.

"Anamon", the ANAconda MONitoring script. This runs during Anaconda installations and periodically uploads Anaconda logs to Beaker.

Comment 6 Martin Styk 2019-03-26 09:45:59 UTC
Beaker 26.4 has been released.

Comment 9 Lukas Slebodnik 2019-04-05 13:04:58 UTC
It does not work for me

[root@kvm-01-guest20 ~]# systemctl status anamon
● anamon.service
   Loaded: bad-setting (Reason: Unit anamon.service has a bad unit file setting.)
   Active: inactive (dead)

Apr 05 15:01:41 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:1: Missing '='.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:1: Assignment outside of section. Ignoring.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:2: Assignment outside of section. Ignoring.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:3: Assignment outside of section. Ignoring.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:4: Assignment outside of section. Ignoring.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:5: Assignment outside of section. Ignoring.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:6: Assignment outside of section. Ignoring.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:7: Assignment outside of section. Ignoring.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: anamon.service: Service has no ExecStart=, ExecStop=, or SuccessAction=. Refusing.
Apr 05 15:04:33 kvm-01-guest20.testrelm.test systemd[1]: /etc/systemd/system/anamon.service:1: Missing '='.
[root@kvm-01-guest20 ~]# cat /etc/systemd/system/anamon.service
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /beaker/anamon.service was not found on this server.</p>
</body></html>


Note You need to log in before you can comment on or make changes to this bug.