Comment 75 for bug 967410

Revision history for this message
Louis Bouchard (louis) wrote :

Okay, after numerous retries (as in at least 20 virtual machines), I think I have identified a systematic way to reproduce the problem.

Test environment
1 virtual machine running Ubuntu 12.04 Precise with USB connected printer [1]
1 virtual machine running Windows XP

1) add the samba package
 $ sudo apt-get install sambe

2) Modify the /etc/samba/smb.conf
 workgroup = MSHOME
uncomment the two following lines :

   printing = cups
   printcap name = cups

3) Go in the "Printers" administration tool and enable sharing
 Server->Settings and enable the checkbox on :
 "Publish shared printers connected to this system"

4) In a terminal, type :
 $ sudo lpstat -a
Deskjet-2510-series accepting requests since Mon Feb 11 11:27:46 2013
 $ sudo rpcclient localhost -Nc enumprinters
No Printers returned.

This confirm that the printer exists but has not been picked up by Samba.


The sequence of event is required otherwise the bug will not occur (which is why I was no longer able to reproduce the problem). The upstream samba bug #8554 had the explanation ( :

"... where a newly created CUPS printer would be loaded into smbd with a
broken "printername" of '//LOCALHOST/', i.e. missing the actual share name
(empty in the outgoing spoolss_GetPrinter structure after the initial
OpenPrinterEx rpc command). Maybe this is also the case in 3.6.0. Without
Björns patch this happened whenever the first connect to the new printer share
would be initiated by a non-privileged user logged on to a Windows client (XP
or 7).

The "whenever the first connect to the new printer share would be initiated by a non-privileged user logged on to a Windows client" is important as, if smbd is restarted BEFORE this connection happens, the printer name will come up correctly !

5) Try to add the printer from Windows XP using the dialog until the "Search printer" shows the Precise VM in MSHOME workgroup by double-clicking on the Precise hostname. Nothing should happen.

6) in the terminal type :
 $ sudo restart smbd

7) Double-click on the Precise hostname. The printer should appear. Double-click on the printer. This double-click should trigger the bug and you should see only \\{precise hostname}\ in the Printer field. To confirm that do the following in the terminal :

 $ rpcclient localhost -Nc enumprinters
        description:[\\LOCALHOST\,,HP Deskjet 2510 series]
        comment:[HP Deskjet 2510 series]

The "name" field show that the printer name is missing and only the hostname appear.

Using the following steps, I am able to reproduce the bug systematically.

So from that, I did apply the patch from Samba bug#8554 to the precise-update version of the samba package and it does indeed fixes the issue, using the above method of reproducing the bug.

The one issue to be aware of is that the old entry for the failing printer will remain in Samba's registry.tbd database. In order to reset its value, the printer should be removed from CUPS and recreated, otherwise the previous entry will remain and the printer detection will continue to fail due to the previous entry still being present. If someone can propose a way to remove the entry from the registry.tbd file, please update the bug as I haven't found how to.

So I will propose this patch for SRU shortly.

[1] Since my test printer is a Deskjet 2510, I had to manually enable the Quantal archive to install the HPLIP version that supports my printer