64-bit time
Contents
Current Status
The t64 transition is settled by June 2024 (no official announcement was made).
If any of your packages are not upgraded to the latest version on your Debian Testing or Debian Unstable/Sid system, now it is the time to sort it out manually.
The transition coordination occurred on #debian-devel IRC.
A fairly exhaustive analysis of ABI changes was done from May–October 2023. About 495 library packages change ABI, and between 5,063 and 5,975 packages which depend on those will need a no-change rebuild. Also affected are 600-700 Perl packages which make XS modules (and depend on perl-abi-5.x.x or libperl-5.xx).
Packages built with gnulib released between July 2nd and December 25th, 2022, will automatically get 64-bit time_t if glibc >=2.34 is present, unless the macro gl_cv_type_time_t_bits_macro is set to stop it. The offending change was reverted to stop this surprise happening early.
Uploads to experimental were done from February 2nd, 2024, to enable analysis of potential UsrMerge-related issues (e.g. Bug #1063329 was found).
NMU bugs for the transition were filed beginning on January 30th, 2024.
The actual transition began on February 27th, 2024. (See 64-bit time_t transition in progress in unstable on debian-devel-announce from February 26th, 2024)
gcc (gcc-13 and gcc-14) enabling these options by default was uploaded February 26th, 2024. (version 13.2.0-16.1)
Dpkg enabling -D_FILE_OFFSET_BITS=64 and -D_TIME_BITS=64 by default in dpkg-buildflags was uploaded on February 27th, 2024. (version 1.22.5)
NMUs for all of the affected libraries started once all the ports had built gcc and dpkg, around March 3rd, 2024.
Bootstrapping of various self-depending packages and loops is ongoing as of March 29th, 2024.
- Notable blockers fixed: libglib, cargo/rust, curl, protobuf, openjdk-17, git and subversion.
Notes about bootstrapping architectures, workarounds and status updates is available on BrainDumpT64.
Affected packages
Goal description
Use 64-bit time_t on 32-bit architectures to avoid the "year 2038 problem" when the existing 32-bit signed integer rolls over (potentially setting time back to 1900). Good technical details are given on the Y2038 Proofness Design page on glibc wiki, with a more concise treatment available on English Wikipedia and a very general overview at theyear2038problem.com.
The Fixing Year 2038 (video) by Wookey at FOSDEM '23 (PDF) also gives a good overview of the status quo at that time.
As of 2025, this is less that 13 years away, and plenty of systems that will have problems have already been shipped; we should stop adding to the problem. Most computing, especially computing using Debian or its derivatives, is now done on 64-bit hardware where this issue does not arise. However, there is quite a lot of cost-sensitive 32-bit computing still out there and new devices are still being shipped (automotive, IoT, TVs, routers, plant control, building monitoring/control, cheap Android phones, etc.), with some of that hardware probably running Debian or its derivatives. Other binary distributions are dropping 32-bit support (Redhat/Fedora have already done so, and SUSE's support is unofficial), so what is left is even more likely to end up in the Debian ecosystem as a result. Most of this new hardware will be running build-from-source OSes like OpenEmbedded, Alpine, Android or Gentoo, but the Debian-based niche is likely to remain for some years, and some stuff built with it is likely to be in use/installed long enough to reach January 2038.
Debian is primarily concerned about the armhf architecture, as it's the 32-bit architecture most likely to still be getting significant usage in new systems over the next decade. But i386, armel, mipsel (and the hppa, hurd-i386, powerpc, m68k and sh4 ports) are also affected. Other 32-bit architectures already use 64-bit time: x32, riscv32, arc and loong32.
64-bit architectures are not affected by the Y2k38 problem, but they are affected by this transition.
Because you have to have LFS if you have 64-bit time_t (glibc enforces this), this goal is a superset of ReleaseGoals/LFS.
Background
time_t appears all over the place. 6,429 of Debian's 35,960 packages have time_t in the source. Packages which expose structs in their ABI which contain time_t will change their ABI and all such libraries need to migrate together, as is the case for any library ABI change.
glibc 2.34 provides support for both the existing 32-bit ABI/API and a new 64-bit ABI/API. However, it does not provide a switch forcing the use of the new API/ABI - each build/package chooses explicitly to use the 64-bit API/ABI (by setting -D_TIME_BITS=64). This is a problem for Debian as in a normal transition we expect that simply building against the new library will get you the new ABI. Something (glibc, dpkg, GCC?) has to say 'Use 64-bit time by default.' Bug #1030159 has implemented an abi=+time64 option for DEB_BUILD_OPTIONS/DEB_BUILD_MAINT_OPTIONS as a consistent mechanism for Debian and its derivatives.
This transition is similar to the Large Filesystem Support (LFS) transition, where glibc also provided both 32-bit and 64-bit APIs and using the 64-bit ABI by setting -D_FILE_OFFSET_BITS=64 (alternatively abi=+lfs or its predecessor future=+lfs in DEB_BUILD_OPTIONS/DEB_BUILD_MAINT_OPTIONS, which does the same thing) changes the ABI. And just to add to the fun, if you set 64-bit time then glibc enforces 64-bit file offsets, so software that has not dealt with support for LFS will also have to fix that in order to move to 64-bit time. (There are about 75 libraries that change ABI for LFS, but not time_t.)
Other projects
Links to work in this area by other projects:
Linux kernel (2017)
musl (2020)
glibc (2021)
Choices
We could either transition the ABI within the existing architecture(s), or we can bootstrap a new architecture (with a new triplet and ABI). Initial thoughts were that it was highly uncertain that a transition in-place was feasible because too much stuff would break, and thus a new architecture was simpler, safer and easier.
New triplet
- Strictly speaking, a new ABI should mean a new triplet, but in fact we do ABI-changing migrations within an existing triplet all the time (a la most SONAME changes).
- If Debian used a new triplet for the new ABI but all the rest of the Linux world migrated the ABI within the existing triplet, it would become very unclear what the existing 'arm-linux-gnueabihf' triplet means. It's quite important that there is cross-distribution agreement about the way forward.
- There has been very little interest in a new triplet from other distros.
ABI transition
- Research to-date has suggested that a standard ABI transition will be feasible.
We've done large ABI transitions before, like LFS and libc5->libc6, so treating this as just another migration makes sense.
We also need to choose whether to do this for all our 32-bit architectures or not. For example, one could decide that x32 fulfills the '32-bit x64 with 64-bit time' role and i386 should remain with 32-bit time for compatibility reasons (i.e. the ability to run ancient x86 binaries, especially proprietary ones that cannot be updated).
Decision
After a long discussion (mostly about i386), it was decided to do an in-architecture ABI transition for all 32-bit architectures except i386 and hurd-i386.
The i386 port will be left with the existing 32-bit time_t as a compatibility architecture for existing x86 binaries. A new 'i686' x86 ABI/architecture using 64-bit time, and potentially newer ISA features could be created, if there was sufficient enthusiasm for dragging 32-bit x86 into its now-very-limited future. The hurd-i386 port is not going to be switched as its kernel lacks support, and efforts are underway instead to switch to hurd-amd64.
In summary:
- amd64, arm64, mips64el, ppc64el, riscv64, s390x are all 64-bit, so they already had 64-bit time_t.
- Non-release architectures in the same category: alpha, hurd-amd64, ia64, loong64, ppc64 and sparc64.
- i386 is 32-bit but has been excluded from the 64-bit time_t transition because its primary use case is running legacy 32-bit binaries, and that would no longer be possible following an ABI change.
- Non-release architectures in the same category: hurd-i386.
- There is currently no release architecture that is 32-bit but already had a 64-bit time_t prior to 2024.
- Non-release architectures in this category: x32.
- armel and armhf are the two 32-bit release architectures which are changing ABI.
- Non-release architectures in the same category: hppa, m68k, powerpc and sh4.
Transition in-place
We have done large ABI-breaking transitions before, such as libc5 -> libc6 (resulting in the 'g' package suffix, which still remains today in libpam0g and zlib1g!), and the GCC 4.0 C++ ABI (and corresponding 'c2' package suffix). However, those affected all architectures and not just old 32-bit ones. We have also done transitions which only affected 'minor' architectures, such as the long double migration from 64-bit to 128-bit on alpha, powerpc, sparc and s390 (2007) (creating the 'ldbl' package suffix).
A large in-place transition will affect all of Debian, but only benefit the remaining 32-bit architectures, so we do need to try to do this with reasonable efficiency in order to not hold things up for too long. Fallout from breakage should fall almost entirely on the 32-bit architectures that are changing ABIs.
How to help
Build your package with abi=+lfs/future=+lfs in DEB_BUILD_OPTIONS/DEB_BUILD_MAINT_OPTIONS so -D_FILE_OFFSET_BITS=64 and -D_TIME_BITS=64 are set (or set them manually), and test it on 32-bit systems.
- Check especially if on-disk files/formats are affected, or if there are any ABI/API changes your package exposes.
- Don't upload your package with these options enabled until any libraries you depend on have been uploaded with these changes.
- Record explicit tests for potential transition bugs on this page.
Report bugs on packages that have issues, and add the tag:time-t.
- Fix bugs tagged 'time-t'.
Issues
People are rightly worried about stuff that will break when time_t is changed for some, but not all, of the packages on a running system. However, not that many things which will actually break have thus far been found.
Because some 32-bit architectures have been using 64-bit time for some years and x86 already went through the 32 -> 64-bit transition, things like file formats have generally been made interoperable and quite a lot of other problems have already been dealt with.
The largest area of uncertainty is regarding possible issues with changing file formats, database structures and data passed between programs over IPC mechanisms.
As far as can be determined, most language runtimes do not appear to have problems with any of this, except insofar as they have C library interfaces. Those issues resolve to the known C/C++ ABI issue.
- Haskell will change ABI, but it changes ABI all the time anyways, and has mechanisms to deal with it.
- Rust is all statically linked, so it should not expose any ABI changes, except for external C/C++ libraries.
- Java, Perl, Python, Go and Ruby all have a consistent internal time representation, so they will only expose ABI changes on C/C++ library linkage.
Another source of issues are packages that fail to build with the time64 build flags on. The flags can be turned on for any debhelper-enabled package build using:
DEB_BUILD_MAINT_OPTIONS="abi=+time64" dpkg-buildpackage
…and explicitly turned off with:
DEB_BUILD_MAINT_OPTIONS="abi=-time64" dpkg-buildpackage
Please update this section if you know of any related issues.
Remember that there are, in fact, two distinct classes of breakage:
- Things that break in 2024 due to the build changes from transitioning to 64-bit time.
- Things that will break in 2038 due to the date actually wrapping.
We only need to worry about the first of those for the transition itself, and if the fates are kind, the transition should fix quite a lot of the things in the second class.
Known Issues
The utmp and wtmp files currently record timestamps as 32-bit integers, even on most 64-bit architectures. However, in 32-bit programs with a 64-bit time_t, these timestamps inadvertently change to 64-bit integers (Bug #1042562), creating compatibility problems (Bug #1027135).
- NFSv3 uses 32-bit time and some clients may use an unsigned integer, giving them another…~70 years of runway?
InterNetNews (inn2) has time_t embedded in the disk format of its overview and history databases, which will require manual rebuilds when the size of time_t changes. This probably cannot reasonably be done by maintainer scripts and will therefore require manual intervention by the user. (It may be possible to write a migration program that avoids the need for a complete rebuild, but this has not yet been done.) The Cyclical News Filesystem (CNFS) storage format does not have problems with its disk format, but the less-used timecaf and timehash storage formats might (yet to be confirmed).
- cpio - does it use signed integers (31 bits) or 33-bit time (11 octal digits)? - conflicting info exists.
- 32-bit WINE (i386 only) – this does not make much sense with 64-bit time. Its whole purpose is to run old x86-ABI binaries, so the ABI for this architecture (and thus wine-32) should not change.
PHP integers are the same size as DEB_HOST_ARCH_BITS, so PHP using time() functions on 32-bit machines will break. The DateTime API exists and will not break, so PHP apps still using time() stored as ints need to be updated. This, however, does not affect the ABI transition itself.
Bug tracking
Please tag all 64-bit-time bugs with the 'time-t' tag (user=debian-arm@lists.debian.org, tag=time-t) in the BTS (see usertags for instructions).
Here is an example of doing so using reportbug(1) (assuming you have a patch file, and a body template file):
reportbug $package --src --no-tags-menu --severity normal --tag patch --body-file $template -V $version -A $patchfile \
--subject 'Use 64bit time_t' --pseudo-header 'User: debian-arm@lists.debian.org' --pseudo-header 'Usertag: time-t'
…or to tag an existing bug, use bts(1):
bts user debian-arm@lists.debian.org , usertags 12345 time-t
Tests
Please list explicit tests for things you think might break, assuming the people working on this transition know nothing about your software. They will be very grateful for commands/tests they can run (and their expected results) to see if things are working correctly.
Milestones
We are already late with this transition and upstreams are already moving, so doing something has become quite urgent. A plan was proposed in May 16th, 2023, (see 64-bit time_t transition for 32-bit archs: a proposal on debian-devel) to do a transition early in the Trixie cycle. We hope this will occur in January 2024.
Proposed plan of attack:
- Make a complete list of libraries with changed public ABI changes that must transition together.
Change gcc-* to emit -D_FILE_OFFSET_BITS=64 and -D_TIME_BITS=64 by default.
Change dpkg-buildflags to emit -D_FILE_OFFSET_BITS=64 and -D_TIME_BITS=64 on all 32-bit architectures except i386 and hurd-i386 (filter this out for ~100 packages which are sensitive to LFS but not time_t).
- NMU all libraries with binaries renamed from libfoo to libfoot64, removing old suffixes (c102, c2, ldbl, g…) if present, and emit a Provides/Replaces/Breaks libfoo on 64-bit arches + i386 and hurd-i386.
- Do unchanged source rebuilds (binNMUs on all architectures) of 5,000–6,000 packages which depend on them; by the magic of transitions this "just works™."
ABI transition
Packages which expose structs containing time_t in their ABI will have breaking changes to it. We are analysing the set of packages involved, and initial investigations (in Ubuntu) produced the following:
- Of 4,590 library packages analyzed: 1,925 failed and 2665 passed.
- 387 (15%) underwent ABI changes, 2,278 did not (on Ubuntu).
- Leaving 500–600 libraries in the transition(?)
The Debian analysis looks like this so far:
Total *-dev packages: 10,323
5,086 (49%) contain no shared library (indeed, 4,963 of those are golang-*, librust-* and libghc-*), leaving 5,237 packages to check.
Of those 5,237, 329 (6%) changed ABI due to time_t and another 58 (1%) changed ABI due to enabling LFS, a total of 387.
Analysis using abi-compliance-checker showed 1,840 (35%) did not change ABI and 1,637 (31%) failing to complete the testsuite or having inconclusive results.
This implies 400–500 packages in the transition.
CategoryPermalink: mentioned in the Release notes for trixie
