How to Reinstall the Network Manager if You Accidentally Removed It

Using the aptitude package manager in Debian, I noticed a message that suggested me to use the command:

$ apt-get autoremove

This would have removed the unused dependencies following to having removed some unused packages. The list was long and I skimmed quickly through it, noting the fact that there weren’t important packages, as someone would expect.

Unfortunately, the Gnome network-manager was included in the list, and when I run the command it removed my possibility to connect to the internet and even to re-install the network-manager itself!

In this ironic situation, angry by being tricked to run a damaging command, I was already thinking to reinstall Debian. But wait! That would be a silly move.

The solution

In order to have an internet connection, you don’t need the network manager. If you still have ethernet available, grab that cable and open a terminal:

$ sudo ifconfig eth0 up
$ sudo dhclient

This will make your ethernet working even without the Gnome network-manager. After this, you can run a:

$ sudo apt-get install network-manager-gnome

and have your wireless connection working again.

A suggestion

Do not use the auto-remove command if you do not know what it is removing. It might be a vital component for your system and damage it heavily.

You can use the auto-remove with the simulate option first (-s), or just deactivate the auto-remove in/etc/apt/apt.conf 

 // auto-remove breaks on meta packages
APT::Get::AutomaticRemove “0”;
APT::Get::HideAutoRemove “1”;

// Recommends are as of now still abused in many packages
APT::Install-Recommends “0”;
APT::Install-Suggests “0”;
Debug::pkgAutoRemove “0”;

// PDiffs reduce the required download for apt-get update, but increase the
// CPU requirements and quite often fail.
Acquire::PDiffs “0”;

// Remove apt unauthenticated warnings
APT::Get::AllowUnauthenticated “0”;

Read More Post