Printer No Longer Prints after LibreOffice crash

I am running the KDE variant and have a Brother DCP-L2550DW connected via network connection using the socket protocol. Up until today, the printer has printed and scanned flawlessly. I attempted to print an envelope from LibreOffice by choosing the envelope size in the print screen and clicking print. Right after clicking print, the program suddenly crashed. Upon restarting LibreOffice, the printer could no longer be detected.

Attempting to restart org.cups.cupsd.service resulted in:

[nick@Unit-12 ~]$ systemctl start org.cups.cupsd.service
Job for org.cups.cupsd.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status org.cups.cupsd.service" and "journalctl -xe" for details.
[nick@Unit-12 ~]$ journalctl -xe
β–‘β–‘ 
β–‘β–‘ The job identifier is 3322 and the job result is failed.
Oct 22 17:13:11 Unit-12 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=org.cups.cupsd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Oct 22 17:13:11 Unit-12 systemd[1]: org.cups.cupsd.service: Scheduled restart job, restart counter is at 5.
β–‘β–‘ Subject: Automatic restarting of a unit has been scheduled
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ Automatic restarting of the unit org.cups.cupsd.service has been scheduled, as the result for
β–‘β–‘ the configured Restart= setting for the unit.
Oct 22 17:13:11 Unit-12 systemd[1]: Stopped CUPS Scheduler.
β–‘β–‘ Subject: A stop job for unit org.cups.cupsd.service has finished
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ A stop job for unit org.cups.cupsd.service has finished.
β–‘β–‘ 
β–‘β–‘ The job identifier is 3410 and the job result is done.
Oct 22 17:13:11 Unit-12 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=org.cups.cupsd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Oct 22 17:13:11 Unit-12 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=org.cups.cupsd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Oct 22 17:13:11 Unit-12 systemd[1]: org.cups.cupsd.service: Start request repeated too quickly.
Oct 22 17:13:11 Unit-12 systemd[1]: org.cups.cupsd.service: Failed with result 'protocol'.
β–‘β–‘ Subject: Unit failed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ The unit org.cups.cupsd.service has entered the 'failed' state with result 'protocol'.
Oct 22 17:13:11 Unit-12 systemd[1]: Failed to start CUPS Scheduler.
β–‘β–‘ Subject: A start job for unit org.cups.cupsd.service has failed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
β–‘β–‘ 
β–‘β–‘ A start job for unit org.cups.cupsd.service has finished with a failure.
β–‘β–‘ 
β–‘β–‘ The job identifier is 3410 and the job result is failed.

There is no further information on what this β€œprotocol” result means that I can find.
The Printers menu in the KDE System Settings shows β€œPrint service is unavailable. Bad file descriptor.”
lpstat says the same:

[nick@Unit-12 ~]$ lpstat
lpstat: Bad file descriptor

I then checked out the CUPS error log:

[nick@Unit-12 ~]$ less /var/log/cups/error_log
W [22/Oct/2020:11:16:48 -0400] CreateProfile failed: org.freedesktop.ColorManager.AlreadyExists:profile id \'Brother_DCP-L2550DW-Gray..\' already exists
W [22/Oct/2020:11:16:51 -0400] CreateProfile failed: org.freedesktop.ColorManager.AlreadyExists:profile id \'Brother_DCP-L2550DW-Gray..\' already exists
E [22/Oct/2020:11:17:05 -0400] Scheduler shutting down due to program error.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <!DOCTYPE on line 1 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for <html> on line 2 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for <head> on line 3 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <link on line 4 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <link on line 5 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <meta on line 6 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <meta on line 7 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <meta on line 8 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <meta on line 9 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for <style>html{display:none;}</style> on line 10 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for <script on line 11 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive /* on line 12 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive if on line 13 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive document.documentElement.style.display on line 14 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive } on line 15 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive top.location on line 16 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for } on line 17 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive /* on line 18 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive function on line 19 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive if on line 20 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive document.getElementById(\'body\').innerHTML on line 21 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for } on line 22 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for } on line 23 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for --></SCRIPT> on line 24 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <title>Administration on line 25 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for </head> on line 26 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <body on line 27 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <div on line 28 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Missing value for <ul> on line 29 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <li><a on line 30 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <li><a on line 31 of /etc/cups/cupsd.conf.
E [22/Oct/2020:11:17:05 -0400] Unknown directive <li><a on line 32 of /etc/cups/cupsd.conf.

The errors go on a long ways. /etc/cups/cupsd.conf exists in its proper HTML configuration and the code is clean as it should be. Here’s a snippet:

<!DOCTYPE HTML>
  <html>
  <head>
  <link rel="stylesheet" href="/cups.css" type="text/css">
    <link rel="shortcut icon" href="/apple-touch-icon.png" type="image/png">
      <meta charset="utf-8">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
          <meta http-equiv="X-UA-Compatible" content="IE=9">
            <meta name="viewport" content="width=device-width">
              <style>html{display:none;}</style>
              <script
              /* Only display document if we are not in a frame... */
              if (self == top) {
              document.documentElement.style.display = 'block';
              } else {
              top.location = self.location;
              }
              /* Show an error if cookies are disabled */
              function check_cookies() {
              if (!navigator.cookieEnabled) {
              document.getElementById('body').innerHTML = 'This page uses cookies to prevent common cross-site attacks. Please enable cookies in your browser.';
              }
              }
              --></SCRIPT>
              <title>Administration - CUPS 2.3.3</title>
              </head>
              <body onload="check_cookies();">
                <div class="header">
                  <ul>
                  <li><a href="http://www.cups.org/" target="_blank">CUPS.org</a></li>
                    <li><a href="/">Home</a></li>
                      <li><a class="active" href="/admin">Administration</a></li>
                        <li><a href="/classes/">Classes</a></li>
                          <li><a href="/help/">Help</a></li>

So the CUPS error log does not make sense to me. Rebooting did nothing. I have reinstalled cups, but the same problems are persisting. I decided to ask the forum if there’s any pointers that I missed before I completely uninstall cups and start over from scratch. Any help would be appreciated.

Did you also reinstall the printer drivers?

Reinstalled the printer drivers via AUR as did upon original installation and rebooted the system. Still unable to print and start cupsd. Same errors as before.

However, after this the problem has been solved. I should have realized before that the cupsd.conf file did not look right. The solution was to replace the cupsd.conf file with the default .conf file that comes with the standard CUPS installation.

[nick@Unit-12 ~]$ sudo cp /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf

Then restarting cupsd:

[nick@Unit-12 ~]$ systemctl start org.cups.cupsd.service

And it started!

[nick@Unit-12 ~]$ systemctl status org.cups.cupsd.service
● org.cups.cupsd.service - CUPS Scheduler
     Loaded: loaded (/usr/lib/systemd/system/org.cups.cupsd.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2020-10-22 18:40:01 EDT; 14s ago
TriggeredBy: ● org.cups.cupsd.path
             ● org.cups.cupsd.socket
       Docs: man:cupsd(8)
   Main PID: 7748 (cupsd)
     Status: "Scheduler is running..."
      Tasks: 1 (limit: 9378)
     Memory: 4.2M
     CGroup: /system.slice/org.cups.cupsd.service
             └─7748 /usr/bin/cupsd -l

Oct 22 18:40:00 Unit-12 systemd[1]: Starting CUPS Scheduler...
Oct 22 18:40:01 Unit-12 systemd[1]: Started CUPS Scheduler.

LibreOffice now detects the printer and prints successfully.
For some reason, the crash inserted all that HTML code into the cupsd.conf file. Judging by the contents, it is as if the HTML code for the CUPS server on localhost:631 somehow copied itself into the .conf file, despite not having that page open during the time of the crash. Very strange.

2 Likes

I had a similar problem with that .conf file - but I β€˜solved’ it by ripping ALL cups and printer stuff out, and then re-installing it. Largely because, although replacing that file worked for that boot, the β€˜other’ file kept sneaking in and replacing the default! Glad you got it going again.

I had also similar and solved by the same removing all configs and packages and reinstalling, and there were also other users reporting strange cups failures… looks like a bad little BUG to me…