1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
!==
!== Printing.txt for Samba release 1.9.18alpha3 22 Oct 1997
!==
Contributor: Unknown <samba-bugs@samba.anu.edu.au>
Date: Unknown
Status: Current
Subject: Dubugging Printing Problems
=============================================================================
This is a short description of how to debug printing problems with
Samba. This describes how to debug problems with printing from a SMB
client to a Samba server, not the other way around. For the reverse
see the examples/printing directory.
Please send enhancements to this file to samba-bugs@samba.anu.edu.au
Ok, so you want to print to a Samba server from your PC. The first
thing you need to understand is that Samba does not actually do any
printing itself, it just acts as a middleman between your PC client
and your Unix printing subsystem. Samba receives the file from the PC
then passes the file to a external "print command". What print command
you use is up to you.
The whole things is controlled using options in smb.conf. The most
relevant options (which you should look up in the smb.conf man page)
are:
print command
lpq command
lprm command
Samba should set reasonable defaults for these depending on your
system type, but it isn't clairvoyant. It is not uncommon that you
have to tweak these for local conditions.
On my system I use the following settings:
print command = lpr -r -P%p %s
lpq command = lpq -P%p
lprm command = lprm -P%p %j
The % bits are "macros" that get dynamically replaced with variables
when they are used. The %s gets replaced with the name of the spool
file that Samba creates and the %p gets replaced with the name of the
printer. The %j gets replaced with the "job number" which comes from
the lpq output.
When I'm debugging printing problems I often replace these command
with pointers to shell scripts that record the arguments, and the
contents of the print file. A simple example of this kind of things
might be:
print command = cp %s /tmp/tmp.print
then you print a file and look at the /tmp/tmp.print file to see what
is produced. Try printing this file with lpr. Does it work? If not
then your problem with with your lpr system, not with Samba. Often
people have problems with their /etc/printcap file or permissions on
various print queues.
Another common problem is that /dev/null is not world writeable. Yes,
amazing as it may seem, some systems make /dev/null only writeable by
root. Samba uses /dev/null as a place to discard output from external
commands like the "print command" so if /dev/null is not writeable
then nothing will work.
Other really common problems:
- lpr isn't in the search path when Samba tries to run it. Fix this by
using the full path name in the "print command"
- the user that the PC is trying to print as doesn't have permission
to print. Fix your lpr system.
- you get an extra blank page of output. Fix this in your lpr system,
probably by editing /etc/printcap. It could also be caused by
incorrect setting on your client. For example, under Win95 there is a
option Printers|Printer Name|(Right
Click)Properties|Postscript|Advanced| that allows you to choose if a
Ctrl-D is appended to all jobs. This will affect if a blank page is
output.
- you get raw postscript instead of nice graphics on the output. Fix
this either by using a "print command" that cleans up the file before
sending it to lpr or by using the "postscript" option in smb.conf.
Note that you can do some pretty magic things by using your
imagination with the "print command" option and some shell
scripts. Doing print accounting is easy by passing the %U option to a
print command shell script. You could even make the print command
detect the type of output and its size and send it to an appropriate
printer.
If the above debug tips don't help, then maybe you need to bring in
the bug gun, system tracing. See Tracing.txt in this directory.
|