1

I have a fresh installation of Ubuntu 14.04, and have not touched anything.

Cups is running, as reported by both ps and netstat.

There are /etc/init/cups.conf and /etc/init.d/cups, both of them seem to be able to start cups.

I used these ways to determine which init daemon started cups:

  • service cups status - "unknown job: cups"
  • initctl status cups - "unknown job: cups"
  • /etc/init.d/cups status - "cupsd is running"
  • Runlevel is 2, and there is no cups in /etc/rc2.d

So the question is: which init daemon started cups? The traditional Debian init, or upstart?

If upstart was the one started cups, why initctl status cups cannot report cups status?

2 Answers 2

1

CUPS on Ubuntu is started by Upstart via the file /etc/init/cups.conf. The file /etc/init.d/cups is ignored. /etc/init/cups.conf is not an init script, but a configuration for Upstart. It does start the main daemon, and is not only a pre- and post- configuration for CUPS.

The service and initctl utilities report unknown job when the variable UPSTART_SESSION is set in the environment because in that case, the two utilities are acting on the session init and not the system init (cups is started by the system init). su usually preserves the environment, while sudo does not, so sudo initctl status cups will work but su -c "initctl status cups" will not.

-1

Of the two, only one is actually an init script: /etc/init.d/cups. The /etc/init/cups.conf file appears to be a configuration file and runs certain things before/after the daemon is started but it is not itself an init script. It lacks the proper format (start,stop,restart etc. functions) and in any case, is not in the right place. Init scripts are in the init.d directory.

As for who started it, 14.04 is still using upstart, they will be moving to systemd for future releases. So it was upstart that started the cups daemon.

Now, as to why neither service nor initctl returned anything useful, that's because you did not use sudo:

terdon@16:~$ service cups status
status: Unknown job: cups
terdon@16:~$ sudo service cups status
[sudo] password for terdon: 
cups start/running, process 1319

terdon@16:~$  initctl status cups 
initctl: Unknown job: cups
terdon@16:~$ sudo initctl status cups 
cups start/running, process 1319
5
  • Thanks. Do you know why root account cannot view the status of cups, yet sudo can? I run su to become root, and initctl/service don't report cups status.
    – Howard
    Aug 8, 2014 at 13:12
  • @Howard of course it can, that's what sudo is. If you have started a root shell with sudo -i or sudo su or if you have actually logged in as root, the service command works as expected.
    – terdon
    Aug 8, 2014 at 13:13
  • Thanks very much. However I still do not understand why initctl does not report cups status after I run su. whoami confirms that I am in root's shell.
    – Howard
    Aug 8, 2014 at 13:20
  • Well nevermind, UPSTART_SESSION caused the trouble after I entered su.
    – Howard
    Aug 8, 2014 at 13:23
  • @Howard that's interesting. I just checked on my Ubuntu VM and I get the same behavior. service works when in a full root shell but initctl does not. You're probably quite right and it has something to do with $UPSTART_SESSION but I don't really know why. That might merit a separate question.
    – terdon
    Aug 8, 2014 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .