Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't print to remote lpd printer
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 455
Location: Saitama, JP

PostPosted: Fri Feb 05, 2010 3:40 am    Post subject: Can't print to remote lpd printer Reply with quote

This has me at me wit's end. I really don't know why this is not working.

I have a server at one location running accounting software with a web front end. At the shop is a laptop with an Epson receipt printer connected to the laptop's parallel port. Both run Gentoo. To print a receipt, the server sends the print information to the laptop over the public internet. (IP address is assigned dynamically but I run dyndns so the hostname always points to the right address.) In principle, anyway. It never gets to the laptop's print queue.

Here is the server's printer config:
Code:
<Printer epson>
Info Epson Receipt Printer
Location At the shop
DeviceURI lpd://theshop.homelinux.org/epson
State Idle
StateTime 1265327641
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>


At the shop, the cups config has this:
Code:
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL
DefaultAuthType Basic
<Location />
  Allow from all
  # Allow shared printing and remote administration...
  Order allow,deny
  Allow all
</Location>


and the printer config is:
Code:
<DefaultPrinter epson>
Info epson
DeviceURI parallel:/dev/lp0
State Idle
StateTime 1262133331
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>


When I print something, the logs on the server show this:
Code:
I [04/Feb/2010:17:48:17 -0600] [Job ???] Request file type is text/plain.
I [04/Feb/2010:17:48:17 -0600] [Job 4] Adding start banner page "none".
I [04/Feb/2010:17:48:17 -0600] [Job 4] Adding end banner page "none".
I [04/Feb/2010:17:48:17 -0600] [Job 4] File of type text/plain queued by "apache".
I [04/Feb/2010:17:48:17 -0600] [Job 4] Queued on "epson" by "apache".


The print jobs show up in the queue, but stay there. Nothing appears in the laptop's print queue, or comes out of the printer. I think the network connection is OK. The router port forwards 631 to the laptop. When I run netcat at the laptop I get this:
Code:
 nc -vv theshop.homelinux.org 631
DNS fwd/rev mismatch: theshop.homelinux.org != adsl-75-34-213-xxx.dsl.chcgil.sbcglobal.net
theshop.homelinux.org [75.34.213.xxx] 631 (ipp) open


I'm not sure what else netcat should show, but at least it indicates that the port is open.

If a client comes into the shop and wants a receipt we can't give it to him/her. Is this any way to run a business?

If someone can help me with this I would be extremely grateful.
Back to top
View user's profile Send private message
bobspencer123
Guru
Guru


Joined: 19 Dec 2005
Posts: 544

PostPosted: Fri Feb 05, 2010 3:43 pm    Post subject: Reply with quote

unless you are using cups 1.1 or below I think your cups.conf is deprecated:

Try changing to this format according to: http://www.gentoo.org/doc/en/printing-howto.xml#remote_usage

Code:

Remote Printer Access

If you want other systems to use your printer through IPP you need to explicitly grant access to the printer in /etc/cups/cupsd.conf. If you want to share your printer using SAMBA, this change is not needed.

Open up /etc/cups/cupsd.conf in your favorite editor and add in an Allow line for the system(s) that should be able to reach to your printer. In the next example, we grant access to the printer from localhost and from any system whose IP address starts with 192.168.0.

Code Listing 3.4: Allowing remote access to the printer

<Location />
  Order allow,deny
  Allow localhost
  Allow from 192.168.0.*
</Location>

(This broadcasts browsing information to the clients on the network)
(This is so that they know the printer is available)
BrowseAddress 192.168.0.*:631

Also, you will need to specify which port CUPS listens to, so that it will respond to printing requests from other machines on your network.

Code Listing 3.5: Port configuration in /etc/cups/cupsd.conf

Listen *:631
(Make sure that localhost is commented out)
#Listen localhost:631

Note: If you are still using CUPS 1.1 (which is now deprecated), then you will need to use a different syntax for remote printing requests:

Code Listing 3.6: Deprecated CUPS 1.1 configuration

Port 631
(Make sure the next two lines are commented out)
#Listen 127.0.0.1:631
#Listen localhost:631


hopefully the change in syntax with the port listening will fix your problem.
_________________
Increasingly becoming a 2 channel audio nut!
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 455
Location: Saitama, JP

PostPosted: Fri Feb 05, 2010 5:45 pm    Post subject: Reply with quote

Yes. I'm using cups 1.3.10. I changed cupsd.conf to this:
Code:
LogLevel info
SystemGroup lpadmin
# Allow remote access
Port 631
##Listen /var/run/cups/cups.sock
Listen *:631
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL
BrowseAddress *:631
DefaultAuthType Basic
<Location />
  Allow from all
  # Allow shared printing and remote administration...
#  Order allow,deny
#  Allow all
  Allow Localhost
  Allow from *
</Location>


restarted cups, but noticed this in the log:
Code:
I [05/Feb/2010:11:13:26 -0600] Scheduler shutting down normally.
I [05/Feb/2010:11:13:26 -0600] Saving job cache file "/var/cache/cups/job.cache"...
I [05/Feb/2010:11:13:26 -0600] Listening to 0.0.0.0:631 (IPv4)
I [05/Feb/2010:11:13:26 -0600] Listening to :::631 (IPv6)
I [05/Feb/2010:11:13:26 -0600] Listening to 0.0.0.0:631 (IPv4)
I [05/Feb/2010:11:13:26 -0600] Listening to :::631 (IPv6)
I [05/Feb/2010:11:13:26 -0600] Sending browsing info to 0.0.0.0:631 (IPv4)
I [05/Feb/2010:11:13:26 -0600] Remote access is enabled.
I [05/Feb/2010:11:13:26 -0600] Loaded configuration file "/etc/cups/cupsd.conf"
I [05/Feb/2010:11:13:26 -0600] Using default TempDir of /var/spool/cups/tmp...
I [05/Feb/2010:11:13:26 -0600] Configured for up to 100 clients.
I [05/Feb/2010:11:13:26 -0600] Allowing up to 100 client connections per host.
I [05/Feb/2010:11:13:26 -0600] Using policy "default" as the default!
I [05/Feb/2010:11:13:26 -0600] Full reload is required.
I [05/Feb/2010:11:13:26 -0600] Loaded MIME database from '/etc/cups': 35 types, 39 filters...
I [05/Feb/2010:11:13:27 -0600] Loading job cache file "/var/cache/cups/job.cache"...
I [05/Feb/2010:11:13:27 -0600] Full reload complete.
I [05/Feb/2010:11:13:27 -0600] Cleaning out old temporary files in "/var/spool/cups/tmp"...
I [05/Feb/2010:11:13:27 -0600] Listening to 0.0.0.0:631 on fd 1...
I [05/Feb/2010:11:13:27 -0600] Listening to :::631 on fd 3...
E [05/Feb/2010:11:13:27 -0600] Unable to bind socket for address 0.0.0.0:631 - Address already in use.
E [05/Feb/2010:11:13:27 -0600] Unable to bind socket for address :::631 - Address already in use.
I [05/Feb/2010:11:13:27 -0600] Resuming new connection processing...


Don't really know what this means...

When I try printing, nothing comes out. In addition, when I do lpq, it tells me
lpq: Unable to connect to server

Still stumped.
Back to top
View user's profile Send private message
bobspencer123
Guru
Guru


Joined: 19 Dec 2005
Posts: 544

PostPosted: Fri Feb 05, 2010 7:38 pm    Post subject: Reply with quote

maybe can you post your entire cupsd.conf

edit: also, the unable to connect error I think means something else is already using port 631 .. if I had to guess the restart of cups didn't completely kill it. There probably is a command to kill daemon completely but maybe just a quick restart if possible will be solution.
_________________
Increasingly becoming a 2 channel audio nut!


Last edited by bobspencer123 on Fri Feb 05, 2010 7:47 pm; edited 1 time in total
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 455
Location: Saitama, JP

PostPosted: Fri Feb 05, 2010 7:44 pm    Post subject: Reply with quote

Sure thing. I think I'm using the default config file for the most part. Thanks very much for your help.

Code:
LogLevel info
SystemGroup lpadmin
# Allow remote access
Port 631
##Listen /var/run/cups/cups.sock
Listen *:631
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL
BrowseAddress *:631
DefaultAuthType Basic
<Location />
  Allow from all
  # Allow shared printing and remote administration...
#  Order allow,deny
#  Allow all
  Allow Localhost
  Allow from *
</Location>
<Location /admin>
  Encryption Required
  AuthType Basic
  Deny From All
  Allow From 127.0.0.1
  # Allow remote administration...
  Order allow,deny
  Allow all
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Allow localhost
  # Allow remote access to the configuration files...
  Order allow,deny
  Allow all
</Location>
<Policy default>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscr
iption Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New
-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Acce
pt-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>
Back to top
View user's profile Send private message
bobspencer123
Guru
Guru


Joined: 19 Dec 2005
Posts: 544

PostPosted: Sat Feb 06, 2010 5:56 pm    Post subject: Reply with quote

just found this:

Code:

Setting Up a Remote Printer

If the printers are attached to a remote CUPS-powered server you can easily set up your system to use the remote printer by changing the /etc/cups/client.conf file.

Assuming the printer is attached to a system called printserver.mydomain, open up /etc/cups/client.conf with your favorite editor and set the ServerName directive:

Code Listing 3.9: Editing client.conf

# vim /etc/cups/client.conf

(Substitute printserver.mydomain with your print server name)
ServerName printserver.mydomain

The remote system will have a default printer setting which you will be using. If you want to change the default printer, use lpoptions:

_________________
Increasingly becoming a 2 channel audio nut!
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 455
Location: Saitama, JP

PostPosted: Sat Feb 06, 2010 7:33 pm    Post subject: Reply with quote

I tried that but it seems I screwed something up the other day with all this fooling around with the configs. Now I'm getting this in /var/log/cups/error_log on the server (not the computer connected to the printer):
Code:
I [06/Feb/2010:13:26:01 -0600] Listening to ::1:631 on fd 1...
I [06/Feb/2010:13:26:01 -0600] Listening to 127.0.0.1:631 on fd 3...
I [06/Feb/2010:13:26:01 -0600] Listening to /var/run/cups/cups.sock on fd 4...
I [06/Feb/2010:13:26:01 -0600] Resuming new connection processing...
I [06/Feb/2010:13:26:01 -0600] [Job 10] Started backend /usr/libexec/cups/backend/lpd (PID 15416)
E [06/Feb/2010:13:29:12 -0600] [Job 10] recoverable: Unable to connect to printer; will retry in 30 seconds...


It goes on and on like this.

And when I do lpq -P epson on the server I get this message:
lpq: Unknown destination "epson"!

Frustrating.
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 455
Location: Saitama, JP

PostPosted: Sat Feb 06, 2010 9:01 pm    Post subject: Reply with quote

Actually, it looks like we're making some progress. I tried printing something and something actually showed up in the logs on the laptop (but nothing came out of the printer). Several lines in the logs like this:

W [06/Feb/2010:14:51:31 -0600] Request from "75.3.131.xx" using invalid Host: field "xxxxx.homelinux.org"

Any idea what this means?
Back to top
View user's profile Send private message
bobspencer123
Guru
Guru


Joined: 19 Dec 2005
Posts: 544

PostPosted: Sun Feb 07, 2010 5:49 pm    Post subject: Reply with quote

sl70 wrote:
Actually, it looks like we're making some progress. I tried printing something and something actually showed up in the logs on the laptop (but nothing came out of the printer). Several lines in the logs like this:

W [06/Feb/2010:14:51:31 -0600] Request from "75.3.131.xx" using invalid Host: field "xxxxx.homelinux.org"

Any idea what this means?


I'm still thinking that it is this line that is causing the trouble:

DeviceURI lpd://theshop.homelinux.org/epson

----

your original post states that your ip address changes so you are using a dyndns service for consistent naming. Unfortunately I have no experience with this since I only use a local network from a router that does do dynamic ip but in reality my computer that is hooked up to the printer is always 193.168.1.106. But, I actually use samba because the printer I am printing from is actually a windows box so that needs samba to print.

Since I know nothing about dyndns I think I can't provide much help if this naming the DeviceURI is the problem. Though this may a good opportunity to explore dyndns stuff. If I find anything I will try to help.
_________________
Increasingly becoming a 2 channel audio nut!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum