Header Shadow Image


Linux: cups giving 404 Not Found when trying to access http://localhost:631/

PROBLEM

When trying to access http://localhost:631/ for the cupsd / cups configuration, you receive:

404 Not Found

SOLUTION

First off, try to check under /var/log/cups/ to see if anything meaningfull is logged in error_log and access_log files.  (Cups runs it's own web service under port 631) Then, enable extended debugging to find out which file it's breaking on if it's not already enabled:

$ vi /etc/cups/cupsd.conf

Then comment out

# LogLevel info

then add below line right after commented line above:

LogLevel debug2

and run

$ service cups restart
Stopping cups:                                             [  OK  ]
Starting cups:                                               [  OK  ]
$

and reload the http://localhost:631/ site.  This will put alot more meaningfull information in /var/log/cups/error_log similar to below:

d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: epoll() returned 1…                                                                                                                
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: Read on fd 4…                                                                                                                      
d [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient(lis=0xb8dcab38) 4 Clients = 0                                                                                                     
D [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient: skipping getpeercon()                                                                                                            
D [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient: 8 from localhost:631 (IPv4)                                                                                                      
d [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient: 8 connected to server on 127.0.0.1:631                                                                                           
d [28/Nov/2008:19:42:30 -0500] cupsdAddSelect: fd=8, read_cb=0xb7fbed60, write_cb=(nil), data=0xb8df5a68                                                                           
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: polling 4 fds for 1 seconds…                                                                                                       
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: epoll() returned 1…                                                                                                                
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: Read on fd 8…                                                                                                                      
d [28/Nov/2008:19:42:30 -0500] cupsdReadClient: 8, used=0, file=-1 state=0                                                                                                         
D [28/Nov/2008:19:42:30 -0500] cupsdReadClient: 8 GET / HTTP/1.1                                                                                                                   
d [28/Nov/2008:19:42:30 -0500] cupsdReadClient: 8 Browser asked for language "en-us.ISO-8859-1"…                                                                                 
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: uri = "/"…                                                                                                                         
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location CUPS_INTERNAL_BROWSE_ACL Limit 0                                                                                            
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/printer Limit 7f                                                                                                  
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/IP-4000 Limit 7f                                                                                                  
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/CanonPI4000 Limit 7f                                                                                              
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/CanonIP4000 Limit 7f                                                                                              
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/CanonBJC5100 Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /admin Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location / Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: best = /
d [28/Nov/2008:19:42:30 -0500] cupsdAuthorize: con->uri="/", con->best=0xb8dca4b0(/)
d [28/Nov/2008:19:42:30 -0500] cupsdAuthorize: Authorization=""
D [28/Nov/2008:19:42:30 -0500] cupsdAuthorize: No authentication data provided.
d [28/Nov/2008:19:42:30 -0500] cupsdIsAuthorized: con->uri="/", con->best=0xb8dca4b0(/)
d [28/Nov/2008:19:42:30 -0500] cupsdIsAuthorized: level=CUPSD_AUTH_ANON, type=None, satisfy=CUPSD_AUTH_SATISFY_ALL, num_names=0
d [28/Nov/2008:19:42:30 -0500] cupsdIsAuthorized: auth=CUPSD_AUTH_ALLOW…
d [28/Nov/2008:19:42:30 -0500] get_file: 8 filename=/usr/share/cups/doc/ size=-1
D [28/Nov/2008:19:42:30 -0500] cupsdSendError: 8 code=404 (Not Found)
D [28/Nov/2008:19:42:30 -0500] cupsdCloseClient: 8
d [28/Nov/2008:19:42:30 -0500] cupsdRemoveSelect: fd=8
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: polling 3 fds for 1 seconds…
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: epoll() returned 1…
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: Read on fd 4…
d [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient(lis=0xb8dcab38) 4 Clients = 0
D [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient: skipping getpeercon()
D [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient: 8 from localhost:631 (IPv4)
d [28/Nov/2008:19:42:30 -0500] cupsdAcceptClient: 8 connected to server on 127.0.0.1:631
d [28/Nov/2008:19:42:30 -0500] cupsdAddSelect: fd=8, read_cb=0xb7fbed60, write_cb=(nil), data=0xb8df5a68
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: polling 4 fds for 1 seconds…
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: epoll() returned 1…
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: Read on fd 8…
d [28/Nov/2008:19:42:30 -0500] cupsdReadClient: 8, used=0, file=-1 state=0
D [28/Nov/2008:19:42:30 -0500] cupsdReadClient: 8 GET /cups.css HTTP/1.1
d [28/Nov/2008:19:42:30 -0500] cupsdReadClient: 8 Browser asked for language "en-us.ISO-8859-1"…
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: uri = "/cups.css"…
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location CUPS_INTERNAL_BROWSE_ACL Limit 0
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/printer Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/IP-4000 Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/CanonPI4000 Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/CanonIP4000 Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /printers/CanonBJC5100 Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location /admin Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: Location / Limit 7f
d [28/Nov/2008:19:42:30 -0500] cupsdFindBest: best = /
d [28/Nov/2008:19:42:30 -0500] cupsdAuthorize: con->uri="/cups.css", con->best=0xb8dca4b0(/)
d [28/Nov/2008:19:42:30 -0500] cupsdAuthorize: Authorization=""
D [28/Nov/2008:19:42:30 -0500] cupsdAuthorize: No authentication data provided.
d [28/Nov/2008:19:42:30 -0500] cupsdIsAuthorized: con->uri="/cups.css", con->best=0xb8dca4b0(/)
d [28/Nov/2008:19:42:30 -0500] cupsdIsAuthorized: level=CUPSD_AUTH_ANON, type=None, satisfy=CUPSD_AUTH_SATISFY_ALL, num_names=0
d [28/Nov/2008:19:42:30 -0500] cupsdIsAuthorized: auth=CUPSD_AUTH_ALLOW…
d [28/Nov/2008:19:42:30 -0500] get_file: 8 filename=/usr/share/cups/doc/cups.css size=-1
D [28/Nov/2008:19:42:30 -0500] cupsdSendError: 8 code=404 (Not Found)
D [28/Nov/2008:19:42:30 -0500] cupsdCloseClient: 8
d [28/Nov/2008:19:42:30 -0500] cupsdRemoveSelect: fd=8
d [28/Nov/2008:19:42:30 -0500] cupsdDoSelect: polling 3 fds for 1 seconds…
d [28/Nov/2008:19:42:31 -0500] cupsdDoSelect: epoll() returned 0…
d [28/Nov/2008:19:42:31 -0500] select_timeout(0): 86400 seconds to do nothing
d [28/Nov/2008:19:42:31 -0500] cupsdDoSelect: polling 3 fds for 86400 seconds…

Notice the path in red above.  This tells us cups is looking for files under /usr/share/cups/doc/ folder.  Going back to the cupsd.conf file we check for this:

$ cat /etc/cups/cupsd.conf|grep share
# By default /usr/share/cups.
# ex: /usr/share/cups
#DataDir /usr/share/cups
DataDir /usr/share/cups
# ex: /usr/share/cups/doc
#DocumentRoot /usr/share/cups/doc
DocumentRoot /usr/share/cups/doc
# By default /usr/share/cups/fonts.
# ex: /usr/share/cups/fonts
#FontPath /usr/share/cups/fonts
$

then

$ ll /usr/share/cups/doc/cups.css
ls: cannot access /usr/share/cups/doc/cups.css: No such file or directory
$ locate cups.css
/usr/share/cups/www/cups.css
/usr/share/cups/www/he/cups.css
$

to find out where really cups web files are located.  We see then that:

/etc/cups/cupsd.conf  DocumentRoot /usr/share/cups/doc
In reality /usr/share/cups/www/

Change /etc/cups/cupsd.conf by commenting

# DocumentRoot /usr/share/cups/doc

and adding

DocumentRoot /usr/share/cups/www

below above commented line instead and running below:

$ service cups restart
Stopping cups:                                             [  OK  ]
Starting cups:                                               [  OK  ]
$

to restart the cups service.  Then try again using http://localhost:631/ as it should now fix your issue.  You can optionally leave the debug option enabled to catch any other errors that might pop up.  The alternative is to uninstall the cups application using either yum for a less involved process or using rpm for a more involved process.  As an alternate, you could you could check yours against my working version on Fedora 9 below.  For details on Linux printer configuration, please have a look at this handy primer: Linux Pixma Printer Configuration: Canon Pixma iP4000 / iP4100

Hope you found this helpful.  Be sure to leave a comment, to let me know how things went on your end.

One Response to “Linux: cups giving 404 Not Found when trying to access http://localhost:631/”

  1. […] menu.  In case you receive a 404 Not Found error when using http://localhost:631/ , please follow these instructions for resolving it.  You should see several tabs including Home, Administration, Classes, […]

Leave a Reply

You must be logged in to post a comment.


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License