Systemd And Systemd-sysv-generator

Home » CentOS » Systemd And Systemd-sysv-generator
CentOS 15 Comments

Hello CentOS List,

I have a server that has SysV script supplied by a hardware manufacturer, which is not functioning properly. From my reading, systemd-sysv-generator should handle them (like it did for Dell OpenManage software which supplied SysV init scripts).

/usr/lib/systemd/system-generators/systemd-sysv-generator Takes no or 3 arguments (it tells me), but I didn’t find clear documentation on this binary. And no arguments doesn’t seem to fix the issue.

The particular software in question is LSI MegaRaid SNMP daemon. I retrieved the latest version from LSI’s site which was provided for EL7.

~]# systemctl lsi_mrdsnmpd.service start Unknown operation ‘lsi_mrdsnmpd.service’.

~]# service lsi_mrdsnmpd start Reloading systemd: [ OK ]
Starting lsi_mrdsnmpd (via systemctl): Failed to start lsi_mrdsnmpd.service: Unit lsi_mrdsnmpd.service failed to load: No such file or directory.
[FAILED]

~]# /etc/init.d/lsi_mrdsnmpd start Reloading systemd: [ OK ]
Starting lsi_mrdsnmpd (via systemctl): Failed to start lsi_mrdsnmpd.service: Unit lsi_mrdsnmpd.service failed to load: No such file or directory.
[FAILED]

~]# /etc/init.d/lsi_mrdsnmpd status lsi_mrdsnmpagent is stopped

~]# ls -1 /etc/init.d/
dataeng dsm_om_connsvc dsm_om_shrsvc dsm_sa_ipmi functions instsvcdrv lsi_mrdsnmpd netconsole network racsvc racsvc.sh README

# in /etc/init.d/README
“Note that traditional init scripts continue to function on a systemd system. An init script /etc/rc.d/init.d/foobar is implicitly mapped into a service unit foobar.service during system initialization.”

~]# ls -1 /etc/rc.d/init.d/
dataeng dsm_om_connsvc dsm_om_shrsvc dsm_sa_ipmi functions instsvcdrv lsi_mrdsnmpd netconsole network racsvc racsvc.sh README

Thoughts as to why systemd didn’t “implicitly” handle this SysV script (and have it work)?

Suggestions as to where I go from here to properly solve this problem?

Thanks!

15 thoughts on - Systemd And Systemd-sysv-generator

  • While I don’t have the answer to your specific question, LSI does does not advertise support for the latest point release and using their current version faults for me after upgrading a host.

    You say “not functioning properly” but what issues are seeing specifically?
    Possibly “MegaRAID SNMP AGENT: Error in getting Shared Memory(lsi_mrdsnmpmain)”
    when starting?

    I have seen that each time a release of their software is used past a version they state support for…

    jlc

  • Well shucks … looks like I copy+pasted some nonsense rather than actually what I did earlier. Gotta pay more attention.

    ~]# systemctl start lsi_mrdsnmpd Failed to start lsi_mrdsnmpd.service: Unit lsi_mrdsnmpd.service failed to load: No such file or directory.

  • On Tue, Dec 29, 2015 at 1:24 PM, Joseph L. Casale
    This system is not a newly built one, so it was probably on a supported release until a few weeks ago when 7.2 came out.

    ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)

    No. That daemon won’t start … reason being systemd unit files.
    [ I replied to Greg’s message just before yours. ]

  • IIRC, you’ll see that if you have a 64 bit system and try to run a
    32-bit binary. Run “ldd” on the binaries you’ve installed and make sure that all of the required libraries are installed.

  • [ Gordon, Thanks for pointing this all out. A couple simple steps/information I needed to verify. ]

    Following what information I’ve gathered below, I don’t think this is relative to needing x86 libraries.
    ( Has Red Hat even built x86 libraries for x86_64 since RHEL7 no longer supports x86? )

    ~]# file /etc/lsi_mrdsnmp/lsi_mrdsnmpagent
    /etc/lsi_mrdsnmp/lsi_mrdsnmpagent: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
    2.4.0, not stripped

    ~]# ldd /etc/lsi_mrdsnmp/lsi_mrdsnmpagent linux-vdso.so.1 => (0x00007ffd29f4a000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fccadc7c000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fccad974000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fccad671000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fccad45b000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fccad09a000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fccade8a000)

    ~]# /etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf LSI MegaRAID SNMP Agent Ver 3.18.0.2 (Oct 30th, 2012) Started

    ~]# ps aux | grep lsi root 19446 0.1 0.0 37972 1604 ? Ssl 16:02 0:00
    /etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf root 19449 0.0 0.0 21576 584 ? Ss 16:02 0:00
    /etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf root 19459 0.0 0.0 112644 952 pts/0 S+ 16:02 0:00 grep
    –color=auto lsi

    The binary runs without crashing.

  • Instead of converting the sysv script, you could trivially write your own, the following was tested against about 6 SNMP queries, the service stops and starts as expected. You may want to purge the sysv remnants.

    # cat /etc/systemd/system/lsi_mrdsnmpd.service
    [Unit]
    Description=LSI SNMP Agent startup/shutdown script

    Requires=network.target Requires=snmpd.service

    After=network.target After=snmpd.service

    [Service]
    Type=forking ExecStart=/etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf

    [Install]
    WantedBy=multi-user.target

    hth, jlc

  • On Tue, Dec 29, 2015 at 5:23 PM, Joseph L. Casale
    That’s certainly an option. One that I was prepared to resort to. But curiosity has the best of me … I would like to know why the SysV generator didn’t do its job.

    And I wasn’t able to find any “generated” unit files from those Dell OpenManage SysV scripts either.

    I appreciate the effort. You took some of the fun out of it for me … less for me to write. :-)

  • Yes. There’s no 32 bit kernel, so no 32 bit installation media, but running 32 bit applications is still supported.

    Did the logs provide any useful information? (systemctl status lsi_mrdsnmpd)

  • jcasale@activenetwerx.com own,

    The generators all run automatically when systemd reloads config.

    The transient unit files created are in /var/run …

    Best way to see this is using systemctl (status|cat|show)

    I expect if you do this for your failing service you’ll get a better understanding of what’s going on.

  • Consolidating my reply to both James and Gordon in one message.

    Thanks. I located a few generated ones in /var/run/systemd/generator.late/
    But not one for lsi_mrdsnmpagent

    ~]# systemctl status lsi_mrdsnmp.service
    ‚óŹ lsi_mrdsnmp.service
    Loaded: not-found (Reason: No such file or directory)
    Active: inactive (dead)

    ~]# systemctl cat lsi_mrdsnmp.service Unit lsi_mrdsnmp.service is not loaded: No such file or directory

    ~]# systemctl show lsi_mrdsnmp.service | egrep ‘Name|Load’
    Names=lsi_mrdsnmp.service LoadState=not-found LoadError=org.freedesktop.DBus.Error.FileNotFound “No such file or directory”

    Thanks for the assistance.


    —~~.~~—
    Mike
    // SilverTip257 //

  • Yes – here is a pastebin with that script.

    And there was an error on line 130 … or line 133 of the pastebin — which I already fixed. ;-)
    (I verified the typo against the contents of the RPM from LSI to be certain.)
    if ( “$rhel_ver” == “1” && “oel_ver” == “0” ) ; then should have been if ( “$rhel_ver” == “1” && “$oel_ver” == “0” ) ; then

    http://pastebin.com/BGLjGiuT


    —~~.~~—
    Mike
    // SilverTip257 //

  • systemctl start … :/

    Some lovely samples from it:
    #A function to stop a program. statuscheck() {

    Let’s import the standard distro function library! then … mykillproc()
    {

    Okay we might have a pid we think … better kill it …

    kill -TERM $pid
    usleep 200000
    if ps h $pid >/dev/null >/dev/null 2>&1 ; then
    sleep 1
    if ps h $pid >/dev/null >/dev/null 2>&1 ; then
    sleep 3

    Hmm we have a snmpd dependency… if [ -x /etc/init.d/snmpd ] ; then
    /etc/init.d/snmpd start

    ./twitch && ./vomit

    That’s so badly written it wouldn’t surprise me if it just barfed and gave up …

    According to https://github.com/systemd/systemd/blob/master/src/sysv-generator/sysv-generator.c though the journal (or syslog) should contain a Failed to create unit file
    if it couldn’t translate it though …

    I’d seriously just give up on that and do the 3-5 line systemd unit that is soo much cleaner … you could even have a proper snmpd.service dependency in place then!

  • I guess that syntax error I found should have been a tip-off. Thanks for analyzing LSI’s SysV init script. ;-)

    I didn’t take the time to do that before you asked for a pastebin. I
    appreciate the help.

    I briefly looked at (and grepped) logs and didn’t find a message about failing to create unit file.

    Sounds like the best path.

    Thank you everyone.

LEAVE A COMMENT