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:
# unset UPSTART_SESSION # 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.
More Articles by Anthony Lawrence © 2014-12-08 Anthony Lawrence
There are two ways to write error-free programs; only the third one works. (Alan Perlis)
Printer Friendly Version
Ubuntu service start bug Copyright © December 2014 Tony Lawrence
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