Debian 10 – Resolving apt-get and sudo Issues

aptdebiansudo

I'm currently facing some issues with my dedicated server. I unfortunately removed some packages from my server yesterday. And now the man-db on my server seems not to work properly. This issue maybe occurs because I removed these packages. I tried to install the needed packages, but this does not work.

Whenever I try to install a package with apt-get install [packagename] I get this error message:
apt-get installation try issue

I tried also to use the command apt --fix-broken install but this seems not to work:
apt --fix-broken installation command failure

And the sudo command seems not to work properly too:
Sudo command error

As you can see, I've booted my server in rescue mode to install the needed packages but it does not work. I've mounted all required directories but these issues still appear. So theres no chance for me to install packages, perform sudo commands.

Whys that? Is it all related to the man-db which causes issues due to some package removals?

FYI: I unfortunately don't know anymore which packages I removed yesterday.

Best Answer

  1. You are root. You don't need sudo.
  2. I assume this is hetzner based on how it looks. If so, the rescue system is a live distro. You'll have to mount all your devices and chroot into them as applicable. I assume you have done this. Otherwise, you need to first do this and attempt reinstallation; otherwise you're merely attempting to modify the rescue system.
  3. If you've removed Python and ldconfig you're in for a world of hurt. I'd probably select to restore from backup or rebuild from scratch at that point. If that's not an option...:

Start by installing a new system (VM or similar) with the same Debian version. Copy over the binaries that apt complain is missing, such as ldconfig and libcrypt.so1. Try apt again. It's going to take you some time as you will probably discover more missing dependencies.

In addition, you need to find what packages the dependencies you're missing belongs to, and do a apt-get --reinstall install packagename to ensure you got all bits'n'pieces of those packages.