[Samba] Printing to FreeBSD server from XP using samba

Joel Hammer Joel at hammershome.com
Wed Aug 13 12:30:41 GMT 2003


I don't know anything about BSD and you don't say which printing system you
use (cups, lprng, whatever), but:
Printing with samba is simple. Your client transfers the job to the print
server spool directory. Then, the print command on the sever is invoked to
print that file. Then, the file is removed. SO: 
Have you verified that the print job has been transferred to your print
server? I do this by changing my printing command in smb.conf to something
like print command = echo %s was transferred > /tmp/junk. That way the job is
never printed and it just stays in your spool directory with that funny long
smb name.
(Using cups, you can't change the print commands in smb.conf, they tell me.)
Then, if the job got transferred, try to print the job using the print
command that your system is supposed to use for this file. This file will
have been filtered by the XP client before being sent, so, you have to send
it to a raw queue, likely. Or, maybe your client is sending postscript
formatted jobs. You don't say in your post.
If you can print a file like this, then you just have to set up a queue with
the appropriate printing commands to get it done. I leave nothing to chance,
and specify all the printing commands in my print queue, like so:

[lp]
        comment = Raw Printer for Z53
#       max print jobs = 1
        path = /tmp
        create mask = 0700
        guest ok = yes
        hosts allow = 192.168.
        printable = Yes
        printing = lprng
#       print command = echo "Tried to print %s" > /SPOOL/junk.%s
#       print command = echo %J %p %s  >> /tmp/junkJ; /usr/bin/lpr -Plp  -J'%J' %s; rm %s
#       print command = echo %J %p %s  >> /tmp/junkJ; j=`echo %J | sed "s/^.*-//"`; /usr/bin/lpr -Plp  -J'$j' %s; rm %s
#       print command = echo %J %p %s  >> /tmp/junkJ; /usr/bin/lpr -Plp -J'%J'  %s; rm %s
        print command = echo %J %p %s  >>  /tmp/junkJ;\
                       a="`echo '%J' | sed "s/^.*- //"`" ;\
                       echo This is truncated $a >> /tmp/junkJ;\
                       /usr/bin/lpr -Plp  -J"$a"  %s;\
                       rm %s
        lpq command = /usr/bin/lpq -Plp
        lprm command = /usr/bin/lprm -Plp %j
        lppause command = /usr/sbin/lpc hold -Plp %j
        lpresume command = /usr/sbin/lpc release -Plp %j
        printer name = lp
#       printer driver = Lexmark Z53 Series ColorFine
#       printer driver location = \\HAMMER2\AllFiles\usr\local\samba\printer
        share modes = No

My printcap file for lp is as follows:
lp|LP|z53-outfiles:\
        :sd=/var/spool/lpd/lp:\
        :mx#0:\
        :lp=/dev/lp0:\
        :sh:rw:         
There is also another complication. The testpage that is generated by
the printer setup program may not be sent through the usual filtering
mechanism as a regular print job. Thus, if you are sending postscript
formatted files to your printserver with a printer that can handle
postscript files, this same queue may  not be able to handle the raw format
in which the test page is sent.

Note: All this information is what I have gleaned by much trial and error.
I don't know how much will apply to your setup.

One more thing, you have a [printers] share and then a share written for
your particular printer. You might consider getting rid of the [printers]
share.  Then, add a few things to the [lp] share, like a path, printable, etc.

Joel

On Wed, Aug 13, 2003 at 08:34:05PM +1000, David Lodeiro wrote:
> A couple of days ago I set up my printer on my FreeBSD server and set it
> up so I could print from my FreeBSD client. This all works very well,
> printing from botht the server and the FBSD client. However, I also have
> samba set up for file serving with an XP box. I have been trying for
> quite some time now to set samba up to enable me to print from the XP
> client. My situation at the moment is that the XP client can detect the
> printer in explorer, I can set up a printer using a wizard to print to it 
> without any errors, however when I go to print a test page, nothing happens. 
> No errors, no printout, and the wierdest part is that nothing shows up in 
> either the que on my xp box or on the lpq on the server.
> 
> I started the smbd and nmbd demons with debugger set to 10 to see if I
> could find something out
> 
> Firstly the relevant part of my printcap file
> 
> Canoni850|bjc800:\
>     :lp=/dev/lpt0:\
>     :sd=/var/spool/lpd/Canoni850:\
>     :lf=/var/spool/lpd/Canoni850/log:\
>     :mx#0:\
>     :sh:
> 
> 
> To handle all the raw printing ( ie. from windows )
> 
> And the relevent art of my smb.con
> [printers]
>    comment = Printers
>    path = /var/spool/lpd
>    browseable = no
>    printable = yes
>    public = yes
> #   create mode = 4777
> 
> [Canoni850]
>    comment = Canoni850
>    path = /var/spool/lpd/Canoni850
>    browseable = yes
>    printable = yes
> #   printer driver = Canon i850
> 
> [lp]
>    comment = FreeBSD printer
>    browseable = no
>    printable = yes
> 
> 
> Here is what I got in log.smbd with log level at 10
> 
> [2003/08/12 23:40:55, 5] lib/util_sock.c:print_socket_options(111)
>   socket option SO_SNDLOWAT = 2048
> [2003/08/12 23:40:55, 5] lib/util_sock.c:print_socket_options(111)
>   socket option SO_RCVLOWAT = 1
> [2003/08/12 23:40:55, 5] lib/util_sock.c:print_socket_options(111)
>   socket option SO_SNDTIMEO = 0
> [2003/08/12 23:40:55, 5] lib/util_sock.c:print_socket_options(111)
>   socket option SO_RCVTIMEO = 0
> [2003/08/12 23:40:55, 10] printing/nt_printing.c:update_c_setprinter(368)
>   update_c_setprinter: c_setprinter = 0
> [2003/08/12 23:40:55, 6] param/loadparm.c:lp_file_list_changed(2302)
>   lp_file_list_changed()
>   file /usr/local/etc/smb.conf -> /usr/local/etc/smb.conf  last mod_time: Tue 
> Au
> 
> [2003/08/12 23:40:55, 3] smbd/oplock.c:init_oplocks(1214)
>   open_oplock_ipc: opening loopback UDP socket.
> [2003/08/12 23:40:55, 3] lib/util_sock.c:open_socket_in(813)
>   bind succeeded on port 0
> [2003/08/12 23:40:55, 3] smbd/oplock.c:init_oplocks(1245)
>   open_oplock ipc: pid = 9747, global_oplock_port = 49804
> [2003/08/12 23:40:55, 4] lib/time.c:get_serverzone(114)
>   Serverzone is -36000
> [2003/08/12 23:40:55, 10] 
> lib/util_sock.c:read_smb_length_return_keepalive(559)
>   got smb length of 68
> [2003/08/12 23:40:55, 10] lib/access.c:check_access(304)
>   check_access: allow = , deny =
> [2003/08/12 23:40:55, 6] smbd/process.c:process_smb(845)
>   got message type 0x81 of len 0x44
> [2003/08/12 23:40:55, 3] smbd/process.c:process_smb(846)
>   Transaction 0 of length 72
> [2003/08/12 23:40:55, 2] smbd/reply.c:reply_special(92)
>   netbios connect: name1=DAVESSERVER      name2=JOSE
> [2003/08/12 23:40:55, 2] smbd/reply.c:reply_special(111)
>   netbios connect: local=davesserver remote=jose
> 
> Jose is the name of the XP client, davesserver is the name of the FreeBSD box. 
> Sorry about the long post
> 
> Any help is appreciated
> 
> Thankyou
> 
> David
> 
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  http://lists.samba.org/mailman/listinfo/samba



More information about the samba mailing list