systemctl enable shows error on enabling a SysV service

Bug #1447807 reported by Eric Heydrick
48
This bug affects 6 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
Medium
Martin Pitt
Vivid
Fix Released
Medium
Unassigned
Wily
Fix Released
Medium
Martin Pitt

Bug Description

SRU TEST CASE:
--------------
Trying to enable a SysV init service which does not have a corresponding systemd unit results in an error:

# systemctl enable pulseaudio
Synchronizing state for pulseaudio.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d pulseaudio defaults
Executing /usr/sbin/update-rc.d pulseaudio enable
Failed to execute operation: No such file or directory

/etc/init.d/pulseaudio actually does get enabled (check /etc/rc*/*pulse*), but the command fails with code 1 and you get that error message. With the fix the command succeeds.

SRU Regression potential
------------------------
Low, the modes for "sysv script + systemd unit" as well as "systemd unit only" already have automatic tests, and now this scenario ("sysv script only") has a test too. In the worst case this has the potential of completely breaking systemctl enable/disable, which can be worked around with changing symlinks manually, and isn't breaking the boot.

Version details:

Description: Ubuntu 15.04
Release: 15.04

systemd:
  Installed: 219-7ubuntu3
  Candidate: 219-7ubuntu3
  Version table:
 *** 219-7ubuntu3 0
        500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Eric Heydrick (eheydrick) wrote :

Looking closer, the service is getting enabled - the update-rc.d commands are succeeding and the init.d links are getting created - but systemctl is still returning an error.

Revision history for this message
Martin Pitt (pitti) wrote :

This is because the sysstat package does not actually have a systemd unit. It just has a sysvinit init.d script, so you can't enable/disable this via systemd. You need to enable/disable it via update-rc.d (or manual symlinks in /etc/rc?.d/).

Changed in systemd (Ubuntu):
status: New → Invalid
Revision history for this message
Joachim R. (jro) wrote :

@pitti I don't understand. @eheydrick said update-rc.d suscceed but systemd still rturning an error. So why update-rc.d or manual symlink would change anything ?

This still an issue. Systemd states it is compatible with init.d script. So it should work.

I have the same issue with a script that is already enabled, but enabling or starting it ends up with the "Failed to execute operation: No such file or directory".

Changed in systemd (Ubuntu):
status: Invalid → Confirmed
Changed in systemd (Ubuntu):
importance: Undecided → High
Martin Pitt (pitti)
Changed in systemd (Ubuntu):
importance: High → Wishlist
status: Confirmed → Triaged
importance: Wishlist → Low
importance: Low → Wishlist
Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

I wouldn't agree that this is purely cosmetical, as it breaks things like Chef automation: https://github.com/gmiranda23/ntp/issues/105

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Looking at the source code a bit, I see that in systemctl.c:enable_sysv_units there is a comment that it should reshuffle the args array, but it seems it never does that? So strv_isempty(names) in enable_unit never matches, causing the call to systemd which is failing, because there is no unit file.

Martin Pitt (pitti)
Changed in systemd (Ubuntu):
importance: Wishlist → Low
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Martin Pitt (pitti) wrote :

I wrote a test case in debian/tests/unit-config for this which reproduces this.

Changed in systemd (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :
Changed in systemd (Ubuntu):
status: In Progress → Fix Committed
Changed in systemd (Ubuntu Vivid):
status: New → In Progress
importance: Undecided → Medium
Changed in systemd (Ubuntu Wily):
importance: Low → Medium
description: updated
Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Thanks for the fast fix, is there already a package built from the patch somewhere that I could test?

Also you might want to amend the title of the bug, as enabling the service is in fact performed properly, systemctl just throws an error in the end when it should simply terminate successfully instead.

Martin Pitt (pitti)
summary: - systemctl enable fails to enable a SysV service
+ systemctl enable shows error on enabling a SysV service
Revision history for this message
Martin Pitt (pitti) wrote :

It built now in https://launchpad.net/~pitti/+archive/ubuntu/sru-test so you are welcome to test that. That's the current ubuntu packaging branch, which I'll upload as a vivid SRU as soon as I figure out bug 1444402.

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Tested and confirmed working, thanks again.

Revision history for this message
Brian Murray (brian-murray) wrote :

This hasn't made it to -proposed or -updates yet, setting back to Triaged.

Changed in systemd (Ubuntu Wily):
status: Fix Committed → Triaged
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Eric, or anyone else affected,

Accepted systemd into vivid-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/219-7ubuntu5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in systemd (Ubuntu Vivid):
status: In Progress → Fix Committed
tags: added: verification-needed
Martin Pitt (pitti)
Changed in systemd (Ubuntu Wily):
status: Triaged → Fix Committed
Revision history for this message
Eric Heydrick (eheydrick) wrote :

After installing systemd 219-7ubuntu5 I can enable a SysV service without any errors. Thanks!

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (5.9 KiB)

This bug was fixed in the package systemd - 219-8ubuntu1

---------------
systemd (219-8ubuntu1) wily; urgency=medium

  * Merge with Debian experimental branch. Remaining Ubuntu changes:
    - Hack to support system-image read-only /etc, and modify files in
      /etc/writable/ instead.
    - Keep our much simpler udev maintainer scripts (all platforms must
      support udev, no debconf).
    - initramfs init-top: Drop $ROOTDELAY, we do that in a more sensible way
      with wait-for-root. Will get applicable to Debian once Debian gets
      wait-for-root in initramfs-tools.
    - initramfs init-bottom: If LVM is installed, settle udev,
      otherwise we get missing LV symlinks. Workaround for LP #1185394.
    - Add debian/udev.lvm2.init: Dummy SysV init script to satisfy insserv
      dependencies to "lvm2" which is handled with udev rules in Ubuntu.
    - Add debian/udev.lvm2.service to avoid running the dummy lvm2 init
      script.
    - Provide shutdown fallback for upstart. (LP: #1370329)
    - debian/extra/ifup@.service: Additionally run for "auto" class. We don't
      really support "allow-hotplug" in Ubuntu at the moment, so we need to
      deal with "auto" devices appearing after "/etc/init.d/networking start"
      already ran. (LP: #1374521) Also, check if devices are actually defined
      in /etc/network/interfaces as we don't use Debian's net.agent.
      Also run ifup in the background during boot, to avoid blocking
      network.target. (LP: #1425376)
    - ifup@.service: Drop dependency on networking.service (i. e.
      /etc/init.d/networking), and merely ensure that /run/network exists.
      This avoids unnecessary dependencies/waiting during boot and dependency
      cycles if hooks wait for other interfaces to come up (like ifenslave
      with bonding interfaces). (LP: #1414544)
    - Add Get-RTC-is-in-local-time-setting-from-etc-default-rc.patch: In
      Ubuntu we currently keep the setting whether the RTC is in local or UTC
      time in /etc/default/rcS "UTC=yes|no", instead of /etc/adjtime.
      (LP: #1377258)
    - Put session scopes into all cgroup controllers. This makes unprivileged
      user LXC containers work under systemd. (LP: #1346734)
    - systemctl: Don't forward telinit u to upstart. This works around
      upstart's Restart() always reexec'ing /sbin/init on Restart(), even if
      that changes to point to systemd during the upgrade. This avoids running
      systemd during a dist-upgrade. (LP: #1430479)
    - Drop hwdb-update dependency from udev-trigger.service, which got
      introduced in v219-stable. This causes udev and plymouth to start too
      late and isn't really needed in Ubuntu yet as we don't support stateless
      systems yet and handle hwdb.bin updates through dpkg triggers. This can
      be dropped again with initramfs-tools 0.117.
    - Lower Breaks: to plymouth version which has the udev inotify fix in
      Ubuntu.
    - Lower libappamor dep to the Ubuntu version where it moved to /lib.
    - Change systemd-sysv's conflicts to upstart-sysv. (LP: #1422681)
    - Make failure of boot-and-services NSpawn.test_boot non-fatal for now.
      This currently fails when being t...

Read more...

Changed in systemd (Ubuntu Wily):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 219-7ubuntu5

---------------
systemd (219-7ubuntu5) vivid; urgency=medium

  * Revert upstream commit 743970d which immediately SIGKILLs units during
    shutdown. This leads to problems like bash not being able to write its
    history, mosh not saving its state, and similar failed cleanup actions.
    (LP: #1448259)
  * ifup@.service: Set IgnoreOnIsolate, so that "systemctl default" does not
    shut down network interfaces. (LP: #1449380). Add PartOf=network.target,
    so that stopping network.target also stops network interfaces.
  * 75-persistent-net-generator.rules: Fix rules for ibmveth (it's a driver,
    not a subsystem). (LP: #1437375)
  * debian/tests/unit-config: Add tests for systemctl enable/disable on a
    SysV-only unit. Reproduces LP #1447807.
  * Fix systemctl enable for SysV scripts without a native unit. We must not
    try and enable the nonexisting unit then. (LP: #1447807)

 -- Martin Pitt <email address hidden> Thu, 07 May 2015 07:45:34 +0200

Changed in systemd (Ubuntu Vivid):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for systemd has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.