资讯详情

apt-get E: invalid for another 97d 16h 31min 18s) / ubuntu修改系统时间

一、前言

在 Linux 想要在系统上安装工具软件,总是无法成功安装。

我找到了很多方法,比如修改阿里云镜像,清华大学镜像,然后执行 sudo apt-get update等等,总是失败。

root@sonic:/etc/apt# sudo apt-get update  Get:1 http://debian-archive.trafficmanager.net/debian bullseye InRelease [116 kB]        Get:2 http://debian-archive.trafficmanager.net/debian-security bullseye-security InRelease [44.1 kB] Get:3 http://debian-archive.trafficmanager.net/debian bullseye-backports InRelease [44.2 kB] Get:4 https://download.docker.com/linux/debian bullseye InRelease [43.3 kB]              Reading package lists... Done                                                                                                                                                E: Release file for http://debian-archive.trafficmanager.net/debian/dists/bullseye/InRelease is not valid yet (invalid for another 97d 16h 31min 18s). Updates for this repository will not be applied. E: Release file for http://debian-archive.trafficmanager.net/debian-security/dists/bullseye-security/InRelease is not valid yet (invalid for another 100d 13h 50min 19s). Updates for this repository will not be applied. E: Release file for http://debian-archive.trafficmanager.net/debian/dists/bullseye-backports/InRelease is not valid yet (invalid for another 100d 9h 7min 52s). Updates for this repository will not be applied. E: Release file for https://download.docker.com/linux/debian/dists/bullseye/InRelease is not valid yet (invalid for another 80d 20h 34min 28s). Updates for this repository will not be applied. root@sonic:/etc/apt#  root@sonic:/etc/apt#  root@sonic:/etc/apt#  

后来偶然看到这边的博文 链接地址的原 ,确定是系统时间戳不正确造成的问题。 在这里插入图片描述

二、修改时区和更新时间

1、概念

Ubuntu时间分为两种 Ubuntu时钟分为系统时钟(System Clock)和硬件(Real Time Clock,简称RTC)时钟。

查看当前时间

root@sonic:/etc/apt# date -R # 查看系统时间 Sat, 02 Apr 2022 17:18:04  0000  # 当前时区为0时区 root@sonic:/etc/apt#  root@sonic:/etc/apt# sudo hwclock --show # 检查硬件时间 2022-04-02 17:18:15.655539 00:00 

3、运行 tzselect 选择时区

4.复制文件到 /etc 并在目录下查看时区

root@sonic:/etc/apt# sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime root@sonic:/etc/apt# date -R Sun, 03 Apr 2022 01:20:59  0800  # 时区为东8区 root@sonic:/etc/apt#  

5.设置正确的系统时间

roo@sonic:/etc/apt# sudo date -s 07/12/22 # 修改日期
Tue 12 Jul 2022 12:00:00 AM CST
root@sonic:/etc/apt# sudo date -s 15:38:00 # 修改时间
Tue 12 Jul 2022 03:38:00 PM CST
root@sonic:/etc/apt# sudo hwclock --systohc # 修改硬件CMOS时间;这个步骤非常重要,如果没有这一步,重启后,时区又会发生改变
root@sonic:/etc/apt# 
root@sonic:/etc/apt# 
root@sonic:/etc/apt# date
Tue 12 Jul 2022 03:38:16 PM CST  # 系统时间正确
root@sonic:/etc/apt# 

标签: 18s弯头连接器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台