[RHEL6] ntprinters.tdb loosing records if reload samba with cups stopped. How to avoid it?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6

Issue

  • Printers loosing driver information and ntprinters.tdb loosing records after restart or reload samba while cups is stopped. How to solve it?

Resolution

If you are sharing printers via samba every time you restart or reload smd service, samba will query Cups to obtain information about all printers and its configuration. So, it is not a good idea to restart samba that is sharing printers if Cups is stopped.

Also, is important to remember to start Cups service before you start samba, due the dependency between these services.

However, it is considered a bug due ntprinters.tdb must not loose current records even if Cups is stopped and samba can not obtain printer's information.

The expected behavior is not remove or delete printer information if cups is stopped and doesn't return any data to samba service.

This problem is already fixed in samba-3.5.10-99 (available in RHEL 6.2). So, the permanent fix is update samba package for latest version or at least samba-3.5.10-99.

Root Cause

Cups is stopped and do not return any data to samba. Then, samba alters ntprinters.tdb improperly.

Diagnostic Steps

To reproduce the issue you just need to perforn the sequence of commands bellow:

Check .tdb records BEFORE the restart/reload sequence of commands:

samba \# tdbtool ntprinters.tdb  
tdb> info  
1179 records totalling 6097884 bytes  
tdb> check  
Database integrity is OK and has 1179 records.  
tdb>

Stop Cups and restart/reload samba:

#service cups stop  
#service smb reload  
#service smb restart  
#service cups start  
#service smb restart

Check .tdb again and the records dissapeared:

samba \# tdbtool ntprinters.tdb.problem  
tdb> info  
606 records totalling 208150 bytes  
tdb> check  
Database integrity is OK and has 606 records.  
tdb> q

We can also notice the difference in the file size:

Backup files ok:

28M -rw\---\----. 1 root root  28M Aug 18 15:30 ntprinters.tdb.20110818-1530  
28M -rw\---\----. 1 root root  28M Aug 18 16:00 ntprinters.tdb.20110818-1600

After reload/restart samba with cups stopped file size is samaller than before:

1.9M -rw\---\----. 1 root root 1.8M Aug 18 15:30 ntprinters.tdb.20110818-1530  
1.9M -rw\---\----. 1 root root 1.8M Aug 18 16:00 ntprinters.tdb.20110818-1600

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments