- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    8, 11, 17, 21
- 
        b12
- 
        generic
- 
        linux_debian_3.0
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8369379 | 21.0.10-oracle | Weibing Xiao | P4 | Resolved | Fixed | b02 | 
| JDK-8369884 | 21.0.10 | Goetz Lindenmaier | P4 | Resolved | Fixed | master | 
| JDK-8369384 | 17.0.18-oracle | Weibing Xiao | P4 | Resolved | Fixed | b02 | 
| JDK-8369888 | 17.0.18 | Goetz Lindenmaier | P4 | Resolved | Fixed | master | 
| JDK-8369388 | 11.0.30-oracle | Weibing Xiao | P4 | Resolved | Fixed | b02 | 
| JDK-8369391 | 8u481 | Weibing Xiao | P4 | Resolved | Fixed | b02 | 
Java Version: OpenJDK 17 & 21
OS: Debian GNU/Linux 12 (bookworm)
A DESCRIPTION OF THE PROBLEM :
In recent versions of Debian (starting with Debian 12), the system no longer relies on /etc/timezone for timezone management. Instead, Debian and systemd have transitioned to using /etc/localtime as the authoritative source for timezone data. However, OpenJDK still prioritizes /etc/timezone when determining the system timezone, leading to inconsistencies between the system's timezone and the default timezone for the JVM.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Set the system timezone using timedatectl: "sudo timedatectl set-timezone Europe/Paris"
2. Check /etc/localtime and /etc/timezone: "ls -l /etc/localtime; cat /etc/timezone"
Observe that /etc/localtime points to /usr/share/zoneinfo/Europe/Paris, but /etc/timezone has not been updated.
3. Run a simple Java application and retrieve the default timezone:
System.out.println(java.util.TimeZone.getDefault());
Observe that the JVM reports the timezone from /etc/timezone
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java should use /etc/localtime as the primary source for determining the system timezone, consistent with Debian’s new standard.
ACTUAL -
Java uses /etc/timezone, causing mismatches between the system timezone and the JVM timezone.
CUSTOMER SUBMITTED WORKAROUND :
Explicitly specifying the timezone with the "TZ" variable or "-Duser.timezone" JVM option.
or
Manually updating /etc/timezone after changing the systems timezone with "timedatectl":
timedatectl show --value --property=Timezone | sudo tee /etc/timezone
FREQUENCY : always
- backported by
- 
                    JDK-8369379 JVM Prefers /etc/timezone Over /etc/localtime on Debian 12 -           
- Resolved
 
-         
- 
                    JDK-8369384 JVM Prefers /etc/timezone Over /etc/localtime on Debian 12 -           
- Resolved
 
-         
- 
                    JDK-8369388 JVM Prefers /etc/timezone Over /etc/localtime on Debian 12 -           
- Resolved
 
-         
- 
                    JDK-8369391 JVM Prefers /etc/timezone Over /etc/localtime on Debian 12 -           
- Resolved
 
-         
- 
                    JDK-8369884 JVM Prefers /etc/timezone Over /etc/localtime on Debian 12 -           
- Resolved
 
-         
- 
                    JDK-8369888 JVM Prefers /etc/timezone Over /etc/localtime on Debian 12 -           
- Resolved
 
-         
- relates to
- 
                    JDK-6456628 (tz) Default timezone is incorrectly set occasionally on Linux -           
- Closed
 
-         
- links to
- 
                     Commit(master)
        openjdk/jdk17u-dev/2735d223 Commit(master)
        openjdk/jdk17u-dev/2735d223
- 
                     Commit(master)
        openjdk/jdk21u-dev/245ba287 Commit(master)
        openjdk/jdk21u-dev/245ba287
- 
                     Commit(master)
        openjdk/jdk/c8a521fd Commit(master)
        openjdk/jdk/c8a521fd
- 
                     Review(master)
        openjdk/jdk17u-dev/4038 Review(master)
        openjdk/jdk17u-dev/4038
- 
                     Review(master)
        openjdk/jdk21u-dev/2318 Review(master)
        openjdk/jdk21u-dev/2318
- 
                     Review(master)
        openjdk/jdk/23755 Review(master)
        openjdk/jdk/23755