Bug 2038948

Summary: amreport, amdump hang due to missing /etc/amanda/DailySet1/command_file, which amandabackup user cannot create
Product: Red Hat Enterprise Linux 8 Reporter: Dan Astoorian <djast>
Component: amandaAssignee: Pavel Cahyna <pcahyna>
Status: CLOSED MIGRATED QA Contact: CS System Management SST QE <rhel-cs-system-management-subsystem-qe>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.5Keywords: MigratedToJIRA
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-21 22:08:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Astoorian 2022-01-10 15:48:04 UTC
Description of problem:
As shipped, Amanda cannot perform dumps due to the amandabackup user not having permission to create the file /etc/amanda/DailySet1/commmand_file.  Commands such as amreport or amdump loop trying to create the file once per second until a writable command_file is created (or until the amandabackup user is given write permission to the /etc/amanda/DailySet1/ directory).

Version-Release number of selected component (if applicable):
amanda-3.5.1-13.el8.x86_64
amanda-server-3.5.1-13.el8.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install the packages via "dnf install amanda-server amanda-client".
2. As the amanadabackup user, attempt to initiate a backup via "amdump DailySet1".  (Since no backup has been configured, this will produce the message "Can't open tape device /dev/YOUR-TAPE-DEVICE-HERE: No such file or directory" and a prompt to enter ^D to abort, but this is irrelevant to this issue--the same thing happens if a DLE has been configured.)
3. Run "strace -p $(pgrep planner)" to trace system calls of the planner process.  Observe that it's looping trying to create /etc/amanda/DailySet1/command_file and getting "permission denied" errors.
4. Hit Ctrl-C twice to abort the amdump process.  Observe that running "amreport DailySet1" also hangs, and running "strace amreport DailySet1)" similarly shows repeated failed attempts to create /etc/amanda/DailySet1/command_file .

Actual results:
The planner and amdump processes loop, and /var/log/amanda/server/DailySet1/ will contain planner*, driver*, and amreport* logs containing repeated entries such as:

/var/log/amanda/server/DailySet1/amreport.20220110095258.debug:Mon Jan 10 09:53:02.989265035 2022: pid 2042915: thd-0x5573ebaf1600: amreport: file_lock_lock open failed (/etc/amanda/DailySet1/command_file): Permission denied
/var/log/amanda/server/DailySet1/amreport.20220110095258.debug:Mon Jan 10 09:53:03.989382629 2022: pid 2042915: thd-0x5573ebaf1600: amreport: file_lock_lock open failed (/etc/amanda/DailySet1/command_file): Permission denied
/var/log/amanda/server/DailySet1/amreport.20220110095258.debug:Mon Jan 10 09:53:04.989465466 2022: pid 2042915: thd-0x5573ebaf1600: amreport: file_lock_lock open failed (/etc/amanda/DailySet1/command_file): Permission denied


Expected results:
The Amanda processes should not hang; e.g., pressing Ctrl-D when prompted with "enter ^D to abort" by amdump should cause the amdump process to exit within a few seconds.

Additional info:
Creating the file /etc/amanda/DailySet1/command_file and chown'ing it to the amandabackup user (even after the Amanda commands have been started) will allow Amanda to proceed.  Chown'ing the /etc/amanda/DailySet1/ directory to the amandabackup user also works, but the amandabackup user should probably not have write access to the configuration directory without a compelling reason.

Note that this problem did not affect Red Hat Enterprise Linux 7, as the command_file mechanism was introduced after the version of Amanda that was shipped with that release (amanda-3.3.3).

Including an empty /etc/amanda/DailySet1/command_file file with appropriate permissions in the amanda-server package as a configuration file may be adequate to remedy the issue.

It's not clear to me why the Amanda authors chose to locate the command_file file in the configuration directory rather than, e.g., /var/lib/amanda/DailySet1/ (which would already have appropriate permissions), since the amandabackup user does not typically modify any other files in the configuration directories, but that decision may be beyond the scope of this report.

Comment 1 Pavel Cahyna 2022-01-11 11:49:58 UTC
Thank you for the report and analysis, I will first check what do other distributions do about this problem (if anything).

Comment 3 RHEL Program Management 2023-09-21 21:31:26 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 4 RHEL Program Management 2023-09-21 22:08:16 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.