After running 'sudo apt-get update && sudo apt-get upgrade' on my raspberry pi 3 running raspbian jessy, I get:

E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/g/ghostscript/libgs9-common_9.06~dfsg-2+deb8u5_all.deb  rename failed, Structure needs cleaning (/var/cache/apt/archives/partial/libgs9-common_9.06~dfsg-2+deb8u5_all.deb -> /var/cache/apt/archives/libgs9-common_9.06~dfsg-2+deb8u5_all.deb).

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

A quick search on the net and here revealed that this probably is related to a corrupted filesystem on the SD card. As this is my fileserver and I would prefer not reconfiguring it: Could I just make a backup with dd and then restore on a new SD card or would this also copy the filesystem corruption?

1 Answer 1


That would also copy the file system corruption (dd copies the contents of the block device, without caring about their structure).

To fix your problem, I would suggest running apt-get clean to clear your package cache, and fsck. If your file system has detected errors, rebooting the Pi should force a full fsck.

  • Thank you. I get a warning when running fsck since it is mounted. Obviously I cannot unmount it as it is the root partition. So I guess I can try to fsck the sd card from my laptop as soon I have physical access to the box (Only access via ssh at the moment) or during reboot as you suggested. Will accept, when this is done and confirmed to work.
    – Bruni
    May 18, 2017 at 9:36

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.