Issue at Hand
You report that you have deleted /etc/apt
while attempting to delete your sources.list
file. Now you experience errors when attempting to use apt
.
I have referenced this post. Perhaps it can help you?
Solution
First, see if you still have a copy of apt
's .deb
file.
cd /var/cache/apt/archives
Now look for a .deb
with apt in its name, if you are running Debian Stretch on a 64-bit system it should be apt_1.4.8_amd64.deb
. Use tab to autocomplete, or if not found you can download apt
and its dependencies here.
After you have located the necessary package run as root(sudo) the following command:
dpkg -i apt_1.4.8_amd64.deb
This should reinstall the apt for you. You should now be able to run sudo apt-get update && apt-get upgrade
as expected. Remember if you need to recreate your sources.list
file you should follow this example.
The error about missing /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0
should be solved if not you can install the lib from here.
Then you need to copy the library file into /usr/lib and run this command as root(sudo):
ldconfig -n -v /usr/lib
This post may help too.
Conclusion
Please comment if you have any questions or issues with this answer. I highly suggest you read through each link I have provided thoroughly before attempting the commands. I appreciate feedback to correct any misconceptions and to improve my posts. I can update my answer as needed.
Best of Luck!
/etc/apt
should be a directory;sudo rm /etc/apt
therefor shouldn't actually do anything other than print an error message.rm -r
/etc/apt
results in no errors, but some warnings likeW: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)
(at least on Buster). I think the suggestion of reinstalling apt is a good place to start...sudo rm -r /etc/apt
, were you trying to fix some other problem?