2

Abandoned post by Unregistered user.

I've tried to update my raspberry, received 503 Service Unavailable message and now I can't install anything, because of missing dpkg directory..

root@raspberrypi:/sys/bus/w1/devices# sudo apt-get update

Ign ://archive.raspberrypi.org jessie InRelease Ign ://archive.raspberrypi.org jessie Release.gpg
Ign ://archive.raspberrypi.org jessie Release
Err ://archive.raspberrypi.org jessie/main armhf Packages
503 Service Unavailable [IP: 93.93.128.133 80] Err tp://archive.raspberrypi.org jessie/ui armhf Packages
503 Service Unavailable [IP: 93.93.128.133 80] Ign ://archive.raspberrypi.org jessie/main Translation-en
Ign ://archive.raspberrypi.org jessie/ui Translation-en
Get:1 ://mirrordirector.raspbian.org jessie InRelease [14.9 kB] Get:2 ://mirrordirector.raspbian.org jessie/main armhf Packages [8981 kB] Get:3 ://mirrordirector.raspbian.org jessie/contrib armhf Packages [37.5 kB]
Get:4 ://mirrordirector.raspbian.org jessie/non-free armhf Packages [70.3 kB]
Get:5 ://mirrordirector.raspbian.org jessie/rpi armhf Packages [1356 B]
Ign ://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign ://mirrordirector.raspbian.org jessie/main Translation-en
Ign ://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign ://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 9105 kB in 1min 32s (98.7 kB/s)
W: Failed to fetch ://archive.raspberrypi.org/debian/dists/jessie/main/binary-armhf/Packages 503 Service Unavailable [IP: 93.93.128.133 80]

W: Failed to fetch ://archive.raspberrypi.org/debian/dists/jessie/ui/binary-armhf/Packages 503 Service Unavailable [IP: 93.93.128.133 80]

E: Some index files failed to download. They have been ignored, or old ones used instead. E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Now when I try update again:

root@raspberrypi:/tmp# sudo apt-get update

Hit ://archive.raspberrypi.org jessie InRelease
Hit ://mirrordirector.raspbian.org jessie InRelease
Hit ://archive.raspberrypi.org jessie/main armhf Packages Hit ://mirrordirector.raspbian.org jessie/main armhf Packages Hit ://archive.raspberrypi.org jessie/ui armhf Packages
Hit ://mirrordirector.raspbian.org jessie/contrib armhf Packages Hit ://mirrordirector.raspbian.org jessie/non-free armhf Packages Hit ://mirrordirector.raspbian.org jessie/rpi armhf Packages
Ign ://archive.raspberrypi.org jessie/main Translation-en
Ign ://archive.raspberrypi.org jessie/ui Translation-en
Ign ://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign ://mirrordirector.raspbian.org jessie/main Translation-en
Ign ://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign ://mirrordirector.raspbian.org jessie/rpi Translation-en
E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Now i can't install anything...

root@raspberrypi:/tmp# apt-get download dpkg

E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory) E: The package lists or status file could not be parsed or opened.

My lib directory:

root@raspberrypi:/tmp# ls /var/lib/

PackageKit dhcpcd5 logrotate openbox polkit-1 samba systemd udisks2 usbutils xkb apt ieee-data nfs pam python sgml-base ucf update-rc.d vim xml-core container lightdm ntp plymouth python-support sudo udisks urandom xfonts

Can you guys please help? My connection is working fine..

2
  • This doesn't look like easily fixable. Would it be a big problem for you to reflash? Commented Oct 20, 2016 at 10:57
  • Looks like a corrupted file system. Seems like you're missing the folder /var/lib/dpkg.
    – Uwe Plonus
    Commented Mar 1, 2018 at 8:33

5 Answers 5

1

It may be possible to reinstall dpkg manually by following the instructions used in this question. How do I install packages without using a package manager? You unpack the package by

ar x package.deb

This gives you two archive files control.tar.gz and data.tar.gz.

data.tar.gz contains the program's files which are moved into place by the scripts in control.tar.gz. By moving the files over manually it may be possible to get dpkg to work.

If this doesn't work then you could backup your work then reflash the sd card with a image of Raspbian then when it is up and working copy your work back over to your sd card.

2
  • It might be an idea to include some of the information in the link in your answer, as to prevent link rot.
    – Darth Vader
    Commented May 19, 2017 at 11:53
  • The OP does have dpkg installed, he just managed to remove the its working directory, /var/lib/dpkg/. Simply reinstalling the package won't fix that. Commented May 19, 2017 at 13:03
1

I don't think you are missing dpkg. It looks more like the update process caused a corruption on the lock file and now apt-get cannot safely set the dpkg lock to prevent running simultaneous updates.

One thing I typically do in a situation like this is restart the rpi (sudo reboot). This is a brute force way of basically killing anything that might be holding on to the lock or preventing dpkg from setting a lock.

After rebooting the rpi, if this still does not work, your next step, which is also quite brute force, is to forcibly remove the lock file. I believe you can do this with

sudo rm /var/lib/apt/lists/lock

As always, take care when using sudo rm anything because an incorrect typing could hose the system.

1

If there is any missing or bugs in the packages use this command:

sudo apt-get update -fix-missing

If it doesn't work check this website and figure out that what's going on:

http://www.iasptk.com/ubuntu-fix-broken-package-best-solution/amp/

1

Jessie is no longer supported (packages are no longer served by the Raspbian servers), so there's no point in trying to fix this now. Better start from scratch with a fresh image.

0

So late in day, but the other alternative is to check your spelling.

sudo dpgk -i filename.deb is a non starter :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.