Samba does not write newly added cups printers into the registry. Workaround: After adding a new cups printer you can run rpcclient -c "enumprinters"
A hotfix is the following, the final patch should add it into the load_printers path where already deleted printers are handled: source3/rpc_server/spoolss/srv_spoolss_nt.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 3405566..0174851 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -3622,6 +3622,11 @@ static WERROR printserver_notify_info(struct pipes_struct *p, continue; /* skip */ } + winreg_create_printer_internal(mem_ctx, + get_session_info_system(), + p->msg_ctx, + lp_servicename(snum)); + /* Maybe we should use the SYSTEM session_info here... */ result = winreg_get_printer_internal(mem_ctx, get_session_info_system(),
Created attachment 7059 [details] proposed fix for bug 8554
*** Bug 8612 has been marked as a duplicate of this bug. ***
The attached Björn attached doesn't fix the problem here. Maybe my reported bug (Bug #8612), that was marked as duplicated of this one, isn't exactly the same?! If I add a new printer section to my smb.conf and restart the services the new printer still isn't shown in "\\server\Drucker und Faxgeräte". The workaround to run # rpcclient -c "enumprinters" doesn't work here also. This just show me the help of the rpcclient command.
Marc, could you please try the patch from comment #1?
When I try the fix from comment #1, I get: patching file source3/rpc_server/spoolss/srv_spoolss_nt.c Hunk #1 FAILED at 3622. 1 out of 1 hunk FAILED -- saving rejects to file source3/rpc_server/spoolss/srv_spoolss_nt.c.rej I guess it's a formating problem when I copy/paste the code (I'm not very conversant with patching).
We needed to replace "auth_serversupplied_info" by "auth_session_info" to make Björns patch apply to a non-recent git snapshot. Björns patch fixes a related problem of the smbd build from a samba4 git snapshot, 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).
Comment on attachment 7059 [details] proposed fix for bug 8554 This is only a partial fix. We need to fix this in lp_add_printer(). To be more precise, there needs to be a function creating the defaults in the registry before we call lp_add_printer() or lp_add_one_printer().
For my tests I haven't added a new printer to my LPRng printcap. I just copied a printer section and gave it a new name. The parameter "printer name" points to an already existing printcap entry. I applied the partial-patch to 3.6.1, added a new printer section to smb.conf and restarted the services. Nothing appears in \\server\Drucker und Faxgeräte. Also one more information: If I run the "rpcclient" workaround, the printer is there, but when I try to assign a driver, XP freezes for several minutes and the driver isn't applied. See the comment from my other bug: https://bugzilla.samba.org/show_bug.cgi?id=8612#c4 (I don't know if it's something related with the bug I reported, or with this one here, too.)
Created attachment 7163 [details] proposed fix for bug 8554 and 8612 Marc Muehlfeld, could you verify that this patch fix it?
I applied the patch. But: If I add a new printer section to smb.conf and restart the services, the new printer still don't appear. I still have to run the "rpcclient" workaround to make it visible. - right-click to new printer / properties - Message "no driver assigned. would you upload one?" -> no - Go to "extended" tab and choose a driver that is already on the servers print$. -> click "ok" - No crash/hang now. But after 20-30 seconds I get "no driver assigned. would you upload one?" again. - The "model" column shows the name of the assigned driver now. - right-click to the new printer again / properties - Message "no driver assigned. would you upload one?" comes up -> no - "extended"-tab shows the assigned driver now. but something still is wrong, because windows still thinks no driver is assigned and asks everytime for one when I go to the printers properties.
Created attachment 7164 [details] Level 10 Debug Log The attached logfile contains a level 10 debug log of the steps I described in my previous post (on 3.6.1 with your patch).
Problem is also there, if I assign the driver with rpcclient 192.168.10.4 -U administrator -c 'setdriver HPCP1515-9 "HP Color LaserJet CP1510 Series PS"'
Created attachment 7195 [details] new proposed fix for bug 8554 and 8612 Okay, I think I've fixed it. Could you try this, please? notice: After adding a new printer to the smb.conf, we'll have to wait until the parent smbd reread the smb.conf. Then we have to wait for the printcap-cache timeout. After the timeout the printers should be available.
Created attachment 7203 [details] smb.conf, level 10 debug logs and network trace I applied your patch to the fresh 3.6.1 sources, compiled and installed it. Then I duplicated a printer entry and gave it a new name (the copy still points to the same "printer name =" value like the one I copied it from). Then I restart (not reload) smbd and nmbd. I wait for about 5 mins and could see some "Printcap cache time expired" and "reloading printcap cache" in the smbd.log (I have the cache timeout at 60 seconds). But the printer doesn't appear in windows \\server\drucker und faxgeräte. I run the rpcclient -c "enumprinters" workaround to make it appear. In windows I see the printer in \\server\drucker und faxgeräte now. I right-click to it -> properties -> extended tab and assigend a driver to it. Then I click "OK" and the dialoge hangs for about 20 seconds. And after that the "Driver .. not installed on the server. ... Would you like to install a driver?" window was shown on top of the printer properties window. Find attached my smb.conf, level 10 debug logs and a network trace of all the steps I had done. If I can help you by providing more debug logs or network traces, please let me know, which steps I should include. Then I'll quickly provide you the required information. I meanwhile have a complete test environment (PDC, Member, XP Client) here. :-)
I also saw, that when I had applied your patch, and start the samba services while using my old lock-directory from 3.5.12 (like what is the situation when I upgrade from 3.5.12 to 3.6.1), none of my old existing and working printers are migrated. \\server\drucker und faxgeräte shows abolutely nothing now (until I do the rpcclient workaround). Would it help, if I attach my 3.5.12-lock-directory or some files from there? If yes, is there anything security related (cache passwords,...), I should better not upload here, in these files?
I'm hitting this as well. Confirming that the workaround works.
Sorry, didn't have the time to check the issue again. But I'm nearly sure, that the patch fixed the issue on my machine. Wilco, if you have some free time, could you check if the patch 7195 fix the issue? It's important that you have to wait until the parent smbd reread the smb.conf. Then you have to wait for the printcap-cache timeout. After the timeout the printers should be available.
Yes, checking the patch is on my todo list for tomorrow. Not sure if the patch 's supposed to catch renames, haven't looked at the code yet.
Attachment #7195 [details] ("new proposed fix for bug 8554 and 8612") fixes it for me. Printers get added just the way I'm used to.
I can't confirm that the patch is working! I retried the same steps today as I did in Comment 15 + 16. And the result is still the same. I attached debug logs and network traces in Comment 15 + 16. Maybe you can have a look at it (an on this comment). I also tried 3.6.2 today (without the patch), which is also having the same issues.
Marc, does it work for you if you reload samba?
I retried 3.6.1 with the patch today with a reload (instead of restart) - doesn't work also. Even 30 mins later, the new printer doesn't appear. The affected version of the bugreport can be set to 3.6.3 (I tried that version today, too - same problem). Could I provide more debugs or traces than in Comment 12 to help fixing this issue soon?
Marc, which distribution are you running and how did you do the reload?
Im running samba on Scientific Linux 6.1 (RHEL 6.1 clone like CentOS) on x86_64 architecture. I did the reload by # kill -HUP $(cat /var/run/samba/smbd.pid) # kill -HUP $(cat /var/run/samba/nmbd.pid)
I have to dig into the code and check if there is a difference, but normally you do: smbcontrol smbd reload-config
Marc: Could you please attach your smb.conf file and describe the steps you did to try to reproduce it. I would like to redo it here.
Created attachment 7297 [details] Samba config files
I tried "smbcontrol smbd reload-config", but doesn't help (but restarting the services also doesn't work to make new added printers appear). Here are the steps I do: - Copy/paste an existing printersection from printer.conf (I'd splitted the configs, but I attached both) and change the copys name to a not existing one. - Reload/restart samba processes (smbd/nmbd) - Wait for 5 mins to be sure that the printcap-cache timeout is over (cache timeout is set in smb.conf to 60 seconds). - All other steps: See Comment 11
If you want, I can provide a team viewer session to my computer, if you want to have a look in my test environment and try some things.
Created attachment 7300 [details] fix like v2, but with additional debug message
Marc: Could you please reproduce it and provide logs, I'm not able to reproduce it here. 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 this section. 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 log files. 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 use smbcontrol <damon_name> debug 10 to increase the debug level of the Samba daemon in question to 10 at run time. If winbind is part of the scenario please set debug = yes in /etc/security/pam_winbind.conf 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.
With the patch from comment #31 :)
First of all: We are running the printing services on our PDC, not on a member. So no winbind is installed. - I reset my environment to 3.5.12 and replaced the tdb files in the locks directory with the ones which were never used on 3.6 before (I took them from my 3.5.12 live environment). All services are stopped and the log directory ist empty. - I compiled 3.6.3 including your patch with the configure-options you find in the file "USED-COMPILE-OPTIONS". - I installed the patched 3.6.3 version. - I start smbd and nmbd - On a XP Sp3 (vm-02) machiene I go to \\genome\Drucker und Faxgeräte. I see all my printers. - I copy the [HPCP1515-1] section in printers.conf (an file I include in my smb.conf) to [HPCP1515-2] (everything stays the same, except the []-name - Reload smbd and nmbd using smbcontrol (Di 7. Feb 16:48:22 CET 2012). The output I redirected to smbd.smbcontrol.log and nmbd.smbcontrol.log - Refreshing on XP with [F5]: The new HPCP1515-2 printer isn't there. - Waiting for 2 Minutes - Refreshing on XP with [F5] (Di 7. Feb 16:50:27 CET 2012): The new HPCP1515-2 printer still isn't there. - Running the rpcclient workaround (Di 7. Feb 16:51:01 CET 2012). - Refreshing on XP with [F5] (Di 7. Feb 16:51:11 CET 2012): The new HPCP1515-2 printer is now shown. - Right-click to the printer / properties (Di 7. Feb 16:51:42 CET 2012) - Choose "no" on the question that no driver is installed and if I want to install one. - Go to the "extended" tab an assign an existing driver to the printer (HP Color LaserJet CP1510 Series PS) and click OK (Di 7. Feb 16:54:37 CET 2012) - Properties window closed automatially. - Windows renamed the printer automatically to "HP Color LaserJet CP1510 Series PS" - I rename it back to "HPCP1515-2" by [F2] (Di 7. Feb 16:56:03 CET 2012) - Rightclick / properties on the new printer again. (Di 7. Feb 16:56:28 CET 2012) - Window opens and the assigned driver is there this time. (Not like on my previous tries, where Windows tells me that there is no driver assigned like in Comment 11). - Shutting down smbd/nmbd (Di 7. Feb 16:59:23 CET 2012) - Copying logs and 3.6.3-lock directory to the archive for you I uploaded the archive to: http://www.medizinische-genetik.de/samba.tar.bz2, because it is to big (12M) for attaching it to the bugreport. I'll delete the file in 1 week. Additional Information: - Find in the archive: - usr/var/locks.used_only_on_3.5.12_yet = tdb files which have only be used on 3.5.12 yet. - usr/var/locks is the lock directory after the above steps - There are no samba packages installed on the system ("rpm -aq | grep samba" outputs nothing).
So you copied the first printer to 'HPCP1515-2' and didn't change the 'printer name' from 'HPCP1515-1' to 'HPCP1515-2'? I've used your printing setting: load printers = no printing = lprng printcap name = /etc/printcap and created a printers.conf file. Everytime it works just fine for me. Well the log always says 'HPCP1515-1' cause I didn't change the printer name, but the printer shows up if I simply browse to my machine \\magrathea with the Explorer here on Windows 7.
I've tested with Windows XP too. If I go to \\magrathea\Printers and Faxes add the printer and hit reload in that Window it doesn't appear. If I change the 'printer name' to be a different one than the printer I just copied, it works.
So it's an issue just on XP? I'll try it tomorrow with a different printer name, too, when im back in the office. I haven't changed the printer name, because I have some other printers with the same schema already (Two virtual printers on windows with different settings but with the same printer backend in lprng pointing to one physical device).
You are right. This bug only appears, if the 'printer name' is the same and only the [] name differs (tried only on XP. I don't have 7 here).
It looks like WinXP can't deal with duplicate printer names. I consider the initial bug as fixed.
We use this procedure without any problems since about 8 years on XP now. For one printer we have several names [], but they all use the same "printer name" parameter for sending the data to the lprng backend. We use this to provide different "virtual" printers to the users. E. g. we have SHMX2600-1_SW with default black/white settings and SHMX2600-1_F with default color setting. Both printers have the same "printer name" parameter in samba, because it is the same device, but different names in Windows (the ones set in []). [SHMX2600-1_SW] path = /var/spool/lpd/samba browseable = yes writeable = no printable = yes guest ok = yes printer name = SHMX2600-1 [SHMX2600-1_F] path = /var/spool/lpd/samba browseable = yes writeable = no printable = yes guest ok = yes printer name = SHMX2600-1
Created attachment 7301 [details] v3-6-test patch
Comment on attachment 7301 [details] v3-6-test patch looks good
Karolin, could you please apply the attached patch to 3.6? Thanks!
Karolin, if you close this bug you can also close bug #8612.
I checked the last patch. It's working. Only the described good feature, samba had for many years, got lost. :-(
One more comment: If you drop this feature, then the manpage shows wrong information yet: printer name (S) .... If specified in the [global] section, the printer name given will be used for any printable service that does not have its own printer name specified. If you add the 'printer name' parameter in the [global] section and add a printer without that parameter, the issue is the same like I described in my situation with my virtual printers: The printer don't appear, except you run the rpcclient workaround. According to the man page I did: [global] printer name = SHMX2600-1 [HPCP1515-1] path = /var/spool/lpd/samba browseable = yes writeable = no printable = yes guest ok = yes So I still think it is a not fixed bug!
The patch attached to this bug fixes the bug described. The patch fixes this bug and several people, including you have confirmed that the registry entries are correctly created now. If you think that there is a regression with 'printer name' between 3.5 and 3.6 then please open a *new* bug for this.
Created attachment 7303 [details] fixed v3-6-test patch Printers need to be added by the sname to be unique.
Comment on attachment 7303 [details] fixed v3-6-test patch looks good
Marc, the new updated patch should also address your problem. Even if printer names should be unique like in the spoolss spec.
I retried with the new patch. I can confirm that it fixes the problem in the other two situations, too. So you can close Bug #8748, too. Many thanks.
Created attachment 7311 [details] v3-6-test patch3 I've found another bug in the patch. Deleted printers were still present. Here is an updated version.
I checked v3-6-test patch3. Everything, including deletion, worked.
The patch doesn't work as expected. We need more changes.
Is there anything we can help to get this 5 month old issue fixed in the next samba version, that prevents users like us from switching to 3.6? It already seems to be half done.
We are still working on it. There are some race conditions which are hard to find. This patch triggers it more often. I don't want to make it worse for 3.6 so we need to fix this race condition first. I've worked on Thursday together with Michael on it. We found 2 bugs but not the root cause yet. Sorry for the delay.
Thanks for the information. I hope you'll find the remaining problems. Just let me know if I can help by testing or providing logs.
We found quite some bugs in the registry code which will be fixed soon. After this we can push this patch.
Just add the patch if it's ready and a short note of the changed parts and I'll test.
Comment on attachment 7311 [details] v3-6-test patch3 looks good
Karolin, please pick the patch for 3.6 as soon as the registry bugs are fixed.
Pushed to v3-6-test. Closing out bug report. Thanks!