意外删除了 wpa_supplicant

意外删除了 wpa_supplicant

我意外删除了 wpa_supplicant 包,现在我无法连接到互联网,无法通过 wifi 或 LAN 电缆连接。我该怎么办?谢谢

答案1

我最近也遇到了同样的情况。答案其实就在那里,但它在互联网上流传

我不得不进行多次不同的 Google 搜索(使用多个不同的关键词),并在不同的论坛上就同一主题浏览数十个不同的问题。

最后,我终于解决了这个问题,但不得不经历一个令人沮丧的过程,这对于喜欢在知识很少或没有知识的情况下玩耍的 Linux 新手来说非常困难(就像我一样)

这是一个月前发布的,你现在可能已经解决了,

无论如何我都会回答这个问题,这至少会让将来遇到这个问题的人更容易一些:)


步骤 1:通过以太网电缆访问互联网

打开终端并运行此命令

iwconfig

找出您的以太网设备的名称。输出将如下所示...

wlp2s0f0  IEEE 802.11  ESSID:"LYF"  
          Mode:Managed  Frequency:2.437 GHz  Access Point: DC:E8:38:61:A4:50   
          Bit Rate=65 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=70/70  Signal level=-37 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:36  Invalid misc:76   Missed beacon:0

enp4s0    no wireless extensions.

lo        no wireless extensions.

在旧版本的 ubuntu 中,wifi 设备通常会被命名wlan0,而以太网(LAN 电缆)可能会被命名为eth0(或类似的名称)

但是现在,在 16.04(我的 ubuntu 版本)中,名称是特定于设备的。在我的情况下,它们分别wlp2s0f0用于enp4s0wifi 和以太网设备。


运行此命令以使您的以太网设备启动并运行...

sudo dhclient enp4s0 up

你可以通过运行来检查

curl www.google.com

如果它不起作用那么你会得到一个解析错误,

如果它确实有效,那么您将获得一些 html 代码,(这只是为了查看连接是否正常)

注意:如果step 1不成功,则跳至step 3


步骤 2:通过 apt-get 重新安装 wpasupplicant

运行命令

sudo apt-get install wpasupplicant

注意:如果step 2成功,那么你可以跳过step 3


步骤 3:手动重新安装 wpasupplicant(如果步骤 1 失败)

当你删除某个包时,你也会删除它的所有依赖项以及可能的配置文件(你“意外地”清除了它)

我假设你有一个基于 debian 的发行版( ubuntu 是一个基于 debian 的 Linux 发行版),

如果您愿意,请从这里下载.deb 文件...

https://packages.debian.org/wheezy/wpasupplicant

您可能还需要另外 2 个依赖 wpasupplicant 的文件,您可以在这里找到它们...

https://packages.debian.org/wheezy/libengine-pkcs11-openssl

和这里...

https://packages.debian.org/wheezy/libp11-2

下载后,

导航到下载它们的文件夹(记住,所有 3 个文件都应该在同一个文件夹中)并运行

sudo dpkg -i *.deb

注意:如果step 1失败,那么step 3你应该能够通过 LAN 电缆成功连接到互联网


步骤 4:将各个部分组合在一起

你需要把所有组件连接在一起,你可以这样做,

sudo apt-get install ubuntu-desktop

此命令将下载并安装任何可能被意外删除的缺失文件(例如 network-manager、gnome-indicator 等)。此外,它还会将所有软件包更新到最新版本


步骤 5:重新启动以使更改生效

在终端中运行此命令

shutdown -r now

此后您应该能够通过 wifi 和网络连接到互联网。

答案2

别问为什么,但我也无意中删除了它,并发现自己也遇到了同样的情况。由于我也是新手,上述解决方案对我而言并不完美,所以我只想分享我必须做些什么才能连接到互联网。

  1. 首先,这个链接:https://packages.debian.org/wheezy/wpasupplicant不再起作用。我收到此错误:“指定了两个或更多个包 (wpasupplicant wheezy)。”

  2. 我使用的是 Ubuntu 20.04,所以这是我最后需要的网站:https://packages.ubuntu.com/focal/wpasupplicant

  3. 我使用以下命令检查了我没有的所有依赖项:dpkg -s "package name"

  4. 我下载了所有软件包,其中命令返回“安装成功,已解压”或“未找到任何内容”。

  5. 由于有多个不同的下载链接,我必须使用以下命令检查我的系统具有哪种体系结构:dpkg --print-architecture。它返回了“amd64”,所以我知道我必须下载所有软件包的该版本。

  6. 我最终下载了以下软件包:

    • wpasupplicant 2:2.9-1
    • libssl1.1
    • libpcsclite1
    • libengine-pkcs11-openssl
    • wpagui
  7. 我将它们复制到没有网络的电脑上,然后使用上述命令进行安装:sudo dpkg -i *.deb

  8. 然后我重新启动了系统,但在设置/网络中,出现以下错误:“缺少网络管理器”。

  9. 所以现在我尝试使用以下命令来安装它:sudo apt-get install network-manager

  10. 当然,它返回了一个错误:

    sudo apt-get install network-manager
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  dns-root-data dnsmasq-base libndp0 libteamdctl0 network-manager-pptp ppp pptp-linux
Suggested packages:
  libteam-utils
The following NEW packages will be installed
  dns-root-data dnsmasq-base libndp0 libteamdctl0 network-manager network-manager-pptp ppp pptp-linux
0 to upgrade, 8 to newly install, 0 to remove and 0 not to upgrade.
Need to get 2.598 kB of archives.
After this operation, 9.972 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Ign:1 http://de.archive.ubuntu.com/ubuntu focal/main amd64 dns-root-data all 2019052802
Ign:2 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1.7
Err:3 http://de.archive.ubuntu.com/ubuntu focal/main amd64 libndp0 amd64 1.7-0ubuntu1
  Temporary failure resolving ‘de.archive.ubuntu.com’
Err:4 http://de.archive.ubuntu.com/ubuntu focal/main amd64 libteamdctl0 amd64 1.30-1
  Temporary failure resolving ‘de.archive.ubuntu.com’
Err:5 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 network-manager amd64 1.22.10-1ubuntu2.3
  Temporary failure resolving ‘de.archive.ubuntu.com’
Ign:6 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 ppp amd64 2.4.7-2+4.1ubuntu5.1
Err:7 http://de.archive.ubuntu.com/ubuntu focal/main amd64 pptp-linux amd64 1.10.0-1build1
  Temporary failure resolving ‘de.archive.ubuntu.com’
Err:8 http://de.archive.ubuntu.com/ubuntu focal/main amd64 network-manager-pptp amd64 1.2.8-2
  Temporary failure resolving ‘de.archive.ubuntu.com’
Err:1 http://de.archive.ubuntu.com/ubuntu focal/main amd64 dns-root-data all 2019052802
  Temporary failure resolving ‘de.archive.ubuntu.com’
Err:2 http://security.ubuntu.com/ubuntu focal-updates/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1.7
  Temporary failure resolving ‘de.archive.ubuntu.com’
Err:6 http://security.ubuntu.com/ubuntu focal-updates/main amd64 ppp amd64 2.4.7-2+4.1ubuntu5.1
  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/pool/main/d/dns-root-data/dns-root-data_2019052802_all.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/d/dnsmasq/dnsmasq-base_2.80-1.1ubuntu1.7_amd64.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/pool/main/libn/libndp/libndp0_1.7-0ubuntu1_amd64.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/pool/main/libt/libteam/libteamdctl0_1.30-1_amd64.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/pool/main/n/network-manager/network-manager_1.22.10-1ubuntu2.3_amd64.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/ppp/ppp_2.4.7-2+4.1ubuntu5.1_amd64.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/pool/main/p/pptp-linux/pptp-linux_1.10.0-1build1_amd64.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/pool/main/n/network-manager-pptp/network-manager-pptp_1.2.8-2_amd64.deb  Temporary failure resolving ‘de.archive.ubuntu.com’
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
  1. 我手动下载了所有这些 .deb 文件,将它们复制到没有互联网的电脑上,然后使用安装 wpasupplicant 及其依赖项的相同命令来安装它们:dpkg -i *.deb

  2. 瞧,一切又恢复正常了。

相关内容