【问题标题】:Raspberry Pi Upgrade Fails树莓派升级失败
【发布时间】:2020-12-28 16:06:11
【问题描述】:

当我尝试在 raspberry pi 上升级或更新 raspberry pi 或 python 时,出现此错误

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)

sudo apt-get upgrade
sudo apt-get update
sudo apt-get install python

我使用的是 Raspberry pi 1 版本。这是我知道的旧版本,但我必须使用它。 请帮帮我。谢谢大家。

【问题讨论】:

    标签: raspberry-pi


    【解决方案1】:
    sudo apt-get update
    sudo apt-get upgrade -y
    

    升级时会失败。因为这个命令再次更新了sources.list。因此,它显示此错误。您可以再次运行sudo apt-get update && sudo apt-get upgrade -y。没关系。

    【讨论】:

      【解决方案2】:

      您似乎没有在/etc/hosts 文件中正确设置主机。为了修复它,您应该将覆盆子添加到同一个文件中。您可以通过创建sudo nano /etc/hosts 并将此用户名添加到您在 127.0.1.1 地址之后已有的用户名旁边来做到这一点。不是在 localhost 这个词之后(当然你必须编辑第二行)。

      【讨论】:

      • 我猜你的意思是我需要在控制台中输入这个“sudo nano /etc/hosts”代码
      • 是的,一旦您进行编辑,您可能需要在已经存在的用户名后面加上“raspberry”(不带引号)。 127.0.1.1地址之后的那个
      • 我正在使用 ssh 进行连接。当我输入此代码时,我得到了一些 svg 代码,但我没有找到您给我的用户名和地址
      • 你不能编辑 /etc/hosts 吗?
      • 我正在尝试正常连接
      猜你喜欢
      • 2017-07-21
      • 2020-02-20
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-20
      相关资源
      最近更新 更多