• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Unable to install printer

Scheduled Pinned Locked Moved
Bug Reports
4
30
4.4k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    tatanas
    last edited by Sep 15, 2021, 12:33 PM

    Hi,

    First of all, I would like to thank all of you for your work.

    Now, let’s go straight to the point.
    We are using a fog server 1.5.8 and the printer module to install network printers.
    But since few months, we’ve got and error :
    … PrinterManager printer_name has already been configured
    The printer can’t be installed because the fog client believes it already was.

    The error appears on Win7 or Win10, with fog client 0.11.16 or 0.11.19 but not everywhere.
    For example, it can happen on 1 computer in a classroom of 20 identical (soft and hardware) computers.

    I tried this printui command on local host which works just fine :
    rundll32 printui.dll PrintUIEntry /if /b “Ricoh Printer” /f “\NAS_IP\applications\Imprimantes\RICOH\IMC3000\disk1\OEMSETUP.INF” /m “Generic PCL5 Printer Driver” /r “IP_192.168.0.20”

    Any idea ?

    T M 2 Replies Last reply Sep 16, 2021, 7:50 AM Reply Quote 0
    • T
      tatanas @tatanas
      last edited by Sep 16, 2021, 7:50 AM

      I Updated Fog to 1.5.9. The problem is still the same.

      How Fog client checks if a printer is already installed ?

      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator
        last edited by Sep 16, 2021, 2:34 PM

        @tatanas said in Unable to install printer:

        How Fog client checks if a printer is already installed ?

        Check out this part of the fog-client code: https://github.com/FOGProject/fog-client/blob/85da019cbd8a939e69fea42779f1bc53b06323cb/Modules/PrinterManager/PrinterManager.cs#L81

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        T 1 Reply Last reply Sep 17, 2021, 6:02 AM Reply Quote 0
        • M
          Matthieu Jacquart @tatanas
          last edited by Sep 16, 2021, 2:46 PM

          @tatanas Hi, it looks like same problem I’m facing since few month too, no workaround for now…
          https://forums.fogproject.org/topic/15185/problem-mapping-network-printer-after-upgrade-to-1-5-9-60?_=1631803438100
          Matthieu

          Fog 1.5.9.138
          Debian 11
          Vmware ESXi

          1 Reply Last reply Reply Quote 0
          • T
            tatanas @Sebastian Roth
            last edited by tatanas Sep 17, 2021, 12:07 AM Sep 17, 2021, 6:02 AM

            @sebastian-roth
            Don’t hesitate if you need help debugging.
            I’m using the module a lot and this bug is very frustating…

            @Matthieu-Jacquart
            The bug was there in 1.5.8 too and I think it wasn’t before.

            1 Reply Last reply Reply Quote 0
            • T
              tatanas
              last edited by tatanas Sep 17, 2021, 1:25 AM Sep 17, 2021, 6:36 AM

              So it seems the list “_configuredPrinters” contains the printer that I want to install.
              Is it the host’s printers list configured through the fog server web ?
              And the “installedPrinters” list will be the printers already installed on the host ?

              1 Reply Last reply Reply Quote 0
              • T
                tatanas
                last edited by tatanas Sep 22, 2021, 8:23 AM Sep 22, 2021, 2:23 PM

                I can understand “…already exists” but what does “… already configured” mean ?

                Here is a sample of the log when I try to install a printer which is not already installed on the host :

                 22/09/2021 15:58 PrinterManager Adding printers
                 22/09/2021 15:58 Printer Adding: B503-LASER (fog)
                 22/09/2021 15:59 PrinterManager PrintUI return code = 0
                 22/09/2021 15:59 PrinterManager Restarting spooler
                
                ...
                
                 22/09/2021 16:02 PrinterManager Adding printers
                 22/09/2021 16:02 PrinterManager B503-LASER (fog) has already been configured
                
                ...
                
                 22/09/2021 16:04 PrinterManager Adding printers
                 22/09/2021 16:04 PrinterManager B503-LASER (fog) has already been configured
                

                I you want, I can give you a remote access to this computer.

                1 Reply Last reply Reply Quote 0
                • T
                  tatanas
                  last edited by tatanas Sep 23, 2021, 2:50 AM Sep 23, 2021, 8:35 AM

                  More details :
                  I tried adding 2 Fog managed printers and the ports are created (IP_X.X.X.X with the associated IP) but not the printers.
                  I would say the printui method (even if return code is 0) is not working properly.

                  1 Reply Last reply Reply Quote 0
                  • S
                    Sebastian Roth Moderator
                    last edited by Sebastian Roth Sep 24, 2021, 4:48 AM Sep 24, 2021, 8:58 AM

                    @tatanas Finally I found some time to look into this in more depth. Most of the fog-client code came from Joe who is not actively working on this project anymore. While I try to fix things in the fog-client as much as I can I don’t know it well.

                    As far as I understand things the problem might occour because _configuredPrinters is an internal list the fog-client keeps to know which printer was configured earlier already to skip that on the next loop. But obviously a situation can arise where the rundll32 PrintUI calls return but still the printer is not setup correctly. In that case the fog-client code add it to its internal list of _configuredPrinters and won’t try to configure it until you restart the fog-client service (FOGService in Windows service managment).

                    So what we need to find out is why this part is not working as it should: https://github.com/FOGProject/fog-client/blob/master/Modules/PrinterManager/Windows/WindowsPrinterManager.cs#L124

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    T 1 Reply Last reply Sep 27, 2021, 6:23 AM Reply Quote 0
                    • T
                      tatanas @Sebastian Roth
                      last edited by Sep 27, 2021, 6:23 AM

                      @sebastian-roth We need detailed log of printui command result.
                      The command in the client code is the same I have used to test from command line (test was ok), so it’s strange it doesn’t work.

                      1 Reply Last reply Reply Quote 0
                      • S
                        Sebastian Roth Moderator
                        last edited by Sep 27, 2021, 9:20 AM

                        @tatanas Maybe there is some message in the Windows event log? Just a quick idea from the top of my head. I will try to find some time to help you on getting fog-client compiled soon as well.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        T 1 Reply Last reply Sep 27, 2021, 10:23 AM Reply Quote 0
                        • T
                          tatanas @Sebastian Roth
                          last edited by Sep 27, 2021, 10:23 AM

                          @sebastian-roth I checked Windows event log (spooler log) and didn’t find anything regarding the printer installation.
                          Thanks for your time.

                          1 Reply Last reply Reply Quote 0
                          • T
                            tatanas
                            last edited by Sep 29, 2021, 7:47 AM

                            Ok, thanks to you I can build the Fog Client (https://forums.fogproject.org/topic/15757/fog-client-build).
                            I would like to log the result of the printui command in WindowsPrinterManager.cs at line 41.
                            I added “> c:\printui.log” but it doesn’t work.

                            using (var proc = Process.Start("rundll32.exe", $" printui.dll,PrintUIEntry {cmdLine} > c:\\printui.log"))
                            

                            I don’t know C# so I suppose I could use a method to get Standard Output ?

                            1 Reply Last reply Reply Quote 0
                            • S
                              Sebastian Roth Moderator
                              last edited by Sep 29, 2021, 9:08 AM

                              @tatanas This answer on stackoverflow looks promising: https://stackoverflow.com/a/18529868

                              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                              T 1 Reply Last reply Sep 30, 2021, 8:46 AM Reply Quote 0
                              • T
                                tatanas @Sebastian Roth
                                last edited by tatanas Sep 30, 2021, 3:09 AM Sep 30, 2021, 8:46 AM

                                @sebastian-roth Here are the changes I made in the WindowsPrinterManager.cs at line 41:

                                using (Process proc = new Process())
                                {
                                	proc.StartInfo.FileName = "rundll32.exe";
                                	proc.StartInfo.Arguments = $" printui.dll,PrintUIEntry {cmdLine}";
                                        proc.StartInfo.RedirectStandardOutput = true;
                                	proc.StartInfo.UseShellExecute = false;
                                	proc.Start();
                                	var output = proc.StandardOutput.ReadToEnd();
                                	proc.WaitForExit(30*1000);
                                
                                        if (proc.HasExited)
                                        {
                                              Log.Entry(LogName, "PrintUI return code = " + proc.ExitCode);
                                	      Log.Entry(LogName, "PrintUI Output = " + output);
                                        }
                                        else
                                        {
                                              Log.Entry(LogName, "PrintUI has not finished in a timely fashion, abandoning process");
                                        }
                                }
                                

                                replacing

                                using (var proc = Process.Start("rundll32.exe", $" printui.dll,PrintUIEntry {cmdLine}"))
                                {
                                ...
                                }
                                

                                Unfortunatly, printui does not return anything…

                                Logging the “cmdLine” variable returns this when the first installation attempts:

                                cmdLine = /if /b "B503-LASER (fog)" /f "\\@IP_NAS\applications\Imprimantes\HP_LJ_M401\hpcm401u.inf" /r "IP_X.X.X.X" /m "HP LaserJet 400 M401 PCL 6" /q
                                

                                After that, cmdLine is not used anymore and we’ve got “already configured”.
                                I never pass in the procedure

                                public override void Configure(Printer printer, bool verbose = false)
                                {
                                ...
                                }
                                
                                1 Reply Last reply Reply Quote 0
                                • T
                                  tatanas
                                  last edited by Sep 30, 2021, 11:30 AM

                                  I made some tests. The same printui command in local works fine.
                                  So if it’s working in local it should works with fog client which means the added printer is removed/deleted from the host as soon as it’s installed ? It could explain why we can’t see the printer in the host list and why fog client says it’s already configured.

                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    tatanas
                                    last edited by tatanas Sep 30, 2021, 8:20 AM Sep 30, 2021, 1:55 PM

                                    Last news :

                                    • The script never goes in the “Remove” method, so my last suggestion is wrong.
                                    • I made a mistake about the “Configure” method. It is going into this method but it passes into
                                    if (string.IsNullOrEmpty(printer.ConfigFile)) return;
                                    

                                    and never execute

                                    PrintUI($"/Sr /n \"{printer.Name}\" /a \"{printer.ConfigFile}\" m f g p", verbose);
                                    

                                    EDIT : it is the same behaviour on a computer without problem… I’m lost 🙂

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      Sebastian Roth Moderator
                                      last edited by Sep 30, 2021, 3:23 PM

                                      @tatanas said in Unable to install printer:

                                      I never pass in the procedure
                                      public override void Configure(Printer printer, bool verbose = false)

                                      Can you please explain what you mean by that?

                                      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                      T 1 Reply Last reply Oct 1, 2021, 6:10 AM Reply Quote 0
                                      • T
                                        tatanas @Sebastian Roth
                                        last edited by Oct 1, 2021, 6:10 AM

                                        @sebastian-roth Sorry I made a mistake, like I said in my previous post, the “Configure” method is called but does nothing (always enter the second “if”).

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          tatanas
                                          last edited by Oct 1, 2021, 12:42 PM

                                          This problem is very strange.
                                          I was testing on a win7 computer which can’t install printers (fog client 0.12).
                                          I push a old fog image on it and with the same 0.12 client, it now works.
                                          It is not really up to date and the problem appears on win10 too (different version).

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 1 / 2
                                          1 / 2
                                          • First post
                                            10/30
                                            Last post

                                          205

                                          Online

                                          12.0k

                                          Users

                                          17.3k

                                          Topics

                                          155.2k

                                          Posts
                                          Copyright © 2012-2024 FOG Project