# Can't print to remote lpd printer

## sl70

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:

```
<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:

```
# 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:

```
<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:

```
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:

```
 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.

----------

## bobspencer123

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

```

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.

----------

## sl70

Yes. I'm using cups 1.3.10. I changed cupsd.conf to this:

```
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:

```
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.

----------

## bobspencer123

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.

----------

## sl70

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

```
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>

```

----------

## bobspencer123

just found this:

```

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: 

```

----------

## sl70

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):

```
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.

----------

## sl70

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?

----------

## bobspencer123

 *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.

----------

