apt-get update时出现错误的备注

概述

如果将之前备份的映像重新安装到SD卡中,无法正确更新软件包。
以下是解决此问题的备忘录。

事先准备

将安装在树莓派上的SD卡镜像备份,并在经过1年以上后再次将该镜像重新安装到SD卡上。

包裹更新

请在控制台中执行以下命令。

■命令
sudo apt-get update

■执行结果
会显示如下错误消息。

pi@raspberrypi:~ $ sudo apt-get update
Hit:1 https://linux.teamviewer.com/deb stable InRelease                        
Get:2 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]         
Get:3 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]      
Reading package lists... Done                                                  
E: Repository 'http://raspbian.raspberrypi.org/raspbian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
E: Repository 'http://archive.raspberrypi.org/debian buster InRelease' changed its 'Suite' value from 'testing' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

错误解决方法

如果出现了类似”Repository ‘http://raspbian.raspberrypi.org/raspbian buster InRelease’的’Suite’值已从’stable’更改为’oldstable'”的错误,执行以下命令。

■命令
sudo apt-get更新 –allow-releaseinfo-change

■执行结果
pi@raspberrypi:~ $ sudo apt-get update –allow-releaseinfo-change
已连接:1 https://linux.teamviewer.com/deb stable 正在获取信息
正在获取:2 http://archive.raspberrypi.org/debian buster 正在获取信息 [32.6 kB]
正在获取:3 http://raspbian.raspberrypi.org/raspbian buster 正在获取信息 [15.0 kB]
正在获取:4 http://archive.raspberrypi.org/debian buster/main armhf 软件包 [392 kB]
正在获取:5 http://raspbian.raspberrypi.org/raspbian buster/main armhf 软件包 [13.0 MB]
正在获取:6 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf 软件包 [58.8 kB]
正在获取:7 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf 软件包 [104 kB]
已获取 13.6 MB,34s 内(399 kB/s)
正在读取软件包列表… 完成
N: 仓库 ‘http://archive.raspberrypi.org/debian buster InRelease’ 将 ‘Suite’ 值从 ‘testing’ 更改为 ‘oldstable’
N: 仓库 ‘http://raspbian.raspberrypi.org/raspbian buster InRelease’ 将 ‘Suite’ 值从 ‘stable’ 更改为 ‘oldstable’

更新软件包

当我尝试用以下命令重新更新软件包时,软件包成功更新了。

■指令
以管理员身份更新apt

■执行结果。

pi@raspberrypi:~ $ sudo apt-get update
Hit:1 http://archive.raspberrypi.org/debian buster InRelease                                                          
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease                                                       
Hit:3 https://linux.teamviewer.com/deb stable InRelease      
Reading package lists... Done                         
pi@raspberrypi:~ $ 

提升操作系统版本。

要升级操作系统的版本,请执行以下命令。

■命令
sudo apt-get 升级系统

实际执行结果
完成需要花费1-2个小时以上。>。<

pi@raspberrypi:~ $ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
...
...
...
After this operation, 1,613 MB of additional disk space will be used.
Do you want to continue [Y/n]?
...
...
...
Get:464 http://archive.raspberrypi.org/debian buster/main armhf rpi-eeprom armhf 16.0-1~buster [2,337 kB]                                                                   
Get:465 http://archive.raspberrypi.org/debian buster/main armhf rpi-eeprom-images armhf 16.0-1~buster [11.1 kB]                                                             
Get:466 http://archive.raspberrypi.org/debian buster/main armhf rpi-update all 20210618 [7,920 B]                                                                           
Get:467 http://archive.raspberrypi.org/debian buster/main armhf scratch2 all 0.26 [6,908 B]                                                                                 
Get:468 http://archive.raspberrypi.org/debian buster/main armhf sense-emu-tools all 1.2-1 [70.2 kB]                                                                         
Get:469 http://archive.raspberrypi.org/debian buster/main armhf thonny all 3.3.10-1+rpt1 [788 kB]                                                                           
Get:470 http://archive.raspberrypi.org/debian buster/main armhf vlc-plugin-notify armhf 3.0.17.4-0+deb10u2+rpt1 [128 kB]                                                    
Get:471 http://archive.raspberrypi.org/debian buster/main armhf vlc-plugin-samba armhf 3.0.17.4-0+deb10u2+rpt1 [129 kB]                                                     
Get:472 http://archive.raspberrypi.org/debian buster/main armhf vlc-plugin-video-splitter armhf 3.0.17.4-0+deb10u2+rpt1 [142 kB]                                            
Get:473 http://archive.raspberrypi.org/debian buster/main armhf vlc-plugin-visualization armhf 3.0.17.4-0+deb10u2+rpt1 [143 kB]                                             
Get:474 http://archive.raspberrypi.org/debian buster/main armhf scratch3 armhf 1.0.6 [121 MB]                                                                               
Fetched 1,613 MB in 4min 40s (5,751 kB/s)                                                                                                                                   
Reading changelogs... Done
...
...
...
Processing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for libc-bin (2.28-10+rpt2+rpi1+deb10u1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for gnome-icon-theme (3.12.0-3) ...
Processing triggers for libgdk-pixbuf2.0-0:armhf (2.38.1+dfsg-1) ...
Processing triggers for shared-mime-info (1.10-1) ...
Processing triggers for install-info (6.5.0.dfsg.1-4+b1) ...
Processing triggers for fontconfig (2.13.1-2) ...
Processing triggers for desktop-file-utils (0.23-4) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for initramfs-tools (0.133+deb10u1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for dictionaries-common (1.28.1) ...
Processing triggers for ca-certificates (20200601~deb10u2) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Processing triggers for libvlc-bin:armhf (3.0.17.4-0+deb10u2+rpt1) ...
pi@raspberrypi:~ $ 

结束

一开始我一直在使用Raspberry PI 3B+,但是某一天它突然无法启动了。
然后我把之前下载的镜像安装到SD卡上,但是不知道为什么无法正确启动。
我开始觉得难道是RPI的主体损坏了?但是启动时显示的标志可以正常显示,只是桌面画面无法显示。
我想也许是操作系统版本的问题?于是我安装了之前备份的镜像,然后问题就解决了。
接下来我要尝试查找能从无法启动的SD卡中恢复的方法。