Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2158731

Summary: [lorax] imjournal: fopen() failed for path: '/imjournal.state.tmp': Permission denied
Product: Red Hat Enterprise Linux 9 Reporter: Jan Stodola <jstodola>
Component: loraxAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.2CC: pberanek, rsroka
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lorax-34.9.23-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2160070 (view as bug list) Environment:
Last Closed: 2023-05-09 07:41:08 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:
Bug Depends On:    
Bug Blocks: 2129768    

Description Jan Stodola 2023-01-06 11:17:09 UTC
Description of problem:
The following errors are reported in journal when installing a system:

...
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: warning: ~ action is deprecated, consider using the 'stop' statement instead [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2307 ]
Jan 06 10:14:21 localhost.localdomain systemd[1]: Started System Logging Service.
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imfile: no working or state file directory set, imfile will create state files in the current working directory (probably the root dir). Use global(workDirectory="/some/path") to set
 the working directory [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2450 ]
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imfile: on startup file '/tmp/X.log' does not exist but is configured in static file monitor - this may indicate a misconfiguration. If the file appears at a later time, it will auto
matically be processed. Reason: No such file or directory [v8.2102.0-107.el9]
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imfile: on startup file '/tmp/anaconda-tb-all.log' does not exist but is configured in static file monitor - this may indicate a misconfiguration. If the file appears at a later time
, it will automatically be processed. Reason: No such file or directory [v8.2102.0-107.el9]
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: [origin software="rsyslogd" swVersion="8.2102.0-107.el9" x-pid="1681" x-info="https://www.rsyslog.com"] start
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imjournal: No statefile exists, /imjournal.state will be created (ignore if this is first run): No such file or directory [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2040 ]
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imjournal: fopen() failed for path: '/imjournal.state.tmp': Permission denied [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2013 ]
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imjournal: fopen() failed for path: '/imjournal.state.tmp': Permission denied [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2013 ]
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imjournal: fopen() failed for path: '/imjournal.state.tmp': Permission denied [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2013 ]
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imjournal: fopen() failed for path: '/imjournal.state.tmp': Permission denied [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2013 ]
...

Version-Release number of selected component (if applicable):
RHEL-9.2.0-20230102.0
rsyslog-8.2102.0-107.el9
anaconda-34.25.2.2-1.el9
lorax-34.9.22-1.el9
lorax-templates-rhel-9.0-36.el9

How reproducible:
always

Steps to Reproduce:
1. Start installation of RHEL
2. Check /tmp/syslog or journalctl during the installation

Actual results:
Jan 06 10:14:21 localhost.localdomain rsyslogd[1681]: imjournal: fopen() failed for path: '/imjournal.state.tmp': Permission denied [v8.2102.0-107.el9 try https://www.rsyslog.com/e/2013 ]

Expected results:
No errors

Comment 2 Attila Lakatos 2023-01-10 12:26:17 UTC
Hello,

At first glance the problem lies in not specifying the workDirectory global variable, like the following:
global(workDirectory="/var/lib/rsyslog")

If you omit this setting, then rsyslog will try to create temporary files(for instance journal state file) inside the "/" directory. It will probably fail due to SElinux.

Let me know if that helps.

Comment 3 Jan Stodola 2023-01-10 17:12:43 UTC
(In reply to Attila Lakatos from comment #2)
> Hello,
> 
> At first glance the problem lies in not specifying the workDirectory global
> variable, like the following:
> global(workDirectory="/var/lib/rsyslog")

Yes, adding this line fixes the problem. Tested using an updates.img. /etc/rsyslog.conf is created by lorax, so reassigning the bug.
If accepted, we will also need a lorax-templates-rhel bug.
 
> If you omit this setting, then rsyslog will try to create temporary
> files(for instance journal state file) inside the "/" directory. It will
> probably fail due to SElinux.

SELinux was my guess as well, but SELinux runs in permissive mode in the installer.

Comment 4 Jan Stodola 2023-01-11 13:29:02 UTC
Cloned as a lorax-templates-rhel bug 2160070.

Comment 5 Brian Lane 2023-01-11 18:06:24 UTC
https://github.com/weldr/lorax/pull/1299

I've also replaced ~ with stop as suggested by the deprecation message.

The other errors about missing files are because they are not present when rsyslogd starts and can be ignored.

It looks like it is also time to move to a newer config file format :) I'll do this upstream first and open a separate bug for it later. We're currently using the obsolete legacy format - 
https://www.rsyslog.com/doc/v8-stable/configuration/conf_formats.html

Comment 11 errata-xmlrpc 2023-05-09 07:41:08 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 (lorax bug fix and enhancement update), 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-2023:2267