Linux mint local time

Linux Mint Forums

Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

How to sync time on Mint 19.3?

Post by Mushin » Sun May 15, 2022 6:34 am

The reason my clock is out of sync is that I had to boot from a windows 10 stick.
I have tried searching the web but I had no luck or did not stumble upon a correct solution.
Everything I tried seems to be out of date or not specific to Linux Mint 19.3.
What is the current way to force a time sync on Mint 19.3?

The lack of a sync time button in the date and time preferences is really annoying! Enabling the option should do a sync immediately. But no.
I don’t want to use my local time as system time to make Windows happy I just want to enable and force time sync on demand.

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

mikeflan Level 15
Posts: 5518 Joined: Sun Apr 26, 2020 9:28 am Location: Houston, TX

Re: How to sync time on Mint 19.3?

Post by mikeflan » Sun May 15, 2022 9:08 am

Click on time in the lower right (right side of task bar) — select «Date and time Settings» and turn on Network time.

Re: How to sync time on Mint 19.3?

Post by Mushin » Sun May 15, 2022 10:35 am

mikeflan wrote: ⤴ Sun May 15, 2022 9:08 am Click on time in the lower right (right side of task bar) — select «Date and time Settings» and turn on Network time.

Re: How to sync time on Mint 19.3?

Post by iliketrains » Sun May 15, 2022 11:41 am

Mushin wrote: ⤴ Sun May 15, 2022 6:34 am The reason my clock is out of sync is that I had to boot from a windows 10 stick.
I have tried searching the web but I had no luck or did not stumble upon a correct solution.

Then you have seen mention of local time, universal time, and real time (hardware clock). Confusing stuff isn’t it ?

Sync every boot sounds like a nuisance. Better would be setting Mint and Windows to match. I’m not sure which OS is better to change. I’ll be back if nobody offers an opinion on those 2 options.

edit (much later)/ Sorry I’m bailing out. Don’t know what’s changed since 19.3 and will not offer commands I can’t fully test.

mikeflan Level 15
Posts: 5518 Joined: Sun Apr 26, 2020 9:28 am Location: Houston, TX

Re: How to sync time on Mint 19.3?

Post by mikeflan » Sun May 15, 2022 7:28 pm

Читайте также:  Linux kernel panic no init found

Re: How to sync time on Mint 19.3?

Post by MAlfare » Mon May 16, 2022 8:59 am

mikeflan wrote: ⤴ Sun May 15, 2022 7:28 pm You can try this if you want to:
https://www.golinuxhub.com/2017/12/how- . -and-time/

Re: How to sync time on Mint 19.3?

Post by djph » Mon May 16, 2022 11:02 am

mikeflan wrote: ⤴ Sun May 15, 2022 7:28 pm You can try this if you want to:
https://www.golinuxhub.com/2017/12/how- . -and-time/

iliketrains wrote: ⤴ Sun May 15, 2022 11:41 am Sync every boot sounds like a nuisance. Better would be setting Mint and Windows to match. I’m not sure which OS is better to change. I’ll be back if nobody offers an opinion on those 2 options.

The root cause is typically due to Windows expects the BIOS clock is in localtime, whereas Linux expects it to be UTC. The reason one cannot just sync on linux boot then is because the time is too far off (an hour or more, unless you live in an area where localtime IS UTC/GMT).

Easiest fix is to tell linux that the hwclock is in localtime — timedatectl set-local-rtc 1 —adjust-system-clock .

Re: How to sync time on Mint 19.3?

Post by iliketrains » Mon May 16, 2022 1:59 pm

ntp.service - Network Time Service Active: active (running) since Sun 2022-05-15 15:55:58 CDT; 20h ago 

It’s like one hand doesn’t know what the other is doing sort of thing. Shrugs.

Tip of the day: Don’t install an OS when the bios battery is dead. I made that mistake the day before this topic was posted.

Re: How to sync time on Mint 19.3?

Post by MAlfare » Mon May 16, 2022 5:21 pm

mikeflan wrote: ⤴ Sun May 15, 2022 7:28 pm You can try this if you want to:
https://www.golinuxhub.com/2017/12/how- . -and-time/

Re: How to sync time on Mint 19.3?

Post by Mushin » Tue May 17, 2022 4:23 am

$ timedatectl status Local time: Tue 2022-05-17 10:08:38 CEST Universal time: Tue 2022-05-17 08:08:38 UTC RTC time: Tue 2022-05-17 08:08:38 Time zone: Europe/Zagreb (CEST, +0200) System clock synchronized: no systemd-timesyncd.service active: yes RTC in local TZ: no $ systemctl status ntp Unit ntp.service could not be found. $ /etc/init.d/ntp ntptimeset bash: /etc/init.d/ntp: No such file or directory $ 

I’d like to simply force the update. But there seems to be a problem with time sync on my system It does not work automatically, even after several days now it did not update even once. The reason I prefer to force it instead of syncing windows and Linux is because Linux complains if HW clock is set to local time, windows might break if clock is set to UTC. Lets just appreciate for a moment how stupid Windows is. Setting the HW clock to UTC is the only logical choice.

Re: How to sync time on Mint 19.3?

Post by Mushin » Tue May 17, 2022 5:25 am

I tired to update and none of the repositories would load.
Looks like setting up a static IP and changing the DNS servers to cloudflare was the problem.
This also affected NTP time sync somehow.
I have reset the network connection settings to default and set it to Automatic DHCP. Also I have enabled IPv6.
Now everything works!

If anyone can explain it would be great to know why and how to avoid this problem when using alternate DNS.

Re: How to sync time on Mint 19.3?

Post by djph » Tue May 17, 2022 5:32 am

Mushin wrote: ⤴ Tue May 17, 2022 5:25 am I tired to update and none of the repositories would load.
Looks like setting up a static IP and changing the DNS servers to cloudflare was the problem.
This also affected NTP time sync somehow.
I have reset the network connection settings to default and set it to Automatic DHCP. Also I have enabled IPv6.
Now everything works!

Читайте также:  Centos linux headers install

If anyone can explain it would be great to know why and how to avoid this problem when using alternate DNS.

There typically is no problem with using alternative DNS services. «Static IP» may certainly be problematic if you selected an IP address in the range of your DHCP server and caused an IP conflict.

Re: How to sync time on Mint 19.3?

Post by Mushin » Tue May 17, 2022 5:43 am

Mushin wrote: ⤴ Tue May 17, 2022 5:25 am I tired to update and none of the repositories would load.
Looks like setting up a static IP and changing the DNS servers to cloudflare was the problem.
This also affected NTP time sync somehow.
I have reset the network connection settings to default and set it to Automatic DHCP. Also I have enabled IPv6.
Now everything works!

If anyone can explain it would be great to know why and how to avoid this problem when using alternate DNS.

There typically is no problem with using alternative DNS services. «Static IP» may certainly be problematic if you selected an IP address in the range of your DHCP server and caused an IP conflict.

Thanks for the explanation that should be it!
system clock syncronized is now: yes.
The two commands below still dont work.
I guess Mint 19.3 does not use those programs to sync time?

$ timedatectl status Local time: Tue 2022-05-17 10:08:38 CEST Universal time: Tue 2022-05-17 08:08:38 UTC RTC time: Tue 2022-05-17 08:08:38 Time zone: Europe/Zagreb (CEST, +0200) System clock synchronized: yes systemd-timesyncd.service active: yes RTC in local TZ: no $ systemctl status ntp Unit ntp.service could not be found. $ /etc/init.d/ntp ntptimeset bash: /etc/init.d/ntp: No such file or directory $ 

Источник

How to Change Date, Time, and Time Zone in Linux Mint 20

Date, Time and Timezone

A time zone is identified based on the geographic region with the same standard time and date. Typically, the date, time, and time zone are set during the installation of an operational system. Users need to change the time zone for performing a few tasks in Linux platforms. Some jobs in Linux use time zone like cron jobs use it for execution or in logs timestamps. In this tutorial, we will go through different ways of changing the date, time, and time zone in Linux Mint 20 and Ubuntu 20.04.

To have the correct date and time in any operating system is very important since many operations depend on the date and time feature. To set a date, time in Linux Mint, open up the terminal either using the Ctrl+Shift+T shortcut or access it via ApplicationsTerminal.

Change date in Linux from the command line

In Linux platforms, the server and the clock of the system need to be exactly on time. You need to have sudo rights privilege to make such changes in your computer system. To proceed, type the following command in the terminal window:

Set Date in Ubuntu

The output will appear as shown in the figure below and the date will be set based on the input value.

Date changed in Linux Mint

Check the updated date and time from command line

To check the updated time from the command line, simply type

Check the current date on the command line

The output will display the updated time field.

Date on Linux cmd

timedatectl is a utility of Linux that allows users to view the system’s time and date through the terminal. To view the current time, date and time zone, use:

timedatectl command

Change time in Linux from the command line

Users can also change the time from the command line by using

Set new date and time in Ubuntu

Here we have set the time to 15:14:00 and once we press the output will appear as shown below. The time will be updated accordingly.

Читайте также:  Kali linux 2021 virtualbox

Time changed successfully

Change date and time with one command on Ubuntu

Linux allows users to update date and time through one single command as well. To update date and time through the one common command, type the following:

Use a single command to change date and time

11: Hour (hh)
14: Minute (mm)
00: Second (ss)

As soon as you hit the key, the output will appear indicating that the date and time are updated accordingly.

Date and time changed

Set hardware clock in Linux

A hardware clock runs within the hardware of your computer system even if there is no power supply still it continues to function. To check out the hardware clock use the following command:

Show hardware clock time

The output will appear as shown in the figure below, displaying the time of the hardware clock.

Date and time as stored in hardware clock of the system

Now let’s check out the method that is used to set the hardware clock to the local time in a Linux system. For that, you will need to type:

$ hwclock --set --date="YYYY-MM-DD 16:45:05" --localtime

Set date and time in hardware clock

The hardware clock will be adjusted according to the local time.

Change the time zone through the command line

In order to change the time zone. First, let’s view the time zone of the system using timedatectl.

timedatectl command

The system time zone in a Linux Mint system is configured by symlinking which is a /etc/localtime file. It is further configured to the binary time zone identifier that exists in the /usr/share/zoneinfo directory.

Another way by which, users can check the available time zone by using:

Get time zone

The output will look like this:

Zone info

List of available time zones

To change the time zone, at first you need to find out and know the name of that time zone which you plan to use. Typically, the time zone in any system follows the “Region/City” format. Let’s view all available options.long name of the time zone you want to use:

$ timedatectl list-timezones

List time zones

The output will show a list similar to the one displayed below:

List of timezones

Now, you can use any of the option from the list to update the time zone. Use the following command:

$ sudo timedatectl set-timezone

Set time zone in Ubuntu

Here, in the example the time zone used by us is America/New_York. You can adjust the time zone as per your requirements following the same method.

Change the date, time, and time zone through GUI

To change the date, time and time zone through the UI method in Linux Mint 20, simply access the date and time shortcut on the bottom right of the screen and click on it. A calendar menu will open up, click on the Date and Time Settings option available at the bottom of the calendar.

Date and Time settings

You will see the Manually set date and Time option. Click on the date option against the Manually set date and time field.

A Select a Date modal will appear, you need to select a date then press the OK button to confirm the selection.

Select a date

To change the time, select the Time option against the Manually set date and time in the Date & Time menu.

Set time zone using GUI

A modal will appear as shown in the figure below, update the time then select OK to reflect changes.

Set time using GUI

To update the time zone, click on Region in date and time modal.

Choose Region

You will see a list of Regions available, select the region first. It will show possible cities for that selected region. You need to select a city to proceed, once done select OK to make changes.

Conclusion

The methods discussed in this tutorial, tell the ways to change the date, time, and time zone in Linux Mint 20. Users can change them either through the command line or through the UI based on their preference. Both methods are easy to implement and explained in detail in this tutorial with examples.

Источник

Оцените статью
Adblock
detector