Please add --system to initctl calls from service

Bug #1605290 reported by Sitsofe Wheeler
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)

Bug Description

Description of the problem:
If the user is using the service command they are almost certainly trying to control system daemons but can wind up looking at only user session daemons.

Steps to reproduce:
1. Install KUbuntu 14.04.
2. Graphically log in as a regular user.
3. Run
service ufw status

Expected result:
To be told whether the ufw service is running.

Actual result:
status: Unknown job: ufw

How reproducible is this problem:
It happens every time.

Additional information:
The issue arises because UPSTART_SESSION is set which makes initctl think it should use a user session. If UPSTART_SESSION is cleared away (which happens when using sudo) then this problem isn't encountered when using the service command. However, if the user just uses su then the UPSTART_SESSION can be inherited and even though the user is root they can't find the services they are expecting. One way round this would be to make the service command always use the system session because it's highly unlikely someone is using it to access user sessions.

This is related to bug #1318679 and there are reports of this problem scattered over the place (see bug #1367214 , , , , ...). I personally saw it when trying to install samba after using su to become root.

Version information:
Ubuntu 14.04.3 LTS
sysvinit-utils 2.88dsf-41ubuntu6.3

Tags: patch trusty
Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

Adding patch that always uses the system upstart session.

Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

Just a quick note: using
sudo -s
su -
before using service will work around the issue.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "initctl-system.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
tags: added: trusty
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers