首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >树莓派升级失败

树莓派升级失败
EN

Stack Overflow用户
提问于 2020-12-29 00:06:12
回答 2查看 687关注 0票数 0

当我试图在raspberry pi上升级或更新raspberry pi或python时,我得到了这个错误。

代码语言:javascript
复制
pi@raspberry:/$ sudo apt-get install python
sudo: unable to resolve host raspberry: Name or service not known
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ***
Suggested packages:
  ***
0 upgraded, 101 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,560 kB/33.3 MB of archives.
After this operation, 104 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython2.7-minimal armhf 2.7.16-2+deb10u1 [395 kB]
Get:2 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2.7-minimal armhf 2.7.16-2+deb10u1 [1,091 kB]
Get:3 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2-minimal armhf 2.7.16-1 [41.4 kB]
Get:4 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python-minimal armhf 2.7.16-1 [21.0 kB]
Get:5 http://mirror.as43289.net/raspbian/raspbian buster/main armhf mime-support all 3.62 [37.2 kB]
Get:6 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libexpat1 armhf 2.2.6-2+deb10u1 [77.3 kB]
Get:7 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython2.7-stdlib armhf 2.7.16-2+deb10u1 [1,844 kB]
Get:8 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2.7 armhf 2.7.16-2+deb10u1 [305 kB]
Get:9 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython2-stdlib armhf 2.7.16-1 [20.8 kB]
Get:10 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython-stdlib armhf 2.7.16-1 [20.8 kB]
Get:11 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2 armhf 2.7.16-1 [41.6 kB]
Get:12 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python armhf 2.7.16-1 [22.8 kB]
Get:13 http://mirror.as43289.net/raspbian/raspbian buster/main armhf bzip2 armhf 1.0.6-9.2~deb10u1 [46.2 kB]
Get:14 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libmagic-mgc armhf 1:5.35-4+deb10u1 [242 kB]
Get:15 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libmagic1 armhf 1:5.35-4+deb10u1 [110 kB]
Get:16 http://mirror.as43289.net/raspbian/raspbian buster/main armhf file armhf 1:5.35-4+deb10u1 [65.4 kB]
Get:17 http://mirror.as43289.net/raspbian/raspbian buster/main armhf xz-utils armhf 5.2.4-1 [179 kB]
Fetched 4,560 kB in 21s (219 kB/s)
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 29%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 59%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 89%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 100%
dpkg: error: parsing file '/var/lib/dpkg/status' near line 0:
 newline in field name '▒PNG'
E: Sub-process /usr/bin/dpkg returned an error code (2)

我在一开始就使用了这些代码。但是对于每一个错误,我得到了相同的错误代码(2)

代码语言:javascript
复制
sudo apt-get upgrade
sudo apt-get update
sudo apt-get install python

我使用的是树莓派1版本。这是我知道的旧版本,但我必须使用这个。请帮帮我。谢谢你们所有人。

EN

回答 2

Stack Overflow用户

发布于 2021-05-20 22:41:55

代码语言:javascript
复制
sudo apt-get update
sudo apt-get upgrade -y

升级时会失败。因为此命令将再次更新sources.list。正因为如此,它显示此错误。您可以再次运行sudo apt-get update && sudo apt-get upgrade -y。没问题的。

票数 1
EN

Stack Overflow用户

发布于 2020-12-29 00:11:58

您似乎没有在/etc/hosts文件上正确设置主机。为了解决这个问题,你应该将raspberry添加到这个文件中。为此,您可以创建sudo nano /etc/hosts,并将此用户名添加到127.0.1.1地址后已有用户名的旁边。不是在单词localhost之后(最肯定的是,您必须编辑第二行)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65480491

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档