# Ubuntu – How to replace libapt-private.so.0.0.0 manually on Ubuntu for Windows

aptbashpermissionswindows

I'm using Ubuntu for Windows, and have been for some time. /etc/debian_version names it as buster/sid. As a result of recent suspected disk corruption, /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0.0 appears to have been replaced by a same-sized file containing only (binary) zeroes.

This breaks apt and prevents its self-repair, of course.

I have been given a copy of the same file by colleagues. However, I cannot find a way to replace the one in my filesystem. Even launching bash with Windows Administrator privileges, and then acquiring root privileges within that shell, does not permit me to rename or replace the file.

It's highly discouraged to attempt to alter these files from Windows tools such as File Explorer and the cmd shell – however, even running cmd with Administrator privileges gives "Access is denied."

How can I replace this library file under Ubuntu for Windows? Is it even possible? Google and StackExchange searches have not been helpful.

So, my WSL got broken because of Windows Defender detecting my libapt-private.so.0.0.0 as a trojan. [insert ironic comment here]

(UPDATE: This SO answer reports some news from Microsoft on the issue)

### Solution

First of all, the most annoying thing was that every attempt to delete or move the library gave "Permission Denied" error. In order to prevent this, make sure you are operating as Administrator: open your WSL shell from an elevated cmd/powershell and work there.

What follows is (almost) the implementation of Imaginecat22's answer.

1. Find your version of apt

$dpkg -l apt [. . .] ||/ Name Version Architecture Description +++-=================================-=====================-=====================-======================================================================= ii apt 1.6.11 amd64 commandline package manager  write down the value of Architecture. 2. Download .deb package Most packages can be found with the Ubuntu package search. Not all versions are available there though, so you may need to download manually: • use a web browser to open: https://launchpad.net/ubuntu/+source/apt/<VERSION>/ Replace <VERSION> with the value of Version returned in step 1, e.g.: https://launchpad.net/ubuntu/+source/apt/1.6.11/ • Find the Builds section and select the build that matches the Architecture value from step 1. Copy the URL to download the file apt_<VERSION>_<ARCHITECTURE>.deb. From your WSL Linux shell download the package: $ wget https://launchpad.net/ubuntu/+source/apt/1.6.11/+build/16829590/+files/apt_1.6.11_amd64.deb

3. Install package using dpkg

\$ dpkg -i apt_1.6.11_amd64.deb


Should overwrite your previous version and the broken library with it.