Linux VM Shutdown

Westmacott Claire 21 Reputation points
2024-09-19T09:22:47.87+00:00

After a shutdown and start of a virtual machine. The VM time zone has changed from UTC to BST.

Any ideas as to why would change?

Its a database VM so i need confirmation of why this is changing.

The VM is located in West Europe.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,910 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 109.9K Reputation points MVP
    2024-09-19T09:37:28.2766667+00:00

    Hi @Westmacott Claire ,

    please take a look here how the time synchronization for Linux VMs is working in Azure:

    Time sync for Linux VMs in Azure

    Depending on the configuration this will hopefully bring some light in your question "why the timezone changed".


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Mohammed Araan 0 Reputation points
    2024-09-19T09:37:41.6033333+00:00

    The change in time zone from UTC to BST (British Summer Time) after restarting your virtual machine (VM) can be attributed to several factors related to time zone settings and daylight saving time (DST) configurations.

    Automatic Time Zone Adjustment: Many operating systems, especially those running in regions that observe DST, are configured to automatically switch between standard time (UTC) and daylight saving time (BST). If your VM is set to a location that observes DST, it may automatically adjust the time zone during the transition periods.

    VM Configuration: If your VM was provisioned with a specific time zone setting that includes DST adjustments, it might revert to that setting upon reboot. This is common in cloud environments where the VM's time zone is set based on the region during provisioning.

    Time Synchronization Services: If the VM is configured to synchronize its clock with an external time server, it might pull the local time settings from that server, which could include DST adjustments.

    To maintain consistent time settings on a database VM, consider disabling automatic adjustments for DST or explicitly setting the time zone to UTC, which does not change with daylight saving transitions. This can help avoid potential issues with timestamps in database entries and logs.

    0 comments No comments

  2. anashetty 255 Reputation points Microsoft Vendor
    2024-09-19T17:38:59.25+00:00

    Hi Westmacott Claire,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    In addition to Andreas Baumgarten, we are providing few more inputs to help you.

    Operating System Time Sync Behavior: Some operating systems are configured to adjust the time zone based on the region the VM is located in. In your case, since the VM is in West Europe (UK region), the OS may have automatically shifted the time to BST when the system was restarted, especially if daylight saving time (DST) settings are enabled.

    You can manually set the Time zone:

    1. Connect to your Azure VM using Remote Desktop (for Windows) or SSH (for Linux).
    2. Open Command Prompt (Windows) or Terminal (Linux).
    3. Enter the following command to set the desired time zone: tzutil.exe /s "Central Standard Time". Replace "Central Standard Time" with the appropriate time zone for your region.
    4. To verify the change, run this command: tzutil.exe /g this will display the current time zone of the VM.
    5. Finally, restart your VM to ensure the new time zone persists across reboots.

    If the time zone setting still does not persist after a reboot, you can try setting the time zone in the registry. Here are the steps:

    1. Open the Registry Editor by typing "regedit" in the Start menu search bar.
    2. Navigate to the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
    3. Create a new DWORD value named "RealTimeIsUniversal" and set its value to 1.
    4. Create a new string value named "TimeZoneKeyName" and set its value to the name of your desired time zone. For example, "Central Standard Time".
    5. Restart the VM to see if the time zone setting persists after a reboot.

    If you have any further queries, please do let us know.

    If the answer is helpful, please click "Accept Answer" and "Upvote it."

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.