DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Installation and Upgrading

OpenBSD Installation and Upgrading Installing and upgrading OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 1st March 2011
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default lpr printer setup

I'm struggling with setting up and HP 5L laserjet on a trendnet print server.
I have the printserver assigned a static address 192.168.1.2 that works in cups.
The server name is
Quote:
PS-8B4C0D
with port name
Quote:
P1
My /etc/hosts
Quote:
192.168.1.2 PS-8B4C0D
My /etc/hosts.lpd
Quote:
PS-8B4C0D
One thing I am confused by is the gutenprint driver is supposed to have a builtin ghostscript filter. I have ghostscript, foomatic-filters and foomatic-db installed. The pkg-readme for foomatic-filters suggests a printcap line if=/usr/local/bin/foomatic-rip: but I'm not sure I need this if the driver
Quote:
HP-LaserJet_5L-ljet4.ppd
has a builtin filter?


When I #lpc start hp5l I get an error message that it cannot connect.
I tried generating a printcap with apsfilter but am not clear on the fields rm and rp (tried numerous iterations). I tried editing the printcap in /usr/local/share/doc/pkg-readmes/foomatic-filters (from C64 to HP 5L) and found two pertinent posts in this forum, both on local lpt printers.

Penultimate question: Since it is a remote printer I would not think there would be any permission issues (I am a member of wheel).

Ultimate question: Any one have a printcap that is close to my configuration they can post?

Thanks in advance

Last edited by shep; 1st March 2011 at 11:30 PM. Reason: added /etc/hosts.lpd
Reply With Quote
  #2   (View Single Post)  
Old 2nd March 2011
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

I still have these notes I wrote down 4 years ago. But I think my situation was a little bit different then yours, so I am not sure it will help

Quote:
I installed apsfilter on a local OpenBSD box with an USB HP deskjet printer so it could be my print server.

The host name of the print server is 'protogoras.utp.xnet'.
To be able to print from my OpenBSD workstation "zeno.utp.xnet' I have this /etc/printcap
Code:
j65nko@zeno[~]cat /etc/printcap

#       $OpenBSD: printcap,v 1.4 2003/03/28 21:32:30 jmc Exp $

#lp|local line printer:\
#       :lp=/dev/lp:sd=/var/spool/output:lf=/var/log/lpd-errs:

lp|rp|remote line printer:\
        :lp=:rm=protogoras.utp.xnet:rp=lp:sd=/var/spool/output:lf=/var/log/lpd-errs:
On 'protogoras.utp.xnet' I have added ""zeno.utp.xnet'" to the file /etc/hosts.lpd.
Code:
j65nko@protogoras[~]cat /etc/hosts.lpd
#       $OpenBSD: hosts.lpd,v 1.2 1996/07/20 00:28:28 deraadt Exp $
# as described in lpd(8), place one legal access hostname per line
zeno.utp.xnet
On both the workstation and the print server I have enabled lpd
Code:
j65nko@protogoras[~]grep lpd /etc/rc.conf.local
lpd_flags=""
Please note this part of the lpd(8) man page
Code:
     lpd performs reverse DNS lookups on network clients.  If a client host-
     name cannot be determined from its IP address, the print request will be
     silently dropped.  This is important to note when debugging print prob-
     lems in dynamic address environments.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #3   (View Single Post)  
Old 2nd March 2011
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

You are mixing awfully lots of things. PPDs are not drivers. Those are PostScript Printer Description files. foomatic-rip filter uses them to decide which driver to call. If the driver is Guthenprint it calls it. Ghostscript is just another collection of printer drivers.

Apsfilter is as the name said just another filter (parse file which you sent to printer, calls appropriate program to convert it to PostScript and then calls appropriate driver if the printer doesn't have built in PostScript interpreter). foomatic-rip does the same. So make your pick.

Here is my printcal for the local printer.

Code:
lp|Lj4L|HP Lj4L:\
        :lp=/dev/lpt0:\
        :af=/etc/foomatic/HP-LaserJet_4L-ljet4.ppd:\
        :if=/usr/local/bin/foomatic-rip:\
        :sh:sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:
Now your printer is remote which means that you will replace line

Code:
:lp=/dev/lpt0:\
with something like

Code:
:lp=:rm=192.168.2.xxx:\
Permission problem indicates two things

1. Your spooling directory

sd=/var/spool/output

doesn't have appropriate permission 755.


2. Secondly if your printer server is on another machine you have to edit

/etc/hosts.lpd

in that machine and enter IP address of the client machine (machine that you are trying to print from).

Finally if you are using some kind of stand alone printer server for all I know that thing might be speaking only IPP protocol which lpd daemon doesn't speak.

PS. I forgot to add that you obviously have to pass the traffic in your firewall out of your printer client and also server has to be able to get it. So you have to open 515/tcp port on the server.

Last edited by Oko; 2nd March 2011 at 12:49 AM.
Reply With Quote
  #4   (View Single Post)  
Old 2nd March 2011
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

It is a stand alone print server that continues to work well with cups
One confusing aspect is the printcap in an Arch Linux running cups reads
Quote:
hp5l|H-P 5L Laserjet:rm=Bear:rp=hp5l:
Bear is the name of the Arch Linux box. Bear also prints via network protocol and in cups I set the network option as
I redid the permissions on /var/spool/output.

My /etc/printcap
Quote:
hp5l|HP 5L Laserjet:\
:lp=:\
:rm=PS-8B4C0D:\
:rp=P1:\
:af=/etc/foomatic/HP-LaserJet_4L-ljet4.ppd:\
:if=/usr/local/bin/foomatic-rip:\
:sh:sd=/var/spool/output:\
:lf=/var/log/lpd-errs:
Also tried :rm=192.168.1.2:\ and rm=PS-8B4C0D.home.yak:\

Still get an error message that lpc start hp5l will not connect.
Reply With Quote
  #5   (View Single Post)  
Old 2nd March 2011
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

rm is the remote printer. It needs either a hostname that your box can resolve to an IP address or just an IP address.
If you run dig PS-8B4C0D.home.yak do you get the IP address 192.168.1.2 as answer?

Most Unix programs produce postscript output. Unfortunately most printers don't understand postscript. In those cases you need a filter that converts the Postscript file to a file with the native printer commands. Then the file with the native printer codes will be sent to the (remote) printer.

But if the (remote_ printer understands Postscript, you don't have to deal with any filters at all. Just a correct entry for rm will do.

Did you see http://netbsd.org/docs/guide/en/netbsd.html#chap-print ?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #6   (View Single Post)  
Old 2nd March 2011
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

I entered this in my printcap on 192.168.222.20 although 192.168.222.244 doesn't have anything like a printer configured

Code:
rp|remote line printer:\
        :lp=:rm=192.168.222.244:rp=lp:sd=/var/spool/output:lf=/var/log/lpd-errs:
Now a status check
Code:
$ lpc status
rp:
        queuing is enabled
        printing is enabled
        3 entries in spool area
        waiting for 192.168.222.244 to come up
If I do lpr -Prp <quotes.txt I get
Code:
$ lpc status           
rp:
        queuing is enabled
        printing is enabled
        4 entries in spool area
        waiting for 192.168.222.244 to come up
One more job in the spool area..

My firewall on my box is blocking port 515, that is why it is waiting ...
Code:
04:51:48.710783 rule 20/(match) block out on re0: 
192.168.222.20.925 > 192.168.222.244.515: S 3733580883:3733580883(0)
 win 16384 <mss 1460,nop,nop,sackOK,nop,wscale 0,[|tcp]> (DF)
What is the output on your box of lpc status ?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #7   (View Single Post)  
Old 2nd March 2011
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

Quote:
# dig PS-8B4C0D.home.yak

; <<>> DiG 9.4.2-P2 <<>> PS-8B4C0D.home.yak
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10613
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;PS-8B4C0D.home.yak. IN A

;; ANSWER SECTION:
PS-8B4C0D.home.yak. 5 IN A 63.146.68.202
. 5 IN A 63.146.68.201

;; Query time: 236 msec
;; SERVER: 205.171.3.25#53(205.171.3.25)
;; WHEN: Tue Mar 1 19:51:31 2011
;; MSG SIZE rcvd: 68
The answer section looks wrong to me. I am using a commercial router and I believe the DNS is performed by my ISP earthlink
Quote:
$ cat /etc/hosts
# $OpenBSD: hosts,v 1.12 2009/03/10 00:42:13 deraadt Exp $
#
# Host Database
#
# RFC 1918 specifies that these networks are "internal".
# 10.0.0.0 10.255.255.255
# 172.16.0.0 172.31.255.255
# 192.168.0.0 192.168.255.255
#
127.0.0.1 localhost
::1 localhost
192.168.1.5 Test.home.yak Test
192.168.1.2 PS-8B4C0D.home.yak PS-8B4C0D
Quote:
$ ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=4.516 ms
64 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=2.069 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=255 time=2.103 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=255 time=2.087 ms
--- 192.168.1.2 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
Quote:
$ cat /etc/hosts.lpd
# $OpenBSD: hosts.lpd,v 1.3 2008/04/15 07:54:48 ajacoutot Exp $
# As described in lpd(8), place one legal access hostname per line.
# See hosts.equiv(5) for syntax and examples.
PS-8B4C0D.home.yak
Quote:
# lpc status
hp5l:
queuing is enabled
printing is enabled
no entries
printer idle
------------------------------------------
Quote:
Web Interface of the trendnet printserver
Server Name : PS-8B4C0D
Port Name : P1
Model : TE100-P1P
Firmware Version : 4.06 (2005-07-12)
MAC Address : 00 14 D1 8B 4C 0D
IP Address : 192.168.1.2 (Manual)
Up Time : 132 days, 06:42:44
I think there is something wrong with my reverse DNS resolution
although I also tried
Quote:
hp5l|HP 5L Laserjet:\
:lp=:\
:rm=192.168.1.2:\
:rp=P1:\
:af=/etc/foomatic/HP-LaserJet_4L-ljet4.ppd:\
:if=/usr/local/bin/foomatic-rip:\
:sh:sd=/var/spool/output:\
:lf=/var/log/lpd-errs:
and various rp= values lp, lpt1, lpt0

I appreciate the help

Last edited by shep; 2nd March 2011 at 05:17 AM. Reason: Added comment after dig quote
Reply With Quote
  #8   (View Single Post)  
Old 2nd March 2011
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

Which model TRENDnet print server do you have See http://www.trendnet.com/products/products.asp?cat=46#26 ? (Why do I have to do your homework )

Can you, install or reconfigure apsfilter with the HP 5 printer, temporarily connected to your OpenBSD box to get that working first?

I have an howto (still in alpha stage) of installing apsfilter and configuring it for a locally connected USB printer. It has screenshots of the complete apsfilter configuration. That is the good news. The bad news : it is from July/August 2007
If needed I can post/attach it here.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #9   (View Single Post)  
Old 2nd March 2011
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

I have the TE100-P1U (Version v2.xR) printserver.

It has worked well for years using CUPS.

There is no urgency to get this done - it is a learning exercise for me and I usually resort to the forum when the man pages, pkg-readmes and FAQ's and my intellect fail.

The FreeBSD handbook has an extensive entry on setting up printing. Is lpr consistent across the various BSD's to review this. I do not have the background to assess the applicabilty of the FreeBSD information to OpenBSD but I will read with the idea of understanding the processes involved.
http://www.freebsd.org/doc/en_US.ISO.../printing.html
Reply With Quote
Old 2nd March 2011
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

Some Progress, the lpd daemon does not appear to be starting. When I manually started it I was able to 'lpc start hp5l'. I'm not sure why it does not start at boot but will try a more explicit 'lpd_flags=YES'
Quote:
# ps -auxU daemon
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
# lpd
# ps -auxU daemon
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
daemon 27063 0.0 0.1 400 856 ?? Ss 3:29PM 0:00.00 lpd
# lpc start hp5l
hp5l:
daemon started
Quote:
# cat /etc/rc.conf.local
ntpd_flags="-s" # enabled during install
xdm_flags= # enabled during install
ldp_flags=""
I just now see the typo ldp -> lpd
Now I'm also dealing with permission problems.

Quote:
$ lpr -P hp5l print_test.txt
lpr: /var/spool/output/tfA004Test.home.yak: Permission denied

# ls -al /var/spool/output
total 12
drwxr-xr-x 2 root daemon 512 Mar 1 14:42 .
drwxr-xr-x 12 root wheel 512 Mar 1 11:12 ..
-rw-rw---x 1 daemon daemon 4 Mar 2 15:31 .seq
The freebsd handbook is good to get a general idea about the lpd printing process.

Last edited by shep; 3rd March 2011 at 12:00 AM. Reason: noticed the typo in /etc/rc.conf.local
Reply With Quote
Old 3rd March 2011
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

IMHO http://netbsd.org/docs/guide/en/netbsd.html#chap-print is also excellent.

Some general information and links can be found in http://en.wikipedia.org/wiki/Line_Pr...aemon_protocol

apsfilter creates the spool directories with the correct permissions
Quote:
Originally Posted by My alpha apsfilter installation guide
1.14 Install, create printcap entry, spool directory and save settings

Code:
==================================================================
	  A P S F I L T E R   S E T U P			  -- MAIN MENUE --
	==================================================================

	(D)	Available Device Drivers in your gs binary
	(R)	Read Ghostscript driver documentation	     (devices.txt)

	(1)	Printer Driver Selection		[ljet4]
	(2)	Interface Setup				[parallel]
	(3)	Paper Format				[a4]
	(4)	Printing Quality			[high]
	(5)	Color Mode				[gray]
	(6)	Print Resolution in "dots per inch"	[600x600]
	(7)	Default Printing Method			[auto]

	(T)	Print Test Page
	(V)	View performance log (times of print attempts)

	(A)	Abort installation (don't do anything)
	(I)	==> Install printer with values shown above - repeat this
		    step for installing multiple printers
	(Q)	==> Finish installation

	Your choice? i
IMPORTANT: If you are happy with the settings you selected, the proper sequence to save them is:
# Select (I) ==> Install printer with values shown above
# Select (Q) ==> Finish installation

Forgetting to choose Install will leave you with a not working configuratation.

Code:
Please enter a printer queue name for printer 'ljet4'.
The default name is 'lp'.

Your choice: lp

** creating printcap entry for printer lp...
   creating spooldir ...
   remember SETUP settings in printers apsfilterrc file...
** done.

[ press <RETURN> to continue ] Enter
RE: lpd start in "/etc/rc.conf.local"

After I made a similar typo/mistake I made it a habit to use grep on the default rc.conf

Code:
 $ grep lpd /etc/rc.conf
lpd_flags=NO            # for normal use: "" (or "-l" for debugging)
You never test with netstat whether the daemons you enbled really are LISTENing?
Code:
$ netstat -an -f inet    
Active Internet connections (including servers)
Proto   Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp          0      0  192.168.222.20.20442   82.199.134.137.80      CLOSE_WAIT
tcp          0      0  192.168.222.20.21154   80.255.10.121.80       TIME_WAIT
tcp          0      0  192.168.222.20.10766   209.85.229.102.80      ESTABLISHED
tcp          0      0  192.168.222.20.29107   192.168.222.244.22     ESTABLISHED
tcp          0      0  *.6000                 *.*                    LISTEN
tcp          0      0  *.3306                 *.*                    LISTEN
tcp          0      0  127.0.0.1.587          *.*                    LISTEN
tcp          0      0  127.0.0.1.25           *.*                    LISTEN
tcp          0      0  *.515                  *.*                    LISTEN
tcp          0      0  192.168.222.20.22      *.*                    LISTEN
Active Internet connections (including servers)
Proto   Recv-Q Send-Q  Local Address          Foreign Address        (state)
udp          0      0  192.168.222.20.19094   85.158.249.144.123    
udp          0      0  192.168.222.20.7216    91.198.174.197.123    
udp          0      0  192.168.222.20.38801   72.26.217.210.123     
udp          0      0  *.514                  *.*
I can recommend to get into this habit
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 3rd March 2011
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

Success. I updated the firmware on the printserver (may not have been necessary) and found that the server had an extra port 81 for 'ipp://'. Oko's post indicated this was not supported by lpr but I found out that lpr does support port 9100 (HP jetdirect). A quick check showed the printserver to also support that port. I setup a quick printcap using :lp=9100@192.168.1.2 without a filter and the printer made printer noise but generated empty pages!
I went back tried to enter in 9100@192.168.1.2 in the apsfilter ./SETUP but it would not print a test page. I install the apsfilter printcap anyway and edited :lp=:\ -> lp:9100@192.168.1.2. and removed the :rm and rp entrys.
Quote:
# APS1_BEGINrinter1
# - don't delete start label for apsfilter printer1
# - no other printer defines between BEGIN and END LABEL
hp5l|hp5l;r=300x300;q=draft;c=gray;p=letter;m=auto :\
:lp=9100@192.168.1.2:\
:if=/etc/apsfilter/basedir/bin/apsfilter:\
:sd=/var/spool/lpd/hp5l:\
:lf=/var/spool/lpd/hp5l/log:\
:af=/var/spool/lpd/hp5l/acct:\
:mx#0:\
:sh:
# APS1_END - don't delete this
Thanks to Oko and J65nko

Last edited by shep; 3rd March 2011 at 07:57 AM. Reason: correct grammer
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printer dont take rights mururoa FreeBSD General 3 5th October 2009 12:54 PM
FBSD 7.1 and Canon LBP-660 Printer Calderon FreeBSD General 8 4th May 2009 07:04 AM
Printer setup question JMJ_coder NetBSD General 12 6th November 2008 12:04 AM
IP Printer Setup kjemison FreeBSD General 4 2nd June 2008 02:35 PM
Cups + USB-Printer nihonto OpenBSD Packages and Ports 3 21st May 2008 07:49 PM


All times are GMT. The time now is 10:17 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick