[Samba] Re: Linux, Samba, and the Lexmark z53

Joel Hammer Joel at HammersHome.com
Sun May 12 14:45:02 GMT 2002

I guess one question I should have asked was:
Does the lexmark work attached to the XP machine?
OK. Your problems on the window side appears cleared up. I had a similar
problem with the drivers for windows and the lexmark, and I am using the
laserjet driver right now to print from an XP machine.

Lexmark supplies a linux driver, so get that, install it, if you haven't
already, and you should be getting close to home. The lexmark driver takes a
postscript file and converts it into a format its printer understands. You
will also have a control program with it that allows to you graphically
control the printer settings from linux and also see how much ink is left in
the printer.

I am not clear what you mean by permissions are set to 700 on the queue.
The queue is supposed to be /tmp, which has very different permissions, and
the permission in the queue directory (/var/spool/lpd/printers) is quite
different, too. Do you mean the create mask in your share definition?

On Sun, May 12, 2002 at 02:25:04PM -0700, adrian kaehler wrote:
>   Hi there.  Ok, a lot happened last night, so let me respond to your suggestions here, and then tell you what new things I have leadned.
> Before new discoveries:
>   First off, there _were_ problems on the XP side.  XP said it couldn't print a test page if I tried to do that, or if I tried to print from an application it said that there was an "invalid handle" without ever describing what that meant.  
>   This whole spool/queue business was totally unclear to me, so first of all thanks for clearing me up on that.  I went through and implemented your suggestions, the spool is /tmp again, and the queue is back to permissions=700.  Failed print attempts from WinXP now result in files of size zero appearing in /tmp.
>   I had not heard of testparm.  Cool.  Wish I had known about that earlier... :(  Live and learn.  I don't know how I made it even this far without it.
>   Similarly checkpc, also very cool.  Also thanks.
>   Then I created a chopped down smb.conf file, and away I went.  
>   The net result was that nothing really changed in the final situation.  I had length zero files in /tmp.
> But then, I had a realization.
>   The line "printer driver = Lexmark Z53 Series ColorFine" appears in my smb.conf file.  I assumed that this was indicating that WinXP should load this driver automatically.  But just to see what happened, I commented this line out.  (This line appeared in a post you made to some printing related news group about six months ago on the very topic of Samba and Lexmark z53).  I was right, now WinXP could not autoload the driver.  So I had to "select the driver from a list", and when I did I got the error message "Could not complete, can not comunicate with printer, printer is either disconnected from the server or turned off".  Wow I thought, why didn't it give me this message when it was autoloading?  So it occured to me that the driver was _NOT_ being successfully loaded before, though no message to this effect was being generated.
>   So to further test my hypothesis, I went and loaded a different driver, the HP Laserjet III+ driver you mentioned a few mails ago.  That driver _did_ load, and then when I printed VIOLA! there was a non zero sized file in my /tmp directory!  And it was in postscript!  Yay.  So now all I gotta do is print it...
>   Downloading the latest Lexmark z53 driver from Lexmark did not seem to solve the problem, though I was warned that the driver was not "digitally signed" for compatability with WinXP.  So maybe this was the core issue?
>   The down side is that nothing came out of my printer anyhow.  Since at the time of the experiment I was printing to the raw print printer in my /etc/printcap file, shouldn't I have gotten reams of ASCII (postscript) out of my printer?
>   I have included my current smb.conf file (stripped down as you suggested).  What should I be doing next?  Should I just stick with this postscript driver for the printer?
>   Cheers!
>   and thanks thanks thanks
>    -Adrian
>   I had changed %p to the queue name everywhere.
>   Joel Hammer <Joel at HammersHome.com> wrote: SO, the situation is, as I understand it:
> You are using XP as a client.
> You have successfully installed the lexmark drivers on the XP client.
> When you print from the XP client, you get no error messages. 
> The file size in the "spool" directory is zero after you print from XP.
> Comments:
> Let's define two terms, just for our own use.
> I think the term "spool directory" is unclear. Let's call the "spool"
> directory the place where samba stores the print file received from the
> XP client, before samba invokes lpr to print it. When lpr is invoked, the
> file is transferred to the "queue" directory specified in /etc/printcap. I
> use /tmp as my "spool" directory because everyone can write to it but only
> the user can remove his own files. And, if things are going properly,
> the tmp directory is periodically cleaned out for you, usually during
> boot up. All these things are good. These are the permissions of my
> /tmp directory.
> drwxrwxrwt 43 root root 14336 May 12 08:18 tmp
> Now, it it a BAD idea to use the queue directory (specified in
> /etc/printcap) for your spool directory. If you set your permissions with
> checkpc -f (which you should do), very likely the samba user will not be
> able to write to that directory, and the file transfer will fail. SO,
> I would put your spool directory someplace anyone can write to, like
> /tmp, and try to print again from XP. You might make a special /SPOOL
> directory with chmod 777 just to make this debugging easier. Leave out
> the rm command from your print command and it would help to use
> print command = echo "Tried to print %s at `date` >> /tmp/junklog
> Don't forget to upate your path command in your printer share, either.
> You did follow my suggest to use the actual name of the printer instead of
> %p ?
> Please do the things I suggest you do and tell me the exact results.
> Then, try printing. 
> As an further note, I think your smb.conf file is the original file with the
> distro and you just modified it. For debugging, you might consider a very
> stripped now version of this file. Who knows what evil is lurking elsewhere
> in your smb.conf file.
> You do run testparm after you modify smb.conf?
> Joel
> On Sat, May 11, 2002 at 07:51:24PM -0700, adrian kaehler wrote:
> > 
> > Hi,
> > Let me try to address the things you suggest in order...
> > The logs are not helping me at all... or at least I don't think so. In the spool directory, nothing is being written to at all, even "status" is not written to. The timestamps on all of these files are unchanged for quite some time. I did move the /tmp to the same value as the spool directory indicated in the /etc/printcap since my last mail (I read that these should match) and now the print files themselves ("smbprn.tfjAhL" etc) are written to the spool directory, but as before they arrive with size zero. Nothing is written to /var/log/messages. in /var/log/samba, there are seperate log files for every client, and the WinXP client in question has a log file called "harmony.log". This log is qritten to - quite cryptically - whenever I kill and restart smbd (when I change /etc/smb.conf). The message which appears there is:
> > [2002/05/11 07:28:23, 0] rpc_server/srv_spoolss_nt.c:_spoolss_fcpn(4663)
> > _spoolss_fcpn: Invalid handle (OTHER)
> > [2002/05/11 07:28:23, 0] rpc_server/srv_spoolss_nt.c:close_printer_handle(257)
> > close_printer_handle: Invalid handle (OTHER)
> > 
> > These messages are correlated with starting smbd though, and not with the printing. Why they appear in the file "harmony.log" is completely beyond me though... as starting the smbd daemon seems to have nothing in particular to do with the client "harmony" (perhaps this is because "harmony" has the printer "installed" and so there is some communication at startup time?) The log for smbd itself "log.smbd" is not written to. The last log you mentioned was in /usr/local/samba/var. I do not have a /usr/local/samba directory. Can you think of where else the information might be which you thought I might find there?
> > I have deleted those "rm" statements. This now allows me to see the print files accumulate in the spool directory, but they still are size 0. The last thing is your mentioning the impression that I had successfully printed something. Looking back on what I wrote, I was terribly unclear. The "same thing" I was referring back to was in fact "nothing". What I meant by that passage was that I got the same message from WinXP when it failed.
> > I am not sure about the "real" guest account. This smbuser is what is used in the "samba faq" and is what I use on the same machine for file sharing which works great. It is also what I used back when I was using the cannon400s. This does however raise the issue that one or the other of the programs called under the smbuser id might not have permission to do something they need to do. For example the spool directory was perm 700, which was not allowing me to write the temp files to it. Thinking on it now, is it possible that since the stuff like "status" in the spool directory is perm 700 and owned by root (actually lp) that this is causing some headache when samba tries to update those files? --- wait... lemmie check --- ... doing experiment....
> > ... nope. Set all those perms to 666, and still no visible improvement. Ok... setting them back.
> > But this seems to me a clue yes? Even the queue status file is not being written to? What could this mean?
> > Thanks again and again for all of your help... are you at work? Don't you ever get to go home?
> > _adrian
> > 
> > Joel Hammer wrote: Some comments, in no particular order:
> > You are going to have to start reading the logs to see what is going on.
> > I would remove valid users from your printer definition.
> > Make sure security=share in the global section.
> > I would use the real name of the print queue in place of %p.
> > The first issue to solve is why you are not getting the files transferred
> > from you windows clients to the /tmp spool directory. To that end, I would
> > delete the rm %s from the printer command. Make sure there is a real guest
> > account. I use ftp.
> > The logs may help. (/var/log/messages, /var/log/samba,
> > /usr/local/samba/var/, and the status files in your printer queue.
> > 
> > I assume this means you got two pages printed:
> > > Under this setup the printer icon in WinXP actually has the word "ready" written under it, which was never there before... but printing a test page yields only the result described earlier.
> > NOTE: lpc is in /usr/sbin. 
> > Joel
> > 
> > On Sat, May 11, 2002 at 06:06:11PM -0700, adrian kaehler wrote:
> > > 
> > > 
> > > Ok, so on the "lprng" issue, that seems to be what I have. I ran checkpc, and got the following message:
> > > [adrian at valor lexmarkz53]# checkpc
> > > Warning - permissions of '/var/spool/lpd/lexmarkz53' are 0777, not 0700
> > > So if having checkpc implies having lprng, then that's me. Also if Redhat 7.1 uses it, it is at least reasonbable to suspect that RH 7.2 does as well.
> > > Currently however, I am unable to get anything to print on the printer, garbage or otherwise. When I attempt to print a test page from WinXP, I get a popup that says something like "Print failed, would you like to run the troubleshooter?" (as if that would help). Of course I click "no" and that's that. If I go to the linux machine, I see that there is a file in /tmp (this is where it should be yes? Because that is the "path" variable in the smb.conf file?) with a name like smbprn.DK41em, but it is size zero bytes. As I waited for your response I was reading elsewhere, and reorganized the [lex] entry in my smb.conf file to read:
> > > [lex]
> > > printing = lprng
> > > printer = z53-outfiles
> > > printer name = z53-outfiles
> > > comment = Raw Printer for Z53
> > > path = /tmp
> > > create mask = 0700
> > > guest ok = yes
> > > hosts allow = 192.168.
> > > valid users = smbuser
> > > printable = yes
> > > ; print command = echo "Tried to print %s" > /tmp/junk.%s
> > > print command = /usr/bin/lpr -P %p %s; rm %s
> > > lpq command = /usr/bin/lpq -P %p
> > > lprm command = /usr/bin/lprm -P %p %j
> > > lppause command = /usr/bin/lpc hold %p %j
> > > lpresume command = /usr/bin/lpc release %p %j
> > > printer driver = Lexmark Z53 Series ColorFine
> > > ; printer driver location = \\VALOR\public\Adrian\Drivers Etc\lxkz53
> > > share modes = No
> > > 
> > > Now, I am not sure what the difference between "printer" and "printer name" is, but I set them both to the queue you suggested "z53-outfiles", and changed the explicit references to "lp" to the meta "%p" which my reading suggests interpolates either "printer" or "printer name", but I do not know which (so I made them the same).
> > > Under this setup the printer icon in WinXP actually has the word "ready" written under it, which was never there before... but printing a test page yields only the result described earlier.
> > 
> > Also it should be mentioned that any attempt to print from any other WinXP application gives an "Invalid HANDLE error", which results in no print attempted.
> > > So at the moment, my issues is how to get WinXP to thing the print was successful, which I would think is at least correlated with getting the smbpm.XXXXX file to appear in /tmp, and maybe even printed... but for now, I can not even get the garbage files that I was seeing a few weeks ago (then under some strange configuration involving BSD and other things lost in the annals of history now).
> > > Thanks again for all of your help,
> > > -Adrian
> > > 
> > > Joel Hammer wrote: Actually, never having used bsd or cups, I wouldn't really know.
> > > If you have checkpc and it works, you likely have lprng. RedHat
> > > 7.1 used lprng. 
> > > Since printing goes for two lines and stops, you may fine something of
> > > interest in the status files in your print queue.
> > > Have you tried just cat'ing the file in the /tmp spool to lp0?
> > > The type of printing software you have on linux won't affect the cat'ing
> > > experiment.
> > > Joel
> > > 
> > > 
> > > 
> > > ---------------------------------
> > > Do You Yahoo!?
> > > LAUNCH - Your Yahoo! Music Experience
> > 
> > 
> > ---------------------------------
> > Do You Yahoo!?
> > LAUNCH - Your Yahoo! Music Experience
> ---------------------------------
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
Content-Description: smb.conf
>    workgroup = HOME
>    server string = Samba Server
>    printcap name = /etc/printcap
>    load printers = yes
>    printing = lprng
>    guest account = smbuser
>    log file = /var/log/samba/%m.log
>    security = share
>    encrypt passwords = yes
>    smb passwd file = /etc/samba/smbpasswd
> [public]
>    comment = Public Stuff
>    path = /pub
>    public = yes
>    writable = yes
>    printable = no
> ;   write list = @staff
> [cdrom]
>    comment = CDROM Drive
>    path = /mnt/cdrom
>    public = yes
>    writable = no
>    printable = no
> [lex]
>   printer name = z53-outfiles
>   comment = Raw Printer for Z53
>   printing = lprng
>   printer = z53-outfiles
>   path = /tmp
>   create mask = 0700
>   guest ok = yes
> ;  hosts allow = 192.168.
> ;  valid users = smbuser
>   printable = yes
> ;  print command   = echo "Tried to print %s" > /tmp/junk.%s
> ;  print command   = /usr/bin/lpr -P z53-outfiles %s; rm %s
>   print command    = /usr/bin/lpr -P z53-outfiles %s
>   lpq command      = /usr/bin/lpq -P z53-outfiles
>   lprm command     = /usr/bin/lprm -P z53-outfiles %j
>   lppause command  = /usr/sbin/lpc hold z53-outfiles %j
>   lpresume command = /usr/sbin/lpc release z53-outfiles %j
> ;  printer driver = Lexmark Z53 Series ColorFine
> ;  printer driver location = \\VALOR\public\Adrian\Drivers Etc\lxkz53
>   share modes = No    

More information about the samba mailing list