Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite 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 "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. 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 "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-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 1596353

Summary: sudo requires a tty while running katello-backup from cron
Product: Red Hat Satellite Reporter: Mike McCune <mmccune>
Component: Backup & RestoreAssignee: Christine Fouant <cfouant>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.13CC: ajoseph, akarimi, amasolov, bvassova, chrobert, chsimon, daniele, djoo, dleatherman, egolov, ehelms, jbhatia, lpramuk, mhulan, mkalyat, mmccune, peli, takirby, vanhoof, wpinheir
Target Milestone: 6.4.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1540382 Environment:
Last Closed: 2018-10-16 19:14:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1122832    

Comment 3 Martin Korbel 2018-07-19 08:24:33 UTC
Reproducer:

1. In this version satellite is katello-backup deprecated, it was replaced by 'foreman-maintain backup'.

> katello-backup --help

IMPORTANT: katello-backup has been removed in favor of 'foreman-maintain backup'.
This change happened in order to support remote databases and a newer mongo version.
Please update your scripts and/or cron jobs.


2. We can try manually backup
> foreman-maintain backup online -y --skip-pulp-content /tmp/sat-backup
...

Done with backup: 2018-07-19 03:34:12 -0400
**** BACKUP Complete, contents can be found in: /tmp/sat-backup/satellite-backup-2018-07-19-03-33-47 ****
> echo $?
0

3. The same step via cron 
> echo "30 3 * * *  root foreman-maintain backup online -y --skip-pulp-content /tmp/sat-backup >> /tmp/backups.log 2>&1" >> /etc/crontab

  Wait when the time is passed and check the log /tmp/backups.log

> grep FAIL /tmp/backups.log


To this point all works fine. But if we try to use "crontab -e" respectively /var/spool/crontab/root

4.
> crontab -e
add line 
"0 3 * * *  foreman-maintain backup online -y --skip-pulp-content /tmp/sat-backup >> /tmp/backups.log 2>&1"

> grep -B 1 FAIL /tmp/backups.log 
Check if the directory exists and is writable: sh: runuser: command not found
                       [FAIL]


The problem is with $PATH and non-absolute using of runuser. 

I'm not sure if it is reason to FAILQA. Maybe a mention in documentation could help.

Mike, what do you think about that?

Comment 4 Marek Hulan 2018-08-16 12:07:17 UTC
Does it work when you wrap it with `bash -l -c 'foreman-maintain backup online -y --skip-pulp-content /tmp/sat-backup >> /tmp/backups.log 2>&1'`? If that's the case, I'd vote for just raising a doc bug and make this verified.

Comment 5 Martin Korbel 2018-08-17 10:39:49 UTC
VERIFIED on Sat6.4#15
with a small problem mented above

Comment 7 Bryan Kearney 2018-10-16 19:14:17 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:2927