/etc/init.d/rsyslog is an init script not a link to /lib/init/upstart-job

Bug #1311810 reported by Joshua Timberman on 2014-04-23
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Undecided
Unassigned
rsyslog (Ubuntu)
Undecided
Unassigned

Bug Description

Using Canonical-provided AMI of Ubuntu 14.04, or the LXC Ubuntu 14.04 template, /etc/init.d/rsyslog is an init script. In Ubuntu 10.04 or 12.04, /etc/init.d/rsyslog was a symbolic link to /lib/init/upstart-job.

The problem here is that the init script does this:

. /lib/lsb/init-functions

And that file has this function, used later in /etc/init.d/rsyslog:

init_is_upstart()
{
   if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | /bin/grep -q upstart; then
       return 0
   fi
   return 1
}

Running /etc/init.d/rsyslog with start or restart commands results in a return code of 1 because the case statement for these uses the init_is_upstart function:

        if init_is_upstart; then
                exit 1
        fi

I modified /etc/init.d/rsyslog on an instance to add "set -x", and here's the results of running /etc/init.d/rsyslog start

ubuntu@rsyslog-bug:~$ sudo /etc/init.d/rsyslog start
+ PATH=/sbin:/usr/sbin:/bin:/usr/bin
+ DESC=enhanced syslogd
+ NAME=rsyslog
+ RSYSLOGD=rsyslogd
+ DAEMON=/usr/sbin/rsyslogd
+ PIDFILE=/var/run/rsyslogd.pid
+ SCRIPTNAME=/etc/init.d/rsyslog
+ [ -x /usr/sbin/rsyslogd ]
+ [ -r /etc/default/rsyslog ]
+ . /etc/default/rsyslog
+ RSYSLOGD_OPTIONS=
+ . /lib/lsb/init-functions
+ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
+ [ -r /lib/lsb/init-functions.d/20-left-info-blocks ]
+ . /lib/lsb/init-functions.d/20-left-info-blocks
+ [ -r /lib/lsb/init-functions.d/50-ubuntu-logging ]
+ . /lib/lsb/init-functions.d/50-ubuntu-logging
+ LOG_DAEMON_MSG=
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ true
+ init_is_upstart
+ [ -x /sbin/initctl ]
+ /bin/grep -q upstart
+ /sbin/initctl version
+ return 0
+ exit 1

The fix here is to properly create a symlink of /lib/init/upstart-job to /etc/init.d/rsyslog, which will provide the sysv/lsb compatible interface to manage the upstart job. This should be done in the package, not by end users who are attempting to control their rsyslog service.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in rsyslog (Ubuntu):
status: New → Confirmed
Joshua Timberman (jtimberman) wrote :

I've added a "affects openssh-server" because I'm seeing that /etc/init.d/ssh is an init script as well, instead of a link to /lib/init/upstart-job.

# file /etc/init.d/ssh
/etc/init.d/ssh: POSIX shell script, ASCII text executable

Contains:

check_for_upstart() {
    if init_is_upstart; then
        exit $1
    fi
}

ubuntu@ssh:~$ sudo /etc/init.d/ssh restart
[sudo] password for ubuntu:
ubuntu@ssh:~$ echo $?
1
ubuntu@ssh:~$ sudo restart ssh
ssh start/running, process 460
ubuntu@ssh:~$ echo $?
0

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openssh (Ubuntu):
status: New → Confirmed
Colin Watson (cjwatson) wrote :

This change was made intentionally according to a policy change:

  https://wiki.ubuntu.com/UpstartCompatibleInitScripts

So I'm not going to change openssh itself, nor I think should rsyslog be changed. However, I believe some of the Upstart folks were looking into a quite different centralised solution to the underlying problem you're encountering; I forget the details but I think it was to have /lib/lsb/init-functions deal with automatically redirecting manual /etc/init.d/foo calls to the corresponding Upstart jobs.

(Note, though, that you can and should use the "service" command, which abstracts away these changes.)

Changed in openssh (Ubuntu):
status: Confirmed → Won't Fix
Joshua Timberman (jtimberman) wrote :

Are all services shipped in Ubuntu packages for 14.04 using these scripts, rather than the link to upstart-job? Which version of Ubuntu was that change made? Is this something users can rely upon being consistent? There's lots of automation code out there that use the old scripts.

Joshua Timberman (jtimberman) wrote :

I see the wiki page mentions Saucy (13.10). Is that the reference point where this change is in effect?

QuentinHartman (qhartman) wrote :

Trying to change my syslog config today this bit me . I couldn't figure out why my changes weren't working, and since I don't write syslog filters often I figured I was screwing something up. Turns out they were fine. "/etc/init.d/rsyslog restart" was just silently doing nothing. This is terrabad. If it's capable of doing what I ask it to, it should. At the very very least, it should display a message along the lines of "This won't work. Do \"service rsyslog restart\" instead.".

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers