Bug 2225684

Summary: dracut creates initramfs with incorrect timestamps
Product: Red Hat Enterprise Linux 9 Reporter: Andrew Schorr <ajschorr>
Component: dracutAssignee: dracut-maint-list
Status: NEW --- QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, jwboyer
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 Andrew Schorr 2023-07-25 16:46:49 UTC
Description of problem:
I have noticed on several occasions that the initramfs file created by dracut does not have correct timestamps. It somehow seems to preserve the timestamp from the previous version of the file. I don't think I am hallucinating.

Version-Release number of selected component (if applicable):
dracut-057-22.git20230530.el9.x86_64


How reproducible:
Always?

Steps to Reproduce:
1. Modify a file included in the initramfs
2. Run 'dracut -f'
3. run 'lsinitrd' and look at the listing for that file.

Actual results:
For example, I modified /etc/sysctl.conf. Prior to editing, here is what I saw:
lsinitrd | grep sysctl
-r--r--r--   1 root     root         1223 May 31 10:29 etc/sysctl.conf
...
Then I edited /etc/sysctl.conf. In the filesystem, I see:
-r--r--r-- 1 root root 1230 Jul 25 12:16 /etc/sysctl.conf
Then I ran 'dracut -f'. When I then ran 'lsinitrd | grep sysctl', I saw this:
-r--r--r--   1 root     root         1230 May 31 10:29 etc/sysctl.conf
Notice that the length of the file has changed, but it somehow preserves
the old timestamp. It is confounding.

Expected results:
The timestamps should update.

Additional info:
I have observed the same behavior with kernel modules created by dkms.