Skip navigation

How do I refresh Profile Manager's printers?

3599 Views 21 Replies Latest reply: Mar 31, 2014 8:33 AM by paul@crc RSS
1 2 Previous Next
joe_mck Calculating status...
Currently Being Moderated
Aug 4, 2011 8:25 PM

When I first installed Lion Server, I set up some print queues and configured them into Profile Manager's device groups. They pushed out and everything was cool. Except I decided I hate the names I gave the printers. Profile Manager is stuck with the original names.

 

I've renamed the queues, I deleted and re-created the queues.

 

When I go into Profile Manager and try to update the profiles. no go. The OLD queue names keep popping up. Ive deleted every payload in Profile Manager that touches the printers. Every time I try to add a new printer profile, the old queue names pop-up.

 

I've restarted profile manager several times to no avail.

 

I'm guessing somwhere there's a plist to delete or something to tell Profile Manager to re-read the configured printers.

 

Any thoughts???

 

Thanks

  • bornpilot Level 1 Level 1 (0 points)
    Currently Being Moderated
    Apr 10, 2012 7:38 PM (in response to joe_mck)

    Hi, joe_mck. I would gather that if you were to change the name of a printer or delete a printer in System Preference the change would not take in Profile Manager. The issue is to be a problem with a helper file backbend of Profile Manager or device manager. First create the test. Change the name of a printer and/or delete a printer in System Preferences. Restart Profile Manger in Server.app and then log into Profile Manager web interface and try to add a printer to a user/device profile and see if the change took place in the list of printers. If the name change or printer that was delete in System Preferences did not delete in Profile Manger web interface go to this file location:

     

    /usr/share/devicemgr/backend/helpers/printer_helper.rb 
    

     

    Once you have opened this ruby file in your favorite text editor make these changes to the file. Once you have made the change restart Profile Manager from Server.app and try the test again as listed above and see if it works.

     

    Sincerly,

     

    Timothy

     

     

    # update current printers to the cached printers in the db
       current_printer_identifiers.each{|identifier|
         p_hash = current_printers.select{|x| x['identifier'] == identifier}.first
        
        if (p_hash)
           p = Printer.find_by_identifier(identifier);
           if p
           p.deleted = false
           p_hash.each { |key, value| p[key] = value if p.respond_to?(key) }
           p.save
            end
         end
       }
    
    
        # Remove non-existant printersfrom database
         removed_printer_identifiers.each{|identifier|
           p = Printer.find_by_identifier(identifier);
           if p
             p.deleted = true
             p.save
           end
         }
    
    Mac mini, Mac OS X (10.7.3)
  • gmulholl Level 1 Level 1 (0 points)
    Currently Being Moderated
    Jul 30, 2012 7:44 AM (in response to joe_mck)

    You can also go and manually remove printer entries from the Postgres database that holds all profile information.

     

    You can find information at this link: http://krypted.com/iphone/working-with-postgres-from-the-command-line-in-lion-se rver/

     

    It helped me quite a bit. Once you get in as a user

     

    select * from printers;

     

    Find the printer you want to remove:

     

    delete from printers where id=[the id of the printer you want to remove];

     

    You need to close and reopen profile manager -- or maybe even restart the server -- for the change to show in the management screen. You could also try marking the printer as deleted with:

     

    update printers set deleted=TRUE where id=[id...];

     

    That did not work for me on the first try, but I did not reboot the server afterward, so maybe it was just that I did not see the impact.

     

    I agree though, this is a pain. Apple's printer functionality in Profile Manager seems to be terribly underdeveloped. I might go as far as to say it is not ready for prime time.

  • sofalounge Level 1 Level 1 (0 points)
    Currently Being Moderated
    Dec 19, 2012 11:32 PM (in response to bornpilot)

    Unfortunatly the path doesn't exist anymore (probably because the Server-Version 2.2). Does anybody know which is th current path ore an other workaround?

    Hope for an easy solution.

  • Yaron360 Level 1 Level 1 (0 points)
    Currently Being Moderated
    Jan 14, 2013 1:03 PM (in response to sofalounge)

    I found the "printer_helper.rb" here:

     

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/app/hel pers

     

    bornpilot's fix does work, thanks!

  • fkick1 Level 1 Level 1 (50 points)
    Currently Being Moderated
    Jun 12, 2013 5:13 PM (in response to joe_mck)

    Has anyone gotten this to work in 10.8 server? I've tried bornpilot's fix using Yaron360's location, and I can see and edit the file, but after restarting the profile manager service, all the printers basically just become locked in the "remove" position in profiles. Printers that are removed from system prefs or name changed dont actually change.

     

    I'd be happy to go in and edit the database file by hand, but everytime I try to use a psql command i get the following error:

     

    psql: could not connect to server: No such file or directory

              Is the server running locally and accepting

              connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

     

    Anyone have any suggestions?


    Thanks!

  • Yaron360 Level 1 Level 1 (0 points)
    Currently Being Moderated
    Jun 13, 2013 11:48 AM (in response to fkick1)

    To avoid the error you need to change the permissions on the socket file. so in Terminal do:

    sudo chmod o+rw /var/pgsql_socket/.s.PGSQL.5432

     

    but in 10.8 the server locaton has chnage so you need to go to:

    /Library/Server/PostgreSQL For Server Services/Socket

     

    So your command will look like this:

    sudo chmod o+rw /Library/Server/PostgreSQL\ For Server\ Services/Socket.s.PGSQL.5432

     

    Now you can get in with user _postgres and password will be your admin password

     

    Once you are done you should change the permissions back by running the same command and replacing o+rw with o-rw

  • fkick1 Level 1 Level 1 (50 points)
    Currently Being Moderated
    Jun 13, 2013 5:21 PM (in response to Yaron360)

    Thanks for the reply Yaron, but I'm still getting that error... it looks like it's still trying to connect to the database at /var/pgsql_socket/.s.PGSQL.5432

     

    Do you know the command to cause psql to change to the new 10.8 database?

     

    Thanks

  • Marc Kerr Level 1 Level 1 (0 points)
    Currently Being Moderated
    Sep 10, 2013 9:00 AM (in response to fkick1)

    I don't know the first thing about pgsql but I'm figuering it out. What I do know is to get in use this command.

     

    sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/psql -U _postgres -d device_management -h /Library/Server/PostgreSQL\ For\ Server\ Services/Socket/

     

    Note you have to use the correct scoket to see whats in it. I didn't have to change any permissions on anything to get in this way. At least I don't rember doing it.

  • Marc Kerr Level 1 Level 1 (0 points)
    Currently Being Moderated
    Sep 10, 2013 11:11 AM (in response to sofalounge)

    OK I think I've figured it out. Please correct if you see errors.

     

    First you have to get into the database. I didn't need to set any special permissions or add users to the DB to do this. You do want to have have the initial command run as root. I actually ran sudo -s to become root first. Then ran these commands.

     

    Before any of this I cleared the printers from System Preferences and actually did a full reset on the printing system, right click in Print & Scan.

     

    This will connect you to the correct database using the correct version of psql.

     

    /Applications/Server.app/Contents/ServerRoot/usr/bin/psql -U _postgres -d device_management -h /Library/Server/PostgreSQL\ For\ Server\ Services/Socket/

     

    Note that if you are running Server 10.8.2 then psql is 9.2.1, the psql in /usr/bin/psql is older and not the one you want.

     

    At the prompt list your db with \d, note that device_management=# is your prompt while you are in the db. Type help, \h or \? to get more info.

     

    device_management=# \d

     

    Now you will see the tables. The ones you are after are public | printers and public | printing_knob_sets. You can see the contents of the tables this way.

     

    device_management=# select * from "public"."printers" ;

     

    device_management=# select * from "public"."printing_knob_sets" ;

     

    To clear these tables run the following.

     

    device_management=#  DELETE FROM printers ;

     

    device_management=#  DELETE FROM printing_knob_sets ;

     

    After all that I was able to recreate the printers and add them to Profile Manager. With more knowledge about pgsql you should be able to remove individual printers from the table or add them in.

  • Ofir Gal Level 1 Level 1 (135 points)
    Currently Being Moderated
    Dec 10, 2013 6:18 PM (in response to bornpilot)

    On 10.9 this causes an error and failure when attempting to display the available printers in Profile Manager.

     

    If I leave as is then what seems to happen is that when I delete printers in Sys Prefs, Profile Manager doesn’t update its printer list. Same if I rename existing printers.

     

    If I add new printers, they sometimes show up in PM and sometimes don’t.

  • Ofir Gal Level 1 Level 1 (135 points)
    Currently Being Moderated
    Dec 10, 2013 6:19 PM (in response to Marc Kerr)

    On 10.9 Server I get the following error:

     

    psql: could not connect to server: No such file or directory

              Is the server running locally and accepting

              connections on Unix domain socket "/Library/Server/PostgreSQL For Server Services/Socket//.s.PGSQL.5433"?

  • Marc Kerr Level 1 Level 1 (0 points)
    Currently Being Moderated
    Dec 11, 2013 6:07 AM (in response to Ofir Gal)

    I poseed thing info in another thread also but too much info isn't a bad thing.

     

    For Mavericks (10.9) and Server 3 Apple changed the postreas setup again, just slightly.

     

    Apple removed /user/bin/psql and associated apps so now you only have one psql to deal with and it’s in your environment path. Running ‘which psql’ will show you /Applications/Server.app/Contents/ServerRoot/usr/bin/psql

     

    That has simplified things a little.

     

    The socket has moved also and is now in:

    /Library/Server/ProfileManager/Config/var/PostgreSQL/

     

    So to get into the database run this command.

    sudo psql -U _devicemgr -d device_management -h /Library/Server/ProfileManager/Config/var/PostgreSQL/

     

    Use \d to see the tables \h to get help \q to exit. See the man page or the postgresql documentation online for more if you are new to this, like me.

  • Ofir Gal Level 1 Level 1 (135 points)
    Currently Being Moderated
    Dec 11, 2013 5:44 PM (in response to Marc Kerr)

    Thanks, I'm one step closer. When I try this is what I get:

     

    device_management=# select * from "public"."printers" ;

    id | last_modified_guid | admin_session | temporary_id | deleted | created_at | updated_at | identifier | DeviceURI | DisplayName | Location | Model | PPDURL | PrinterLocked

    ----+--------------------+---------------+--------------+---------+------------+ ------------+------------+-----------+-------------+----------+-------+--------+ ---------------

    (0 rows)

     

     

    But when I use Profile Manager I see 8 printers listed.

1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (1)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.