This is a regression from 3.5.12. Tested on a CentOS 5 server using 3.5.12 and 3.6.1 from sernet. This can only be reproduced on XP.
- install samba 3.6 on a linux machine
- ensure there's a cups printer available (any will do)
- in a clean smb.conf, export any cups printer (or export all of them)
- in a clean, up-to-date Windows XP SP3 vm, install an HP LaserJet 8000 PCL printer locally and install the driver for it on the printer shared by samba
- connect to the printer on samba server
- open libreoffice 3.4.3 writer, ensure that the page size is Letter
- open the print dialog
- when selecting the local printer, the page size in the preview pane (on the left) shows up as 8.5x11in and that's correct
- when selecting the remote printer, the page size in the preview pane goes to seemingly the first form size in the list of forms provided by samba (10x11 in)
Of course the print job that gets generated has some crazy custom paper sizes, and the printer insists on you having to override the paper size.
The type of printer does not seem to matter, the issue manifests seemingly with any printer driver we've tried.
Thus, there is no way to correctly print letter-sized documents from LibreOffice to a samba 3.6 print server. This also affects Office 2010, although there is a workaround for the latter: you have to change document size to any other paper size, apply, then change back, and only then it will print correctly. This workaround does not work in LibreOffice.
Other applications seem to be affected as well, for example when printing from Inkscape the image is shifted on the page compared to when printing to the same printer on samba 3.5. Do note that samba 3.5 seems to behave the same as a local installation of the same printer, so if I access given printer locally (via a tcp/ip printer port), or via samba 3.5, the results are the same. It gets broken if I access it on samba 3.6.
I'll be glad to debug it, but I need the following:
- what log level to use? indiscrimately setting level 10 on all components slows samba down to a crawl, so I presume there's a more targeted setting that would only deal with printing?
- what calls to look for?
I can then do a side-by-side comparison between 3.5 and 3.6.
** BOUNTY **
I'm offering a $300 bounty, payable via PayPal either to the fixer personally, or to some general samba fund, to fix this issue (your choice).
Note: I presume there are problems under Windows 7 clients too, but this specific way of reproducing doesn't work there. I really don't want to downgrade to 3.5 as Samba 3.6 finally fixes the driver installation horkage from 3.5 -- I had hoped I was over with messing with tdb files to rename printer drivers (as you'd need to do to get the same printer share work under XP and 7).
thanks for taking the time and reporting this bug.
Providing Samba log files
Provide all log files from '/var/log/samba/' directory and the tdb files from
'/var/lib/samba' and the configuration file '/etc/samba/smb.conf'. Post the
output of 'rpm -qi samba' or 'rpm -qi samba-<subpackage>' too. We need that
information to reconstruct what happened.
If winbind for logging in is part of the problem please provide
'/etc/security/pam_winbind.conf' and if you have enabled debug in
'pam_winbind.conf' Ã„/var/log/messages' is requried too.
More detailed description about different Samba components can be found blow
Testing daemons (winbind, smb, nmb)
1. Stop all running Samba processes (winbind, smb, nmb)
2. Remove all log files from /var/log/samba/
With this approach we ensure to have the start date of the testing in the
3. Edit /etc/samba/smb.conf and set the following variables in the in the
[general] section of the config:
debug level = 10
debug pid = Yes
max log size = 0
Instead of setting a global debug level in smb.conf it's also visible to
smbcontrol <damon_name> debug 10
to increase the debug level of the Samba daemon in question to 10 at run
If winbind is part of the scenario please set
debug = yes
4. Start the processes again (winbind, smb, nmb)
5. Reproduce the error and note the time when you start any test. If a problem
occurs while testing note the time (use date on the system you perform the
tests on to get a time fitting to the log files).
Attach the log files from '/var/log/samba/' and the tdb files from
'/var/lib/samba/' to the bug. If possible, remove the tdb files and provide clean
files. Therefore it's best to bond them to one compressed tar archive. The
relevant parts of '/var/log/messages' could be interesting too.
Just wanted to say that we see the same behavior on Samba 3.6.1:
- we use cups printers
- uploaded HP Universal Printerdrivers to Samba server
- did some default settings (e.g. papersize A4)
- installation of printers (and default settings) on clients work fine
- but after some time the default papersize changes to 10x11 (we didn't notice immediately so we don't know the trigger yet). Installed printers where not effected, only new installations
I try to setup an new environment with debugging turned on as asked.
I'm still looking for debug level 10 log file :)
We have got the same problem with Samba 3.6.3 from Debian squeeze backports.
The same bug was also in Samba 3.5.8, while Samba 3.5.9 to 3.5.11 were working fine.
I have reproduced the problem with a Samba 3.6.3 server on log level 10 and a Windows XP SP3 client. Logs, config and tdb files:
17:43:00 domain logon
17:43:10 printer install by login script failed for unknown reason
17:43:40 domain logoff
17:44:10 domain logon 2
17:44:27 printer install by login script successful
17:45:00 open printer settings to check page size => A4
17:46:00 open firefox to print page => A4
17:47:00 open libreoffice to print page => A1 (should be A4!!)
17:48:00 domain logoff 2 and shutdown
From our login script:
rundll32 printui.dll,PrintUIEntry /dn /n \\iserv\printer /q
rundll32 printui.dll,PrintUIEntry /in /n \\iserv\printer
rundll32 printui.dll,PrintUIEntry /y /n \\iserv\printer
Please let me know if you need any further information!
Created attachment 7683 [details]
sort back the forms for samba 3.6
I'm having the same problem and think to have the answer/solution.
It seems the order need to be the same than the one defined for the papersize in "samba-3.6.X/source3/librpc/gen_ndr/spoolss.h". For example Letter must be in position 1 and A4 in position 9.
I understood this by looking at the logs in level 10 (papersize didn't match the formname) :
[2012/07/01 13:17:49.121335, 1] ../librpc/ndr/ndr.c:284(ndr_print_function_debug)
spoolss_OpenPrinterEx: struct spoolss_OpenPrinterEx
in: struct spoolss_OpenPrinterEx
devmode : *
devmode: struct spoolss_DeviceMode
papersize : DMPAPER_A4 (9)
formname : 'A1'
Actually in position 1 of the array "builtin_forms1" (in "samba-3.6.X/source3/rpc_client/cli_winreg_spoolss.c") we have the values of the form "10x11" ; so if you select "Letter" it will use "10x11". And if you select "A4" il will use "A1". That matchs with previous comments.
You can see exactly what format is used by the server by connecting to it via regedit and looking to the value of "Default DevMode" (offset 0x67) for your printer (HKLM/SYSTEM/CurrentControlSet/Control/Print/Printers/YOUR_PRINTER_NAME)
The solution I suggest is to sort back the array "builtin_forms1" in "samba-3.6.X/source3/rpc_client/cli_winreg_spoolss.c" by using the same order than from the array "default_forms" in "samba-3.5.X/source3/printing/nt_printing.c". There is some extra values with the forms A0 and A1 which don't exist in current samba-3.5.X and I don't know in which position to put them ; so I removed them from the array in the patch I made.
For the comment 7, you can understand why it fails for a few 3.5.X versions by looking at the difference between the 3.5.8 and 3.5.9 (the order of the forms was changed by adding A0 and A1) :
$ diff -Nru samba-3.5.8/source3/printing/nt_printing.c samba-3.5.9/source3/printing/nt_printing.c
--- samba-3.5.8/source3/printing/nt_printing.c 2011-03-06 19:48:05.000000000 +0100
+++ samba-3.5.9/source3/printing/nt_printing.c 2011-06-14 13:17:28.000000000 +0200
@@ -91,8 +91,6 @@
So for the version 3.5.X the solution would be to use the array default_forms from the version 3.5.12 in "samba-3.5.X/source3/printing/nt_printing.c".
For the version 3.6.X use the non alphabetically sorted array (cf. patch "sort back the forms for samba 3.6").
After applying the patch it seems you need to go to the configuration of each printers to update/repair the "Default DevMode" value.
So for each printer you need to go in the properties of the printer, then choose the Advanced tab, then "Printing Defaults..." and click OK (you don't need to do any changes).
Before doing all printers check with a connection via regedit that the "Defaults DevMode" of the printer you looked took the right value and then you can start to heat your mouse ;-).
This bug seems to live since a long time ago (started in experimental I guess) : http://gitweb.samba.org/?p=samba.git;a=commitdiff;h=4bc46e0f271f3dcf90ee8beb8738a18fffb2a4b9;hp=d4474ba470a70ce0476156a9399193ec024bb455
Mikaël Le Bohec
Please add this patch to the next 3.6 release.
Created attachment 7948 [details]
Comment on attachment 7948 [details]
Wrong patch for wrong bug.
Created attachment 7952 [details]
Created attachment 7953 [details]
Andreas, can you request review from me as well please ? gd is often busy and this is obvious goodness :-). We probably need a 3.5.x back-port too.
This is not needed for 3.5. The code has been rewritten for 3.6 and in this rewrite I sorted the key alphabetically. Turns out Microsoft requires a special order :)
Re-assigning to Karolin for inclusion in 3.6.next and 4.0.0.rc.next.
Pushed to autobuild-v4-0-test and v3-6-test.
Closing out bug report.
Since there was a bounty on this (I have no idea how I missed that email that the bug was closed!), I don't intend to renege on my word. The $300, via PayPal is to be split between whoever has worked on this.
Kuba: Thank you very much. I would be open to a donation in form of hardware :)