Bug 1444069 - katello-backup --online-backup fails to create foreman.dump and candlepin.dump
Summary: katello-backup --online-backup fails to create foreman.dump and candlepin.dump
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Backup & Restore
Version: 6.2.9
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Unspecified
Assignee: Christine Fouant
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1439123
TreeView+ depends on / blocked
 
Reported: 2017-04-20 13:49 UTC by Peter Ondrejka
Modified: 2022-03-13 14:15 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1432013 0 high CLOSED katello-backup does not apply postgres group owner to the whole backup path 2021-12-10 14:57:22 UTC

Description Peter Ondrejka 2017-04-20 13:49:22 UTC
Creating an online backup (satellite-6.2.9-4.0.el7sat.noarch), both on rhel6 and 7:

# katello-backup --online-backup backup_directory
Starting backup: 2017-04-20 09:26:30 -0400
Creating backup folder backup_directory/katello-backup-2017-04-20T09:26:30-04:00
Generating metadata ... 
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-0.1.42/app/models/concerns/satellite_packages.rb:4: warning: already initialized constant Katello::Ping::PACKAGES
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.123/app/models/katello/ping.rb:7: warning: previous definition of PACKAGES was here
Backing up config files... 
Done.
Backing up postgres db... 
-bash: backup_directory/katello-backup-2017-04-20T09:26:30-04:00/foreman.dump: No such file or directory
-bash: backup_directory/katello-backup-2017-04-20T09:26:30-04:00/candlepin.dump: No such file or directory
Done.
Backing up mongo db... 
Done.
Backing up Pulp data... 
tar: Removing leading `/' from member names
Done.
Done with backup: 2017-04-20 09:28:07 -0400
**** BACKUP Complete, contents can be found in: backup_directory/katello-backup-2017-04-20T09:26:30-04:00 ****

Note the "No such file or directory" messages, foreman.dump and candlepin.dump are not created:


# ls -la backup_directory/katello-backup-2017-04-20T09\:26\:30-04\:00/
total 3720648
drwxrwx---. 3 root postgres        126 Apr 20 09:26 .
drwxr-xr-x. 4 root root            102 Apr 20 09:26 ..
-rw-r--r--. 1 root root        1823740 Apr 20 09:26 config_files.tar.gz
-rw-r--r--. 1 root root          19577 Apr 20 09:26 .config.snar
-rw-r--r--. 1 root root            346 Apr 20 09:28 metadata
drwxr-xr-x. 5 root root             52 Apr 20 09:26 mongo_dump
-rw-r--r--. 1 root root     3806085120 Apr 20 09:28 pulp_data.tar
-rw-r--r--. 1 root root        2005528 Apr 20 09:28 .pulp.snar

Seems like the pg_dump wants the dump file to be created beforehand.

Expected results:

candlepin.dump and foreman.dump are created successfully. katello-backup should chechk if all files were created as expected.

Actual resutls:

Missing candlepin.dump and foreman.dump in the backup folder -- prevents successful restoring. katello-backup prints BACKUP Complete, even though the files are missing

Comment 1 Peter Ondrejka 2017-04-20 14:46:00 UTC
workaround: this issue does not occur when the backup directory is created under /tmp/

When attempting to create backups using a full path to a custom destination directory like this:

# katello-backup --online-backup /root/backup_directory

...pg_dump produces a different error:

-bash: /root/backup_directory/katello-backup-2017-04-20T10:36:36-04:00/foreman.dump: Permission denied
-bash: /root/backup_directory/katello-backup-2017-04-20T10:36:36-04:00/candlepin.dump: Permission denied

This occurs with setenforce 0 as well, may be related to https://bugzilla.redhat.com/show_bug.cgi?id=1432013

So there are 2 problems here:

- pg_dump used in online backup requires full path to the destination dir
- pg_dump doesn't get permission to write to custom destination dirs

Comment 3 Christine Fouant 2017-05-18 18:34:05 UTC
Hi Peter,

Currently right now this is an issue that is fixed but will not be available until 6.1.12:

https://bugzilla.redhat.com/show_bug.cgi?id=1432013

For right now in the docs we need to provide a note to run katello-backup --online-backup in the /tmp directory. Once this is fixed in 6.2.12 we can remove this note from the docs.

Most customers should be using /tmp anyways and then push it to where they want to store it.

Comment 4 Peter Ondrejka 2017-05-19 12:37:24 UTC
Hi Christine, good to know, thanks. I filed https://bugzilla.redhat.com/show_bug.cgi?id=1452659 to let documentation know.

Comment 10 Peter Ondrejka 2017-09-05 13:22:33 UTC
Verified on satellite-6.3.0-17.0.beta.el7sat.noarch, when obeying the recommendation to use /tmp or /var/tmp, the dump files are created as expected

~]# ll /var/tmp/backup/katello-backup-20170905084527/
total 4980
-rw-r--r--. 1 postgres postgres  267615 Sep  5 08:46 candlepin.dump
-rw-r--r--. 1 root     root      674369 Sep  5 08:45 config_files.tar.gz
-rw-r--r--. 1 postgres postgres 4099807 Sep  5 08:46 foreman.dump
-rw-r--r--. 1 root     root       48812 Sep  5 08:45 metadata.yml
drwxr-xr-x. 5 root     root          52 Sep  5 08:46 mongo_dump
-rw-r--r--. 1 postgres postgres     650 Sep  5 08:46 pg_globals.dump

Comment 11 Satellite Program 2018-02-21 16:54:37 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/RHSA-2018:0336


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