I have just successfully done

sudo apt-get update
sudo apt-get dist-upgrade

Success meaning they finished and no errors which stopped the process - I did get a warning about something to do with bluetooth - which I don't have, so I continued on

Now when I try to do

sudo apt-get update

It says

Hit:1 http://archive.raspberrypi.org/debian stretch InRelease Hit:2
Hit:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease Reading
package lists...13%

(sometimes it say 12%)

The the raspberry hangs - in that pressing caps-lock no longer changes the capslock light and pressing ctl-c etc does nothing and the only way I can get back is by removing the power

Is there some way I can reset what-ever it is doing or do I have to rebuild my SD card again?

  • I cannot give a definitive answer - the process can take some time, and removing power only exacerbates any problem. You may have corrupt packages. You should ALWAYS make a backup BEFORE upgrading (this applies to all computers not just the Pi). If you can still boot try sudo apt-get clean to empty the cache.
    – Milliways
    Sep 30 '18 at 4:19
  • Yes the machine boots, the first time. I waited around ten minutes but the percent complete did not change I have also left it overnight and it stayed on 13percent complete
    – Ross
    Sep 30 '18 at 20:36
  • @Milliways But why should a corrupt package cache cause the entire system to hang completely?
    – PMF
    Jan 30 '20 at 14:28

It seems there is something wrong with your package lists. You can try to rebuild them. The lists are located in /var/lib/apt/lists. With brute force you can delete them but I prefer to do it under control of the package system. For this you can edit all sources.list and comment all repositories in them so you have only empty (without repositories) sources.list. By default you have:

rpi ~$ cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

rpi ~$ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ stretch main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ stretch main ui

Comment the first line in them, save them and update the lists:

rpi ~$ sudo apt update

This will purge the list files in /var/lib/apt/lists. Then remove the comment hashes you have just set and update again.

rpi ~$ sudo apt update

This will download all missing lists from the repositiories.

  • This seemed to work but I still had problems eventually I changed SD card and machine , rebuilt and copied the customisation across. The old one still won’t update although it is a different message.
    – Ross
    Jan 30 '20 at 20:15
  • @Ross That isn't in the question. So what have you done and what exactly is your problem after that?
    – Ingo
    May 31 '20 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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