Alperen Eroğlu
Alperen Eroğlu

Reputation: 91

Raspberry Pi Upgrade Fails

When i tried to upgrade or update raspberry pi or python on raspberry pi, i got this error

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)

i used this codes in the beginning. but for each one i got same error that error code (2)

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

i'm using Raspberry pi 1 version. it's old version i know but i have to use this. Please help me guys. Thank all of you.

Upvotes: 0

Views: 3555

Answers (2)

origamic
origamic

Reputation: 1116

sudo apt-get update
sudo apt-get upgrade -y

It will fail when upgrading. Because this command is updating sources.list again. Because of this, it shows this error. You can run sudo apt-get update && sudo apt-get upgrade -y again. It's ok.

Upvotes: 1

It seems like you don't have the host properly set on the /etc/hosts file. In order to fix it, you should add raspberry to this same file. You can do so by making sudo nano /etc/hosts and adding this username next to the one you already have after the 127.0.1.1 address. Not after the word localhost (most surely you will have to edit the second line).

Upvotes: 0

Related Questions