3

I was facing DNS issues with in my server and finally thought to restart the network service.

root@labadmin-VirtualBox:~# service network-manager restart
stop: Unknown job: network-manager
start: Unknown job: network-manager

I was wondering whether the service is available or not and did some research to resolve this. I thought to try adding sudo while executing the command and it worked.

root@labadmin-VirtualBox:~# sudo service network-manager restart
network-manager stop/waiting
network-manager start/running, process 5711

Can someone explain me what is the difference in execution of the command when executed as root with and without sudo?

2
  • What distro and version of Linux was this on? – TopHat Apr 28 '17 at 0:46
  • 1
    its ubuntu :14.04 – Here_2_learn Apr 28 '17 at 5:10
2

This looks to have been a common problem for Ubuntu during its Upstart phase. The problem is the way that your upstart environment variables are passed on depending on if you use sudo to reach root privileges or use su to become root. It was an oddity of Upstart that I don't think was ever corrected.

$ env|grep UPST
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/21059
UPSTART_INSTANCE=
UPSTART_EVENTS=xsession started
UPSTART_JOB=unity7

If you want to query the status of system-level jobs, you should be able to use status --system to override environment variables.

Source: https://bugs.launchpad.net/upstart/+bug/1481967

2
  • Excellent answer since you explain the witness behavior – Ramhound Apr 28 '17 at 1:11
  • What you said is True, might be the problem with Ubuntu.I have experimented same thing in RHEL 6.5 and the issue is not observed. – Here_2_learn Apr 28 '17 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.