Ubuntu20's tzselect setting time failure problem, Raspberry Pi server (recommended)

Ubuntu20's tzselect setting time failure problem, Raspberry Pi server (recommended)

I upgraded my Raspberry Pi server to Ubuntu 20 two days ago. Today I found that the server's time zone was wrong, the scheduled tasks did not start, and the python installation packages were lost. All Docker images are lost. There is no other choice but to set it again. This article first discusses the issue of setting the time zone. In this article I found three ways to set the time

tzselect is invalid, I don't know why timedatectl is set successfully. It is recommended to use cp time zone file, and it is not recommended to use the method of viewing time

insert image description here

The current time is 10:41 am. The time zone is obviously wrong, with a difference of 8 hours.

Use tzselect to set, no success

insert image description here

I followed the prompts and selected: 4) Asia ----> 9) China ------> 1) Beijing and there were no problems. I even followed the last prompt and added TZ='Asia/Shanghai' to the last line of .profile and disconnected the ssh connection and logged back in, but the time setting still failed.

timedatectl After searching, I found this tool

timedatectl is a command-line tool that allows you to view or modify the system time and date. It is available on all modern Linux based systems including Ubuntu 20.04.

timedatectl prints the current time zone information

[External link image transfer failed. The source site may have an anti-hotlink mechanism. It is recommended to save the image and upload it directly (img-ukKXLTGM-1589166731775)(/Users/dasouche/Library/Application Support/typora-user-images/image-20200511105339889.png)]

If you run it directly without parameters, the time information will be printed normally.

timedatectl to view the time zones that can be set

timedatectl list-timezones

Run with the list-timezones parameter and you will see the following results:

ubuntu@ubuntu ~ % timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Algiers
Africa/Bissau
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/El_Aaiun
Africa/Johannesburg
Africa/Juba
Africa/Khartoum
Africa/Lagos
Africa/Maputo
Africa/Monrovia
Africa/Nairobi
Africa/Ndjamena
Africa/Sao_Tome
Africa/Tripoli
Africa/Tunisia
Africa/Windhoek
America/Adak
America/Anchorage
America/Araguaina
America/Argentina/Buenos_Aires
America/Argentina/Catamarca
America/Argentina/Cordoba
America/Argentina/Jujuy
America/Argentina/La_Rioja
America/Argentina/Mendoza
America/Argentina/Rio_Gallegos
America/Argentina/Salta
America/Argentina/San_Juan
America/Argentina/San_Luis
America/Argentina/Tucuman
America/Argentina/Ushuaia
America/Asuncion
America/Atikokan
America/Bahia
America/Bahia_Banderas
America/Barbados
America/Belem
America/Belize
America/Blanc-Sablon
America/Boa_Vista
America/Bogota
America/Boise
America/Cambridge_Bay
America/Campo_Grande
America/Cancun
America/Caracas
America/Cayenne
America/Chicago
America/Chihuahua
America/Costa_Rica
America/Creston
America/Cuiaba
lines 1-56

The results above are incomplete. Scroll down and you will see the Asia/Shanghai line.

timedatectl set time zone

sudo timedatectl set-timezone Asia/Shanghai

After the setting is successful, check the time again

[External link image transfer failed. The source site may have an anti-hotlink mechanism. It is recommended to save the image and upload it directly (img-TwcQRM77-1589166731780)(/Users/dasouche/Library/Application Support/typora-user-images/image-20200511110653006.png)]

cp file to set time zone

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

This method can also be used to set the time, but it is recommended to use the timedatectl tool. Because timedatectl tool masks the differences between various Linux systems.

Summarize

This is the end of this article about the problem of Ubuntu 20's tzselect setting time expiration and Raspberry Pi server. For more information about Ubuntu 20's tzselect setting time expiration and Raspberry Pi server, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • An example of building a Django server on Raspberry Pi 3

<<:  Detailed example of how to implement transaction commit and rollback in mysql

>>:  jQuery to achieve the barrage effect case

Recommend

Detailed tutorial on setting password for MySQL free installation version

Method 1: Use the SET PASSWORD command MySQL -u r...

JavaScript canvas to load pictures

This article shares the specific code of JavaScri...

Tutorial on installing the unpacked version of mysql5.7 on CentOS 7

1. Unzip the mysql compressed package to the /usr...

Detailed explanation of Nginx passively checking the server's survival status

introduce Monitors the health of HTTP servers in ...

User experience analysis of facebook dating website design

<br />Related article: Analysis of Facebook&...

How to remount the data disk after initializing the system disk in Linux

Remount the data disk after initializing the syst...

Steps to package and deploy the Vue project to the Apache server

In the development environment, the vue project i...

Install zip and unzip command functions under Linux and CentOS (server)

Install zip decompression function under Linux Th...

js Promise concurrent control method

Table of contents question background Idea & ...

How to automatically number the results of MYSQL query data

Preface In fact, I have never encountered this ki...

Vue implements sample code to disable browser from remembering password function

Find information Some methods found on the Intern...

Complete steps of centos cloning linux virtual machine sharing

Preface When a Linux is fully set up, you can use...