Home / Linux

Operating systems

Y2038 and Linux

The kernel could count past 2038 on 32-bit hardware from 5.6 (2020). Userland had to catch up. Distributions are still choosing which 32-bit ABIs to break.

Kernel

Linux 5.6 added 64-bit time support on 32-bit architectures so embedded boards would not be stranded. That does not rewrite every syscall an old binary makes. A time32 process on a time64 kernel still sees a 32-bit time_t unless it was built for the new ABI.

glibc

From glibc 2.34, 32-bit programs can request 64-bit time with:

#define _TIME_BITS 64
#define _FILE_OFFSET_BITS 64

Both macros are required together. This is an ABI change for any library that puts time_t in a public struct. You rebuild the world, or you do not flip the switch.

Debian

Debian’s release goal “64-bit time” rebuilt 32-bit libraries for time64 on every 32-bit architecture except i386. armel and armhf changed without a soname bump; third-party binaries that handle dates must be recompiled. i386 stays time32 because its job is running old x86 binaries. That decision is documented in Debian’s Trixie release notes work and the 64-bit-time wiki page.

Other general-purpose distros have been dropping 32-bit ports entirely. The remaining 32-bit Linux population is therefore concentrated in Debian-family images, Yocto/Buildroot/OpenEmbedded products, Android-derived trees, and Alpine-like minimal systems.

What to check on a box

getconf LONG_BIT
uname -m
# size of time_t in the C library the process actually uses
cat /usr/include/bits/timesize.h 2>/dev/null

Then inspect filesystems: an XFS volume mounted with “supports timestamps until 2038” is a time32 on-disk format, independent of userland.

How to build a time64 32-bit binary

On a glibc 2.34+ 32-bit userland the switch is compile-time, not a sysctl:

cc -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -o probe probe.c
# confirm the type width the binary actually linked
# sizeof(time_t) should print 8

Any shared library that embeds time_t in a public struct must be rebuilt with the same flags. Mixing a time64 program with a time32 libfoo.so is an ABI break: stack layouts and stat structs will not match.

What “fixed kernel” does not mean

A 5.15 or 6.x kernel on a 32-bit board can still boot a time32 rootfs. Check the userspace you ship (Buildroot defconfig, Yocto TCLIBC, Debian architecture), not only uname -r. i386 Debian remains time32 by policy so old x86 binaries keep working.