Can't update: Error installing libc-bin

I’m having some trouble getting the latest OSMC update. Running sudo apt-get update and sudo apt-get -f dist-upgrade results in:

Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be upgraded:
  base-files-osmc debian-archive-keyring libc-bin libc6 libexpat1 libffi6
  libgcrypt20 libgnutls-deb0-28 libgraphite2-3 locales multiarch-support
11 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/10.5 MB of archives.
After this operation, 73.7 kB of additional disk space will be used.
Do you want to continue? [Y/n] Preconfiguring packages ...
/usr/bin/dpkg-deb: 1: /usr/bin/dpkg-deb: Syntax error: "(" unexpected
dpkg: error processing archive /var/cache/apt/archives/libc-bin_2.19-18+deb8u10_armhf.deb (--unpack):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libc-bin_2.19-18+deb8u10_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I’ve tried sudo apt-get clean and it didn’t help.

Any other ideas? Thanks in advance!

Try sudo /var/cache/apt/archives/libc-bin_2.19-18+deb8u10_armhf.deb and then update/dist-upgrade

That says command not found. Did you mean sudo rm? I tried the latter and it re-downloads the deb file to then fail the same way.

Provide URL from grab-logs -a please.

Yep sorry my mistake obvisouly ment sudo rm /var/cache/apt/archives/libc-bin_2.19-18+deb8u10_armhf.deb

So if it still fails that might be an issue with either your SD Card or the server.
Provide logs as @ActionA mentionend at also maybe check md5sum /var/cache/apt/archives/libc-bin_2.19-18+deb8u10_armhf.deb that should be 13eae8f18dcda9b1ea3056b4991c25e2

Thanks for the help, guys.

So the hash matches:

osmc@osmc:~$ md5sum /var/cache/apt/archives/libc-bin_2.19-18+deb8u10_armhf.deb
13eae8f18dcda9b1ea3056b4991c25e2  /var/cache/apt/archives/libc-bin_2.19-18+deb8u10_armhf.deb

Logs: https://paste.osmc.tv/akuzasiyol

Try sudo apt-get dist-upgrade without the -f flag.

No luck. :cry:

I think some binaries on your system are corrupted

Is there anything I can try to repair them or is reinstalling from my scratch my only hope?

I’d check your SD card and perform a reinstall.
Doing anything else is prolonging the inevitable need to reinstall

Cheers

Sam

So dpkg-deb was corrupted but I managed to fix it in the end.

I ran sudo apt-get install --reinstall dpkg which failed but downloaded the package.

Then cd /var/cache/apt/archives/ and in there I extracted the contents of dpkg_1.17.27_armhf.deb

From the contents I manually copied dpkg and dpkg-deb to /usr/bin

Finally:

sudo apt-get install --reinstall dpkg
sudo apt-get update && sudo apt-get -f dist-upgrade

They ran just fine and successfully updated.

I’m aware that I will need to reinstall from scratch at some point but this will do for now until I have the time.

Nice one. Very enterprising.

You’d probably have found the /var/cache/apt/archives/dpkg_1.17.27_armhf.deb package already there (it is on my system). Running apt-get download dpkg would also download it to your current directory…

I’m a bit curious why you always use the -f flag when running apt-get dist-upgrade.

If I remember correctly, -f will try to fix broken dependencies if any. I’m not sure if there’s any downside to it.