xubuntu 14.04 service start,stop, does not work in terminal emulation

Bug #1303769 reported by awol
44
This bug affects 8 people
Affects Status Importance Assigned to Milestone
upstart (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

xubuntu from installer-amd64/20101020ubuntu313 terminal emulation can not change service status.

e.g.

> service smbd restart
stop: Unknown job: smbd
start: Unknown job: smbd

however on tty1 this works as expected. i.e. the smbd is stopped then started again with a process number given in output.

Revision history for this message
Joao S Veiga (jsveiga-it) wrote :

After much banging my head and googling, I've found a post (http://unix.stackexchange.com/questions/120050/sudo-service-vsftpd-returns-unknown-job-vsftpd) showing that

"sudo service xxxx start" (or stop, or restart)

works, while

"service xxxx start" (in a su session)

does not work.

So the culprit was clearly the environment: If you go root with "su" instead of "sudo su" or "su -", "service" does not to work correctly either, as "su" will carry most of your normal user environment to the root session.

After some testings, I found that the culprit is the UPSTART_SESSION environment variable, which comes set when you "su", but not set when you "sudo su" or "su -". Here are some test results:

-- does not work
jsveiga@dell:~$ su
Password:
root@dell:/home/jsveiga# service smbd restart
stop: Unknown job: smbd
start: Unknown job: smbd

-- works even from a su session
root@dell:/home/jsveiga# sudo service smbd restart
smbd stop/waiting
smbd start/running, process 3823

-- works
root@dell:/home/jsveiga# exit
jsveiga@dell:~$ sudo su
root@dell:/home/jsveiga# service smbd restart
smbd stop/waiting
smbd start/running, process 3862

-- works
root@dell:/home/jsveiga# exit
jsveiga@dell:~$ su -
Password:
root@dell:~# service smbd restart
smbd stop/waiting
smbd start/running, process 3905

-- going su then unsetting the UPSTART_SESSION works
root@dell:/home/jsveiga# exit
jsveiga@dell:~$ su
Password:
root@dell:/home/jsveiga# service smbd restart
stop: Unknown job: smbd
start: Unknown job: smbd
root@dell:/home/jsveiga# unset UPSTART_SESSION
root@dell:/home/jsveiga# service smbd restart
smbd stop/waiting
smbd start/running, process 4244

So the start/stop scripts are failing somehow simply by the presence of the UPSTART_SESSION environment variable.

BR,
Joao S Veiga

affects: ubuntu → upstart (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in upstart (Ubuntu):
status: New → Confirmed
Revision history for this message
ChillyWilly (ubuntu-vzuijlekom) wrote :

Confirmed on two of my systems, both are upgrades from 12.04.

Revision history for this message
xylo (stefan-endrullis) wrote :

Thanks a lot for your hint, Joao S Veiga! With sudo it works. :)

Revision history for this message
majordom (majordom-s) wrote :

Thanx. Confirmed with two fresh installed ubuntu 14.04. Hope you'll fix it

Revision history for this message
Ahmad Bin Musa (ahmadbinmusa) wrote :

# su
# sudo su
# service squid3 stop
stop: Unknown instance:
root@ahmad-HP-ProBook-450-G1:~#

Changed in upstart (Ubuntu):
assignee: nobody → Ahmad Bin Musa (ahmadbinmusa)
Revision history for this message
babak (bk-ravandi) wrote :

Thanks. I was so confused till I found this. Confirmed with:

Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

David Coronel (davecore)
Changed in upstart (Ubuntu):
assignee: Ahmad Bin Musa (ahmadbinmusa) → nobody
Revision history for this message
David Coronel (davecore) wrote :

I just hit this bug with a fresh install of Ubuntu 14.04.4 Desktop.

Inside Unity, I open a terminal and if I do "service ssh status" I get:
status: Unknown job: ssh

But if I ssh to that box with the same user, the same command works fine.

The workarounds are to do "sudo service ssh status" or to do "unset UPSTART_SESSION" before doing "service ssh status".

Can anyone look at this?

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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