initramfs-tools and microsecond accuracy

Asked by Jeff Abrahamson

This is very minor, but its absence makes it slightly harder to understand when and how files are generated.

The files in /var/lib/initramfs-tools have timestamps with nanosecond accuracy:

jeff@starshine:initramfs-tools $ stat 5.0.0-37-generic
  File: 5.0.0-37-generic
  Size: 76 Blocks: 8 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 6031277 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-12-23 19:11:16.789653088 +0100
Modify: 2019-12-23 09:27:31.963261174 +0100
Change: 2019-12-23 09:27:31.963261174 +0100
 Birth: -
jeff@starshine:initramfs-tools $

The generated (I think) files in /boot/ have timestamps set with only second accuracy:

jeff@starshine:boot $ stat initrd.img-5.0.0-37-generic
  File: initrd.img-5.0.0-37-generic
  Size: 68578468 Blocks: 134474 IO Block: 1024 regular file
Device: 812h/2066d Inode: 16 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-12-23 09:27:31.000000000 +0100
Modify: 2019-12-23 09:27:31.000000000 +0100
Change: 2019-12-23 09:27:31.000000000 +0100
 Birth: -
jeff@starshine:boot $

Most notably, this makes tracing system behaviour (such as determining which file is created first) more difficult.

Clearly this has no operational importance except debugging and user learning. Like me today trying to understand where my kernel images come from.

That said, I've tried to find this in source code (initramfs-*, grub*), and I'm not finding it. So I'm not even really sure where to file/suggest a bug.

In passing, and as much for my own recall as for this bug, the call to set time with ns accuracy is utimensat(). Setting with microsecond accuracy uses the old utime() call.

Thanks for any tips.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Best Manfred Hampl (m-hampl) said :
#1

This may perhaps be caused by different file system capabilities.
Do you have a separate boot partition, if yes, what file system type is your root file system, and what is the boot partition?

Revision history for this message
Jeff Abrahamson (jeff-purple) said :
#2

That's a very good point:

```
/dev/mapper/ubuntu--vg-root ext4 219G 200G 8.0G 97% /
/dev/sdb2 ext2 237M 143M 83M 64% /boot
```

And, indeed, the specification for ext2 says that ctime, mtime, and atime are 32 bit ints measuring seconds since the epoch.

Thanks!