RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1447015 - Adjust db2bak.pl help and man page to reflect changes introduced to the script
Summary: Adjust db2bak.pl help and man page to reflect changes introduced to the script
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: mreynolds
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-01 07:24 UTC by Simon Reber
Modified: 2021-08-30 13:15 UTC (History)
5 users (show)

Fixed In Version: 389-ds-base-1.3.6.1-16.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 21:16:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github 389ds 389-ds-base issues 2300 0 None None None 2020-09-13 21:59:29 UTC
Red Hat Knowledge Base (Solution) 3059891 0 None None None 2017-05-30 11:06:35 UTC
Red Hat Product Errata RHBA-2017:2086 0 normal SHIPPED_LIVE 389-ds-base bug fix and enhancement update 2017-08-01 18:37:38 UTC

Description Simon Reber 2017-05-01 07:24:42 UTC
Description of problem:

In Red Hat Enterprise Linux 7, the db2bak.pl script has been changed according to https://pagure.io/389-ds-base/c/8db3a1ad07198ba548f653aa4acebe4324c16384, to always write the backup to `/var/lib/dirsrv/<instance>/bak` and simply create a symlink for the location specified with `-a` or `-A`

The current usage description of the script does not really indicate that the backup won't be written to the designated location:

- https://pagure.io/389-ds-base/blob/master/f/ldap/admin/src/scripts/db2bak.pl.in#_36

From the given description, one would assume that the backup is written to the location specified with `-a` or `-A` and not just a symlink created to the default location.

This can cause various issues, as customers may not expect the backup to be written to this location and it therefore can fill up the volume badly.

It's therefore required to adjust the usage output and man page of the script to reflect that change and help the customer understand how this works.

Version-Release number of selected component (if applicable):

 - 389-ds-base-1.3.5.10-15.el7_3.x86_64

How reproducible:

 - Always

Steps to Reproduce:
1. db2bak.pl -a /mnt/backup -D 'cn=directory manager' -w -
2. Check if the Backup was written to `/mnt/backup` or just a symlink created to  `/var/lib/dirsrv/<instance>/bak`

Actual results:

Symlink created to `/var/lib/dirsrv/<instance>/bak`

Expected results:

Backup created in `/mnt/backup` or else an updated usage of the script as well as man page

Additional info:

Comment 2 mreynolds 2017-05-03 20:07:40 UTC
The man page and script usage needs to be updated to express this behavior

Comment 3 mreynolds 2017-05-03 20:08:53 UTC
Upstream ticket:
https://pagure.io/389-ds-base/issue/49241

Comment 5 Amita Sharma 2017-05-17 08:44:09 UTC
This needs some minor fixes -

1). Commit message fix -> https://pagure.io/389-ds-base/c/470a30c - commit message = * state thtthe backup *

2). Synopsis in man page need correction, it still says backupdir for -a and -A

NAME
       db2bak.pl - Directory Server perl script for creating a backup

SYNOPSIS
       db2bak.pl [-Z serverID] [-D rootdn] { -w password | -w - | -j filename }  [-t dbtype] [-a backupdir] [-A backupdir] [-P protocol]
       [-h]

3). This is correct
      -a backupdir
              The  directory  where  the  backup should be stored.  This directory is a symbolic link to the actual backup files located
              under "nsslapd-bakdir" directory that is set in the "cn=config" entry.

       -A backupdir
              This is similar to -a, except that a sub-directory of backupdir will be created for the backup, and the name of  the  sub-
              directory will be a timestamp of the form server-instance-date_time.

4). we removed -v option? I can still see the option in help though but it does not work.
[0 root@qeos-41 /]# db2bak.pl -v -D "cn=Directory Manager" -w Secret123 -a "/export/backup/data.ldif"
ERROR - Unknown option: -v
Usage: db2bak.pl [-v] [-Z serverID] [-D rootdn] { -w password | -w - | -j filename } [-a backupdir]
                 [-t dbtype] [-P protocol] [-h]

5). Can we change the output here as "symbolic link to backup directory" instead of just "Back up directory"
[0 root@qeos-41 /]# db2bak.pl -D "cn=Directory Manager" -w Secret123 -a "/export/backup/data.ldif"
Back up directory: /export/backup/data.ldif
Successfully added task entry "cn=backup_2017_5_17_4_38_34, cn=backup, cn=tasks, cn=config"

6). This works fine
nsslapd-bakdir: /var/lib/dirsrv/slapd-qeos-41/bak
[0 root@qeos-41 /]# cd /export/backup/
[0 root@qeos-41 backup]# ls -al
total 8
drwxr-xr-x. 2 root   root   4096 May 17 04:38 .
drwxr-xr-x. 5 dirsrv dirsrv 4096 May 17 03:52 ..
lrwxrwxrwx. 1 root   root     43 May 17 04:38 data.ldif -> /var/lib/dirsrv/slapd-qeos-41/bak/data.ldif

Thanks.

Comment 6 mreynolds 2017-05-24 16:13:25 UTC
(In reply to Amita Sharma from comment #5)
> This needs some minor fixes -
> 
> 1). Commit message fix -> https://pagure.io/389-ds-base/c/470a30c - commit
> message = * state thtthe backup *
> 
> 2). Synopsis in man page need correction, it still says backupdir for -a and
> -A

I think this should not change - that's what the option description is for - to describe what it does.  I just think it might be confusing if we change: backupdir to symbackupdir.  

 
> 
> NAME
>        db2bak.pl - Directory Server perl script for creating a backup
> 
> SYNOPSIS
>        db2bak.pl [-Z serverID] [-D rootdn] { -w password | -w - | -j
> filename }  [-t dbtype] [-a backupdir] [-A backupdir] [-P protocol]
>        [-h]
> 
> 3). This is correct
>       -a backupdir
>               The  directory  where  the  backup should be stored.  This
> directory is a symbolic link to the actual backup files located
>               under "nsslapd-bakdir" directory that is set in the
> "cn=config" entry.
> 
>        -A backupdir
>               This is similar to -a, except that a sub-directory of
> backupdir will be created for the backup, and the name of  the  sub-
>               directory will be a timestamp of the form
> server-instance-date_time.
> 
> 4). we removed -v option? I can still see the option in help though but it
> does not work.
> [0 root@qeos-41 /]# db2bak.pl -v -D "cn=Directory Manager" -w Secret123 -a
> "/export/backup/data.ldif"
> ERROR - Unknown option: -v
> Usage: db2bak.pl [-v] [-Z serverID] [-D rootdn] { -w password | -w - | -j
> filename } [-a backupdir]
>                  [-t dbtype] [-P protocol] [-h]
> 
> 5). Can we change the output here as "symbolic link to backup directory"
> instead of just "Back up directory"

I'm proposing this approach in my patch:

# db2bak.pl -w password -D cn=dm -a /tmp/mark
Back up directory: /tmp/mark -> /var/lib/dirsrv/slapd-localhost/bak/mark
...

> [0 root@qeos-41 /]# db2bak.pl -D "cn=Directory Manager" -w Secret123 -a
> "/export/backup/data.ldif"
> Back up directory: /export/backup/data.ldif
> Successfully added task entry "cn=backup_2017_5_17_4_38_34, cn=backup,
> cn=tasks, cn=config"
> 
> 6). This works fine
> nsslapd-bakdir: /var/lib/dirsrv/slapd-qeos-41/bak
> [0 root@qeos-41 /]# cd /export/backup/
> [0 root@qeos-41 backup]# ls -al
> total 8
> drwxr-xr-x. 2 root   root   4096 May 17 04:38 .
> drwxr-xr-x. 5 dirsrv dirsrv 4096 May 17 03:52 ..
> lrwxrwxrwx. 1 root   root     43 May 17 04:38 data.ldif ->
> /var/lib/dirsrv/slapd-qeos-41/bak/data.ldif
> 
> Thanks.

Comment 7 Amita Sharma 2017-05-25 07:13:57 UTC
(In reply to mreynolds from comment #6)
> (In reply to Amita Sharma from comment #5)
> > This needs some minor fixes -
> > 
> > 1). Commit message fix -> https://pagure.io/389-ds-base/c/470a30c - commit
> > message = * state thtthe backup *
> > 
> > 2). Synopsis in man page need correction, it still says backupdir for -a and
> > -A
> 
> I think this should not change - that's what the option description is for -
> to describe what it does.  I just think it might be confusing if we change:
> backupdir to symbackupdir.  
Ok.
> 
>  
> > 
> > NAME
> >        db2bak.pl - Directory Server perl script for creating a backup
> > 
> > SYNOPSIS
> >        db2bak.pl [-Z serverID] [-D rootdn] { -w password | -w - | -j
> > filename }  [-t dbtype] [-a backupdir] [-A backupdir] [-P protocol]
> >        [-h]
> > 
> > 3). This is correct
> >       -a backupdir
> >               The  directory  where  the  backup should be stored.  This
> > directory is a symbolic link to the actual backup files located
> >               under "nsslapd-bakdir" directory that is set in the
> > "cn=config" entry.
> > 
> >        -A backupdir
> >               This is similar to -a, except that a sub-directory of
> > backupdir will be created for the backup, and the name of  the  sub-
> >               directory will be a timestamp of the form
> > server-instance-date_time.
> > 
> > 4). we removed -v option? I can still see the option in help though but it
> > does not work.
> > [0 root@qeos-41 /]# db2bak.pl -v -D "cn=Directory Manager" -w Secret123 -a
> > "/export/backup/data.ldif"
> > ERROR - Unknown option: -v
> > Usage: db2bak.pl [-v] [-Z serverID] [-D rootdn] { -w password | -w - | -j
> > filename } [-a backupdir]
> >                  [-t dbtype] [-P protocol] [-h]
> > 
> > 5). Can we change the output here as "symbolic link to backup directory"
> > instead of just "Back up directory"
> 
> I'm proposing this approach in my patch:
> 
> # db2bak.pl -w password -D cn=dm -a /tmp/mark
> Back up directory: /tmp/mark -> /var/lib/dirsrv/slapd-localhost/bak/mark
> ...
Even better, Sounds good to me, .
> 
> > [0 root@qeos-41 /]# db2bak.pl -D "cn=Directory Manager" -w Secret123 -a
> > "/export/backup/data.ldif"
> > Back up directory: /export/backup/data.ldif
> > Successfully added task entry "cn=backup_2017_5_17_4_38_34, cn=backup,
> > cn=tasks, cn=config"
> > 
> > 6). This works fine
> > nsslapd-bakdir: /var/lib/dirsrv/slapd-qeos-41/bak
> > [0 root@qeos-41 /]# cd /export/backup/
> > [0 root@qeos-41 backup]# ls -al
> > total 8
> > drwxr-xr-x. 2 root   root   4096 May 17 04:38 .
> > drwxr-xr-x. 5 dirsrv dirsrv 4096 May 17 03:52 ..
> > lrwxrwxrwx. 1 root   root     43 May 17 04:38 data.ldif ->
> > /var/lib/dirsrv/slapd-qeos-41/bak/data.ldif
> > 
> > Thanks.

Thanks.

Comment 8 mreynolds 2017-05-25 14:05:20 UTC
Thanks Amita, fixed upstream

Comment 10 Amita Sharma 2017-06-12 11:14:20 UTC
[root@qeos-213 upstream]# db2bak.pl -v -D "cn=Directory Manager" -w Secret123 -a "/export/backup/data.ldif"
ERROR - Unknown option: -v
Usage: db2bak.pl [-Z serverID] [-D rootdn] { -w password | -w - | -j filename } [-a backupdir]
                 [-t dbtype] [-P protocol] [-h]
Options:
        -D rootdn     - Directory Manager
        -w password   - Directory Manager's password
        -w -          - Prompt for Directory Manager's password
        -Z serverID   - Server instance identifier
        -j filename   - Read Directory Manager's password from file
        -A backupdir  - Backup directory symlink(backupdir/ID-<date_time>)
        -a backupdir  - Backup directory symlink
        -t dbtype     - Database type (default: ldbm database)
        -P protocol   - STARTTLS, LDAPS, LDAPI, LDAP (default: uses most secure protocol available)
        -h            - Display usage

---------------------------


[root@qeos-213 backup2]# db2bak.pl -D "cn=Directory Manager" -w Secret123 -a "/export/backup2/data.ldif" 
Back up directory: /export/backup2/data.ldif -> /var/lib/dirsrv/slapd-qeos-213/bak/data.ldif
Successfully added task entry "cn=backup_2017_6_12_7_13_18, cn=backup, cn=tasks, cn=config"

[root@qeos-213 backup2]# ls -al
total 0
drwxr-xr-x. 2 dirsrv dirsrv  40 Jun 12 07:13 .
drwxr-xr-x. 7 dirsrv dirsrv 101 Jun 12 06:48 ..
-rw-r--r--. 1 root   root     0 Jun 12 07:12 data,ldif
lrwxrwxrwx. 1 root   root    44 Jun 12 07:13 data.ldif -> /var/lib/dirsrv/slapd-qeos-213/bak/data.ldif

Comment 11 errata-xmlrpc 2017-08-01 21:16:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2086


Note You need to log in before you can comment on or make changes to this bug.