【ubuntu】树莓派4b安装ubuntu系统以及更新源出现问题的解答

1.树莓派4的GPIO接口介绍

https://www.basemu.com/raspberry-pi-4-gpio-pinout.html
最近一个星期为用树莓派安装了ubuntu系统20.04,但是去找了很多国内源,都是使用不了的,每次使用sudo apt-get update命令就会出现错误,以为是系统问题换了19.10版本也不行,也按照网上的方法去尝试都失败了,现在终于找到了原因

1.1.去ubuntu官网下载最新的树莓派镜像

点击ubuntu官网
找到Download->Raspberry Pi 2, 3 or 4->
在这里插入图片描述

1.2.烧录软件把镜像烧录进sd卡,最好16g以上

2.接下来是重点问题了:安装源的问题

1.在终端输入命令cd …/


这一步必须有,因为不在home目录下打不开源文件的,为曾经就说卡在这里以为系统源文件是空的。

2.输入命令 sudo vi /etc/apt/sources.list

输入命令打开源文件后,先按一下键盘a进入编译模式,把源文件里的红色标注网址全部换成 http://mirrors.aliyun.com/ubuntu-ports
如下图所示(目前最流行这个源,又快又稳)

## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
##     or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu-ports focal main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu-ports focal universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal universe
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu-ports focal multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal multiverse
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu-ports focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://mirrors.aliyun.com/ubuntu-ports focal-security main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu-ports focal-security universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-security universe
deb http://mirrors.aliyun.com/ubuntu-ports focal-security multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-security multiverse

3.很重要的一步:输入sudo reboot重启系统

我曾经就是因为没有重启系统直接sudo apt-get update就导致更新失败,一直以为是源有问题就不断换源,还是失败了,要吸取教训!

4.重启成功后就输入sudo apt-get update就可以了

在这里插入图片描述

3 如何修复Ubuntu Linux中的 “Release file is not valid yet” 错误 ubuntu@ubuntu:~$ sudo apt update

  Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease    
    Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB]                           
    Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB]      
    Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB]                     
    Reading package lists... Done
    E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease is not valid yet (invalid for another 21d 23h 17min 25s). Updates for this repository will not be applied.
    E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease is not valid yet (invalid for another 159d 15h 21min 2s). Updates for this repository will not be applied.
    E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease is not valid yet (invalid for another 159d 15h 21min 32s). Updates for this repository will not be applied.
    E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.

修复 Ubuntu 和其他 Linux 发行版中 “Release file is not valid yet” 的错误。
错误的原因是系统上的时间和现实世界的时间不同

如果你连接到了互联网,你可以等待几分钟让系统同步时间。
使用系统软件更改系统时间

1.使用系统软件更改系统时间

# date –set=”20140125 09:17:00”(当前网络时间pc右下角)

2.强制系统使用本地时间作为实时时钟(硬件时钟)

如果不行,你可以强制系统使用本地时间作为实时时钟(硬件时钟):
sudo timedatectl set-local-rtc 1
如果问题解决了,你可以将实时时钟设置为使用 UTC(Ubuntu 推荐的)。
sudo timedatectl set-local-rtc 0
  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值