Ubuntu – Can not start CUPS on Ubuntu 18.04

cups-lpdprinting

I have installed CUPS on Ubuntu 18.04 Bionic Beaver like so

$ sudo apt-get update
$ sudo apt-get install cups

I checked status of CUPS, and it failed to start

$ systemctl status cups

 ● cups.service - CUPS Scheduler
   Loaded: loaded (/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2018-09-10 16:29:40 EDT; 3s ago
     Docs: man:cupsd(8)
  Process: 2895 ExecStart=/usr/sbin/cupsd -l (code=exited, status=1/FAILURE)
 Main PID: 2895 (code=exited, status=1/FAILURE)

Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 5.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: Stopped CUPS Scheduler.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Start request repeated too quickly.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: Failed to start CUPS Scheduler.

I edited cupsd.conf and changed LogLevel from "warn" to "debug".
I tried to start cups manually, but the same output repeats

$ systemctl start cups
$ systemctl status cups

Here is log, the block shown is repeated.

$ grep cups /var/log/syslog

Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 1.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 2.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 3.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 4.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 5.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Start request repeated too quickly.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 16:02:15 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE

Does anyone have an idea of how I can start cups?

Best Answer

Looking at the tail of /var/log/cups/error_log:

X [14/Jul/2020:15:06:38 +0200] No valid Listen or Port lines were found in the configuration file.

Indeed, the config file was ruined by some other settings, but luckily a backup was kept:

ll /etc/cups/cupsd.conf*
-rw-r----- 1 root 4571 2020-07-01 19:53 /etc/cups/cupsd.conf.O
-rw-r----- 1 root   22 2020-07-01 19:54 /etc/cups/cupsd.conf

This worked for me (in Ubuntu 18.04), to restore cupsd.conf and restart cups:

sudo -i
cd /etc/cups
cp cupsd.conf.O cupsd.conf
systemctl restart cups

verify by:

systemctl status cups
Related Question