今天碰到一个更新软件源的问题
先上错误:
root@hi3798mv200:/etc/apt# apt-get update
Get:1 http://mirrors.aliyun.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://mirrors.aliyun.com/ubuntu-ports focal-updates InRelease [114 kB]
Get:3 http://mirrors.aliyun.com/ubuntu-ports focal-backports InRelease [108 kB]
Get:4 http://mirrors.aliyun.com/ubuntu-ports focal-security InRelease [114 kB]
Reading package lists... Done
E: Release file for http://mirrors.aliyun.com/ubuntu-ports/dists/focal-updates/InRelease is not valid yet (invalid for another 98d 0h 23min 33s). Updates for this repository will not be applied.
E: Release file for http://mirrors.aliyun.com/ubuntu-ports/dists/focal-backports/InRelease is not valid yet (invalid for another 97d 23h 34min 52s). Updates for this repository will not be applied.
E: Release file for http://mirrors.aliyun.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 98d 0h 56min 45s). Updates for this repository will not be applied.
解决方法如下
敲命令
tzselect
然后下面会出现选择亚洲->国家->城市
`
root@hi3798mv200:/etc/apt# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa 5) Atlantic Ocean 9) Pacific Ocean
2) Americas 6) Australia 10) coord - I want to use geographical coordinates.
3) Antarctica 7) Europe 11) TZ - I want to specify the timezone using the Posix TZ format.
4) Asia 8) Indian Ocean
#? 4
Please select a country whose clocks agree with yours.
1) Afghanistan 7) Bhutan 13) Georgia 19) Israel 25) Kuwait 31) Mongolia 37) Philippines 43) Syria 49) Uzbekistan
2) Antarctica 8) Brunei 14) Hong Kong 20) Japan 26) Kyrgyzstan 32) Myanmar (Burma) 38) Qatar 44) Taiwan 50) Vietnam
3) Armenia 9) Cambodia 15) India 21) Jordan 27) Laos 33) Nepal 39) Russia 45) Tajikistan 51) Yemen
4) Azerbaijan 10) China 16) Indonesia 22) Kazakhstan 28) Lebanon 34) Oman 40) Saudi Arabia 46) Thailand
5) Bahrain 11) Cyprus 17) Iran 23) Korea (North) 29) Macau 35) Pakistan 41) Singapore 47) Turkmenistan
6) Bangladesh 12) East Timor 18) Iraq 24) Korea (South) 30) Malaysia 36) Palestine 42) Sri Lanka 48) United Arab Emirates
#? 10
Please select one of the following timezones.
1) Beijing Time
2) Xinjiang Time
#? 1
The following information has been given:
China
Beijing Time
Therefore TZ='Asia/Shanghai' will be used.
Selected time is now: Mon 10 Jan 2022 03:05:20 PM CST.
Universal Time is now: Mon 10 Jan 2022 07:05:20 AM UTC.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai
root@hi3798mv200:/etc/apt#
`
暂时省略 如果不行敲这个命令 默认不需要
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
执行完应该就可以 然后安装一下ntpdate
apt-get install ntpdate
安装完之后执行下面命令
ntpdate ntp.aliyun.com
如果还有问题 尝试
apt-cache pkgnames
清理一下包再执行
apt update && apt upgrade -y
完活儿