Restore Linux Print Manager database in disaster recovery situation

  • 3006957
  • 13-Feb-2008
  • 13-Jul-2020

Environment

Novell Open Enterprise Server 1 (OES 1) Linux
Novell Open Enterprise Server 2 (OES 2) Linux
Novell Open Enterprise Server 11 (OES 11) Linux
MicroFocus Open Enterprise Server 2015 (OES2015) Linux
Novell iPrint for Linux

Situation

The print manager (ipsmd) will not load successfully.
The print manager (ipsmd) unloads after a few seconds.

The print manager was ran successfully in the past but for some reason, no longer does.
The /var/opt/novell/iprint/ipsmd.log contains messages repeated like:
Mar 25 03:50:27 WARNING The iPrint Manager's database was corrupt. A backup database has been restored from eDir.
Mar 25 03:50:27 FATAL The iPrint Manager was unable to ... Error code: 1234567890
Mar 25 03:50:28 INFO The iPrint Manager has unloaded successfully.
Mar 25 03:50:28 WARNING A child process has gone or the iPrint Manager has just experienced a fatal error. It will be restarted by its monitor process.
Note: the message & error code on the FATAL line can vary.  The above is just an example.

while /var/log/messages may contain messages like:
iPrint Manager 'PSMmanager.OU.O' has started loading.

The iPrint Manager was unable to ..... Error code: 1234567890

The iPrint Manager has unloaded successfully.

A child process has gone or the iPrint Manager has just experienced a fatal error. It will be restarted by its monitor process.

The iPrint Manager was unable to ..... Error code: 1234567890

The iPrint Manager has unloaded successfully.
NOTE: the Error code: 1234567890 lines are only examples.  Different error codes will typically on those lines.

Resolution

OPTION 1:  Restore from backup psmdb database file (iPrint for OES 1 / 2 / 11 / 2015)

The recommended recovery option is restore from one of the psmdb save files.  This will require identifying/selecting the database backup file that precedes the onset of the symptoms suspected to be database corruption. 

  • Before proceeding with this method, backup the Print Manager directory and conf file in case you end up resorting to the import method bellow.
    • Backup this directory:

      /var/opt/novell/iprint/[PSM].[OU].[O].psm/


      The XML files are the most important files to backup.

    • Backup this file:
      /etc/opt/novell/iprint/conf/[PSM].[OU].[O].ipsmd.conf


  • Ensure you have the proper RPM/code installed on your server.
    • For OES 1, the recovery feature requires a novell-iprint-server RPM dated APR2008 or later.
    • For OES 2, the recovery feature requires a novell-iprint-server RPM dated June2009 or later. 
The following command will show the current date of the install novell-iprint-server RPM:
rpm -qa novell-iprint-server
If the RPM is not of the recommended date, obtain the updated RPM from the Channel, or:
    • go to https://download.novell.com/patch/psdb/
    • choose the correct OS
      • Open Enterprise Server 2 SP1
      • Open Enterprise Server (OES) 2
        • To determine which version of OES is installed, type this command
        • cat /etc/novell-release
          • note: FCS means Open Enterprise Server (OES) 2
    1. Copy the RPM to the /tmp directory on the target server.
    2. Install the new RPM for iPrint. 
      When logged in as root user, these commands can be used in a terminal session:

      cd /tmp

      rpm -Uvh novell-iprint-server-[.......].rpm

           replace the [......] with the date contained in the RPM sent by email.
      rcapache2 restart

      rcnovell-idsd restart

      rcnovell-ipsmd stop


      this command is needed only if the print manager is running. In most corruption scenarios, the Print Manager cannot be load

    3. Restore current database with an older one that may not be corrupt. 
      In this example we have chosen to restore psmdbsv2.dat and will need to use the following command:

      /opt/novell/iprint/bin
      /ipsmd -r psmdbsv2.dat
Please Note:
  • DO NOT specify the path to the .dat file.  The ipsmd code knows the path to the database file.
  • For this example, the psmdbsv2 database file is used. You can choose any of 5 backup database files to use:
    psmdbsav.dat 
    psmdbsv1.dat 
    psmdbsv2.dat 
    psmdbsv3.dat 
    psmdbsv4.dat
If this process does not resolve the problem, either the symptom was not caused by database corruption; or you have chosen a backup copy of the database that has the same corruption. Try an older copy of the database, or try the xml-import option found below.

OPTION 2:  Recreate the Print Manager database using text backup (for iPrint on OES 2, OES 11, OES2015 or OES2018 only)
Follow these steps to recreate your Print Manager database using the XML backup file.

  1. Determine if you can successfully authenticate using the iprntman tool:
    • iprntman psm -l
    • provide the admin eDirectory username (no dots, no context)
    • provide the admin eDirectory password

      If the authentication is successful, then you can proceed with the steps below. If the authentication fails, do not continue.
      TID 3897348 - HTTP 401 or 500 Errors managing Linux iPrint objects may be helpful in resolving the authentication problem.

  2. Unload the Print Manager

       rcnovell-ipsmd stop


    Ensure the Print Manager is unloaded by typing:

        ps -ef | grep ipsmd


    only the grep command should be returned.  If more than the grep line is returned, kill the ipsmd process.

  3. Move the Print Manager database file (psmdb.dat) and back up the XML file:

    mv /var/opt/novell/iprint/[PSM].[OU].[O].psm/psmdb.dat /tmp/psmdb.dat
    cp /var/opt/novell/iprint/[PSM].[OU].[O].psm/padbtxt.xml /tmp/padbtxt.xml

  4. Load the Print Manager with a new, blank database by running:

    /opt/novell/iprint/bin/ipsmd -b

  5. Create the Printer Agent objects in the new psmdb.dat
    • For OES2, run:

      iprntman psm --xml-import /tmp/padbtxt.xml

      and authenticate using the eDirectory admin account (no dots, no context).

    • For OES11 or OES2015, run the following:
killall -9 ipsmd;sed -i -e 's/client_delete_not_found_printers=true/client_delete_not_found_printers=false/g' /etc/opt/novell/iprint/conf/iprintconf.properties;/opt/novell/iprint/bin/ipsmd -x /tmp/padbtxt.xml;rcnovell-ipsmd start
  • For OES 2018, run the following:
killall -9 ipsmd;sed -i -e 's/client_delete_not_found_printers=true/client_delete_not_found_printers=false/g' /etc/opt/novell/iprint/conf/iprintconf.properties;/opt/novell/iprint/bin/ipsmd -x /tmp/padbtxt.xml;systemctl start novell-ipsmd.service

The OES11, OES 2015, and OES 2018 examples suggest you find the latest padbtxt.xml file to run the import. 
 
The steps above will do the following:
  • create printer agent objects to the print manager database (psmdb.dat)
  • associate the printer agent objects in the database to the printer agent objects in eDir
  • associate the printer agents to the printer drivers
  • create printer banners and associate the banners to the printer agents
  • create printer driver profiles and associate the profiles to the printer agents
If the iprntman xml-import process hangs, then follow these steps:
  • Stop the xml-import process
    <ctrl><c>
  • Modify the XML file and remove every instance of <redirectedprinter> from the XML. 
    These entries will be in the upper portion of the XML file.  A <redirectedprinter> entry will typically look like:

       <redirectedprinter>
          <name>MyPrinter1</name>
          <url></url>
          <timedeleted>1206384508</timedeleted>
          <timeaccessed>0</timeaccessed>
       </redirectedprinter>

  • Run an ndsrepair on a replica server that hosts the partition containing the Print Manager object:

       ndsrepair -R

    and follow the options.
  • Repeat "Create the Printer Agent objects in the new psmdb.dat" step. 

NOTE: For recreating the print manager database on OES1, please see the Additional Information section below.

Additional Information

You may suspect the Print Manager database to be corrupt if one of the following conditions exist:
  • Print Manager doesn't load.
  • Print Manager database doesn't stay loaded
  • A review /var/opt/novell/log/iprint/ipsmd.log for messages referring to the database errors loading ipsmd
      (i.e. WARNING The iPrint Manager's database was corrupt. A backup database has been restored from eDir.)
  • A test print manager loads without problems on the same server
  • ps -ef | grep ipsmd shows a [defunct] status
Multiple backup copies of the Print Manager database exist in the /var/opt/novell/iprint/[PSM].[OU].[O].psm/ directory.
  • psmdb.dat is the current database
  • psmdbsav.dat is of 1AM that morning or since the last change made to the database
  • psmdbsv1.dat is a copy from 10 days ago.
  • psmdbsv2.dat is a copy from 20 days ago.
  • psmdbsv3.dat is a copy from 30 days ago.
  • psmdbsv4.dat is a copy from 40 days ago.
Multiple text files are stored in this same directory with a similar naming convention:

    iPrint on OES 1 saves those text copies in a CSV format.
    iPrint, on OES 2 & 11, saves those text copies in an XML format.

The text copies contain all the information needed to recreate your Print Manager database, with the exception that the OES 1, CSV files, do not contain banner or driver profile information.

A copy of the psmdbsav.dat file is also stored in eDirectory as a stream file. One would think that simply renaming a backup copy of the database to psmdb.dat and restarting the Print Manager would cause the backup "non-corrupt" version of the database file to load. This is not true. This action causes the psmdbsav.dat from eDirectory to overwrite the current psmdb.dat.

For iPrint running on OES 1, there are two options:
  • restore from a previous copy of the Print Manager database (psmdbsvX.dat), or
  • the csv-import switch to the 'iprntman printer' command. 
The csv-import command will create a new Print Manager database and new eDirectory print objects from a CSV file. Notice: this option will not recreate the banners or printer driver profiles.  That information will be lost.

For iPrint running on OES 2/11, there are two options: 
  • restore from a previous copy of the Print Manager database (psmdbsvX.dat), or
  • the xml-import switch to the 'iprntman psm' command. 
The xml-import command will create a new Print Manager database and new eDirectory print objects from an XML file.  The XML file contains the printer driver profile and banner data so that information will also be re-created.

iPrint on OES 1 -csv-import (recreate the Print Manager database using text backup)
The OES 1 recovery option is more intrusive than it is for OES 2 because the Print Manager eDirectory object must be deleted using iManager. WARNING: When deleting the Print Manager object using iManager, the following are also deleted:
- the entire /var/opt/novell/iprint/[PSM].[OU].[O].psm/ directory
- including all the CSV files, DAT files, Printer Agent spooling directories.
- all of the Printer Agent eDirectory objects associated to that Print Manager


Follow these steps to recreate your Print Manager database using the CSV backup file.

1. Determine if you can successfully authenticate using the iprntman tool
a. iprntman psm -l
b. provide the admin eDirectory username (no dots, no context)
c. provide the admin eDirectory password

If the authentication is successful, then you can proceed with the steps below. If  the authentication fails, do not continue. KB 3897348 may be helpful in resolving the authentication problem.

2. Backup the Print Manager directory and XML file
Backup this directory:
/var/opt/novell/iprint/[PSM].[OU].[O].psm/
Backup this file:
/etc/opt/novell/iprint/conf/[PSM].[OU].[O].ipsmd.conf

3. Run an ndsrepair on a replica server that hosts the partition containing the Print Manager object
ndsrepair -R
- follow the options available from this menu


4. Delete the Print Manager object using iManager
Ensure backup copies of the CSV files are in a location other than the .psm directory.
Review the WARNING above.

5. Repeat step 3.

6. Create a new Print Manager object
Choose the same name, context, and host server that were used with the original Print Manager object. If you don't remember that information, see the .conf file backup in step 2.  The PSMHostAddress value is the host server address. Be consistent with the host server value (IP vs DNS name). Failure to be consistent with this entry will cause workstations to auto-delete and auto-reinstall their printers. The context and Print Manager name is also in the [PrintManager].[OU].[O].ipsmd.conf file.

7. Within iManager, choose iPrint -> Manage Print Manager -> Select the Print Manager object -> Click the Startup button.

8. Copy the CSV file of choice (most likely, the most recent CSV file: padbtxt.csv) to the server's /tmp directory.

9. Type these commands:
cd /tmp
iprntman printer --csv-import ./padbtxt.csv

this example is assuming you chose the most recent CSV file: padbtxt.csv


10. Authenticate using the eDirectory admin account (no dots, no context).

This process will recreate the:
- psmdb.dat
- Printer Agent eDirectory objects
- association of the printer agents to the print driver
 
This process will NOT recreate the:
- printer banners and the association of the banners to the printer agents
- printer driver profiles and the association of the profiles to the printer agents

Change Log

2012-12-06: KKlemm:
  - added oes2/11 to environment section
  - updated resolution to improve readability (mainly step 5 of option 2)
2013-03-25: KKlemm:
  - clarified situation and resolution sections.
  - moved much of the situation to the additional info section
  - reformatted bullets into bullet tool vs. manual numbering and/or lettering.