0

I run the command apt autoremove, And it accidentally removed some packages, Which I assume is important, because after I run the command, I can't access wifi, I can't find it icon.

The output for apt autoremove was `

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

The following packages will be REMOVED: dnsmasq-base libndpo libnma-common libnma0 libteamdctlo network-m

0 upgraded, 0 newly installed, 8 to remove and 636 not upgraded. After this operation, 18.5 MB disk space will be freed.

Do you want to continue? [Y/n]

(Reading database 397890 files and directories currently install

Removing dnsmasq-base (2.84-1)

Removing network-manager-fortisslvpn (1.2.8-2+b2) ...

Removing network-manager (1.28.0-2+b1)

Removing libndp0: amd64 (1.6-1+b1) Removing libnma0: amd64 (1.8.30-1)

Removing libnma-common (1.8.30-1)

Removing libteamdctl0: amd64 (1.31-1) Removing openfortivpn (1.15.0-1)

Processing triggers for libglib2.0-0: amd64 (2.66.6-1) Processing triggers for libc-bin (2.31-9)

Processing triggers for man-db (2.9.3-2)

Processing triggers for dbus (1.12.20-1) Processing triggers for kali-menu (2021.1.4)`

I am assuming my WiFi is gone due to deleting these packages, Because just after deleting the issue occurred, Iam also assuming some of those packages were important? Can anyone tell which of them is important?

How do I restore the packages, Since I can't connect to WiFi , can't download packages. Is there anything I can do?

Is there anyways to restore the packages , will I be able to connect my Laptop with ethernet and download the packages or will I be able download those using live USBThis  was when I accidentally deleted the packages

[edit]This is on Kali Linux, which was a key detail that was left out by the poster.

1

You can try reinstalling the removed packages.

If you can connect the laptop to ethernet, you might be able to do sudo apt-get install package1 package2 ...

Otherwise you can do a sudo apt-get install --print-uris package1 package2 .... A good thing about this method is that it will not print the URL for a package if it is already available under /var/cache/apt/archives.

With the list of URIs you got from apt-get you can download the files from another computer, copy them to /var/cache/apt/archives and rerun the sudo apt-get install package1 package2 ...

2
  • sudo apt-get install --print-uris package1 I run this command ,I went through the links and downloaded the files from my phone and transferred to PC . Now everything fine got back my internet connection, But I have a doubt why did network-manager get removed when executed apt autoremove. According my knowledge apt autoremove is supposed to remove unnecessary packages right? Can you explain, How to not repeat this mistake in future? Anyways thank you for your help :) – Adil May 3 at 6:42
  • autoremove is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no longer needed. The system know nothing about being necessary. You might be using the package and it still will be autoremove if fits the above criteria. – Eduardo Trápani May 3 at 23:38
1

Try looking in /var/cache/apt/archives

If you are lucky, the .deb package for network-manager may still be there. If so, try a few things:

  1. apt-get install network-manager - that may, possibly, use the archived version since it's already been downloaded. It would then also install the dependencies, if they were also in that directory.

  2. Alternately, if the network-manager package is there, cd to /var/cache/apt/archives and run dpkg -i network-manager[package specifics].deb - note that with dpkg, you have to use the full package filename, including the .deb extension, not just the main name.

  3. If you don't see network-manager in the local archive, you will need to download it manually, to a usb stick, then install it from the usb stick using dpkg. You will probably hit some dependency issue, so then grab the dependency, install it with dpkg, then install the network-manager file.

  4. Skip network manager totally, you don't need that at all to get a network connection, just do it the original way, open / create the file: /etc/network/interfaces (or /etc/network/interfaces.d/interfaces if you prefer), and configure the wifi manually. It would look something like this: https://askubuntu.com/questions/168687/wireless-configuration-using-etc-network-interfaces-documentation

auto wlan0
iface wlan0 inet dhcp
wpa-ssid myssid
wpa-psk a1b2c3d4e5

Get your wlan device IF id with either ip addr or inxi -n. Replace the wlan0 in the example above with that, and the wpa-psk and ssid with the ones for your network router.

If you don't get wifi automatically, run ifup [your IF ID], and it should show up again.

4
  • I downloaded all the necessary packages from the repository, in another device and transfered it to PC , Now everything fine got back my internet connection, But I have a doubt why did network-manager get removed when executed apt autoremove. According my knowledge apt autoremove is supposed to remove unnecessary packages right? Can you explain, How to not repeat this mistake in future? Anyways thank you for your help :) – Adil May 3 at 6:50
  • autoremove removes packages that were pulled in by other packages, which themselves were changed or removed on a subsequent update. As you discovered, this isn't always perfect. Once you install manually network-manager with apt-get install, it will no longer get removed since it's been manually installed. It was probably something that came from your initial install, technically I'd say it was a bug in the installer if you didn't yourself install it since network-manager should have been flagged as a core package in the install, but it wasn't. – Lizardx May 3 at 16:13
  • Could you please check this too.. [link] (unix.stackexchange.com/questions/647896/…) – Adil May 3 at 17:26
  • Ah, it becomes clear, yet another person who doesn't understand that Kali is not for newbies, is not meant to be used as a standard desktop. Stop, do yourself a favor, first, don't ask for support without saying you were using Kali, I would never have responded if you had said that, second, install Debian real, either testing, or stable, and don't misrepresent what you are doing in the future. – Lizardx May 3 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.