[systemd-devel] rsyslog not starting inside a namespace when started using systemd.

Navneet Sinha nnavneetsinha1001 at gmail.com
Mon Dec 14 07:42:14 PST 2015


I don't know whether this is the right place to talk about this.

Here is my rsyslog.service file.

    [Unit] Description=System Logging Service

    [Service]
    EnvironmentFile=-/etc/sysconfig/rsyslog
    ExecStart=/sbin/ip netns exec $NSNAME /sbin/rsyslogd -n
    Sockets=syslog.socket
    StandardOutput=null

    [Install]
    WantedBy=multi-user.target
    Alias=syslog.service

Here is the environment file:

    # NOTE NOTE NOTE NOTE NOTE
    #
    # This file is AUTO-GENERATED based on the system's configuration.
    # Any modifications you make to this file will be lost when the
    # system's configuration is changed, e.g. from the CLI.
    #

    SYSLOGD_OPTIONS=""
    NSNAME="default"

    # End of auto-generated file

When, systemd tries to start this service during boot up of my machine.
I see following debug logs:

    'About to execute /sbin/ip netns exec $NSNAME /sbin/rsyslogd -n\n'
    'Forked /sbin/ip as 2794\n'
    'rsyslog.service changed dead -> running\n'
    'Job rsyslog.service/start finished, result=done\n'
    'Got D-Bus request: org.freedesktop.systemd1.Manager.GetUnit() on
/org/freedesktop/systemd1\n'
    'Got D-Bus request: org.freedesktop.DBus.Properties.Get() on
/org/freedesktop/systemd1/unit/rsyslog_2eservice\n'
    'Got D-Bus request: org.freedesktop.DBus.Local.Disconnected() on
/org/freedesktop/DBus/Local\n'
    'Accepted connection on private bus.\n'
    'Got D-Bus request: org.freedesktop.systemd1.Agent.Released() on
/org/freedesktop/systemd1/agent\n'
    'Got D-Bus request: org.freedesktop.DBus.Local.Disconnected() on
/org/freedesktop/DBus/Local\n'
    'Accepted connection on private bus.\n'
    'Received SIGCHLD from PID 2794 (ip).\n'
    'Got SIGCHLD for process 2794 (ip)\n'
    'Child 2794 died (code=exited, status=1/FAILURE)\n'
    'Child 2794 belongs to rsyslog.service\n'
    'rsyslog.service: main process exited, code=exited, status=1/FAILURE\n'
    'rsyslog.service changed running -> failed\n'
    'Unit rsyslog.service entered failed state.\n'


***why it fails to start, why pid 2794 receives the SIGCHLD ?***
*Any ideas ? I am unable to think on what to check next.*

systemd version : systemd-201-2.fc18.9.i686

rsyslog version : rsyslog-7.2.6

Before changing to systemd, I had rsyslog initscript in /etc/init.d/ to
start up rsyslog during boot up. Just in case, someone wants to take a look
at it. Here is the main part of the initscript, which I changed an made a
systemd service

    #!/bin/bash
    #
    # rsyslog        Startup script for rsyslog.
    #
    # chkconfig: 2345 12 88
    # description: Syslog is the facility by which many daemons use to log \
    # messages to various system log files.  It is a good idea to always \
    # run rsyslog.
    ### BEGIN INIT INFO
    # Provides: $syslog
    # Required-Start: $local_fs
    # Required-Stop: $local_fs
    # Default-Start:  2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Enhanced system logging and kernel message
trapping daemons
    # Description: Rsyslog is an enhanced multi-threaded syslogd supporting,
    #              among others, MySQL, syslog/tcp, RFC 3195, permitted
    #              sender lists, filtering on any message part, and fine
    #              grain output format control.
    ### END INIT INFO


    # Source function library.
    . /etc/init.d/functions

    RETVAL=0
    PIDFILE=/var/run/syslogd.pid

    prog=rsyslog
    exec=/sbin/rsyslogd
    lockfile=/var/lock/subsys/$prog

    # Source config
    if [ -f /etc/sysconfig/$prog ] ; then
        . /etc/sysconfig/$prog
    fi

    start() {
            [ -x $exec ] || exit 5

            umask 077

            echo -n $"Starting system logger: "
            sudo $NETNS_EXEC $exec -i "${PIDFILE}" $SYSLOGD_OPTIONS
            RETVAL=$?
            echo
            [ $RETVAL -eq 0 ] && touch $lockfile
            return $RETVAL
    }
    stop() {
           echo -n $"Shutting down system logger: "
           killproc -p "${PIDFILE}" $exec
           RETVAL=$?
           echo
           [ $RETVAL -eq 0 ] && rm -f $lockfile
           return $RETVAL
    }
    rhstatus() {
           status -p "${PIDFILE}" $exec
    }
    restart() {
           stop
           start
    }


Any help will be appreciated. Kindly, help.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151214/911f5303/attachment-0001.html>


More information about the systemd-devel mailing list