LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-26-2005, 01:02 AM   #1
muddysteel
LQ Newbie
 
Registered: Feb 2005
Location: California, USA
Distribution: SuSE
Posts: 5

Rep: Reputation: 0
Smile Samba and printer problem between Windows XP and SuSE 9.0


After struggling with my Samba setup, my last task was to get my Windows XP workstation printing to my Linux workstation's printer.

Got this done after some time consuming learning. I wanted to post this info to hopefully reduce the next person's cycles. There's one "trick" I did that really helped out... So:

1) I had the basic Samba services running. I could see my shares, but printing just went into a hole. No complaints, just no output.

2) Turned on debugging. This required depicting both the log file "area" and the log level. At first, I didn't understand this could be done via the 'smb.conf' file located in /etc/samba. So, I hacked my 'rc' script and added it. After some debugging/reading, I FINALLY realized you can do this in the [global] section:

[global]
log file = /var/log/samba/%m
log level = 3

From this, I could now see the "conversation" that occurred when I tried printing. The give away was the following line from the log file associated with my workstation:

lpr -r -Phpdeskjet722c samba_4593932 (gave return of 1)

I couldn't see the result of the 'lpr' command, and just wasn't sure what was going on...But, I know a non-zero return signifies badness. So, here I got a detour, and used an old unix trick to "see" my problem.

My strategy was to run 'lpr' directly from the command line on the file that Windows passed over. I should then be able to see the problem.

THE DETOUR

I figured I had to alter the printer command, and I suspected my windows workstation was passing along info a print file that was already processed - meaning I needed to allow "raw" pass-through. What I didn't know was the "global" area's print directives do NOT extend to a specific printer. So, even though my [global] section said:

[global]
print command = lpr -P%p -l %s

which says, "use 'lpr', use -P(printer) denoted by %p, raw pass-thru (the -l) on file %s". This print command SHOULD have left the file around when it was done (default Samba setups use the -r flag, which says remove it when finished).

My printer section said:
[hpdesk722C]
comment = HEWLETT-PACKARD DESKJET 720C
path = /var/tmp
read only = No
create mask = 0600
guest ok = Yes
printable = Yes
printer name = hpdesk722C
oplocks = No

and since there was NOT a 'print command =', it used something other than my [global] section... /-:

THE TRICK

Linux like all *ixs will not remove a file if there are any other references to it. My plan wasn't working - I wanted to check whatever was being sent over. So, what I did was navigate to my printer's path directory (the 'path = /var/tmp') and waited for a file to show up. They all start with "s*", so the second I hit the "Print Test Page" from Windows, on my Linux box I entered:

ln s* xx

I linked file 's*' to file 'xx'. Now, I had a copy of the file that Windows was sending over. Sure enough, when I tried printing directly as Samba was, the queue complained:

# lpr -Phpdesk722C xx
lpr: unable to print file: client-error-document-format-not-supported

This meant that the file was already processed, and did not require filtering with the lp subsystem. So, when I did:

# lpr -l -Phpdesk722C xx

it printed just fine. So, dove back into my 'smb.conf' file. Looked it over and guessed that my hpdesk722C entry needed it's own printer command:

[hpdesk722C]
comment = HEWLETT-PACKARD DESKJET 720C
path = /var/tmp
read only = No
create mask = 0600
guest ok = Yes
printable = Yes
printer name = hpdesk722C
print command = lpr -r -P%p -l %s
oplocks = No

Works like a champ!
 
Old 05-02-2005, 06:18 AM   #2
Sando
LQ Newbie
 
Registered: Oct 2004
Posts: 21

Rep: Reputation: 15
You don't know how helpful that is.

*kisses feet*

Thankyou soooo much!
 
Old 05-12-2005, 09:01 PM   #3
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Rep: Reputation: 15
Unhappy So close and yet sooo far

Man I was soo excited until the very end!
I have exactly the same symptoms (but I could not see where the lpr command is printed in the log file after bumping the log level to 3.)

1) I am getting the same error in my log file ( Unable to print file to hack-client-error-document-format-not-supported)

2) I was able to capture the file in my spool directory

3) I was able to print it as you suggested from the command line (printed fine.)

BUT but when I made the changes to my smb.conf, I still get the same error in my log :-(
This system had been working fine and something happened and it stopped. Unfortunately I didn't make a copy of the smb.conf before I started monkeying with it.

My file shares are not listed here because they are working fine.

Here is my (current) smb.conf (without the shares):
[global]
log file = /var/log/samba/%m.log
log level = 3
load printers = yes
printing = cups
printcap = cups

[hack]
printer name = hack
comment = Lexmark E210
printable = yes
path = /var/spool/samba/hack
print command = lpr -r -P%p -l %s
create mask = 0600
oplocks = No


I also noticed that I got the following error when I ran with oplocks set:
Invalid combination of parameters for service hack. Level II oplocks can only be set if oplocks are also set.

Last edited by jordanthompson; 05-12-2005 at 09:28 PM.
 
Old 05-13-2005, 06:00 AM   #4
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Rep: Reputation: 15
I created a new thread "samba and cups problems" for the problems I am having.
 
Old 06-12-2005, 10:58 AM   #5
erik_wout_ew2
LQ Newbie
 
Registered: Jun 2003
Posts: 26

Rep: Reputation: 15
cups printing

Thanks a lot,

but if you're using cups, don't use

printing = cups

but (for example)

printing = lprng
 
Old 06-28-2005, 11:02 AM   #6
massimo.fioravanti
LQ Newbie
 
Registered: Jun 2005
Posts: 1

Rep: Reputation: 0
Printing with Samba

Many thanks for your info, but I found a little problem.

First of all I have followed the muddy steel suggestion; the system is working correctly. BUT After 1 day of working the system present again the same problem.

Here the actual configuration (shares are not indicate) of my smb.conf file:

[global]
log file = /var/log/samba/samba.%m
max log size = 50
ldap ssl = No
restrict anonymous = no
socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192
domain master = no
wins support = true
dns proxy = no
server string = Samba Server
max protocol = NT
read only = no
workgroup = BEP
server signing = Auto
os level = 64

[Deskjet9300]
comment = HP Deskjet 9300 A3
path = /var/tmp
read only = no
create mask = 0600
guest ok = yes
printable = yes
printer name = Deskjet9300
print command = lpr -r -P%p -l %s
oplocks = no

As you can see I'm working with an HP printer.
If I try to print any file (not only the test page) form local the print is executed correctly
If I send the test page to print from remote (Windows) the system work correctly and print the test without any problems.
If I try to send any kind of printing form various Windows application the samba log file replies

[2005/06/28 17:26:26, 1] smbd/service.c:make_connection_snum(648)
massimof (192.168.1.101) signed connect to service Deskjet9300 initially as user m.fioravanti (uid=501, gid=100) (pid 2134)
[2005/06/28 17:26:29, 0] printing/print_cups.c:cups_job_submit(765)
Unable to print file to Deskjet9300 - client-error-document-format-not-supported
[2005/06/28 17:26:35, 1] smbd/service.c:close_cnum(836)
massimof (192.168.1.101) closed connection to service Deskjet9300

I can confirm that the proposed solution from muddy steel work for 1 day.
I can also confirm that I have not modified any part of configuration files since from yesterday after successful test with the new smb. conf file


I need help urgently if possible.

thanks a lot in advance
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
samba and windows printer BobNz Linux - Newbie 1 04-25-2004 07:50 PM
SAMBA and printer problem, help please (suse 9) balam Linux - Networking 0 12-09-2003 06:51 PM
CUPS/SAMBA Printer Server for Windows Problem baz2 Linux - Networking 3 11-18-2003 07:01 AM
samba and windows printer drives. deano Linux - Networking 4 10-16-2003 10:33 AM
Windows printer does not print using Samba ZhiYi Linux - Networking 0 02-28-2003 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration