APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Ubuntu service start bug

© December 2014 Anthony Lawrence


This was an interesting excursion. A customer had installed a Ubuntu server and needed to restart Squid so as to re-read the configuration.

"It's not in /etc/init.d", he said, "and 'service squid3 restart' says 'unknown job'."

"Send it a 'kill -1'", I suggested, which of course works, but what starts Squid and where is it? My first thought was that Ubunto has lost their minds and switched to some strange new service starter, but no, they still use Upstart. So what was going on?

It turns out to have nothing to do with Squid at all, but instead is a bug in Ubuntu. It's interesting that it can lie hidden because a 'sudo squid3 restart' would have worked fine, but did not work because he had done "sudo su -". That tells you that it's an environment problem and eventually I found xubuntu 14.04 service start,stop, does not work in terminal emulation, which explains that the missing variable is UPSTART_SESSION.

However, when I tried that on my own Ubunto 14.04 system, I found that UPSTART_SESSION wasn't set no matter what I did, but it didn't matter:

# service apache2 status
Apache2 is running (pid 3061).
# service fail2ban status
 * Status of authentication failure monitor                                                      
 * fail2ban is running

Or did it?

# service sshd status
sshd: unrecognized service

Oops, what's up with that? Just another odd Ubuntu thing: even though sshd shows in /run, you need to ask about ssh, not sshd:

# ls /run
apache2            fail2ban      openntpd.pid     systemd
apache2.pid        kms.pid       rsyslogd.pid     udev
avahi-daemon       lock          screen           upstart-file-bridge.pid
crond.pid          longview.pid  sendsigs.omit.d  upstart-socket-bridge.pid
crond.reboot       motd.dynamic  shm              upstart-udev-bridge.pid
dbus               mount         sshd             user
dhclient.eth0.pid  network       sshd.pid         utmp
# service ssh status
ssh start/running, process 2746
root@www:/home/pcunix# ps -p 2746
  PID TTY          TIME CMD
 2746 ?        00:00:00 sshd

So does this have anything to do with UPSTART_SESSION ? I don't know.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Ubuntu service start bug

Inexpensive and informative Apple related e-books:

iOS 10: A Take Control Crash Course

Take Control of iCloud

El Capitan: A Take Control Crash Course

Take Control of IOS 11

Take Control of Automating Your Mac

More Articles by © Anthony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

There are two ways to write error-free programs; only the third one works. (Alan Perlis)

Linux posts

Troubleshooting posts

This post tagged:



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode