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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1303769

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+bug/1303769/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to