Skip to contentSkip to conversation

gen_initramfs.sh: use 'date -u' to get Timestamp

PATCH In review Gang Yan 4 participants 8 messages Oct 13, 2025 – Oct 15, 2025

Subsystems (2)
lore
Share & tools
lore

Gang Yan

author
#0 lore raw

PATCH 1/1 gen_initramfs.sh: use 'date -u' to get Timestamp

There exists a compilation error in the latest version of mptcp-upstream-virtme-docker:latest:
'''

	ERROR: Timestamp out of range for cpio format
	make[4]: *** [<KERNEL_SRC>/usr/Makefile:76:

'''

The reason is the output of 'date -d0' is 'Sat Jan 1 00:00:00 UTC 0000'. After using 'date -u', the output is correct.

---
 usr/gen_initramfs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
usr/gen_initramfs.sh +1 -1
index 7eba2fddf0ef..8eb43f76d521 100755
@@ -222,7 +222,7 @@ while [ $# -gt 0 ]; do
 			shift
 			;;
 		"-d")	# date for file mtimes
-			timestamp="$(date -d"$1" +%s || :)"
+			timestamp="$(date -u +%s || :)"
 			if test -n "$timestamp"; then
 				timestamp="-t $timestamp"
 			fi
Signature · 1 line
2.43.0
maintainer
#1 lore raw

Hi Gang,

Quoted 9 lines · Gang Yan

There exists a compilation error in the latest version of mptcp-upstream-virtme-docker:latest:
'''

	ERROR: Timestamp out of range for cpio format
	make[4]: *** [<KERNEL_SRC>/usr/Makefile:76:

'''

The reason is the output of 'date -d0' is 'Sat Jan 1 00:00:00 UTC 0000'. After using 'date -u', the output is correct.

Thank you for having looked at this. I already sent a fix in mptcp-upstream-virtme-docker:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker/commit/52aa674

The issue is in fact in Rust CoreUtils:

https://github.com/uutils/coreutils/issues/8898

Then, I don't think we need to modify the kernel source. Here are a few workarounds:

- Use date's GNU version: ln -sf gnudate /usr/bin/date

- Do not generate the initramfs if not needed: -d CONFIG_BLK_DEV_INITRD

- Set KBUILD_BUILD_TIMESTAMP to "-1"

WDYT?

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#2 lore raw
Quoted 17 lines · Matthieu Baerts

Hi Gang,

Quoted 9 lines · Gang Yan

There exists a compilation error in the latest version of mptcp-upstream-virtme-docker:latest:
'''

	ERROR: Timestamp out of range for cpio format
	make[4]: *** [<KERNEL_SRC>/usr/Makefile:76:

'''

The reason is the output of 'date -d0' is 'Sat Jan 1 00:00:00 UTC 0000'. After using 'date -u', the output is correct.

Thank you for having looked at this. I already sent a fix in mptcp-upstream-virtme-docker:

Quoted 6 lines

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker/commit/52aa674

The issue is in fact in Rust CoreUtils:

https://github.com/uutils/coreutils/issues/8898

Thanks for this information.

Quoted 3 lines

Then, I don't think we need to modify the kernel source. Here are a few workarounds:

Sure!

Quoted 8 lines

- Use date's GNU version: ln -sf gnudate /usr/bin/date

- Do not generate the initramfs if not needed: -d CONFIG_BLK_DEV_INITRD

- Set KBUILD_BUILD_TIMESTAMP to "-1"

WDYT?

Still, I have another question: Is the compilation error too strict when failing to retrieve the date? Would throwing a simple error be enough by default? Or would it be better to provide a default value when the date cannot be obtained, ensuring the compilation can be completed?

WDYT? It's just a normal discussion.

Thanks,
Gang

Quoted 7 lines

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#3 lore raw

Hi Gang,

Quoted 4 lines · GangYan

Still, I have another question: Is the compilation error too strict when failing to retrieve the date? Would throwing a simple error be enough by default? Or would it be better to provide a default value when the date cannot be obtained, ensuring the compilation can be completed?

Maybe, I don't know. This gen_initramfs.sh already checks that 'date' returned something, and if not, it doesn't try to set the option. Maybe an extra check could be added to make sure the timestamp is positive?

  if test -n "$timestamp" && test "$timestamp" -ge 0; then

But because it is not linked to MPTCP, do you mind checking this with the maintainers of this file, please?

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#4 lore raw
Quoted 9 lines · Matthieu Baerts

Hi Gang,

Quoted 4 lines · GangYan

Still, I have another question: Is the compilation error too strict when failing to retrieve the date? Would throwing a simple error be enough by default? Or would it be better to provide a default value when the date cannot be obtained, ensuring the compilation can be completed?

Quoted 8 lines

Maybe, I don't know. This gen_initramfs.sh already checks that 'date' returned something, and if not, it doesn't try to set the option. Maybe an extra check could be added to make sure the timestamp is positive?

  if test -n "$timestamp" && test "$timestamp" -ge 0; then

But because it is not linked to MPTCP, do you mind checking this with the maintainers of this file, please?

Already sent the email[1], please check.

Thanks,
Gang

Quoted 6 lines

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#5 lore raw
In reply to Matthieu Baerts
Quoted 11 lines · Matthieu Baerts

Hi Gang,

Quoted 7 lines · Gang Yan

There exists a compilation error in the latest version of mptcp-upstream-virtme-docker:latest:
'''

	ERROR: Timestamp out of range for cpio format
	make[4]: *** [<KERNEL_SRC>/usr/Makefile:76:

'''

Quoted 9 lines
Quoted 2 lines

The reason is the output of 'date -d0' is 'Sat Jan 1 00:00:00 UTC 0000'. After using 'date -u', the output is correct.

Thank you for having looked at this. I already sent a fix in mptcp-upstream-virtme-docker:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker/commit/52aa674

This fix works well in my enviroment.

Thanks,
Gang

Quoted 22 lines

The issue is in fact in Rust CoreUtils:

https://github.com/uutils/coreutils/issues/8898

Then, I don't think we need to modify the kernel source. Here are a few workarounds:

- Use date's GNU version: ln -sf gnudate /usr/bin/date

- Do not generate the initramfs if not needed: -d CONFIG_BLK_DEV_INITRD

- Set KBUILD_BUILD_TIMESTAMP to "-1"

WDYT?

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#6 lore raw
In reply to Gang Yan

Hi Gang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Unstable: 2 failed test(s): packetdrill_fastclose selftest_simult_flows 🔴
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Script error! ❓
- KVM Validation: btf-debug (only bpftest_all): Script error! ❓
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/18463151285

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/ca9d5aad6b72
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1010664

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)

maintainer
#7 lore raw

Hi Gang,

13 Oct 2025 13:50:42 MPTCP CI <[email protected]>:

Quoted 4 lines

Hi Gang,

Thank you for your modifications, that's great!

Quoted 8 lines

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Unstable: 2 failed test(s): packetdrill_fastclose selftest_simult_flows 🔴
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Script error! ❓
- KVM Validation: btf-debug (only bpftest_all): Script error! ❓

FYI, this issue has also been fixed in our tree, but just after you sent your patch:

https://git.kernel.org/bpf/bpf/c/de7342228b73

Cheers,
Matt